// Function: _init @ 08900018

void _init(void)

{
  frame_dummy();
  __do_global_ctors_aux();
  return;
}



----------------------------------------

// Function: _start @ 08900040

/* WARNING: Removing unreachable block (ram,0x08900134) */
/* WARNING: Removing unreachable block (ram,0x08900104) */
/* WARNING: Removing unreachable block (ram,0x089000f0) */
/* WARNING: Removing unreachable block (ram,0x0890011c) */
/* WARNING: Removing unreachable block (ram,0x089000a0) */
/* WARNING: Removing unreachable block (ram,0x08900138) */

int processEntry _start(SceSize args,void *argp)

{
  undefined4 uVar1;
  code *pcVar2;
  code *pcVar3;
  
                    /* Unresolved local var: _func_void_SceSize_void_ptr * _main_func@[???]
                       Unresolved local var: _func_void * _init_func@[???]
                       Unresolved local var: int priority@[???]
                       Unresolved local var: uint attribute@[???]
                       Unresolved local var: uint stackSize@[???]
                       Unresolved local var: char * threadName@[???]
                       Unresolved local var: SceUID thid@[???] */
  if ((module_info.modattribute & 0x1000) == 0) {
    pcVar3 = _main;
    pcVar2 = _init;
  }
  else {
    pcVar2 = (code *)&SUB_88900018;
    pcVar3 = (code *)0x88900184;
  }
  (*pcVar2)();
  uVar1 = sceKernelCreateThread("user_main",(uint)pcVar3 & 0x7fffffff,0x20,0x40000);
  sceKernelStartThread(uVar1);
  return 0;
}



----------------------------------------

// Function: _main @ 08900184

void _main(SceSize args,void *argp)

{
  size_t sVar1;
  uint uVar2;
  char **ppcVar3;
  int iVar4;
  char *local_70 [20];
  
                    /* Unresolved local var: char *[20] argv@[???]
                       Unresolved local var: int argc@[DW_OP_reg18(s2)]
                       Unresolved local var: int loc@[DW_OP_reg16(s0)]
                       Unresolved local var: char * ptr@[DW_OP_reg19(s3)]
                       Unresolved local var: int res@[???] */
  ppcVar3 = local_70;
  iVar4 = 0;
  for (uVar2 = 0; uVar2 < args; uVar2 = uVar2 + sVar1 + 1) {
    *ppcVar3 = (char *)((int)argp + uVar2);
    iVar4 = iVar4 + 1;
    sVar1 = strlen((char *)((int)argp + uVar2));
    ppcVar3 = ppcVar3 + 1;
    if (iVar4 == 0x13) break;
  }
  local_70[iVar4] = (char *)0x0;
  __psp_libc_init(iVar4,local_70);
  atexit(_fini);
  iVar4 = main(iVar4,local_70);
                    /* WARNING: Subroutine does not return */
  exit(iVar4);
}



----------------------------------------

// Function: __do_global_dtors_aux @ 0890022c

void __do_global_dtors_aux(void)

{
  code *pcVar1;
  
  if (completed_2322 == '\0') {
    completed_2322 = 0;
    pcVar1 = *(code **)p_2320;
    while (pcVar1 != (code *)0x0) {
      p_2320 = p_2320 + 4;
      (*pcVar1)();
      pcVar1 = *(code **)p_2320;
    }
    __deregister_frame_info(&cie_089f2de0);
    completed_2322 = '\x01';
  }
  return;
}



----------------------------------------

// Function: call___do_global_dtors_aux @ 089002b0

void call___do_global_dtors_aux(void)

{
  return;
}



----------------------------------------

// Function: frame_dummy @ 089002c4

/* WARNING: Removing unreachable block (ram,0x08900310) */

void frame_dummy(void)

{
  __register_frame_info(&cie_089f2de0,(object *)object_2403);
  return;
}



----------------------------------------

// Function: call_frame_dummy @ 08900324

void call_frame_dummy(void)

{
  return;
}



----------------------------------------

// Function: back_to_kernel @ 08900338

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void back_to_kernel(void)

{
  return;
}



----------------------------------------

// Function: exit_callback @ 08900340

int exit_callback(int arg1,int arg2,void *common)

{
  sceKernelExitGame();
  return 0;
}



----------------------------------------

// Function: setup_callbacks @ 08900360

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void setup_callbacks(void)

{
  int iVar1;
  
                    /* Unresolved local var: int id@[???] */
  iVar1 = sceKernelCreateThread("update_thread",update_thread,0x11,4000);
  if (-1 < iVar1) {
    sceKernelStartThread(iVar1,0,0);
    return;
  }
  return;
}



----------------------------------------

// Function: update_thread @ 089003b4

int update_thread(SceSize args,void *argp)

{
  undefined4 uVar1;
  
                    /* Unresolved local var: int cbid@[???] */
  uVar1 = sceKernelCreateCallback("Exit Callback",exit_callback,0);
  sceKernelRegisterExitCallback(uVar1);
  sceKernelSleepThreadCB();
  return 0;
}



----------------------------------------

// Function: __static_initialization_and_destruction_0 @ 089003f4

void __static_initialization_and_destruction_0(int __initialize_p,int __priority)

{
  if (__initialize_p == 1) {
    if (__priority == 0xffff) {
      std::ios_base::Init::Init(&std::__ioinit);
      return;
    }
  }
  else if ((__initialize_p == 0) && (__priority == 0xffff)) {
    std::ios_base::Init::~Init(&std::__ioinit,0xffff);
    return;
  }
  return;
}



----------------------------------------

// Function: _GLOBAL__D_game @ 08900438

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__D_game(void)

{
  __static_initialization_and_destruction_0(0,0xffff);
  return;
}



----------------------------------------

// Function: _GLOBAL__I_game @ 08900444

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__I_game(void)

{
  __static_initialization_and_destruction_0(1,0xffff);
  return;
}



----------------------------------------

// Function: quit_game @ 08900450

void quit_game(int code)

{
  Mix_FreeChunk((Mix_Chunk *)::::music);
  Mix_CloseAudio();
  SDL_Quit();
                    /* WARNING: Subroutine does not return */
  exit(code);
}



----------------------------------------

// Function: SDL_SetupVideo @ 08900488

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SetupVideo(void)

{
  byte bVar1;
  SDL_VideoInfo *pSVar2;
  char *pcVar3;
  FILE *pOut;
  SFtype SVar4;
  DFtype in_f12_13;
  
                    /* Unresolved local var: SDL_VideoInfo * info@[???]
                       Unresolved local var: int bpp@[???]
                       Unresolved local var: int flags@[???] */
  pSVar2 = SDL_GetVideoInfo();
  bVar1 = pSVar2->vfmt->BitsPerPixel;
  SDL_GL_SetAttribute(SDL_GL_RED_SIZE,5);
  SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,5);
  SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,5);
  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,0x10);
  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
  ::::screen = SDL_SetVideoMode(0x1e0,0x110,(uint)bVar1,0x80000022);
  if (::::screen == (SDL_Surface *)0x0) {
    pOut = _impure_ptr->_stderr;
    pcVar3 = SDL_GetError();
    fprintf(pOut,"Video mode set failed: %s\n",pcVar3);
    quit_game(1);
  }
  tan(in_f12_13);
  SVar4 = __truncdfsf2(in_f12_13);
  ::::ymax = SVar4 * DAT_089dbcd0;
  ::::ymin = -::::ymax;
  ::::xmax = (::::ymax * DAT_089dbcd4) / DAT_089dbcd8;
  ::::xmin = (::::ymin * DAT_089dbcd4) / DAT_089dbcd8;
  glEnable(0xbe2);
  glBlendFunc(0x302,1);
  glEnableClientState(0x8074);
  return;
}



----------------------------------------

// Function: SDL_Setup @ 089005c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_Setup(void)

{
  int iVar1;
  char *pcVar2;
  FILE *pOut;
  
  iVar1 = SDL_Init(0x30);
  if (-1 < iVar1) {
    SDL_SetupVideo();
    return;
  }
  pOut = _impure_ptr->_stderr;
  pcVar2 = SDL_GetError();
  fprintf(pOut,"Video or Audio initialization failed: %s\n",pcVar2);
  quit_game(1);
  SDL_SetupVideo();
  return;
}



----------------------------------------

// Function: SDL_SetupAudio @ 08900624

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SetupAudio(void)

{
  int iVar1;
  SDL_RWops *src;
  char *pcVar2;
  FILE *pOut;
  Uint16 local_18 [2];
  int local_14 [3];
  
                    /* Unresolved local var: int channel@[???]
                       Unresolved local var: int audio_rate@[???]
                       Unresolved local var: Uint16 audio_format@[???]
                       Unresolved local var: int audio_channels@[???]
                       Unresolved local var: int audio_buffers@[???] */
  local_14[0] = 0x5622;
  local_18[0] = 0x8010;
  local_14[1] = 2;
  iVar1 = Mix_OpenAudio(0x5622,0x8010,2,0x1000);
  if (iVar1 != 0) {
    puts("Unable to open audio!");
                    /* WARNING: Subroutine does not return */
    exit(1);
  }
  Mix_QuerySpec(local_14,local_18,local_14 + 1);
  if (::::music == (anon_struct_dwarf_13fd *)0x0) {
    src = SDL_RWFromFile("music.wav","rb");
    ::::music = (anon_struct_dwarf_13fd *)Mix_LoadWAV_RW(src,1);
    iVar1 = Mix_PlayChannelTimed(-1,(Mix_Chunk *)::::music,-1,-1);
    if (iVar1 == -1) {
      pOut = _impure_ptr->_stderr;
      pcVar2 = SDL_GetError();
      fprintf(pOut,"Unable to play WAV file: %s\n",pcVar2);
    }
  }
  return;
}



----------------------------------------

// Function: controls @ 0890070c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void controls(void)

{
  neutron *pnVar1;
  int iVar2;
  
  sceCtrlReadBufferPositive(&::::currentPad,1);
  pnVar1 = ::::game;
  if (::::currentPad.Buttons != ::::lastPad.Buttons) {
    ::::lastPad.TimeStamp = ::::currentPad.TimeStamp;
    ::::lastPad.Rsrv[2] = ::::currentPad.Rsrv[2];
    ::::lastPad.Rsrv[3] = ::::currentPad.Rsrv[3];
    ::::lastPad.Rsrv[4] = ::::currentPad.Rsrv[4];
    ::::lastPad.Rsrv[5] = ::::currentPad.Rsrv[5];
    ::::lastPad.Lx = ::::currentPad.Lx;
    ::::lastPad.Ly = ::::currentPad.Ly;
    ::::lastPad.Rsrv[0] = ::::currentPad.Rsrv[0];
    ::::lastPad.Rsrv[1] = ::::currentPad.Rsrv[1];
    ::::lastPad.Buttons = ::::currentPad.Buttons;
    if ((::::currentPad.Buttons & 0x40) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,5);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x10) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,6);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x80) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,3);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x20) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,4);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x4000) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,2);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x100) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,3);
      neutron::execute_action(pnVar1,iVar2);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 0x200) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,4);
      neutron::execute_action(pnVar1,iVar2);
    }
    if ((::::currentPad.Buttons & 8) != 0) {
      quit_game(0);
    }
    pnVar1 = ::::game;
    if ((::::currentPad.Buttons & 1) != 0) {
      iVar2 = stage_interface::catch_key(::::game->interface,7);
      neutron::execute_action(pnVar1,iVar2);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: main @ 08900918

int main(int argc,char **argv)

{
  neutron *this;
  uint uVar1;
  uint uVar2;
  undefined4 unaff_s0;
  undefined4 unaff_s1;
  undefined4 unaff_s2;
  undefined4 unaff_s3;
  undefined4 unaff_s4;
  undefined4 unaff_s5;
  undefined4 unaff_s6;
  undefined4 unaff_s7;
  GLfloat GVar3;
  undefined4 in_f13;
  GLdouble in_f14_15;
  
  this = operator_new(0xbb4);
  neutron::neutron(this,::::user_color,::::user_difficulty,::::user_stage,SUB41(unaff_s0,0));
  ::::game = this;
  neutron::load_stage(this,1000,true);
  neutron::create_miniatures(::::game);
  SDL_Setup();
  do {
    uVar1 = ::::actualTock - ::::lastTock;
    uVar2 = uVar1 & 1 | uVar1 >> 1;
    if ((int)uVar1 < 0) goto LAB_08900afc;
    while (::::game->speed < (float)(int)uVar1) {
      while( true ) {
        ::::lastTock = ::::actualTock;
        controls();
        glViewport(0,0,0x1e0,0x110);
        glClear(0x4000);
        glMatrixMode(0x1701);
        glLoadIdentity();
        __extendsfdf2(::::xmin);
        __extendsfdf2(::::xmax);
        __extendsfdf2(::::ymin);
        GVar3 = ::::ymax;
        __extendsfdf2(::::ymax);
        glFrustum((GLdouble)CONCAT44(in_f13,GVar3),in_f14_15,(GLdouble)CONCAT44(unaff_s1,unaff_s0),
                  (GLdouble)CONCAT44(unaff_s3,unaff_s2),(GLdouble)CONCAT44(unaff_s5,unaff_s4),
                  (GLdouble)CONCAT44(unaff_s7,unaff_s6));
        glMatrixMode(0x1700);
        glLoadIdentity();
        glShadeModel(0x1d00);
        neutron::main_loop(::::game);
        neutron::print(::::game);
        SDL_GL_SwapBuffers();
        uVar1 = ::::actualTock - ::::lastTock;
        uVar2 = uVar1 & 1 | uVar1 >> 1;
        if (-1 < (int)uVar1) break;
LAB_08900afc:
        if ((float)uVar2 + (float)uVar2 <= ::::game->speed) goto LAB_08900b20;
      }
    }
LAB_08900b20:
    ::::actualTock = SDL_GetTicks();
  } while( true );
}



----------------------------------------

// Function: stage_interface @ 08900b34

/* DWARF original prototype: void stage_interface(stage_interface * this, int color, int difficuty,
   int stage, bool sound) */

void __thiscall
stage_interface::stage_interface(stage_interface *this,int color,int difficuty,int stage,bool sound)

{
  int *piVar1;
  float fVar2;
  glinterface *pgVar3;
  button *pbVar4;
  int iVar5;
  undefined *puVar6;
  int iVar7;
  undefined *puVar8;
  undefined *puVar9;
  char *word;
  stage_interface *psVar10;
  int (*paiVar11) [4];
  char in_t0;
  
  this->whats[0] = "         original idea           ";
  this->whats[1] = "      designed and coded by      ";
  this->whats[2] = "            music by             ";
  this->whos[2] = "          moish vexler           ";
  this->whats[3] = "           tested by             ";
  this->whos[3] = "        benoit duchesne          ";
  this->whats[4] = "           thanks to             ";
  this->whos[4] = "         pili and maria          ";
  this->whats[5] = "          dedicated to           ";
  this->whos[5] = "        laura miyashiro          ";
  this->whos[1] = "          josep florit           ";
  this->actual_staff = 0;
  this->whos[0] = "          josep florit           ";
  paiVar11 = ::::INTRO_DATA;
  psVar10 = this;
  do {
    piVar1 = *paiVar11;
                    /* Unresolved local var: void anon_var_0@[???] */
    puVar6 = (undefined *)(*paiVar11)[1];
    puVar8 = (undefined *)(*paiVar11)[2];
    puVar9 = (undefined *)(*paiVar11)[3];
    paiVar11 = paiVar11 + 1;
    psVar10->intro_positions[0][0] = (int)*piVar1;
    psVar10->intro_positions[0][1] = (int)puVar6;
    psVar10->intro_positions[0][2] = (int)puVar8;
    psVar10->intro_positions[0][3] = (int)puVar9;
    psVar10 = (stage_interface *)(psVar10->buttons + 3);
  } while (paiVar11 != (int (*) [4])&switchD_089031b8::switchdataD_089dc2d8);
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)this->buttons + iVar5) = 0;
    iVar5 = iVar7;
  } while (iVar7 != 0xa0);
  pgVar3 = operator_new(1);
  this->locator = pgVar3;
  this->choosen_color = color;
  this->max_stages = stage;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0xf0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->bottom = 0xc;
  pbVar4->size = fVar2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->action = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 3;
  pbVar4->action_type = 0;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[4] = pbVar4;
  button::load_text(pbVar4,"<",-1);
  this->buttons[4]->color[3] = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0xf0;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->bottom = 0xc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 4;
  pbVar4->action_type = 0;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[5] = pbVar4;
  button::load_text(pbVar4,">",-1);
  this->buttons[5]->color[3] = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[6] = pbVar4;
  button::load_text(pbVar4,"",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0xf;
  pbVar4->top = 0x20;
  pbVar4->right = 300;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x16;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x1e] = pbVar4;
  button::load_text(pbVar4,"tap to select or drag to move",-1);
  this->buttons[0x1e]->color[3] = 0x96;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->top = 0x110;
  pbVar4->size = fVar2;
  pbVar4->action = 1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 2;
  this->buttons[0x13] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->top = 0x110;
  pbVar4->size = fVar2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  pbVar4->action = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 3;
  this->buttons[0x14] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x195;
  pbVar4->top = 0x20;
  pbVar4->right = 0x1d1;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 8;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 7;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0xd] = pbVar4;
  button::load_text(pbVar4,"exit",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x17;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 6;
  pbVar4->action_type = 4;
  this->buttons[0x22] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x18;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 5;
  this->buttons[0x23] = pbVar4;
  pbVar4->action_type = 5;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x13;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 3;
  pbVar4->action_type = 2;
  this->buttons[0x1b] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x14;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 4;
  pbVar4->action_type = 3;
  this->buttons[0x1c] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0xf;
  pbVar4->top = 0x20;
  pbVar4->right = 0x82;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x15;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x1d] = pbVar4;
  button::load_text(pbVar4,"play",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->action = -1;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[0] = pbVar4;
  button::load_text(pbVar4,"  score:",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->action = -1;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[1] = pbVar4;
  button::load_text(pbVar4,"000000",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->action = -1;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[2] = pbVar4;
  button::load_text(pbVar4,"enemies:",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[3] = pbVar4;
  button::load_text(pbVar4,"00",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x12;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x1a] = pbVar4;
  button::load_text(pbVar4,"try again",-1);
  this->buttons[0x1a]->color[3] = 0xff;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x5f;
  pbVar4->top = 0x20;
  pbVar4->right = 0xbe;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x19;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x24] = pbVar4;
  button::load_text(pbVar4," yes ",-1);
  this->buttons[0x24]->color[3] = 0xff;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0xf;
  pbVar4->top = 0x20;
  pbVar4->right = 0x55;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x1a;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 7;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x25] = pbVar4;
  button::load_text(pbVar4," no ",-1);
  this->buttons[0x25]->color[3] = 0xff;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x11;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x15] = pbVar4;
  button::load_text(pbVar4,"sound",-1);
  this->buttons[0x15]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[0x19] = pbVar4;
  if (in_t0 == '\0') {
    button::load_text(pbVar4,"off",-1);
    pbVar4 = this->buttons[0x19];
  }
  else {
    button::load_text(pbVar4,"on",-1);
    pbVar4 = this->buttons[0x19];
  }
  pbVar4->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x10;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x17] = pbVar4;
  if (difficuty == 0) {
    button::load_text(pbVar4,"easy",-1);
    pbVar4 = this->buttons[0x17];
  }
  else {
    button::load_text(pbVar4,"hard",-1);
    pbVar4 = this->buttons[0x17];
  }
  pbVar4->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0xf;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x16] = pbVar4;
  button::load_text(pbVar4,"color",-1);
  this->buttons[0x16]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0xe;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x18] = pbVar4;
  button::load_text(pbVar4,"back",-1);
  this->buttons[0x18]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 10;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0xf] = pbVar4;
  button::load_text(pbVar4,"new",-1);
  this->buttons[0xf]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[0x20] = pbVar4;
  button::load_text(pbVar4,"game",-1);
  this->buttons[0x20]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0xb;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x10] = pbVar4;
  button::load_text(pbVar4,"next",-1);
  this->buttons[0x10]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[0x1f] = pbVar4;
  button::load_text(pbVar4,"stage",-1);
  this->buttons[0x1f]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0xc;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0x11] = pbVar4;
  button::load_text(pbVar4,"play",-1);
  this->buttons[0x11]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  this->buttons[0x21] = pbVar4;
  button::load_text(pbVar4,"one",-1);
  this->buttons[0x21]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0xd;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 2;
  this->buttons[0x12] = pbVar4;
  button::load_text(pbVar4,"back",-1);
  this->buttons[0x12]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->right = 0x172;
  pbVar4->size = fVar2;
  pbVar4->action = 2;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[7] = pbVar4;
  button::load_text(pbVar4,"game",-1);
  this->buttons[7]->color[3] = 0xff;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 3;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[8] = pbVar4;
  button::load_text(pbVar4,"setup",-1);
  this->buttons[8]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 0x1b;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[9] = pbVar4;
  button::load_text(pbVar4,"staff",-1);
  this->buttons[9]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  pbVar4->printer = pgVar3;
  fVar2 = DAT_089dbcdc;
  pbVar4->left = 0x6e;
  pbVar4->top = 0xc0;
  pbVar4->right = 0x172;
  pbVar4->bottom = 0x16;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 5;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = 1;
  pbVar4->key = 2;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[10] = pbVar4;
  button::load_text(pbVar4,"train",-1);
  this->buttons[10]->color[3] = 0x19;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 6;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 3;
  pbVar4->action_type = 2;
  this->buttons[0xb] = pbVar4;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->top = 0x110;
  pbVar4->right = 0x1e0;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->size = fVar2;
  pbVar4->action = 7;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 4;
  pbVar4->action_type = 3;
  pbVar4->effect_alpha = 0;
  this->menu_option[1] = 2;
  this->menu_option[2] = 3;
  this->menu_option[3] = 5;
  this->menu_option[4] = 10;
  this->menu_option[5] = 0xb;
  this->menu_option[6] = 0xc;
  this->menu_option[7] = 0xd;
  this->menu_option[8] = 6;
  this->menu_option[10] = 8;
  this->buttons[0xc] = pbVar4;
  pbVar4->isFadeing = false;
  this->menu_option[9] = 7;
  this->menu_option[0] = 0;
  this->menu_option[0xb] = 9;
  this->actual_option = 0;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->printer = pgVar3;
  pbVar4->left = 0xf;
  pbVar4->top = 0x20;
  pbVar4->bottom = -0x1c;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->right = 0x96;
  pbVar4->size = fVar2;
  pbVar4->action = 9;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->key = 2;
  pbVar4->action_type = 1;
  pbVar4->isFadeing = false;
  pbVar4->effect_alpha = 0;
  this->buttons[0xe] = pbVar4;
  button::load_text(pbVar4,"load enemy",-1);
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  word = this->whats[this->actual_staff];
  pbVar4->isFadeing = false;
  this->buttons[0x26] = pbVar4;
  button::load_text(pbVar4,word,-1);
  this->buttons[0x26]->color[3] = 200;
  pbVar4 = operator_new(0x158);
  pgVar3 = operator_new(1);
  fVar2 = DAT_089dbcdc;
  pbVar4->color[3] = 0xff;
  pbVar4->color[0] = 0xff;
  pbVar4->color[1] = 0xff;
  pbVar4->color[2] = 0xff;
  pbVar4->printer = pgVar3;
  pbVar4->size = fVar2;
  pbVar4->action = -1;
  pbVar4->x = 0.0;
  pbVar4->y = 0.0;
  pbVar4->z = 0.0;
  pbVar4->width = 0.0;
  pbVar4->height = 0.0;
  pbVar4->visible = false;
  pbVar4->enabled = false;
  pbVar4->left = 0;
  pbVar4->top = 0;
  pbVar4->right = 0;
  pbVar4->bottom = 0;
  iVar5 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar5 + 4;
    *(undefined4 *)((int)pbVar4->characters + iVar5) = 0xffffffff;
    iVar5 = iVar7;
  } while (iVar7 != 0x104);
  pbVar4->action_type = -1;
  pbVar4->effect_alpha = 0;
  pbVar4->key = 0;
  iVar5 = this->actual_staff;
  this->buttons[0x27] = pbVar4;
  pbVar4->isFadeing = false;
  button::load_text(pbVar4,this->whos[iVar5],-1);
  this->buttons[0x27]->color[3] = 200;
  return;
}



----------------------------------------

// Function: neutron @ 08902aa0

/* WARNING: Removing unreachable block (ram,0x08902c30) */
/* WARNING: Removing unreachable block (ram,0x08902bf8) */
/* WARNING: Removing unreachable block (ram,0x08902bb4) */
/* WARNING: Removing unreachable block (ram,0x08902b80) */
/* WARNING: Removing unreachable block (ram,0x08902b4c) */
/* WARNING: Removing unreachable block (ram,0x08902b14) */
/* WARNING: Removing unreachable block (ram,0x08902b30) */
/* WARNING: Removing unreachable block (ram,0x08902b68) */
/* WARNING: Removing unreachable block (ram,0x08902b98) */
/* WARNING: Removing unreachable block (ram,0x08902bd4) */
/* WARNING: Removing unreachable block (ram,0x08902c14) */
/* WARNING: Removing unreachable block (ram,0x08902c4c) */
/* DWARF original prototype: void neutron(neutron * this, int color, int difficuty, int stage, bool
   sound) */

void __thiscall neutron::neutron(neutron *this,int color,int difficuty,int stage,bool sound)

{
  float fVar1;
  GLfloat GVar2;
  GLfloat GVar3;
  GLfloat GVar4;
  int iVar5;
  stage_interface *this_00;
  camera *pcVar6;
  glinterface *pgVar7;
  sound_mixer *psVar8;
  bool in_t0;
  neutron *pnVar9;
  undefined4 unaff_s2;
  int iVar10;
  undefined1 sound_00;
  
  this->game_over = false;
  this->ground = (terrain *)0x0;
  this->proton = (player *)0x0;
  iVar10 = 0;
  pnVar9 = this;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar10 = iVar10 + 1;
    iVar5 = rand();
    pnVar9->background_colors[0][0] = iVar5 % 500 + 200;
    iVar5 = rand();
    pnVar9->background_colors[0][1] = iVar5 % 500 + -0xfa;
    iVar5 = rand();
    pnVar9->background_colors[0][2] = iVar5 % 500 + -0xfa;
    iVar5 = rand();
    pnVar9->background_colors[0][3] = iVar5 % 0xff;
    iVar5 = rand();
    pnVar9->background_colors[0][4] = iVar5 % 0xff;
    iVar5 = rand();
    pnVar9->background_colors[0][5] = iVar5 % 0xff;
    iVar5 = rand();
    pnVar9->background_colors[0][6] = iVar5 % 3 + 1;
    iVar5 = rand();
    pnVar9->background_colors[0][8] = 1;
    pnVar9->background_colors[0][7] = iVar5 % 2;
    iVar5 = rand();
    pnVar9->background_colors[0][9] = iVar5 % 0x167 + 1;
    iVar5 = rand();
    pnVar9->background_colors[0][10] = iVar5 % 0x32 + -0x19;
    iVar5 = rand();
    pnVar9->background_colors[0][0xb] = iVar5 % 0x32 + -0x19;
    iVar5 = rand();
    sound_00 = (undefined1)unaff_s2;
    pnVar9->background_colors[0][0xc] = iVar5 % 0x32 + -0x19;
    pnVar9 = (neutron *)(pnVar9->miniatures + 7);
  } while (iVar10 != 0x32);
  this->bg_current_size = 0;
  this->bg_current_count = 0;
  iVar10 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar5 = iVar10 + 4;
    *(undefined4 *)((int)this->miniatures + iVar10) = 0;
    iVar10 = iVar5;
  } while (iVar5 != 100);
  iVar10 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar5 = iVar10 + 4;
    *(undefined4 *)((int)this->electron + iVar10) = 0;
    iVar10 = iVar5;
  } while (iVar5 != 0x78);
  this->time = 10;
  fVar1 = DAT_089dbce0;
  this->go_status = 1000;
  this->game_status = 1000;
  this->speed = fVar1;
  this->game_cam = (camera *)0x0;
  this->interface = (stage_interface *)0x0;
  this->user_color = color;
  this->user_difficulty = difficuty;
  this->user_stage = stage;
  this->user_sound = in_t0;
  this->low_quality = false;
  this->intro_step = 0;
  this->last_charged_electron = 0;
  this->uncharged_electrons = 0;
  this->charged_electrons = 0;
  this->timer = 0;
  this->vision = 0;
  this->colision = 0;
  this->actual_stage = 0;
  this->actual_artifact = 0;
  this->timer_artifact = 0;
  this->game_mode = 0;
  this->move_ship[0] = 0;
  this->move_ship[1] = 0;
  this->move_ship[2] = 0;
  this->camera_passes = 0;
  this_00 = operator_new(0x714);
  stage_interface::stage_interface(this_00,color,difficuty,stage,(bool)sound_00);
  this->interface = this_00;
  this->save_game = false;
  this->actual_miniature = 0;
  pcVar6 = operator_new(0x38);
  pcVar6->x = 0.0;
  pcVar6->y = 0.0;
  GVar2 = DAT_089dbce4;
  pcVar6->z = 0.0;
  pcVar6->y_ori = GVar2;
  pcVar6->x_dir = 0.0;
  pcVar6->y_dir = 0.0;
  pcVar6->z_dir = 0.0;
  pcVar6->x_ori = 0.0;
  pcVar6->z_ori = 0.0;
  pcVar6->degrees = 0;
  pgVar7 = operator_new(1);
  GVar4 = DAT_089dbcf4;
  GVar2 = DAT_089dbce8;
  pcVar6->locator = pgVar7;
  GVar3 = DAT_089dbcec;
  pcVar6->z_dir = GVar4;
  GVar4 = DAT_089dbcf0;
  iVar10 = this->user_stage;
  pcVar6->x_dir = GVar2;
  pcVar6->z = GVar4;
  pcVar6->y_dir = GVar3;
  pcVar6->last_x = 0.0;
  pcVar6->last_y = 0.0;
  pcVar6->last_z = 0.0;
  this->game_cam = pcVar6;
  pcVar6->x = GVar2;
  pcVar6->y = GVar3;
  this->isSolo = false;
  this->sound_status = 0;
  if (iVar10 == 1) {
    this->isTutorial = true;
    this->tutorial_step = 0;
  }
  else {
    this->tutorial_step = -1;
    this->isTutorial = false;
  }
  this->score_buffer[5] = '0';
  this->tutorial_counter = 0;
  this->enemies_buffer[0] = '0';
  this->enemies_buffer[1] = '0';
  this->score = 0;
  this->prints = 0;
  builtin_strncpy(this->score_buffer,"00000",5);
  this->n_score = (char *)0x0;
  this->n_enemies = (char *)0x0;
  this->mixer = (sound_mixer *)0x0;
  psVar8 = operator_new(0x1c);
  psVar8->TOTAL_SOUNDS = 0xc;
  psVar8->refresh_effects = false;
  iVar10 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar5 = iVar10 + 1;
    psVar8->effects[iVar10] = false;
    iVar10 = iVar5;
  } while (iVar5 != 0xc);
  this->mixer = psVar8;
  psVar8->TOTAL_MUSIC = 4;
  psVar8->refresh_music = false;
                    /* Unresolved local var: void anon_var_0@[???] */
  psVar8->music[0] = false;
  psVar8->music[1] = false;
  psVar8->music[2] = false;
  psVar8->music[3] = false;
  return;
}



----------------------------------------

// Function: create_unions @ 08902ec0

/* WARNING: Removing unreachable block (ram,0x08902f48) */
/* WARNING: Removing unreachable block (ram,0x08902f9c) */
/* WARNING: Removing unreachable block (ram,0x08902ef0) */
/* WARNING: Removing unreachable block (ram,0x08903144) */
/* WARNING: Removing unreachable block (ram,0x089030c8) */
/* WARNING: Removing unreachable block (ram,0x08903114) */
/* WARNING: Removing unreachable block (ram,0x08903164) */
/* WARNING: Removing unreachable block (ram,0x08903024) */
/* WARNING: Removing unreachable block (ram,0x08903048) */
/* WARNING: Removing unreachable block (ram,0x08902f78) */
/* WARNING: Removing unreachable block (ram,0x08903064) */
/* WARNING: Removing unreachable block (ram,0x08903098) */
/* DWARF original prototype: void create_unions(terrain * this) */

void __thiscall terrain::create_unions(terrain *this)

{
  piece *ppVar1;
  int iVar2;
  plane *ppVar3;
  plane **pppVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  float fVar8;
  int iVar9;
  float fVar10;
  int iVar11;
  
                    /* Unresolved local var: int i@[DW_OP_reg12(t4)] */
  iVar6 = this->N_PLANES;
  if (0 < iVar6) {
    pppVar4 = this->map;
    iVar5 = 0;
    do {
      while( true ) {
        ppVar3 = *pppVar4;
        if (ppVar3->dead_axis != 1) break;
        ppVar1 = ppVar3->pieces[0];
        iVar5 = iVar5 + 1;
        pppVar4 = pppVar4 + 1;
        fVar8 = ppVar1->y;
        fVar10 = ppVar1->z;
        iVar7 = (int)ppVar1->x;
        this->unions[0][0][0] = iVar7;
        iVar9 = (int)fVar8;
        iVar11 = (int)fVar10;
        this->unions[0][0][1] = iVar9 + ppVar3->side_size + -1;
        iVar2 = ppVar3->side_size;
        this->unions[0][1][0] = iVar7;
        this->unions[0][0][2] = iVar11 + iVar2 / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][1][2] = iVar11;
        this->unions[0][2][0] = iVar7;
        this->unions[0][1][1] = iVar9 + iVar2 / 2;
        this->unions[0][2][1] = iVar9 + ppVar3->side_size / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][3][0] = iVar7;
        this->unions[0][3][1] = iVar9;
        this->unions[0][2][2] = iVar11 + iVar2 + -1;
        this->unions[0][3][2] = iVar11 + ppVar3->side_size / 2;
        this = (terrain *)(this->map + 0xb);
        if (iVar6 <= iVar5) {
          return;
        }
      }
      iVar2 = ppVar3->side_size;
      if (ppVar3->dead_axis == 2) {
        ppVar1 = ppVar3->pieces[0];
        iVar7 = (int)ppVar1->x;
        iVar11 = (int)ppVar1->y;
        iVar9 = (int)ppVar1->z;
        this->unions[0][0][1] = iVar11;
        this->unions[0][0][2] = iVar9;
        this->unions[0][1][0] = iVar7;
        this->unions[0][1][1] = iVar11;
        this->unions[0][0][0] = iVar7 + iVar2 / 2;
        this->unions[0][1][2] = iVar9 + ppVar3->side_size / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][2][1] = iVar11;
        this->unions[0][2][0] = iVar7 + iVar2 + -1;
        this->unions[0][2][2] = iVar9 + ppVar3->side_size / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][3][1] = iVar11;
        this->unions[0][3][0] = iVar7 + iVar2 / 2;
        this->unions[0][3][2] = iVar9 + ppVar3->side_size + -1;
      }
      else {
        ppVar1 = ppVar3->pieces[0];
        iVar7 = (int)ppVar1->x;
        iVar9 = (int)ppVar1->y;
        iVar11 = (int)ppVar1->z;
        this->unions[0][0][0] = iVar7 + iVar2 / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][0][2] = iVar11;
        this->unions[0][1][0] = iVar7;
        this->unions[0][0][1] = iVar9 + iVar2 + -1;
        iVar2 = ppVar3->side_size;
        this->unions[0][1][2] = iVar11;
        this->unions[0][1][1] = iVar9 + iVar2 / 2;
        this->unions[0][2][0] = iVar7 + ppVar3->side_size + -1;
        iVar2 = ppVar3->side_size;
        this->unions[0][2][2] = iVar11;
        this->unions[0][2][1] = iVar9 + iVar2 / 2;
        iVar2 = ppVar3->side_size;
        this->unions[0][3][1] = iVar9;
        this->unions[0][3][2] = iVar11;
        this->unions[0][3][0] = iVar7 + iVar2 / 2;
      }
      iVar5 = iVar5 + 1;
      pppVar4 = pppVar4 + 1;
      this = (terrain *)(this->map + 0xb);
    } while (iVar5 < iVar6);
  }
  return;
}



----------------------------------------

// Function: wich_union @ 08903188

/* DWARF original prototype: int wich_union(terrain * this, int a, int b, int c, int n_plane, int
   union_type) */

int __thiscall terrain::wich_union(terrain *this,int a,int b,int c,int n_plane,int union_type)

{
  int in_t0;
  int iVar1;
  int in_t1;
  
                    /* Unresolved local var: int look_for@[???] */
  switch(this->map[in_t0]->face_number) {
  default:
    goto switchD_089031b8_caseD_0;
  case 1:
  case 4:
    if (in_t1 == 1) goto LAB_08903278;
    if (in_t1 < 2) {
LAB_08903298:
      if (in_t1 == 0) {
        iVar1 = 2;
      }
      else {
        iVar1 = 0;
      }
      goto LAB_089031ec;
    }
    iVar1 = 6;
    if (in_t1 == 2) goto LAB_089031ec;
    break;
  case 2:
  case 5:
    if (in_t1 != 1) {
      if (1 < in_t1) {
        if (in_t1 == 2) {
          iVar1 = 6;
        }
        else if (in_t1 == 3) {
          iVar1 = 4;
        }
        else {
          iVar1 = 0;
        }
        goto LAB_089031ec;
      }
      if (in_t1 != 0) {
        iVar1 = 0;
        goto LAB_089031ec;
      }
LAB_08903288:
      iVar1 = 1;
      goto LAB_089031ec;
    }
LAB_08903278:
    iVar1 = 3;
    goto LAB_089031ec;
  case 3:
  case 6:
    if (in_t1 == 1) goto LAB_08903288;
    if (in_t1 < 2) goto LAB_08903298;
    if (in_t1 == 2) {
      iVar1 = 4;
      goto LAB_089031ec;
    }
  }
  iVar1 = 5;
  if (in_t1 != 3) {
switchD_089031b8_caseD_0:
    iVar1 = 0;
  }
LAB_089031ec:
  if ((iVar1 != this->map[a]->face_number) && (a = b, iVar1 != this->map[b]->face_number)) {
    a = c;
  }
  return a;
}



----------------------------------------

// Function: set_unions_of_plane @ 089032a8

/* DWARF original prototype: void set_unions_of_plane(terrain * this, int n_plane) */

void __thiscall terrain::set_unions_of_plane(terrain *this,int n_plane)

{
  int a;
  int b;
  int c;
  int b_00;
  int c_00;
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int (*paaiVar5) [4] [3];
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int *piVar13;
  plane *ppVar14;
  int *piVar15;
  int *piVar16;
  int *piVar17;
  int *piVar18;
  int *piVar19;
  int *piVar20;
  int local_70 [4];
  int iVar21;
  int local_40;
  int local_3c;
  int local_38;
  int local_34;
  undefined1 *local_2c;
  
  c_00 = DAT_089dc308;
  b_00 = DAT_089dc304;
  iVar1 = set_unions_of_plane(int)::C_11;
  c = DAT_089dc2fc;
  b = DAT_089dc2f8;
  a = set_unions_of_plane(int)::C_12;
                    /* Unresolved local var: int top_unions_count@[???]
                       Unresolved local var: int left_unions_count@[???]
                       Unresolved local var: int right_unions_count@[???]
                       Unresolved local var: int bottom_unions_count@[???]
                       Unresolved local var: int[3] top_unions@[???]
                       Unresolved local var: int[3] left_unions@[???]
                       Unresolved local var: int[3] right_unions@[???]
                       Unresolved local var: int[3] bottom_unions@[???] */
  local_2c = (undefined1 *)local_70;
  piVar17 = local_70;
  piVar20 = local_70;
                    /* Unresolved local var: int i@[???] */
  iVar8 = this->N_PLANES;
  local_70[0] = set_unions_of_plane(int)::C_9;
  local_70[1] = DAT_089dc31c;
  local_70[2] = DAT_089dc320;
  local_70[3] = set_unions_of_plane(int)::C_10;
  iVar2 = DAT_089dc310;
  iVar21 = DAT_089dc314;
  if (iVar8 < 1) {
    local_3c = 0;
    local_38 = 0;
    local_40 = 0;
  }
  else {
    local_34 = 0;
    local_38 = 0;
    local_3c = 0;
    local_40 = 0;
    iVar12 = 0;
    piVar13 = this->ground_material + 3;
    do {
      if (n_plane != iVar12) {
                    /* Unresolved local var: int j@[???] */
        iVar11 = this->unions[n_plane][0][0];
        iVar10 = this->unions[n_plane][1][0];
        piVar16 = local_70 + local_34;
        iVar9 = this->unions[n_plane][2][0];
        iVar7 = this->unions[n_plane][3][0];
        paaiVar5 = (int (*) [4] [3])(piVar13 + 1);
        iVar6 = 0;
        piVar15 = (int *)((int)piVar17 + 0x24);
        piVar19 = (int *)((int)piVar20 + 0x18);
        piVar18 = (int *)(local_2c + 0xc);
        do {
          iVar4 = (*paaiVar5)[0][0];
          if (((iVar11 == iVar4) && (this->unions[n_plane][0][1] == (*paaiVar5)[0][1])) &&
             (this->unions[n_plane][0][2] == (*paaiVar5)[0][2])) {
            *piVar16 = iVar12;
            piVar16 = piVar16 + 1;
            local_34 = local_34 + 1;
            if (iVar4 != iVar10) goto LAB_089033fc;
            iVar3 = this->unions[n_plane][1][1];
LAB_08903504:
            if ((iVar3 != (*paaiVar5)[0][1]) || (this->unions[n_plane][1][2] != (*paaiVar5)[0][2]))
            goto LAB_089033fc;
            *piVar18 = iVar12;
            local_38 = local_38 + 1;
            local_2c = local_2c + 4;
            piVar18 = piVar18 + 1;
            if (iVar4 == iVar9) {
              iVar3 = this->unions[n_plane][2][1];
              goto LAB_08903544;
            }
LAB_08903404:
            if (iVar4 == iVar7) {
              iVar4 = this->unions[n_plane][3][1];
LAB_0890357c:
              if ((iVar4 == (*paaiVar5)[0][1]) && (this->unions[n_plane][3][2] == (*paaiVar5)[0][2])
                 ) {
                *piVar15 = iVar12;
                piVar17 = (int *)((int)piVar17 + 4);
                local_40 = local_40 + 1;
                piVar15 = piVar15 + 1;
              }
            }
          }
          else {
            if (iVar4 == iVar10) {
              iVar3 = this->unions[n_plane][1][1];
              goto LAB_08903504;
            }
LAB_089033fc:
            if (iVar4 != iVar9) goto LAB_08903404;
            iVar3 = this->unions[n_plane][2][1];
LAB_08903544:
            if ((iVar3 != (*paaiVar5)[0][1]) || (this->unions[n_plane][2][2] != (*paaiVar5)[0][2]))
            goto LAB_08903404;
            *piVar19 = iVar12;
            piVar20 = (int *)((int)piVar20 + 4);
            local_3c = local_3c + 1;
            piVar19 = piVar19 + 1;
            if (iVar4 == iVar7) {
              iVar4 = this->unions[n_plane][3][1];
              goto LAB_0890357c;
            }
          }
          iVar6 = iVar6 + 1;
          paaiVar5 = (int (*) [4] [3])(*paaiVar5 + 1);
        } while (iVar6 != 4);
      }
      iVar12 = iVar12 + 1;
      piVar13 = piVar13 + 0xc;
    } while (iVar12 != iVar8);
    if (local_34 == 1) {
      this->map[n_plane]->id_union_top = local_70[0];
      goto joined_r0x089035f4;
    }
  }
  ppVar14 = this->map[n_plane];
  iVar8 = wich_union(this,local_70[0],local_70[1],local_70[2],iVar2,iVar21);
  ppVar14->id_union_top = iVar8;
joined_r0x089035f4:
  if (local_38 == 1) {
    this->map[n_plane]->id_union_left = local_70[3];
  }
  else {
    ppVar14 = this->map[n_plane];
    iVar8 = wich_union(this,local_70[3],iVar2,iVar21,iVar2,iVar21);
    ppVar14->id_union_left = iVar8;
  }
  if (local_3c == 1) {
    this->map[n_plane]->id_union_right = iVar1;
  }
  else {
    ppVar14 = this->map[n_plane];
    iVar1 = wich_union(this,iVar1,b_00,c_00,iVar2,iVar21);
    ppVar14->id_union_right = iVar1;
  }
  if (local_40 == 1) {
    this->map[n_plane]->id_union_bottom = a;
    return;
  }
  ppVar14 = this->map[n_plane];
  iVar2 = wich_union(this,a,b,c,iVar2,iVar21);
  ppVar14->id_union_bottom = iVar2;
  return;
}



----------------------------------------

// Function: am_i_clear @ 089036c4

/* DWARF original prototype: bool am_i_clear(terrain * this) */

bool __thiscall terrain::am_i_clear(terrain *this)

{
  int iVar1;
  plane *ppVar2;
  int iVar3;
  piece *ppVar4;
  plane **pppVar5;
  int iVar6;
  int iVar7;
  
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
  iVar7 = this->N_PLANES;
  this->is_clear = true;
  if (0 < iVar7) {
    pppVar5 = this->map;
    iVar6 = 0;
LAB_089036dc:
    do {
                    /* Unresolved local var: int j@[???] */
      ppVar2 = *pppVar5;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar3 = 0;
        ppVar4 = ppVar2->pieces[0];
        while( true ) {
          iVar3 = iVar3 + 1;
          if ((ppVar4->state != false) && (0 < ppVar4->owner)) {
            iVar6 = iVar6 + 1;
            this->is_clear = false;
            pppVar5 = pppVar5 + 1;
            if (iVar7 <= iVar6) goto LAB_08903734;
            goto LAB_089036dc;
          }
          if (iVar3 == iVar1) break;
          ppVar4 = ppVar2->pieces[1];
          ppVar2 = (plane *)&ppVar2->i;
        }
      }
      iVar6 = iVar6 + 1;
      pppVar5 = pppVar5 + 1;
    } while (iVar6 < iVar7);
  }
LAB_08903734:
  return this->is_clear;
}



----------------------------------------

// Function: fire_up_cue @ 08903754

/* DWARF original prototype: void fire_up_cue(terrain * this, int ship_ident) */

void __thiscall terrain::fire_up_cue(terrain *this,int ship_ident)

{
  int iVar1;
  plane *ppVar2;
  piece *ppVar3;
  int iVar4;
  plane *ppVar5;
  int iVar6;
  int iVar7;
  
                    /* Unresolved local var: int i@[DW_OP_reg10(t2)] */
  iVar7 = this->N_PLANES;
  if (0 < iVar7) {
    iVar6 = 0;
    do {
      this = (terrain *)this->map;
                    /* Unresolved local var: int j@[DW_OP_reg7(a3)] */
      ppVar2 = *(plane **)this;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar4 = 0;
        do {
          ppVar3 = ppVar2->pieces[0];
          ppVar5 = ppVar2;
          while( true ) {
            iVar4 = iVar4 + 1;
            ppVar2 = (plane *)&ppVar5->i;
            if (ppVar3->owner == ship_ident) break;
            if (iVar4 == iVar1) goto LAB_089037a4;
            ppVar3 = ppVar5->pieces[1];
            ppVar5 = ppVar2;
          }
          ppVar3->owner = -2;
          ppVar3->status = 2;
          ppVar3->state = false;
        } while (iVar4 != iVar1);
      }
LAB_089037a4:
      iVar6 = iVar6 + 1;
    } while (iVar6 != iVar7);
  }
  return;
}



----------------------------------------

// Function: clear_cue @ 089037d4

/* DWARF original prototype: void clear_cue(terrain * this, int ship_ident) */

void __thiscall terrain::clear_cue(terrain *this,int ship_ident)

{
  int iVar1;
  plane *ppVar2;
  int iVar3;
  plane *ppVar4;
  piece *ppVar5;
  int iVar6;
  int iVar7;
  
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
  iVar7 = this->N_PLANES;
  if (0 < iVar7) {
    iVar6 = 0;
    do {
      this = (terrain *)this->map;
                    /* Unresolved local var: int j@[???] */
      ppVar2 = *(plane **)this;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar3 = 0;
        do {
          ppVar5 = ppVar2->pieces[0];
          ppVar4 = ppVar2;
          while( true ) {
            iVar3 = iVar3 + 1;
            ppVar2 = (plane *)&ppVar4->i;
            if (ppVar5->owner == ship_ident) break;
            if (iVar3 == iVar1) goto LAB_08903824;
            ppVar5 = ppVar4->pieces[1];
            ppVar4 = ppVar2;
          }
          ppVar5->temporal = true;
        } while (iVar3 != iVar1);
      }
LAB_08903824:
      iVar6 = iVar6 + 1;
    } while (iVar6 != iVar7);
  }
  return;
}



----------------------------------------

// Function: restart @ 08903848

/* DWARF original prototype: void restart(terrain * this) */

void __thiscall terrain::restart(terrain *this)

{
  int iVar1;
  plane *ppVar2;
  piece *ppVar3;
  int iVar4;
  terrain *ptVar5;
  int iVar6;
  int iVar7;
  
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
  iVar7 = this->N_PLANES;
  if (0 < iVar7) {
    iVar6 = 0;
    ptVar5 = this;
    do {
      ptVar5 = (terrain *)ptVar5->map;
                    /* Unresolved local var: int j@[DW_OP_reg5(a1)] */
      ppVar2 = *(plane **)ptVar5;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar4 = 0;
        do {
          ppVar3 = ppVar2->pieces[0];
          iVar4 = iVar4 + 1;
          ppVar3->temporal = true;
          ppVar3->type = 0;
          ppVar3->state = false;
          ppVar3->status = 0;
          ppVar2 = (plane *)&ppVar2->i;
        } while (iVar1 != iVar4);
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 != iVar7);
  }
  this->time = 0;
  return;
}



----------------------------------------

// Function: combat_mode @ 089038b0

/* DWARF original prototype: void combat_mode(terrain * this) */

void __thiscall terrain::combat_mode(terrain *this)

{
  int iVar1;
  plane *ppVar2;
  piece *ppVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int i@[DW_OP_reg8(t0)] */
  iVar6 = this->N_PLANES;
  if (0 < iVar6) {
    iVar5 = 0;
    do {
      this = (terrain *)this->map;
                    /* Unresolved local var: int j@[DW_OP_reg5(a1)] */
      ppVar2 = *(plane **)this;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar4 = 0;
        do {
          ppVar3 = ppVar2->pieces[0];
          iVar4 = iVar4 + 1;
          ppVar3->owner = -2;
          ppVar3->state = false;
          ppVar3->temporal = false;
          *(undefined4 *)&ppVar3->prints_counter = 0;
          *(undefined4 *)((int)&ppVar3->prints_counter + 4) = 0;
          ppVar2 = (plane *)&ppVar2->i;
        } while (iVar1 != iVar4);
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 != iVar6);
  }
  return;
}



----------------------------------------

// Function: navigation_mode @ 0890391c

/* DWARF original prototype: void navigation_mode(terrain * this) */

void __thiscall terrain::navigation_mode(terrain *this)

{
  int iVar1;
  plane *ppVar2;
  piece *ppVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
  iVar6 = this->N_PLANES;
  if (0 < iVar6) {
    iVar5 = 0;
    do {
      this = (terrain *)this->map;
                    /* Unresolved local var: int j@[DW_OP_reg6(a2)] */
      ppVar2 = *(plane **)this;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar4 = 0;
        do {
          ppVar3 = ppVar2->pieces[0];
          iVar4 = iVar4 + 1;
          ppVar3->owner = -2;
          ppVar2 = (plane *)&ppVar2->i;
          ppVar3->state = false;
          if (ppVar3->status != 2) {
            ppVar3->temporal = true;
          }
          *(undefined4 *)&ppVar3->prints_counter = 0;
          *(undefined4 *)((int)&ppVar3->prints_counter + 4) = 0;
        } while (iVar4 != iVar1);
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 != iVar6);
  }
  return;
}



----------------------------------------

// Function: change_color @ 08903998

/* DWARF original prototype: void change_color(terrain * this, int r, int g, int b, int a) */

void __thiscall terrain::change_color(terrain *this,int r,int g,int b,int a)

{
  int in_t0;
  
  this->material[3] = in_t0;
  this->material[0] = r;
  this->material[1] = g;
  this->material[2] = b;
  return;
}



----------------------------------------

// Function: create_from_miniature @ 089039ac

/* DWARF original prototype: void create_from_miniature(terrain * this, miniature * mini_map) */

void __thiscall terrain::create_from_miniature(terrain *this,miniature *mini_map)

{
  plane *ppVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  int *piVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int local_188 [4];
  int in_stack_fffffe88;
  
                    /* Unresolved local var: plane *[90] temp_map@[???]
                       Unresolved local var: int id_count@[???]
                       Unresolved local var: bool has_double@[???] */
  piVar6 = local_188;
                    /* Unresolved local var: int i@[???] */
  if (mini_map->cubes < 1) {
    this->N_PLANES = 0;
    this->N_PLANES = 0;
    return;
  }
  iVar9 = 0;
  do {
    iVar8 = iVar9 * 6;
    iVar7 = 1;
    piVar4 = local_188 + iVar9 * 6;
    do {
                    /* Unresolved local var: int j@[???] */
      ppVar1 = miniature::convert_to_plane(mini_map,iVar9,iVar7,iVar8,in_stack_fffffe88);
      *piVar4 = (int)ppVar1;
      iVar7 = iVar7 + 1;
      iVar8 = iVar8 + 1;
      piVar4 = piVar4 + 1;
    } while (iVar7 != 7);
    iVar9 = iVar9 + 1;
  } while (iVar9 < mini_map->cubes);
  iVar9 = iVar9 * 6;
                    /* Unresolved local var: int i@[???] */
  this->N_PLANES = iVar9;
  if (iVar9 < 1) {
    iVar8 = 0;
  }
  else {
    iVar8 = 0;
    iVar7 = 0;
    do {
                    /* Unresolved local var: int j@[???] */
      iVar5 = 0;
      if (iVar9 < 1) {
        iVar5 = ((plane *)*piVar6)->face_number;
        this->map[iVar8] = (plane *)*piVar6;
        if (iVar5 == 4) {
          iVar5 = this->start_on_plane;
          goto LAB_08903b38;
        }
      }
      else {
        ppVar1 = (plane *)*piVar6;
        iVar3 = local_188[0];
        piVar4 = local_188;
        while( true ) {
          while( true ) {
            iVar5 = iVar5 + 1;
            piVar4 = piVar4 + 1;
            if ((((ppVar1->i != *(int *)(iVar3 + 4)) || (ppVar1->j != *(int *)(iVar3 + 8))) ||
                (ppVar1->dead_axis != *(int *)(iVar3 + 0x10))) ||
               (ppVar1->dead_offset != *(int *)(iVar3 + 0x14))) break;
            iVar2 = ppVar1->face_number;
            if (iVar2 != *(int *)(iVar3 + 0x18)) goto LAB_08903aac;
            if (iVar5 == iVar9) goto LAB_08903a94;
            iVar3 = *piVar4;
          }
          if (iVar5 == iVar9) break;
          iVar3 = *piVar4;
        }
        iVar2 = ppVar1->face_number;
LAB_08903a94:
        this->map[iVar8] = ppVar1;
        if (iVar2 == 4) {
          iVar5 = this->start_on_plane;
LAB_08903b38:
          if (iVar5 == -1) {
            this->start_on_plane = iVar8;
          }
        }
      }
      iVar8 = iVar8 + 1;
LAB_08903aac:
      iVar7 = iVar7 + 1;
      piVar6 = piVar6 + 1;
    } while (iVar7 < iVar9);
  }
  this->N_PLANES = iVar8;
  return;
}



----------------------------------------

// Function: create_from_array @ 08903ba8

/* DWARF original prototype: void create_from_array(terrain * this, int N_PLANES, int[7] * PLANES)
    */

void __thiscall terrain::create_from_array(terrain *this,int N_PLANES,int (*PLANES) [7])

{
  plane *ppVar1;
  int iVar2;
  int (*paiVar3) [20];
  plane *ppVar4;
  int iVar5;
  terrain *ptVar6;
  int iVar7;
  
                    /* Unresolved local var: int i@[???] */
  this->N_PLANES = N_PLANES;
  if (0 < N_PLANES) {
    iVar7 = 0;
    ptVar6 = this;
    do {
      ptVar6 = (terrain *)ptVar6->map;
      *(plane **)ptVar6 = (plane *)0x0;
      ppVar1 = operator_new(0x1fb0);
      ppVar1->ident = iVar7;
      ppVar1->i = (*PLANES)[0];
      ppVar1->j = (*PLANES)[1];
      ppVar1->side_size = (*PLANES)[2];
      ppVar1->dead_axis = (*PLANES)[3];
      ppVar1->dead_offset = (*PLANES)[4];
      ppVar1->face_number = (*PLANES)[5];
      iVar2 = (*PLANES)[6];
      ppVar1->id_union_right = -1;
      ppVar1->id_union_top = -1;
      ppVar1->axis_polarity = iVar2;
      ppVar1->id_union_left = -1;
      ppVar1->id_union_bottom = -1;
      ppVar4 = ppVar1;
      iVar2 = 0;
      do {
                    /* Unresolved local var: void anon_var_0@[???] */
        iVar5 = iVar2 + 4;
        ppVar4->cam_positions[0][0] = 0;
        ppVar4->cam_positions[0][1] = 0;
        ppVar4->cam_positions[0][2] = 0;
        *(undefined4 *)((int)ppVar1->pieces + iVar2) = 0;
        ppVar4 = (plane *)&ppVar4->side_size;
        iVar2 = iVar5;
      } while (iVar5 != 0x640);
      iVar2 = 0;
      do {
        iVar5 = 0;
        paiVar3 = ppVar1->index + iVar2;
        do {
                    /* Unresolved local var: void anon_var_0@[???] */
          iVar5 = iVar5 + 1;
          (*paiVar3)[0] = 0;
          paiVar3 = (int (*) [20])(*paiVar3 + 1);
        } while (iVar5 != 0x14);
        iVar2 = iVar2 + 1;
      } while (iVar2 != 0x14);
      ppVar1->a_vertex[0] = 0;
      ppVar1->a_vertex[1] = 0;
      ppVar1->a_vertex[2] = 0;
      ppVar1->b_vertex[0] = 0;
      ppVar1->b_vertex[1] = 0;
      ppVar1->b_vertex[2] = 0;
      ppVar1->c_vertex[0] = 0;
      ppVar1->c_vertex[1] = 0;
      ppVar1->c_vertex[2] = 0;
      ppVar1->d_vertex[0] = 0;
      ppVar1->d_vertex[1] = 0;
      ppVar1->d_vertex[2] = 0;
      ppVar1->max_vertex[0] = 0;
      ppVar1->max_vertex[1] = 0;
      ppVar1->max_vertex[2] = 0;
      iVar2 = this->N_PLANES;
      iVar7 = iVar7 + 1;
      *(plane **)ptVar6 = ppVar1;
      ppVar1->visited = false;
      PLANES = PLANES + 1;
    } while (iVar7 < iVar2);
  }
  if (this->start_on_plane == -1) {
    this->start_on_plane = 0;
  }
  return;
}



----------------------------------------

// Function: print_skeleton @ 08903d28

/* DWARF original prototype: void print_skeleton(terrain * this) */

void __thiscall terrain::print_skeleton(terrain *this)

{
  int iVar1;
  int iVar2;
  plane *y_origin;
  GLfloat in_a3;
  terrain *ptVar3;
  int iVar4;
  GLfloat unaff_retaddr;
  GLfloat in_stack_00000000;
  int *in_stack_00000004;
  GLfloat in_stack_00000008;
  int in_stack_0000000c;
  GLfloat in_stack_fffffffc;
  
                    /* Unresolved local var: int i@[???] */
  if (0 < this->N_PLANES) {
    iVar4 = 0;
    ptVar3 = this;
    do {
      ptVar3 = (terrain *)ptVar3->map;
      y_origin = *(plane **)ptVar3;
      iVar2 = y_origin->dead_axis;
      if (iVar2 == 1) {
        if (this->map[y_origin->id_union_bottom]->dead_axis == 1) {
          iVar1 = y_origin->id_union_right;
          iVar2 = 1;
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = *(plane **)ptVar3;
          iVar1 = y_origin->id_union_right;
          iVar2 = y_origin->dead_axis;
        }
        if (this->map[iVar1]->dead_axis == iVar2) {
          iVar2 = y_origin->id_union_top;
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = *(plane **)ptVar3;
          iVar2 = y_origin->id_union_top;
        }
        if (this->map[iVar2]->dead_axis == y_origin->dead_axis) {
          iVar2 = y_origin->id_union_left;
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = *(plane **)ptVar3;
          iVar2 = y_origin->id_union_left;
        }
LAB_08903eec:
        if (this->map[iVar2]->dead_axis != y_origin->dead_axis) {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
        }
      }
      else {
        if (iVar2 == 2) {
          if (this->map[y_origin->id_union_left]->dead_axis == 2) {
            iVar2 = y_origin->id_union_bottom;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_bottom;
          }
          iVar1 = y_origin->dead_axis;
          if (this->map[iVar2]->dead_axis == iVar1) {
            iVar2 = y_origin->id_union_right;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_right;
            iVar1 = y_origin->dead_axis;
          }
          if (this->map[iVar2]->dead_axis == iVar1) {
            iVar2 = y_origin->id_union_top;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_top;
          }
          goto LAB_08903eec;
        }
        if (iVar2 == 3) {
          if (this->map[y_origin->id_union_left]->dead_axis == 3) {
            iVar2 = y_origin->id_union_top;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_top;
          }
          iVar1 = y_origin->dead_axis;
          if (this->map[iVar2]->dead_axis == iVar1) {
            iVar2 = y_origin->id_union_right;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_right;
            iVar1 = y_origin->dead_axis;
          }
          if (this->map[iVar2]->dead_axis == iVar1) {
            iVar2 = y_origin->id_union_bottom;
          }
          else {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
            y_origin = *(plane **)ptVar3;
            iVar2 = y_origin->id_union_bottom;
          }
          goto LAB_08903eec;
        }
      }
      in_a3 = (GLfloat)this->ground_material[2];
      glinterface::square_3D
                (this->printer,(GLfloat)this->ground_material[0],(GLfloat)this->ground_material[1],
                 in_a3,(int)unaff_retaddr,(int)in_stack_fffffffc,(int)in_stack_00000000,
                 (int)in_stack_00000004,in_stack_00000008,in_stack_0000000c);
      iVar4 = iVar4 + 1;
    } while (iVar4 < this->N_PLANES);
  }
  return;
}



----------------------------------------

// Function: build_skeleton @ 089041ac

/* DWARF original prototype: void build_skeleton(terrain * this, bool build) */

void __thiscall terrain::build_skeleton(terrain *this,bool build)

{
  char cVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  plane *y_origin;
  GLfloat in_a3;
  terrain *ptVar5;
  GLfloat unaff_retaddr;
  GLfloat in_stack_00000000;
  int *in_stack_00000004;
  GLfloat in_stack_00000008;
  int in_stack_0000000c;
  GLfloat in_stack_fffffffc;
  
  iVar4 = this->N_PLANES;
  iVar3 = this->painted_planes;
  if (iVar3 < iVar4) {
    iVar2 = this->painted_bones;
    if (iVar2 < 5) {
      this->painted[iVar3][iVar2] = build;
      this->painted_bones = iVar2 + 1;
    }
    else {
      this->painted_planes = iVar3 + 1;
      this->painted_bones = 0;
    }
  }
  else {
    this->status = 1;
    this->painted_bones = 0;
    this->painted_planes = 0;
  }
  if (0 < iVar4) {
    iVar3 = 0;
    ptVar5 = this;
    do {
      y_origin = ptVar5->map[0];
      iVar4 = y_origin->dead_axis;
      if (iVar4 == 1) {
        if (ptVar5->painted[0][0] == false) {
          cVar1 = ptVar5->painted[0][1];
        }
        else if (this->map[y_origin->id_union_bottom]->dead_axis == 1) {
          cVar1 = ptVar5->painted[0][1];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][1];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][2];
        }
        else if (this->map[y_origin->id_union_right]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][2];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][2];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][3];
        }
        else if (this->map[y_origin->id_union_top]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][3];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][3];
        }
        if (cVar1 != '\0') {
          iVar4 = y_origin->id_union_left;
LAB_089043dc:
          if (this->map[iVar4]->dead_axis != y_origin->dead_axis) {
            glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                              unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          }
        }
      }
      else if (iVar4 == 2) {
        if (ptVar5->painted[0][0] == false) {
          cVar1 = ptVar5->painted[0][1];
        }
        else if (this->map[y_origin->id_union_left]->dead_axis == 2) {
          cVar1 = ptVar5->painted[0][1];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][1];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][2];
        }
        else if (this->map[y_origin->id_union_bottom]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][2];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][2];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][3];
        }
        else if (this->map[y_origin->id_union_right]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][3];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][3];
        }
        if (cVar1 != '\0') {
          iVar4 = y_origin->id_union_top;
          goto LAB_089043dc;
        }
      }
      else if (iVar4 == 3) {
        if (ptVar5->painted[0][0] == false) {
          cVar1 = ptVar5->painted[0][1];
        }
        else if (this->map[y_origin->id_union_left]->dead_axis == 3) {
          cVar1 = ptVar5->painted[0][1];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][1];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][2];
        }
        else if (this->map[y_origin->id_union_top]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][2];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][2];
        }
        if (cVar1 == '\0') {
          cVar1 = ptVar5->painted[0][3];
        }
        else if (this->map[y_origin->id_union_right]->dead_axis == y_origin->dead_axis) {
          cVar1 = ptVar5->painted[0][3];
        }
        else {
          glinterface::line(this->printer,(GLfloat)this->material,(GLfloat)y_origin,in_a3,
                            unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004);
          y_origin = ptVar5->map[0];
          cVar1 = ptVar5->painted[0][3];
        }
        if (cVar1 != '\0') {
          iVar4 = y_origin->id_union_bottom;
          goto LAB_089043dc;
        }
      }
      in_a3 = (GLfloat)this->ground_material[2];
      glinterface::square_3D
                (this->printer,(GLfloat)this->ground_material[0],(GLfloat)this->ground_material[1],
                 in_a3,(int)unaff_retaddr,(int)in_stack_fffffffc,(int)in_stack_00000000,
                 (int)in_stack_00000004,in_stack_00000008,in_stack_0000000c);
      iVar3 = iVar3 + 1;
      ptVar5 = (terrain *)ptVar5->map;
    } while (iVar3 < this->N_PLANES);
  }
  return;
}



----------------------------------------

// Function: print @ 0890471c

/* DWARF original prototype: int print(terrain * this, bool skeleton, int actual_plane, bool
   low_quality) */

int __thiscall terrain::print(terrain *this,bool skeleton,int actual_plane,bool low_quality)

{
  int iVar1;
  int iVar2;
  terrain *ptVar3;
  int iVar4;
  
                    /* Unresolved local var: int prints@[???] */
  if (skeleton) {
    if (this->status == 4) {
      build_skeleton(this,true);
      iVar1 = this->N_PLANES;
      goto joined_r0x089047e8;
    }
    if (this->status == 5) {
      build_skeleton(this,false);
      iVar1 = this->N_PLANES;
      goto joined_r0x089047e8;
    }
    print_skeleton(this);
  }
                    /* Unresolved local var: int i@[???] */
  iVar1 = this->N_PLANES;
joined_r0x089047e8:
  if (iVar1 < 1) {
    return 0;
  }
  iVar4 = 0;
  iVar1 = 0;
  ptVar3 = this;
  do {
    ptVar3 = (terrain *)ptVar3->map;
    iVar1 = iVar1 + 1;
    iVar2 = plane::print(*(plane **)ptVar3,low_quality);
    iVar4 = iVar4 + iVar2;
  } while (iVar1 < this->N_PLANES);
  return iVar4;
}



----------------------------------------

// Function: init @ 08904818

/* DWARF original prototype: void init(terrain * this, int offset_x, int offset_y, int offset_z, int
   cam_distance) */

void __thiscall terrain::init(terrain *this,int offset_x,int offset_y,int offset_z,int cam_distance)

{
  plane *ppVar1;
  plane **pppVar2;
  int iVar3;
  int unaff_s4;
  
                    /* Unresolved local var: int i@[???] */
  if (0 < this->N_PLANES) {
    pppVar2 = this->map;
    iVar3 = 0;
    ppVar1 = *pppVar2;
    while( true ) {
      ppVar1->ident = iVar3;
      plane::generate_positions(ppVar1,offset_x,offset_y,offset_z,unaff_s4);
      ppVar1 = *pppVar2;
      iVar3 = iVar3 + 1;
      pppVar2 = pppVar2 + 1;
      if (this->max_vertex[0] < ppVar1->max_vertex[0]) {
        this->max_vertex[0] = ppVar1->max_vertex[0];
      }
      if (this->max_vertex[1] < ppVar1->max_vertex[1]) {
        this->max_vertex[1] = ppVar1->max_vertex[1];
      }
      if (this->max_vertex[2] < ppVar1->max_vertex[2]) {
        this->max_vertex[2] = ppVar1->max_vertex[2];
      }
      if (this->N_PLANES <= iVar3) break;
      ppVar1 = *pppVar2;
    }
  }
  create_unions(this);
                    /* Unresolved local var: int i@[???] */
  iVar3 = 0;
  if (0 < this->N_PLANES) {
    do {
      set_unions_of_plane(this,iVar3);
      iVar3 = iVar3 + 1;
    } while (iVar3 < this->N_PLANES);
  }
  return;
}



----------------------------------------

// Function: get_cam_position_x @ 08904930

/* DWARF original prototype: float get_cam_position_x(plane * this, int value) */

float __thiscall plane::get_cam_position_x(plane *this,int value)

{
  if (this->dead_axis == 1) {
    return (float)(value + this->side_size * this->axis_polarity);
  }
  if (this->dead_axis != 2) {
    return (float)(value * 3 - this->side_size);
  }
  return (float)(value * 3 - this->side_size);
}



----------------------------------------

// Function: get_cam_position_y @ 08904990

/* DWARF original prototype: float get_cam_position_y(plane * this, int value) */

float __thiscall plane::get_cam_position_y(plane *this,int value)

{
  if (this->dead_axis == 1) {
    return (float)(value * 3 - this->side_size);
  }
  if (this->dead_axis != 2) {
    return (float)(value * 3 - this->side_size);
  }
  return (float)(value + this->side_size * this->axis_polarity);
}



----------------------------------------

// Function: get_cam_position_z @ 089049fc

/* DWARF original prototype: float get_cam_position_z(plane * this, int value) */

float __thiscall plane::get_cam_position_z(plane *this,int value)

{
  if (this->dead_axis == 1) {
    return (float)(value * 3 - this->side_size);
  }
  if (this->dead_axis != 2) {
    return (float)(this->side_size * this->axis_polarity + value);
  }
  return (float)(value * 3 - this->side_size);
}



----------------------------------------

// Function: find_piece_index @ 08904a68

/* DWARF original prototype: int find_piece_index(plane * this, float x, float y, float z) */

int __thiscall plane::find_piece_index(plane *this,float x,float y,float z)

{
  float in_f12;
  float in_f13;
  float in_f14;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int index@[???] */
  if (this->dead_axis == 1) {
    return *(int *)((int)this +
                   (((int)in_f13 - this->i) * 0x14 + ((int)in_f14 - this->j)) * 4 + 0x1970);
  }
  if (this->dead_axis == 2) {
    return *(int *)((int)this +
                   (((int)in_f12 - this->i) * 0x14 + ((int)in_f14 - this->j)) * 4 + 0x1970);
  }
  return *(int *)((int)this +
                 (((int)in_f12 - this->i) * 0x14 + ((int)in_f13 - this->j)) * 4 + 0x1970);
}



----------------------------------------

// Function: has_piece @ 08904b4c

/* DWARF original prototype: bool has_piece(plane * this, float x, float y, float z) */

bool __thiscall plane::has_piece(plane *this,float x,float y,float z)

{
  int iVar1;
  piece *ppVar2;
  int iVar3;
  float in_f12;
  float in_f13;
  float in_f14;
  
                    /* Unresolved local var: bool has@[???]
                       Unresolved local var: int i@[DW_OP_reg5(a1)] */
  iVar1 = this->side_size * this->side_size;
  iVar3 = 0;
  if (0 < iVar1) {
    ppVar2 = this->pieces[0];
    while( true ) {
      iVar3 = iVar3 + 1;
      if (((ppVar2->x == in_f12) && (ppVar2->y == in_f13)) && (ppVar2->z == in_f14)) {
        return true;
      }
      if (iVar3 == iVar1) break;
      ppVar2 = this->pieces[1];
      this = (plane *)&this->i;
    }
  }
  return false;
}



----------------------------------------

// Function: longest_way @ 08904bbc

/* DWARF original prototype: int longest_way(plane * this, int x, int y, int z, int right_advance,
   int left_advance) */

int __thiscall plane::longest_way(plane *this,int x,int y,int z,int right_advance,int left_advance)

{
  bool bVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  int iVar4;
  undefined3 extraout_var_02;
  undefined4 in_t0;
  undefined4 in_t1;
  int iVar5;
  
                    /* Unresolved local var: bool obstacle@[???]
                       Unresolved local var: int right_distance@[???]
                       Unresolved local var: int left_distance@[???]
                       Unresolved local var: int right_x@[???]
                       Unresolved local var: int right_y@[???]
                       Unresolved local var: int right_z@[???]
                       Unresolved local var: int left_x@[???]
                       Unresolved local var: int left_y@[???]
                       Unresolved local var: int left_z@[???]
                       Unresolved local var: int index@[???] */
  iVar5 = 0;
switchD_08904d94_caseD_0:
  do {
    bVar1 = false;
    bVar2 = has_piece(this,(float)x,(float)y,(float)z);
    iVar3 = CONCAT31(extraout_var,bVar2);
    while( true ) {
      if ((iVar3 == 0) || (bVar1)) {
        iVar3 = 0;
        goto switchD_08904d6c_caseD_0;
      }
      iVar3 = find_piece_index(this,(float)x,(float)y,(float)z);
      if (this->pieces[iVar3]->state == false) break;
      bVar1 = true;
      bVar2 = has_piece(this,(float)x,(float)y,(float)z);
      iVar3 = CONCAT31(extraout_var_00,bVar2);
    }
    iVar5 = iVar5 + 1;
    switch(in_t0) {
    default:
      goto switchD_08904d94_caseD_0;
    case 1:
      break;
    case 2:
      break;
    case 3:
      break;
    case 0xfffffffd:
      break;
    case 0xfffffffe:
      break;
    case 0xffffffff:
    }
  } while( true );
LAB_08904ca0:
  bVar1 = false;
  bVar2 = has_piece(this,(float)x,(float)y,(float)z);
  iVar4 = CONCAT31(extraout_var_01,bVar2);
  while( true ) {
    if ((iVar4 == 0) || (bVar1)) {
      if (iVar5 == iVar3) {
        return 2;
      }
      return iVar5 < iVar3 ^ 1;
    }
    iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
    if (this->pieces[iVar4]->state == false) break;
    bVar1 = true;
    bVar2 = has_piece(this,(float)x,(float)y,(float)z);
    iVar4 = CONCAT31(extraout_var_02,bVar2);
  }
  iVar3 = iVar3 + 1;
  switch(in_t1) {
  default:
switchD_08904d6c_caseD_0:
    break;
  case 1:
    break;
  case 2:
    break;
  case 3:
    break;
  case 0xfffffffd:
    break;
  case 0xfffffffe:
    break;
  case 0xffffffff:
  }
  goto LAB_08904ca0;
}



----------------------------------------

// Function: available_ways @ 08904ef8

/* DWARF original prototype: int available_ways(plane * this, int x, int y, int z, int advance) */

int __thiscall plane::available_ways(plane *this,int x,int y,int z,int advance)

{
  bool bVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  int in_t0;
  int iVar8;
  int iVar9;
  int in_stack_00000014;
  
                    /* Unresolved local var: bool canGoRight@[???]
                       Unresolved local var: bool canGoLeft@[???]
                       Unresolved local var: int index_left@[???]
                       Unresolved local var: int index_right@[???]
                       Unresolved local var: int right_advance@[???]
                       Unresolved local var: int left_advance@[???] */
  iVar4 = this->dead_axis;
  if (iVar4 == 2) {
    if (in_t0 == -1) {
      if (this->face_number == 5) {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = -3;
        iVar9 = 3;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
      else {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = 3;
        iVar9 = -3;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
    }
    else if (in_t0 < 0) {
      if (in_t0 == -3) {
        if (this->face_number == 5) {
          fVar5 = (float)x;
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 1;
          iVar9 = -1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar5 = (float)x;
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -1;
          iVar9 = 1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else {
LAB_08904f48:
        iVar3 = 0;
        iVar4 = 0;
        iVar8 = 0;
        iVar9 = 0;
      }
    }
    else if (in_t0 == 1) {
      if (this->face_number == 5) {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = 3;
        iVar9 = -3;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
      else {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = -3;
        iVar9 = 3;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
    }
    else {
      if (in_t0 != 3) goto LAB_08904f48;
      if (this->face_number == 5) {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = -1;
        iVar9 = 1;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
      else {
        fVar5 = (float)x;
        fVar6 = (float)y;
        fVar7 = (float)z;
        iVar4 = find_piece_index(this,(float)x,(float)y,(float)z);
        iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
        iVar8 = 1;
        iVar9 = -1;
        if (iVar4 < 0) {
          bVar1 = false;
          goto LAB_08904f70;
        }
      }
    }
  }
  else {
    fVar5 = 4.2039e-45;
    if (iVar4 == 3) {
      if (in_t0 == -1) {
        if (this->face_number == 4) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -2;
          iVar9 = 2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 2;
          iVar9 = -2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else if (in_t0 < 0) {
        if (in_t0 != -2) goto LAB_08904f48;
        if (this->face_number == 4) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 1;
          iVar9 = -1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -1;
          iVar9 = 1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else if (in_t0 == 1) {
        if (this->face_number == 4) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 2;
          iVar9 = -2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -2;
          iVar9 = 2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else {
        if (in_t0 != 2) goto LAB_08904f48;
        if (this->face_number == 4) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -1;
          iVar9 = 1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 1;
          iVar9 = -1;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
    }
    else {
      if (iVar4 != 1) goto LAB_08904f48;
      if (in_t0 == -2) {
        if (this->face_number == 6) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -3;
          iVar9 = 3;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 3;
          iVar9 = -3;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else if (in_t0 < -1) {
        if (in_t0 != -3) goto LAB_08904f48;
        if (this->face_number == 6) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 2;
          iVar9 = -2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -2;
          iVar9 = 2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else if (in_t0 == 2) {
        if (this->face_number == 6) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 3;
          iVar9 = -3;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -3;
          iVar9 = 3;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
      else {
        if (in_t0 != 3) goto LAB_08904f48;
        if (this->face_number == 6) {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = -2;
          iVar9 = 2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
        else {
          fVar6 = (float)y;
          fVar7 = (float)z;
          iVar4 = find_piece_index(this,4.2039e-45,(float)y,(float)z);
          iVar3 = find_piece_index(this,fVar5,fVar6,fVar7);
          iVar8 = 2;
          iVar9 = -2;
          if (iVar4 < 0) {
            bVar1 = false;
            goto LAB_08904f70;
          }
        }
      }
    }
  }
  if (this->side_size * this->side_size < iVar4) {
    bVar1 = false;
  }
  else {
    bVar1 = this->pieces[iVar4]->state == false;
  }
LAB_08904f70:
  bVar2 = false;
  if (-1 < iVar3) {
    if (this->side_size * this->side_size < iVar3) {
      bVar2 = false;
    }
    else {
      bVar2 = this->pieces[iVar3]->state == false;
    }
  }
  iVar4 = -1;
  if (bVar1) {
    iVar4 = 1;
    if (bVar2) {
      if ((iVar8 != 0) && (iVar9 != 0)) {
        iVar4 = longest_way(this,x,y,z,advance,in_stack_00000014);
        return iVar4;
      }
      return 2;
    }
  }
  else if (bVar2) {
    iVar4 = 0;
  }
  return iVar4;
}



----------------------------------------

// Function: print @ 08905b7c

/* DWARF original prototype: int print(plane * this, bool low_quality) */

int __thiscall plane::print(plane *this,bool low_quality)

{
  piece *this_00;
  int iVar1;
  plane *ppVar2;
  plane *ppVar3;
  int iVar4;
  int iVar5;
  
                    /* Unresolved local var: int prints@[???] */
                    /* Unresolved local var: int i@[???] */
  iVar1 = this->side_size;
  if (iVar1 * iVar1 < 1) {
    return 0;
  }
  iVar5 = 0;
  iVar4 = 0;
  ppVar2 = this;
  do {
    this_00 = ppVar2->pieces[0];
    ppVar3 = ppVar2;
    while( true ) {
      iVar4 = iVar4 + 1;
      ppVar2 = (plane *)&ppVar3->i;
      if (this_00 == (piece *)0x0) break;
      if (this_00->state == false) {
        if (this_00->status != 2) break;
        iVar1 = this->dead_axis;
      }
      else {
        iVar1 = this->dead_axis;
      }
      iVar5 = iVar5 + 1;
      piece::print(this_00,iVar1,low_quality);
      iVar1 = this->side_size;
      if (iVar1 * iVar1 <= iVar4) {
        return iVar5;
      }
      this_00 = ppVar3->pieces[1];
      ppVar3 = ppVar2;
    }
    if (iVar1 * iVar1 <= iVar4) {
      return iVar5;
    }
  } while( true );
}



----------------------------------------

// Function: generate_positions @ 08905c80

/* WARNING: Removing unreachable block (ram,0x08905cd4) */
/* DWARF original prototype: void generate_positions(plane * this, int offset_x, int offset_y, int
   offset_z, int cam_distance) */

void __thiscall
plane::generate_positions(plane *this,int offset_x,int offset_y,int offset_z,int cam_distance)

{
  GLfloat GVar1;
  piece *ppVar2;
  glinterface *pgVar3;
  int iVar4;
  int in_t0;
  int (*paiVar5) [3];
  int iVar6;
  int iVar7;
  piece **pppVar8;
  int iVar9;
  int (*paiVar10) [20];
  float fVar11;
  float fVar12;
  float fVar13;
  int (*local_48) [3];
  int local_44;
  int local_40;
  
                    /* Unresolved local var: int count@[???]
                       Unresolved local var: int inc_i@[???]
                       Unresolved local var: int inc_j@[???] */
                    /* Unresolved local var: int i@[???] */
  if (this->side_size < 1) {
    return;
  }
                    /* Unresolved local var: int j@[???] */
  iVar9 = 0;
  local_40 = 0;
  iVar6 = 0;
LAB_08905cf0:
  pppVar8 = this->pieces + iVar9;
  local_44 = 0;
  iVar7 = 0;
  paiVar5 = this->cam_positions + iVar9;
  paiVar10 = this->index + iVar6;
  local_48 = paiVar5;
  do {
    ppVar2 = operator_new(0x50);
    GVar1 = DAT_089dc360;
    ppVar2->ident = -1;
    ppVar2->size = GVar1;
    ppVar2->material[2] = 0xff;
    ppVar2->temporal = true;
    ppVar2->material[0] = 0xff;
    ppVar2->material[1] = 0xff;
    ppVar2->material[3] = 200;
    ppVar2->state = false;
    ppVar2->type = 0;
    *(undefined4 *)&ppVar2->prints_counter = 0;
    *(undefined4 *)((int)&ppVar2->prints_counter + 4) = 0;
    pgVar3 = operator_new(1);
    ppVar2->owner = -2;
    ppVar2->status = 0;
    ppVar2->ident = iVar9;
    fVar11 = DAT_089dc364;
    iVar4 = this->dead_axis;
    ppVar2->printer = pgVar3;
    ppVar2->effect_size = ppVar2->size;
    ppVar2->effect_alpha = fVar11;
    *pppVar8 = ppVar2;
    if (iVar4 == 1) {
      fVar13 = (float)(iVar6 + offset_y + this->i);
      fVar11 = (float)(iVar7 + offset_z + this->j);
      fVar12 = (float)(offset_x + this->dead_offset);
      (*local_48)[0] = (int)fVar12 + in_t0 * this->axis_polarity;
      ppVar2->z = fVar11;
      (*paiVar5)[1] = (local_40 + (int)fVar13) - in_t0;
      (*paiVar5)[2] = (local_44 + (int)fVar11) - in_t0;
      ppVar2->x = fVar12;
      ppVar2->y = fVar13;
    }
    else if (iVar4 == 2) {
      iVar4 = this->axis_polarity;
      fVar13 = (float)(iVar6 + offset_x + this->i);
      fVar11 = (float)(iVar7 + offset_z + this->j);
      fVar12 = (float)(offset_y + this->dead_offset);
      (*local_48)[0] = (local_40 + (int)fVar13) - in_t0;
      ppVar2->z = fVar11;
      (*paiVar5)[1] = (int)fVar12 + in_t0 * iVar4;
      (*paiVar5)[2] = (local_44 + (int)fVar11) - in_t0;
      ppVar2->x = fVar13;
      ppVar2->y = fVar12;
    }
    else {
      iVar4 = this->axis_polarity;
      fVar12 = (float)(iVar6 + offset_x + this->i);
      fVar13 = (float)(offset_y + this->j + iVar7);
      fVar11 = (float)(offset_z + this->dead_offset);
      (*local_48)[0] = (local_40 + (int)fVar12) - in_t0;
      ppVar2->z = fVar11;
      (*paiVar5)[1] = ((int)fVar13 + local_44) - in_t0;
      (*paiVar5)[2] = (int)fVar11 + in_t0 * iVar4;
      ppVar2->x = fVar12;
      ppVar2->y = fVar13;
    }
    ppVar2 = *pppVar8;
    iVar4 = this->max_vertex[0];
    (*paiVar10)[0] = iVar9;
    if (iVar4 < (int)ppVar2->x) {
      this->max_vertex[0] = (int)ppVar2->x;
    }
    if (this->max_vertex[1] < (int)ppVar2->y) {
      this->max_vertex[1] = (int)ppVar2->y;
    }
    if (this->max_vertex[2] < (int)ppVar2->z) {
      this->max_vertex[2] = (int)ppVar2->z;
    }
    if (iVar6 == 0) {
      if (iVar7 == 0) {
        fVar11 = ppVar2->y;
        fVar12 = ppVar2->z;
        this->a_vertex[0] = (int)ppVar2->x;
        this->a_vertex[1] = (int)fVar11;
        this->a_vertex[2] = (int)fVar12;
        iVar4 = this->side_size;
      }
      else {
        iVar4 = this->side_size;
      }
      if (iVar4 + -1 == iVar7) {
        fVar11 = ppVar2->y;
        fVar12 = ppVar2->z;
        this->b_vertex[0] = (int)ppVar2->x;
        this->b_vertex[1] = (int)fVar11;
        this->b_vertex[2] = (int)fVar12;
      }
      if (iVar4 == 1) goto LAB_08905fdc;
    }
    else {
      iVar4 = this->side_size;
      if (iVar6 == iVar4 + -1) {
LAB_08905fdc:
        if (iVar7 == 0) {
          fVar11 = ppVar2->y;
          fVar12 = ppVar2->z;
          this->c_vertex[0] = (int)ppVar2->x;
          this->c_vertex[1] = (int)fVar11;
          this->c_vertex[2] = (int)fVar12;
        }
        if (iVar6 == iVar7) {
          fVar11 = ppVar2->z;
          fVar12 = ppVar2->y;
          this->d_vertex[0] = (int)ppVar2->x;
          this->d_vertex[1] = (int)fVar12;
          this->d_vertex[2] = (int)fVar11;
        }
      }
    }
    iVar7 = iVar7 + 1;
    local_48 = local_48 + 1;
    iVar9 = iVar9 + 1;
    pppVar8 = pppVar8 + 1;
    paiVar10 = (int (*) [20])(*paiVar10 + 1);
    paiVar5 = paiVar5 + 1;
    if (iVar4 <= iVar7) break;
    local_44 = local_44 + in_t0 / 10;
  } while( true );
  do {
    iVar6 = iVar6 + 1;
    if (iVar4 <= iVar6) {
      return;
    }
    local_40 = local_40 + in_t0 / 10;
  } while (iVar4 < 1);
  goto LAB_08905cf0;
}



----------------------------------------

// Function: set_coordinates @ 089061a0

/* DWARF original prototype: void set_coordinates(camera * this, GLfloat x, GLfloat y, GLfloat z,
   GLfloat x_dir, GLfloat y_dir, GLfloat z_dir) */

void __thiscall
camera::set_coordinates
          (camera *this,GLfloat x,GLfloat y,GLfloat z,GLfloat x_dir,GLfloat y_dir,GLfloat z_dir)

{
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  GLfloat in_f15;
  GLfloat in_f16;
  GLfloat in_f17;
  
  this->z_dir = in_f17;
  this->last_x = this->x;
  this->last_y = this->y;
  this->last_z = this->z;
  this->x = in_f12;
  this->y = in_f13;
  this->z = in_f14;
  this->x_dir = in_f15;
  this->y_dir = in_f16;
  return;
}



----------------------------------------

// Function: update_pos @ 089061d4

/* DWARF original prototype: void update_pos(camera * this, int cam_x, int cam_y, int cam_z, GLfloat
   x, GLfloat y, GLfloat z) */

void __thiscall
camera::update_pos(camera *this,int cam_x,int cam_y,int cam_z,GLfloat x,GLfloat y,GLfloat z)

{
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  
  this->z_dir = in_f14;
  this->last_x = this->x;
  this->last_y = this->y;
  this->last_z = this->z;
  this->x = (float)cam_x;
  this->y = (float)cam_y;
  this->z = (float)cam_z;
  this->x_dir = in_f12;
  this->y_dir = in_f13;
  return;
}



----------------------------------------

// Function: restart @ 08906220

/* DWARF original prototype: void restart(camera * this) */

void __thiscall camera::restart(camera *this)

{
  GLfloat GVar1;
  
  GVar1 = DAT_089dbce4;
  this->z_ori = 0.0;
  this->x = 0.0;
  this->y_ori = GVar1;
  this->y = 0.0;
  this->z = 0.0;
  this->x_dir = 0.0;
  this->y_dir = 0.0;
  this->z_dir = 0.0;
  this->x_ori = 0.0;
  return;
}



----------------------------------------

// Function: locate @ 08906250

/* DWARF original prototype: void locate(camera * this) */

void __thiscall camera::locate(camera *this)

{
  GLfloat in_a1;
  GLfloat in_a2;
  GLfloat in_a3;
  GLfloat in_stack_00000000;
  GLfloat in_stack_00000004;
  GLfloat in_stack_00000008;
  GLfloat in_stack_0000000c;
  GLfloat in_stack_00000010;
  GLfloat in_stack_00000014;
  
  glinterface::lookat(this->locator,in_a1,in_a2,in_a3,in_stack_00000000,in_stack_00000004,
                      in_stack_00000008,in_stack_0000000c,in_stack_00000010,in_stack_00000014);
  return;
}



----------------------------------------

// Function: change_color @ 08906298

/* DWARF original prototype: void change_color(player * this, int user_color) */

void __thiscall player::change_color(player *this,int user_color)

{
  if (user_color == 0) {
    (this->super_ship).material[3] = 200;
    (this->super_ship).material[1] = 100;
    (this->super_ship).material[2] = 0xf;
    (this->super_ship).material[0] = 0;
    return;
  }
  if (user_color != 1) {
    (this->super_ship).material[3] = 200;
    (this->super_ship).material[1] = 0x46;
    (this->super_ship).material[2] = 0x96;
    (this->super_ship).material[0] = 0;
    return;
  }
  (this->super_ship).material[3] = 200;
  (this->super_ship).material[1] = 10;
  (this->super_ship).material[2] = 100;
  (this->super_ship).material[0] = 100;
  return;
}



----------------------------------------

// Function: restart @ 08906304

/* DWARF original prototype: void restart(player * this) */

void __thiscall player::restart(player *this)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
  iVar2 = this->start_x;
  iVar3 = this->start_y;
  iVar4 = this->start_z;
  iVar1 = (this->super_ship).material[3];
  (this->super_ship).step_speed = 1;
  (this->super_ship).x_predict = (float)iVar2;
  (this->super_ship).y_predict = (float)iVar3;
  (this->super_ship).z_predict = (float)iVar4;
  (this->super_ship).effect_size = (this->super_ship).size;
  (this->super_ship).effect_alpha = iVar1;
  (this->super_ship).x = (float)iVar2;
  (this->super_ship).y = (float)iVar3;
  (this->super_ship).z = (float)iVar4;
  (this->super_ship).cue_counter = 0;
  (this->super_ship).status = 1;
  (this->super_ship).step_counter = 0;
  return;
}



----------------------------------------

// Function: restart @ 0890635c

/* DWARF original prototype: void restart(enemy * this) */

void __thiscall enemy::restart(enemy *this)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  GLfloat GVar5;
  
  iVar2 = this->start_x;
  iVar3 = this->start_y;
  iVar4 = this->start_z;
  GVar5 = (this->super_ship).size;
  iVar1 = (this->super_ship).material[3];
  this->active = true;
  (this->super_ship).x_predict = (float)iVar2;
  (this->super_ship).y_predict = (float)iVar3;
  (this->super_ship).z_predict = (float)iVar4;
  (this->super_ship).effect_size = GVar5;
  (this->super_ship).effect_alpha = iVar1;
  (this->super_ship).x = (float)iVar2;
  (this->super_ship).y = (float)iVar3;
  (this->super_ship).z = (float)iVar4;
  (this->super_ship).cue_counter = 0;
  (this->super_ship).status = 0;
  (this->super_ship).step_counter = 0;
  (this->super_ship).step_speed = 1;
  return;
}



----------------------------------------

// Function: predict @ 089063b8

/* DWARF original prototype: void predict(enemy * this, plane * * map) */

void __thiscall enemy::predict(enemy *this,plane **map)

{
  float fVar1;
  float fVar2;
  float fVar3;
  
  fVar3 = (this->super_ship).x;
  fVar2 = (this->super_ship).y;
  fVar1 = (this->super_ship).z;
  (this->super_ship).x_predict = fVar3;
  (this->super_ship).y_predict = fVar2;
  (this->super_ship).z_predict = fVar1;
  switch((this->super_ship).advance) {
  case 1:
    if (fVar3 < (((float)map[(this->super_ship).actual_plane]->side_size +
                 map[(this->super_ship).actual_plane]->pieces[0]->x) - DAT_089dbce4) - DAT_089dbce4)
    {
      (this->super_ship).x_predict = fVar3 + DAT_089dbce4;
      return;
    }
    break;
  case 2:
    if (fVar2 < (((float)map[(this->super_ship).actual_plane]->side_size +
                 map[(this->super_ship).actual_plane]->pieces[0]->y) - DAT_089dbce4) - DAT_089dbce4)
    {
      (this->super_ship).y_predict = fVar2 + DAT_089dbce4;
      return;
    }
    break;
  case 3:
    if (fVar1 < (((float)map[(this->super_ship).actual_plane]->side_size +
                 map[(this->super_ship).actual_plane]->pieces[0]->z) - DAT_089dbce4) - DAT_089dbce4)
    {
      (this->super_ship).z_predict = fVar1 + DAT_089dbce4;
    }
    break;
  case -3:
    if (map[(this->super_ship).actual_plane]->pieces[0]->z < fVar1) {
      (this->super_ship).z_predict = fVar1 - DAT_089dbce4;
      return;
    }
    break;
  case -2:
    if (map[(this->super_ship).actual_plane]->pieces[0]->y < fVar2) {
      (this->super_ship).y_predict = fVar2 - DAT_089dbce4;
      return;
    }
    break;
  case -1:
    if (map[(this->super_ship).actual_plane]->pieces[0]->x < fVar3) {
      (this->super_ship).x_predict = fVar3 - DAT_089dbce4;
      return;
    }
  }
  return;
}



----------------------------------------

// Function: tell_me_the_cost @ 0890659c

/* DWARF original prototype: int tell_me_the_cost(ship * this, float x, float y, float z, plane * *
   map, int n_planes, int plane_src, int plane_dest, int cost) */

int __thiscall
ship::tell_me_the_cost
          (ship *this,float x,float y,float z,plane **map,int n_planes,int plane_src,int plane_dest,
          int cost)

{
  int iVar1;
  float in_t0;
  int in_t1;
  float z_00;
  int iVar2;
  plane **unaff_s0;
  int unaff_s1;
  int unaff_s2;
  int unaff_s3;
  int *piVar3;
  int unaff_s4;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  
                    /* Unresolved local var: int[4] costs@[???]
                       Unresolved local var: int min@[???] */
  if (z != in_t0) {
    piVar3 = (int *)((int)x + (int)z * 4);
    iVar2 = *piVar3;
    local_34 = in_t1 + 1;
    z_00 = *(float *)(iVar2 + 0x20);
    if (in_t0 == z_00) {
      *(undefined1 *)(iVar2 + 0x30) = 0;
    }
    else if (in_t0 == *(float *)(iVar2 + 0x24)) {
      *(undefined1 *)(iVar2 + 0x30) = 0;
    }
    else if (in_t0 == *(float *)(iVar2 + 0x2c)) {
      *(undefined1 *)(iVar2 + 0x30) = 0;
    }
    else {
      if (in_t0 != *(float *)(iVar2 + 0x28)) {
        iVar1 = *(int *)((int)z_00 * 4 + (int)x);
        *(undefined1 *)(iVar2 + 0x30) = 1;
        if (*(char *)(iVar1 + 0x30) == '\0') {
          local_40 = tell_me_the_cost(this,x,y,z_00,unaff_s0,unaff_s1,unaff_s2,unaff_s3,unaff_s4);
          iVar2 = *piVar3;
        }
        else {
          local_40 = 0x5a;
        }
        if (*(char *)(*(int *)((int)*(float *)(iVar2 + 0x24) * 4 + (int)x) + 0x30) == '\0') {
          local_3c = tell_me_the_cost(this,x,y,*(float *)(iVar2 + 0x24),unaff_s0,unaff_s1,unaff_s2,
                                      unaff_s3,unaff_s4);
          iVar2 = *piVar3;
        }
        else {
          local_3c = 0x5a;
        }
        if (*(char *)(*(int *)((int)*(float *)(iVar2 + 0x2c) * 4 + (int)x) + 0x30) == '\0') {
          local_38 = tell_me_the_cost(this,x,y,*(float *)(iVar2 + 0x2c),unaff_s0,unaff_s1,unaff_s2,
                                      unaff_s3,unaff_s4);
          iVar2 = *piVar3;
        }
        else {
          local_38 = 0x5a;
        }
        if (*(char *)(*(int *)((int)*(float *)(iVar2 + 0x28) * 4 + (int)x) + 0x30) == '\0') {
          local_34 = tell_me_the_cost(this,x,y,*(float *)(iVar2 + 0x28),unaff_s0,unaff_s1,unaff_s2,
                                      unaff_s3,unaff_s4);
          iVar2 = *piVar3;
        }
        else {
          local_34 = 0x5a;
        }
        local_34 = local_40 + local_3c + local_38 + local_34;
      }
      *(undefined1 *)(iVar2 + 0x30) = 0;
    }
    return local_34;
  }
  *(undefined1 *)(*(int *)((int)z * 4 + (int)x) + 0x30) = 0;
  return in_t1;
}



----------------------------------------

// Function: set_position @ 08906814

/* DWARF original prototype: void set_position(ship * this, GLfloat x, GLfloat y, GLfloat z) */

void __thiscall ship::set_position(ship *this,GLfloat x,GLfloat y,GLfloat z)

{
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  
  this->z = in_f14;
  this->x = in_f12;
  this->y = in_f13;
  return;
}



----------------------------------------

// Function: arrange_direction_to @ 08906824

/* DWARF original prototype: void arrange_direction_to(ship * this, int face_forward) */

void __thiscall ship::arrange_direction_to(ship *this,int face_forward)

{
  int iVar1;
  
  switch(this->actual_face) {
  default:
    goto switchD_08906848_caseD_0;
  case 1:
  case 4:
    if (face_forward == 3) {
LAB_08906920:
      this->previous_face = 6;
      return;
    }
    if (face_forward < 4) {
      if (face_forward != 2) {
        return;
      }
      goto LAB_089068a0;
    }
    if (face_forward == 5) {
      this->previous_face = 2;
      return;
    }
    break;
  case 2:
  case 5:
    if (face_forward == 3) goto LAB_08906920;
    if (face_forward < 4) goto LAB_08906910;
    if (face_forward == 4) goto LAB_08906944;
    break;
  case 3:
    iVar1 = 2;
    if (face_forward == 2) {
LAB_089068a0:
      this->previous_face = 5;
      return;
    }
    if (2 < face_forward) {
      if (face_forward == 4) goto LAB_08906944;
      if (face_forward != 5) {
        return;
      }
      goto LAB_08906908;
    }
    goto LAB_08906910;
  case 6:
    if (face_forward == 2) goto LAB_089068a0;
    if (2 < face_forward) {
      if (face_forward != 4) {
        if (face_forward != 5) {
          return;
        }
        this->previous_face = 2;
        return;
      }
LAB_08906944:
      this->previous_face = 1;
      return;
    }
LAB_08906910:
    if (face_forward == 1) {
      this->previous_face = 4;
      return;
    }
switchD_08906848_caseD_0:
    return;
  }
  iVar1 = 3;
  if (face_forward != 6) {
    return;
  }
LAB_08906908:
  this->previous_face = iVar1;
  return;
}



----------------------------------------

// Function: change_direction @ 08906950

/* DWARF original prototype: void change_direction(ship * this, int turn) */

void __thiscall ship::change_direction(ship *this,int turn)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  if (turn != 0) {
    switch(this->actual_face) {
    default:
      goto switchD_089069a8_caseD_0;
    case 1:
      goto switchD_089069a8_caseD_4;
    case 2:
      goto switchD_089069a8_caseD_5;
    case 3:
      goto switchD_089069a8_caseD_6;
    case 4:
      goto switchD_089069a8_caseD_1;
    case 5:
      goto switchD_089069a8_caseD_2;
    case 6:
      iVar1 = this->previous_face;
      iVar2 = 2;
      if (iVar1 == 2) goto LAB_08906b74;
      if (2 < iVar1) {
        if (iVar1 != 4) {
          if (iVar1 != 5) {
            return;
          }
          this->previous_face = 1;
          return;
        }
        goto LAB_08906b58;
      }
      goto LAB_08906ab0;
    }
  }
  switch(this->actual_face) {
  default:
switchD_089069a8_caseD_0:
    return;
  case 1:
    goto switchD_089069a8_caseD_1;
  case 2:
switchD_089069a8_caseD_2:
    iVar1 = this->previous_face;
    iVar2 = 3;
    if (iVar1 == 3) {
LAB_08906b24:
      this->previous_face = 1;
      return;
    }
    if (iVar1 < 4) {
      if (iVar1 != 1) {
        return;
      }
      goto LAB_08906b48;
    }
    iVar3 = 4;
    if (iVar1 == 4) goto LAB_08906b34;
    break;
  case 3:
    iVar1 = this->previous_face;
    iVar2 = 2;
    if (iVar1 == 2) goto LAB_08906b74;
    if (2 < iVar1) {
      if (iVar1 == 4) goto LAB_08906b58;
      if (iVar1 != 5) {
        return;
      }
      goto LAB_08906b24;
    }
    goto LAB_08906ab0;
  case 4:
switchD_089069a8_caseD_4:
    iVar1 = this->previous_face;
    if (iVar1 == 3) goto LAB_08906a70;
    if (iVar1 < 4) {
      if (iVar1 != 2) {
        return;
      }
      goto LAB_08906b48;
    }
    iVar3 = 5;
    if (iVar1 == 5) {
      this->previous_face = 3;
      return;
    }
    break;
  case 5:
switchD_089069a8_caseD_5:
    iVar1 = this->previous_face;
    iVar2 = 3;
    if (iVar1 == 3) {
LAB_08906b74:
      this->previous_face = 4;
      return;
    }
    if (3 < iVar1) {
      if (iVar1 != 4) {
        if (iVar1 != 6) {
          return;
        }
        goto LAB_08906b24;
      }
      goto LAB_08906b48;
    }
LAB_08906ab0:
    if (iVar1 != 1) {
      return;
    }
LAB_08906b34:
    this->previous_face = iVar2;
    return;
  case 6:
switchD_089069a8_caseD_6:
    iVar1 = this->previous_face;
    iVar2 = 2;
    if (iVar1 == 2) goto LAB_08906b24;
    if (iVar1 < 3) {
      if (iVar1 != 1) {
        return;
      }
      goto LAB_08906b58;
    }
    iVar3 = 4;
    if (iVar1 != 4) {
      if (iVar1 != 5) {
        return;
      }
      goto LAB_08906aa8;
    }
    goto LAB_08906b34;
  }
  if (iVar1 != 6) {
    return;
  }
LAB_08906aa8:
  this->previous_face = iVar3;
  return;
switchD_089069a8_caseD_1:
  iVar1 = this->previous_face;
  iVar2 = 3;
  if (iVar1 == 3) {
LAB_08906b58:
    this->previous_face = 5;
    return;
  }
  if (3 < iVar1) {
    if (iVar1 != 5) {
      if (iVar1 != 6) {
        return;
      }
LAB_08906a70:
      this->previous_face = 2;
      return;
    }
LAB_08906b48:
    this->previous_face = 6;
    return;
  }
  if (iVar1 != 2) {
    return;
  }
  goto LAB_08906b34;
}



----------------------------------------

// Function: do_step @ 08906b84

/* DWARF original prototype: void do_step(ship * this, plane * * map) */

void __thiscall ship::do_step(ship *this,plane **map)

{
  int iVar1;
  plane *ppVar2;
  plane *ppVar3;
  int iVar4;
  float fVar5;
  float fVar6;
  GLfloat GVar7;
  float fVar8;
  float fVar9;
  
  iVar4 = this->actual_plane;
  this->last_plane = iVar4;
  this->last_advance = this->advance;
  fVar9 = DAT_089dbce4;
  switch(this->actual_face) {
  default:
    goto switchD_08906bb8_caseD_0;
  case 1:
  case 4:
    iVar1 = this->previous_face;
    if (iVar1 == 3) {
      fVar9 = this->x;
      if (fVar9 != map[iVar4]->pieces[0]->x) {
LAB_089072b4:
        fVar8 = DAT_089dbce4;
        this->advance = -1;
        this->x = fVar9 - fVar8;
        return;
      }
      iVar4 = map[iVar4]->id_union_left;
      fVar6 = this->z;
      ppVar3 = map[iVar4];
      this->actual_plane = iVar4;
      fVar8 = ppVar3->pieces[ppVar3->side_size + 1]->z;
      if (fVar6 < fVar8) {
LAB_08907420:
        fVar9 = DAT_089dbce4;
        this->previous_face = 4;
        this->advance = 3;
        iVar4 = ppVar3->face_number;
        this->z = fVar6 + fVar9;
        this->actual_face = iVar4;
        return;
      }
      if (fVar8 == fVar6) goto LAB_089072b4;
LAB_089070e0:
      fVar9 = DAT_089dbce4;
      this->previous_face = 1;
      GVar7 = fVar6 - fVar9;
    }
    else {
      if (iVar1 < 4) {
        if (iVar1 != 2) {
          return;
        }
        ppVar2 = map[iVar4];
        fVar8 = this->y;
        iVar1 = 2;
        if (fVar8 != ((float)ppVar2->side_size + ppVar2->pieces[0]->y) - DAT_089dbce4) {
          GVar7 = fVar8 + DAT_089dbce4;
          goto LAB_08906c8c;
        }
        fVar6 = this->z;
        ppVar3 = map[ppVar2->id_union_top];
        this->actual_plane = ppVar2->id_union_top;
        fVar5 = ppVar3->pieces[ppVar3->side_size + 1]->z;
        if (fVar6 < fVar5) {
LAB_089074a8:
          this->previous_face = 4;
          this->advance = 3;
          iVar4 = ppVar3->face_number;
          this->z = fVar6 + fVar9;
          this->actual_face = iVar4;
          return;
        }
        if (fVar5 == fVar6) {
          GVar7 = fVar8 + fVar9;
          goto LAB_08906c8c;
        }
      }
      else {
        if (iVar1 == 5) {
          fVar8 = this->y;
          if (fVar8 != map[iVar4]->pieces[0]->y) goto LAB_08907478;
          iVar4 = map[iVar4]->id_union_bottom;
          fVar6 = this->z;
          ppVar3 = map[iVar4];
          this->actual_plane = iVar4;
          fVar9 = ppVar3->pieces[ppVar3->side_size + 1]->z;
          if (fVar6 < fVar9) goto LAB_08907420;
          if (fVar9 == fVar6) goto LAB_08907478;
          goto LAB_089070e0;
        }
        if (iVar1 != 6) {
          return;
        }
        ppVar2 = map[iVar4];
        fVar8 = this->x;
        if (fVar8 != ((float)ppVar2->side_size + ppVar2->pieces[0]->x) - DAT_089dbce4) {
          GVar7 = fVar8 + DAT_089dbce4;
LAB_08907450:
          this->advance = 1;
          this->x = GVar7;
          return;
        }
        fVar6 = this->z;
        ppVar3 = map[ppVar2->id_union_right];
        this->actual_plane = ppVar2->id_union_right;
        fVar5 = ppVar3->pieces[ppVar3->side_size + 1]->z;
        if (fVar6 < fVar5) goto LAB_089074a8;
        if (fVar5 == fVar6) {
          GVar7 = fVar8 + fVar9;
          goto LAB_08907450;
        }
      }
      GVar7 = fVar6 - fVar9;
      this->previous_face = 1;
    }
    this->advance = -3;
    iVar4 = ppVar3->face_number;
    this->z = GVar7;
    this->actual_face = iVar4;
    return;
  case 2:
  case 5:
    iVar1 = this->previous_face;
    if (iVar1 == 3) {
      fVar9 = this->x;
      if (fVar9 != map[iVar4]->pieces[0]->x) goto LAB_089072b4;
      iVar4 = map[iVar4]->id_union_left;
      fVar6 = this->y;
      ppVar2 = map[iVar4];
      this->actual_plane = iVar4;
      fVar8 = ppVar2->pieces[ppVar2->side_size + 1]->y;
      if (fVar6 < fVar8) {
LAB_089073fc:
        fVar9 = DAT_089dbce4;
        this->advance = 2;
        this->previous_face = 2;
        iVar4 = ppVar2->face_number;
        this->y = fVar6 + fVar9;
        this->actual_face = iVar4;
        return;
      }
      if (fVar8 == fVar6) goto LAB_089072b4;
    }
    else {
      if (3 < iVar1) {
        if (iVar1 == 4) {
          ppVar3 = map[iVar4];
          if (this->z != ((float)ppVar3->side_size + ppVar3->pieces[0]->z) - DAT_089dbce4) {
LAB_08907180:
            this->advance = 3;
            this->z = this->z + fVar9;
            return;
          }
          fVar8 = this->y;
          ppVar2 = map[ppVar3->id_union_bottom];
          this->actual_plane = ppVar3->id_union_bottom;
          fVar6 = ppVar2->pieces[ppVar2->side_size + 1]->y;
          if (fVar8 < fVar6) goto LAB_0890748c;
          if (fVar6 == fVar8) goto LAB_08907180;
        }
        else {
          if (iVar1 != 6) {
            return;
          }
          ppVar3 = map[iVar4];
          fVar6 = this->x;
          if (fVar6 != ((float)ppVar3->side_size + ppVar3->pieces[0]->x) - DAT_089dbce4) {
            GVar7 = fVar6 + DAT_089dbce4;
            goto LAB_08907450;
          }
          fVar8 = this->y;
          ppVar2 = map[ppVar3->id_union_right];
          this->actual_plane = ppVar3->id_union_right;
          fVar5 = ppVar2->pieces[ppVar2->side_size + 1]->y;
          if (fVar8 < fVar5) {
LAB_0890748c:
            this->advance = 2;
            this->previous_face = 2;
            iVar4 = ppVar2->face_number;
            this->y = fVar8 + fVar9;
            this->actual_face = iVar4;
            return;
          }
          if (fVar5 == fVar8) {
            GVar7 = fVar6 + fVar9;
            goto LAB_08907450;
          }
        }
        GVar7 = fVar8 - fVar9;
        this->previous_face = 5;
        goto LAB_08906f90;
      }
      if (iVar1 != 1) {
        return;
      }
      fVar8 = this->z;
      if (fVar8 != map[iVar4]->pieces[0]->z) goto LAB_08907348;
      iVar4 = map[iVar4]->id_union_top;
      fVar6 = this->y;
      ppVar2 = map[iVar4];
      this->actual_plane = iVar4;
      fVar9 = ppVar2->pieces[ppVar2->side_size + 1]->y;
      if (fVar6 < fVar9) goto LAB_089073fc;
      if (fVar9 == fVar6) goto LAB_08907348;
    }
    fVar9 = DAT_089dbce4;
    this->previous_face = 5;
    GVar7 = fVar6 - fVar9;
LAB_08906f90:
    this->advance = -2;
    iVar4 = ppVar2->face_number;
    this->y = GVar7;
    this->actual_face = iVar4;
    return;
  case 3:
    iVar1 = this->previous_face;
    if (iVar1 != 2) {
      if (iVar1 < 3) {
LAB_08906e60:
        if (iVar1 != 1) {
switchD_08906bb8_caseD_0:
          return;
        }
        fVar8 = this->z;
        if (fVar8 != map[iVar4]->pieces[0]->z) {
LAB_08907348:
          fVar9 = DAT_089dbce4;
          this->advance = -3;
          this->z = fVar8 - fVar9;
          return;
        }
        iVar4 = map[iVar4]->id_union_left;
        fVar9 = this->x;
        ppVar3 = map[iVar4];
        this->actual_plane = iVar4;
        fVar6 = DAT_089dbce4;
        fVar5 = ppVar3->pieces[ppVar3->side_size + 1]->x;
        if (fVar9 < fVar5) {
          this->previous_face = 6;
          this->advance = 1;
          iVar4 = ppVar3->face_number;
          this->x = fVar9 + fVar6;
          this->actual_face = iVar4;
          return;
        }
        if (fVar5 == fVar9) goto LAB_08907348;
      }
      else {
        if (iVar1 == 4) goto LAB_0890735c;
        if (iVar1 != 5) {
          return;
        }
        fVar8 = this->y;
        if (fVar8 != map[iVar4]->pieces[0]->y) goto LAB_08907478;
        iVar4 = map[iVar4]->id_union_bottom;
        fVar9 = this->x;
        ppVar3 = map[iVar4];
        this->actual_plane = iVar4;
LAB_08906e14:
        fVar6 = DAT_089dbce4;
        fVar5 = ppVar3->pieces[ppVar3->side_size + 1]->x;
        if (fVar9 < fVar5) {
          this->previous_face = 6;
          GVar7 = fVar9 + fVar6;
          goto LAB_08906e48;
        }
        if (fVar5 == fVar9) {
LAB_08907478:
          fVar9 = DAT_089dbce4;
          this->advance = -2;
          this->y = fVar8 - fVar9;
          return;
        }
      }
      fVar8 = DAT_089dbce4;
      this->previous_face = 3;
      GVar7 = fVar9 - fVar8;
      goto LAB_08907224;
    }
LAB_0890718c:
    ppVar2 = map[iVar4];
    fVar8 = this->y;
    if (fVar8 != ((float)ppVar2->side_size + ppVar2->pieces[0]->y) - DAT_089dbce4) {
      GVar7 = fVar8 + DAT_089dbce4;
LAB_08906c8c:
      this->advance = iVar1;
      this->y = GVar7;
      return;
    }
    fVar6 = this->x;
    ppVar3 = map[ppVar2->id_union_top];
    this->actual_plane = ppVar2->id_union_top;
    fVar5 = ppVar3->pieces[ppVar3->side_size + 1]->x;
    if (fVar5 <= fVar6) {
      if (fVar5 == fVar6) {
        GVar7 = fVar8 + fVar9;
        goto LAB_08906c8c;
      }
LAB_0890721c:
      GVar7 = fVar6 - fVar9;
      this->previous_face = 3;
LAB_08907224:
      this->advance = -1;
      iVar4 = ppVar3->face_number;
      this->x = GVar7;
      this->actual_face = iVar4;
      return;
    }
    break;
  case 6:
    iVar1 = this->previous_face;
    if (iVar1 == 2) goto LAB_0890718c;
    if (iVar1 < 3) goto LAB_08906e60;
    if (iVar1 != 4) {
      if (iVar1 != 5) {
        return;
      }
      fVar8 = this->y;
      if (fVar8 != map[iVar4]->pieces[0]->y) {
        this->advance = -2;
        this->y = fVar8 - fVar9;
        return;
      }
      iVar4 = map[iVar4]->id_union_bottom;
      fVar9 = this->x;
      ppVar3 = map[iVar4];
      this->actual_plane = iVar4;
      goto LAB_08906e14;
    }
LAB_0890735c:
    ppVar2 = map[iVar4];
    if (this->z != ((float)ppVar2->side_size + ppVar2->pieces[0]->z) - DAT_089dbce4) {
LAB_089073ec:
      this->advance = 3;
      this->z = this->z + fVar9;
      return;
    }
    fVar6 = this->x;
    ppVar3 = map[ppVar2->id_union_right];
    this->actual_plane = ppVar2->id_union_right;
    fVar8 = ppVar3->pieces[ppVar3->side_size + 1]->x;
    if (fVar8 <= fVar6) {
      if (fVar8 == fVar6) goto LAB_089073ec;
      goto LAB_0890721c;
    }
  }
  GVar7 = fVar6 + fVar9;
  this->previous_face = 6;
LAB_08906e48:
  this->advance = 1;
  iVar4 = ppVar3->face_number;
  this->x = GVar7;
  this->actual_face = iVar4;
  return;
}



----------------------------------------

// Function: init_pos @ 089074ec

/* DWARF original prototype: void init_pos(ship * this, int x, int y, int z) */

void __thiscall ship::init_pos(ship *this,int x,int y,int z)

{
  camera *pcVar1;
  GLfloat unaff_f22;
  GLfloat in_stack_00000000;
  GLfloat in_stack_fffffffc;
  
  camera::update_pos(this->cam_ship,x,y,z,unaff_f22,in_stack_fffffffc,in_stack_00000000);
  pcVar1 = this->cam_ship;
  pcVar1->last_z = (float)z;
  pcVar1->last_x = (float)x;
  pcVar1->last_y = (float)y;
  return;
}



----------------------------------------

// Function: init @ 08907560

/* DWARF original prototype: void init(ship * this, plane * * map) */

void __thiscall ship::init(ship *this,plane **map)

{
  int iVar1;
  plane *ppVar2;
  float in_a2;
  float in_a3;
  GLfloat in_stack_00000010;
  GLfloat in_stack_00000014;
  GLfloat in_stack_00000018;
  
                    /* Unresolved local var: int index@[???]
                       Unresolved local var: int cam_x@[???]
                       Unresolved local var: int cam_y@[???]
                       Unresolved local var: int cam_z@[???] */
  iVar1 = plane::find_piece_index(map[this->actual_plane],(float)map,in_a2,in_a3);
  ppVar2 = map[this->actual_plane];
  camera::update_pos(this->cam_ship,ppVar2->cam_positions[iVar1][0],ppVar2->cam_positions[iVar1][1],
                     ppVar2->cam_positions[iVar1][2],in_stack_00000010,in_stack_00000014,
                     in_stack_00000018);
  return;
}



----------------------------------------

// Function: find_path @ 08907600

/* WARNING: Removing unreachable block (ram,0x08907d5c) */
/* WARNING: Removing unreachable block (ram,0x089079e4) */
/* WARNING: Removing unreachable block (ram,0x08907dd8) */
/* WARNING: Removing unreachable block (ram,0x08907c04) */
/* WARNING: Removing unreachable block (ram,0x08907bc0) */
/* WARNING: Removing unreachable block (ram,0x08907e44) */
/* WARNING: Removing unreachable block (ram,0x08907e60) */
/* WARNING: Removing unreachable block (ram,0x08907b40) */
/* WARNING: Removing unreachable block (ram,0x08907d30) */
/* WARNING: Removing unreachable block (ram,0x08907e18) */
/* WARNING: Removing unreachable block (ram,0x08907e88) */
/* DWARF original prototype: bool find_path(ship * this, int x, int y, int z, int dead_axis, int
   polarity) */

bool __thiscall ship::find_path(ship *this,int x,int y,int z,int dead_axis,int polarity)

{
  int iVar1;
  int in_t0;
  int in_t1;
  bool bVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  
                    /* Unresolved local var: bool found@[???] */
  if (in_t0 == 3) {
    fVar5 = (float)x;
    fVar4 = this->y;
    if (this->x == fVar5) {
      bVar2 = false;
      if (fVar4 != (float)y) {
        if ((float)y <= fVar4) {
          iVar1 = this->advance;
          if (iVar1 == 1) goto LAB_08907d74;
          if (iVar1 == 2) {
            iVar1 = rand();
LAB_08907b48:
            change_direction(this,iVar1 % 2);
            fVar4 = this->y;
            bVar2 = true;
          }
          else {
            bVar2 = true;
            if (iVar1 == -1) goto LAB_08907c70;
          }
        }
        else {
          iVar1 = this->advance;
          if (iVar1 == -1) {
LAB_08907d74:
            if (0 < in_t1) {
LAB_08907d7c:
              change_direction(this,1);
              fVar4 = this->y;
              bVar2 = true;
              goto LAB_0890774c;
            }
          }
          else {
            if (iVar1 != 1) {
              if (iVar1 == -2) {
                iVar1 = rand();
                goto LAB_08907b48;
              }
              bVar2 = true;
              goto LAB_0890774c;
            }
LAB_08907c70:
            if (in_t1 < 1) goto LAB_08907d7c;
          }
          change_direction(this,0);
          fVar4 = this->y;
          bVar2 = true;
        }
      }
    }
    else {
      bVar2 = false;
    }
LAB_0890774c:
    fVar3 = this->x;
    if (fVar4 == (float)y) {
      if (fVar5 != fVar3) {
        iVar1 = this->advance;
        if (fVar5 <= fVar3) {
          if (iVar1 == 1) goto LAB_08907d48;
          if (iVar1 == 2) {
LAB_08907af0:
            if (0 < in_t1) goto LAB_08907af8;
LAB_08907c5c:
            change_direction(this,1);
            fVar4 = this->y;
            bVar2 = true;
          }
          else {
            bVar2 = true;
            if (iVar1 == -2) goto LAB_08907c54;
          }
        }
        else if (iVar1 == -1) {
LAB_08907d48:
          bVar2 = true;
          iVar1 = rand();
          change_direction(this,iVar1 % 2);
          fVar4 = this->y;
        }
        else if (iVar1 == 2) {
LAB_08907c54:
          if (0 < in_t1) goto LAB_08907c5c;
LAB_08907af8:
          change_direction(this,0);
          fVar4 = this->y;
          bVar2 = true;
        }
        else {
          bVar2 = true;
          if (iVar1 == -2) goto LAB_08907af0;
        }
      }
      if (fVar4 == (float)y) {
        return bVar2;
      }
      fVar3 = this->x;
    }
    if (fVar5 == fVar3) {
      return bVar2;
    }
    iVar1 = this->advance;
    if (fVar3 < fVar5) {
      if (iVar1 == -1) goto LAB_08907d1c;
      if (iVar1 != 2) {
        if (iVar1 != -2) {
          return bVar2;
        }
        if (0 < in_t1) {
          change_direction(this,0);
          return bVar2;
        }
        goto LAB_08907ac4;
      }
    }
    else {
      if (iVar1 == 1) {
LAB_08907d1c:
        iVar1 = rand();
        change_direction(this,iVar1 % 2);
        return bVar2;
      }
      if (iVar1 == 2) {
        if (in_t1 < 1) goto LAB_08907ac4;
        goto LAB_08907df8;
      }
      if (iVar1 != -2) {
        return bVar2;
      }
    }
    if (0 < in_t1) {
LAB_08907ac4:
      change_direction(this,1);
      return bVar2;
    }
LAB_08907df8:
    change_direction(this,0);
    return bVar2;
  }
  if (in_t0 == 2) {
    fVar5 = (float)z;
    fVar4 = this->x;
    if (this->z == fVar5) {
      bVar2 = false;
      if (fVar4 != (float)x) {
        iVar1 = this->advance;
        if ((float)x <= fVar4) {
          if (iVar1 == 1) goto LAB_08907dc8;
          if (iVar1 == 3) {
LAB_08907c38:
            if (0 < in_t1) goto LAB_08907c40;
LAB_08907cd0:
            change_direction(this,0);
            fVar4 = this->x;
            bVar2 = true;
          }
          else {
            bVar2 = true;
            if (iVar1 == -3) goto LAB_08907cc8;
          }
        }
        else if (iVar1 == -1) {
LAB_08907dc8:
          bVar2 = true;
          iVar1 = rand();
          change_direction(this,iVar1 % 2);
          fVar4 = this->x;
        }
        else if (iVar1 == 3) {
LAB_08907cc8:
          if (0 < in_t1) goto LAB_08907cd0;
LAB_08907c40:
          change_direction(this,1);
          fVar4 = this->x;
          bVar2 = true;
        }
        else {
          bVar2 = true;
          if (iVar1 == -3) goto LAB_08907c38;
        }
      }
    }
    else {
      bVar2 = false;
    }
    fVar3 = this->z;
    if (fVar4 == (float)x) {
      if (fVar5 != fVar3) {
        iVar1 = this->advance;
        if (fVar5 <= fVar3) {
          if (iVar1 == 2) goto LAB_08907dac;
          if (iVar1 == 3) {
LAB_08907bf4:
            bVar2 = true;
            iVar1 = rand();
            change_direction(this,iVar1 % 2);
            fVar4 = this->x;
          }
          else {
            bVar2 = true;
            if (iVar1 == -2) goto LAB_08907ce4;
          }
        }
        else {
          if (iVar1 == -2) {
LAB_08907dac:
            if (0 < in_t1) {
LAB_08907db4:
              change_direction(this,1);
              fVar4 = this->x;
              bVar2 = true;
              goto LAB_0890784c;
            }
          }
          else {
            if (iVar1 != 2) {
              if (iVar1 == -3) goto LAB_08907bf4;
              bVar2 = true;
              goto LAB_0890784c;
            }
LAB_08907ce4:
            if (in_t1 < 1) goto LAB_08907db4;
          }
          change_direction(this,0);
          fVar4 = this->x;
          bVar2 = true;
        }
      }
LAB_0890784c:
      if (fVar4 == (float)x) {
        return bVar2;
      }
      fVar3 = this->z;
    }
    if (fVar5 == fVar3) {
      return bVar2;
    }
    iVar1 = this->advance;
    if (fVar3 < fVar5) goto LAB_089079b8;
    if (iVar1 != 2) {
      if (iVar1 == 3) goto LAB_089079d4;
      goto LAB_08907998;
    }
LAB_08907d04:
    if (0 < in_t1) goto LAB_08907d0c;
  }
  else {
    if (in_t0 != 1) {
      return false;
    }
    fVar5 = (float)z;
    fVar4 = this->y;
    if (this->z == fVar5) {
      bVar2 = false;
      if (fVar4 != (float)y) {
        if ((float)y <= fVar4) {
          iVar1 = this->advance;
          if (iVar1 == 2) {
            iVar1 = rand();
            goto LAB_08907e20;
          }
          if (iVar1 == 3) {
LAB_08907b78:
            if (0 < in_t1) goto LAB_08907b80;
LAB_08907c94:
            change_direction(this,1);
            fVar4 = this->y;
            bVar2 = true;
          }
          else {
            bVar2 = true;
            if (iVar1 == -3) goto LAB_08907c8c;
          }
        }
        else {
          iVar1 = this->advance;
          if (iVar1 == -2) {
            iVar1 = rand();
LAB_08907e20:
            change_direction(this,iVar1 % 2);
            fVar4 = this->y;
            bVar2 = true;
          }
          else if (iVar1 == 3) {
LAB_08907c8c:
            if (0 < in_t1) goto LAB_08907c94;
LAB_08907b80:
            change_direction(this,0);
            fVar4 = this->y;
            bVar2 = true;
          }
          else {
            bVar2 = true;
            if (iVar1 == -3) goto LAB_08907b78;
          }
        }
      }
    }
    else {
      bVar2 = false;
    }
    fVar3 = this->z;
    if (fVar4 == (float)y) {
      if (fVar5 != fVar3) {
        iVar1 = this->advance;
        if (fVar5 <= fVar3) {
          if (iVar1 == 2) goto LAB_08907d90;
          if (iVar1 == 3) {
LAB_08907bb0:
            bVar2 = true;
            iVar1 = rand();
            change_direction(this,iVar1 % 2);
            fVar4 = this->y;
          }
          else {
            bVar2 = true;
            if (iVar1 == -2) goto LAB_08907ca8;
          }
        }
        else {
          if (iVar1 == -2) {
LAB_08907d90:
            if (0 < in_t1) {
LAB_08907d98:
              change_direction(this,1);
              fVar4 = this->y;
              bVar2 = true;
              goto LAB_089076e4;
            }
          }
          else {
            if (iVar1 != 2) {
              if (iVar1 == -3) goto LAB_08907bb0;
              bVar2 = true;
              goto LAB_089076e4;
            }
LAB_08907ca8:
            if (in_t1 < 1) goto LAB_08907d98;
          }
          change_direction(this,0);
          fVar4 = this->y;
          bVar2 = true;
        }
      }
LAB_089076e4:
      if (fVar4 == (float)y) {
        return bVar2;
      }
      fVar3 = this->z;
    }
    if (fVar5 == fVar3) {
      return bVar2;
    }
    iVar1 = this->advance;
    if (fVar5 <= fVar3) {
      if (iVar1 == 2) goto LAB_08907d04;
      if (iVar1 == 3) {
        iVar1 = rand();
        change_direction(this,iVar1 % 2);
        return bVar2;
      }
LAB_08907998:
      if (iVar1 != -2) {
        return bVar2;
      }
    }
    else {
LAB_089079b8:
      if (iVar1 == -2) goto LAB_08907d04;
      if (iVar1 != 2) {
        if (iVar1 != -3) {
          return bVar2;
        }
LAB_089079d4:
        iVar1 = rand();
        change_direction(this,iVar1 % 2);
        return bVar2;
      }
    }
    if (in_t1 < 1) {
LAB_08907d0c:
      change_direction(this,1);
      return bVar2;
    }
  }
  change_direction(this,0);
  return bVar2;
}



----------------------------------------

// Function: where_is @ 08907e94

/* DWARF original prototype: int where_is(ship * this, float x, float y, float z, plane * * map, int
   n_planes) */

int __thiscall ship::where_is(ship *this,float x,float y,float z,plane **map,int n_planes)

{
  bool bVar1;
  undefined3 extraout_var;
  plane *this_00;
  float y_00;
  undefined4 *puVar2;
  float fVar3;
  
                    /* Unresolved local var: int isIn@[???] */
                    /* Unresolved local var: int i@[???] */
  if (0 < (int)y) {
    fVar3 = 0.0;
    y_00 = y;
    puVar2 = (undefined4 *)x;
    do {
      this_00 = (plane *)*puVar2;
      puVar2 = puVar2 + 1;
      bVar1 = plane::has_piece(this_00,x,y_00,z);
      if (CONCAT31(extraout_var,bVar1) != 0) {
        return (int)fVar3;
      }
      fVar3 = (float)((int)fVar3 + 1);
    } while (y != fVar3);
  }
  return 0;
}



----------------------------------------

// Function: look_for_pos @ 08907f4c

/* DWARF original prototype: bool look_for_pos(ship * this, float x, float y, float z, plane * *
   map, int n_planes) */

bool __thiscall ship::look_for_pos(ship *this,float x,float y,float z,plane **map,int n_planes)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  byte bVar5;
  plane **unaff_s0;
  int unaff_s1;
  int unaff_s2;
  int unaff_retaddr;
  int unaff_f20;
  
                    /* Unresolved local var: int[4] costs@[???]
                       Unresolved local var: int min@[???]
                       Unresolved local var: int best@[???]
                       Unresolved local var: int iAmOnPlane@[???] */
  iVar1 = where_is(this,x,y,look_for_pos(float,float,float,plane**,int)::C_9,unaff_s0,unaff_s1);
  this->plane_path = iVar1;
  if (iVar1 == this->actual_plane) {
    *(undefined1 *)(*(int *)(iVar1 * 4 + (int)x) + 0x30) = 0;
    return true;
  }
  iVar2 = tell_me_the_cost(this,x,y,*(float *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x20),
                           unaff_s0,unaff_s1,unaff_s2,unaff_retaddr,unaff_f20);
  iVar1 = tell_me_the_cost(this,x,y,*(float *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x24),
                           unaff_s0,unaff_s1,unaff_s2,unaff_retaddr,unaff_f20);
  iVar3 = tell_me_the_cost(this,x,y,*(float *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x2c),
                           unaff_s0,unaff_s1,unaff_s2,unaff_retaddr,unaff_f20);
  iVar4 = tell_me_the_cost(this,x,y,*(float *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x28),
                           unaff_s0,unaff_s1,unaff_s2,unaff_retaddr,unaff_f20);
                    /* Unresolved local var: int i@[???] */
  bVar5 = iVar1 < iVar2;
  if (!(bool)bVar5) {
    iVar1 = iVar2;
  }
  if (iVar3 < iVar1) {
    bVar5 = 2;
    iVar1 = iVar3;
  }
  if (iVar4 < iVar1) {
    iVar1 = this->actual_plane;
LAB_08908108:
    this->plane_path = *(int *)(*(int *)(iVar1 * 4 + (int)x) + 0x28);
  }
  else if (bVar5 == 1) {
    this->plane_path = *(int *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x24);
  }
  else if (bVar5 < 2) {
    if (bVar5 != 0) {
      iVar1 = this->plane_path;
      goto LAB_08908120;
    }
    this->plane_path = *(int *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x20);
  }
  else {
    if (bVar5 != 2) {
      if (bVar5 != 3) {
        iVar1 = this->plane_path;
        goto LAB_08908120;
      }
      iVar1 = this->actual_plane;
      goto LAB_08908108;
    }
    this->plane_path = *(int *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x2c);
  }
  iVar1 = this->plane_path;
LAB_08908120:
  this->path_found = false;
  iVar1 = *(int *)(*(int *)(iVar1 * 4 + (int)x) + 0x18);
  if (iVar1 != this->actual_face) {
    arrange_direction_to(this,iVar1);
    return false;
  }
  *(undefined1 *)(*(int *)(this->actual_plane * 4 + (int)x) + 0x30) = 0;
  return true;
}



----------------------------------------

// Function: go_to @ 08908260

/* DWARF original prototype: bool go_to(ship * this, float x, float y, float z, plane * * map, int
   n_planes) */

bool __thiscall ship::go_to(ship *this,float x,float y,float z,plane **map,int n_planes)

{
  bool bVar1;
  undefined3 extraout_var;
  float in_f12;
  float in_f13;
  float in_f14;
  plane **unaff_f20;
  int unaff_f21;
  
                    /* Unresolved local var: bool didArrive@[???]
                       Unresolved local var: bool onPlane@[???] */
  if (((this->x == in_f12) && (in_f13 == this->y)) && (in_f14 == this->z)) {
    this->plane_path = -1;
    this->path_found = false;
    return true;
  }
  bVar1 = look_for_pos(this,x,y,z,unaff_f20,unaff_f21);
  if ((CONCAT31(extraout_var,bVar1) != 0) && (this->path_found == false)) {
    bVar1 = find_path(this,(int)in_f12,(int)in_f13,(int)in_f14,(int)unaff_f20,unaff_f21);
    this->path_found = bVar1;
    return false;
  }
  return false;
}



----------------------------------------

// Function: move @ 08908394

/* WARNING: Removing unreachable block (ram,0x089086f4) */
/* WARNING: Removing unreachable block (ram,0x0890864c) */
/* WARNING: Removing unreachable block (ram,0x08908510) */
/* WARNING: Removing unreachable block (ram,0x089086dc) */
/* WARNING: Removing unreachable block (ram,0x0890870c) */
/* WARNING: Removing unreachable block (ram,0x08908684) */
/* DWARF original prototype: int move(enemy * this, plane * * map, int proton_face) */

int __thiscall enemy::move(enemy *this,plane **map,int proton_face)

{
  int iVar1;
  int iVar2;
  uint turn;
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  plane **x;
  plane *ppVar3;
  float in_a3;
  piece *ppVar4;
  int cam_z;
  GLfloat unaff_s4;
  GLfloat unaff_s5;
  GLfloat unaff_retaddr;
  
                    /* Unresolved local var: int index_predict@[???]
                       Unresolved local var: int way@[???]
                       Unresolved local var: int axis@[???]
                       Unresolved local var: int index@[???] */
  iVar1 = plane::find_piece_index
                    (map[(this->super_ship).actual_plane],(float)map,(float)proton_face,in_a3);
  if (map[(this->super_ship).actual_plane]->pieces[iVar1]->state != false) {
    return map[(this->super_ship).actual_plane]->pieces[iVar1]->type;
  }
  x = map;
                    /* Unresolved local var: int cam_x@[???]
                       Unresolved local var: int cam_y@[???]
                       Unresolved local var: int cam_z@[???] */
  predict(this,map);
  iVar2 = plane::find_piece_index
                    (map[(this->super_ship).actual_plane],(float)x,(float)proton_face,in_a3);
  turn = plane::available_ways
                   (map[(this->super_ship).actual_plane],(int)(this->super_ship).x,
                    (int)(this->super_ship).y,(int)(this->super_ship).z,(int)unaff_s4);
  if (map[(this->super_ship).actual_plane]->pieces[iVar2]->state == false) {
    iVar2 = rand();
    if (iVar2 % 0xf == 5) {
      if (turn < 2) goto LAB_089086bc;
      if (turn == 2) {
        iVar2 = rand();
        ship::change_direction(&this->super_ship,iVar2 % 2);
        iVar2 = this->type;
      }
      else {
        iVar2 = this->type;
      }
    }
    else {
      iVar2 = this->type;
    }
  }
  else if (turn < 2) {
LAB_089086bc:
    ship::change_direction(&this->super_ship,turn);
    iVar2 = this->type;
  }
  else {
    iVar2 = rand();
    ship::change_direction(&this->super_ship,iVar2 % 2);
    iVar2 = this->type;
  }
  if (iVar2 == 2) {
    this->active = (bool)(this->active ^ 1);
  }
  if (iVar2 == 3) {
    if (this->active != false) {
      iVar2 = rand();
      this->active = (bool)((byte)iVar2 & 1);
      goto LAB_0890853c;
    }
    this->active = true;
  }
  else {
LAB_0890853c:
    if (this->active == false) goto LAB_089085bc;
  }
  piece::change_state(map[(this->super_ship).actual_plane]->pieces[iVar1],
                      (this->super_ship).material,2);
  ppVar4 = map[(this->super_ship).actual_plane]->pieces[iVar1];
  __floatsidf(-(this->super_ship).cue_counter);
  iVar2 = (this->super_ship).ident;
  *(undefined4 *)&ppVar4->prints_counter = extraout_v0;
  *(undefined4 *)((int)&ppVar4->prints_counter + 4) = extraout_v1;
  ppVar4->owner = iVar2;
  iVar2 = this->type;
  (this->super_ship).cue_counter = (this->super_ship).cue_counter + 1;
  if (iVar2 == 3) {
    iVar2 = rand();
    (this->super_ship).material[0] = iVar2 % 200;
    iVar2 = rand();
    (this->super_ship).material[1] = iVar2 % 200;
    iVar2 = rand();
    (this->super_ship).material[2] = iVar2 % 200;
  }
LAB_089085bc:
  ppVar3 = map[(this->super_ship).actual_plane];
  cam_z = ppVar3->cam_positions[iVar1][2];
  iVar2 = ppVar3->cam_positions[iVar1][0];
  iVar1 = ppVar3->cam_positions[iVar1][1];
  ship::do_step(&this->super_ship,map);
  camera::update_pos((this->super_ship).cam_ship,iVar2,iVar1,cam_z,unaff_s4,unaff_s5,unaff_retaddr);
  return 0;
}



----------------------------------------

// Function: move @ 08908730

/* DWARF original prototype: int move(player * this, plane * * map, int mode) */

int __thiscall player::move(player *this,plane **map,int mode)

{
  int iVar1;
  undefined4 extraout_v0;
  piece *ppVar2;
  undefined4 extraout_v1;
  int *material;
  plane *ppVar3;
  float in_a3;
  int iVar4;
  GLfloat unaff_s4;
  int iVar5;
  GLfloat unaff_s5;
  GLfloat unaff_retaddr;
  
                    /* Unresolved local var: int index@[???] */
  iVar1 = plane::find_piece_index(map[(this->super_ship).actual_plane],(float)map,(float)mode,in_a3)
  ;
                    /* Unresolved local var: int cam_x@[???]
                       Unresolved local var: int cam_y@[???]
                       Unresolved local var: int cam_z@[???] */
  material = (this->super_ship).material;
  ppVar2 = map[(this->super_ship).actual_plane]->pieces[iVar1];
  if (ppVar2->state == false) {
    piece::change_state(ppVar2,material,1);
    map[(this->super_ship).actual_plane]->pieces[iVar1]->owner = (this->super_ship).ident;
    if (mode == 1) {
      iVar5 = (this->super_ship).actual_plane;
      iVar4 = (this->super_ship).cue_counter;
      ppVar2 = map[iVar5]->pieces[iVar1];
      __floatsidf(-iVar4);
      (this->super_ship).cue_counter = iVar4 + 1;
      *(undefined4 *)&ppVar2->prints_counter = extraout_v0;
      *(undefined4 *)((int)&ppVar2->prints_counter + 4) = extraout_v1;
      goto LAB_0890881c;
    }
  }
  else {
    if (mode == 1) {
      return ppVar2->type;
    }
    piece::change_state(ppVar2,material,1);
    map[(this->super_ship).actual_plane]->pieces[iVar1]->owner = (this->super_ship).ident;
  }
  iVar5 = (this->super_ship).actual_plane;
  map[iVar5]->pieces[iVar1]->temporal = true;
LAB_0890881c:
  ppVar3 = map[iVar5];
  iVar5 = ppVar3->cam_positions[iVar1][2];
  iVar4 = ppVar3->cam_positions[iVar1][0];
  iVar1 = ppVar3->cam_positions[iVar1][1];
  ship::do_step(&this->super_ship,map);
  camera::update_pos((this->super_ship).cam_ship,iVar4,iVar1,iVar5,unaff_s4,unaff_s5,unaff_retaddr);
  return 0;
}



----------------------------------------

// Function: print @ 08908924

/* DWARF original prototype: void print(enemy * this, int axis, bool low_quality) */

void __thiscall enemy::print(enemy *this,int axis,bool low_quality)

{
  int iVar1;
  float fVar2;
  int in_stack_00000000;
  int in_stack_00000004;
  int in_stack_00000008;
  int in_stack_0000000c;
  GLfloat in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  
  if ((this->super_ship).status != 6) {
    glinterface::solid_cube
              ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,(int)in_stack_00000010
               ,in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
    return;
  }
  fVar2 = (this->super_ship).effect_size;
  if (fVar2 < DAT_089dc368) {
    (this->super_ship).effect_size = fVar2 + DAT_089dc36c;
  }
  iVar1 = (this->super_ship).effect_alpha;
  if (iVar1 < 1) {
    (this->super_ship).status = 2;
  }
  else {
    iVar1 = iVar1 + -7;
    (this->super_ship).effect_alpha = iVar1;
  }
  if (iVar1 < 0) {
    (this->super_ship).effect_alpha = 0;
  }
  glinterface::solid_cube
            ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,in_stack_00000000,
             in_stack_00000004,in_stack_00000008,in_stack_0000000c,in_stack_00000010);
  glinterface::solid_cube
            ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,(int)in_stack_00000010,
             in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
  return;
}



----------------------------------------

// Function: print @ 08908a2c

/* DWARF original prototype: void print(player * this, int axis, bool low_quality) */

void __thiscall player::print(player *this,int axis,bool low_quality)

{
  int iVar1;
  float fVar2;
  int in_stack_00000000;
  int in_stack_00000004;
  int in_stack_00000008;
  int in_stack_0000000c;
  GLfloat in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  
  iVar1 = (this->super_ship).status;
  if (iVar1 != 6) {
    if (iVar1 == 3) {
      glinterface::solid_cube
                ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,in_stack_00000000,
                 in_stack_00000004,in_stack_00000008,in_stack_0000000c,in_stack_00000010);
      iVar1 = (this->super_ship).effect_alpha;
      if (iVar1 < 0xff) {
        (this->super_ship).effect_alpha = iVar1 + 7;
        fVar2 = (this->super_ship).effect_size;
      }
      else {
        fVar2 = (this->super_ship).effect_size;
      }
      if ((this->super_ship).size < fVar2) {
        (this->super_ship).effect_size = fVar2 - DAT_089dc360;
      }
      else if ((this->super_ship).material[3] <= (this->super_ship).effect_alpha) {
        (this->super_ship).status = 1;
      }
    }
    glinterface::solid_cube
              ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,(int)in_stack_00000010
               ,in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
    return;
  }
  fVar2 = (this->super_ship).effect_size;
  if (fVar2 < DAT_089dc368) {
    (this->super_ship).effect_size = fVar2 + DAT_089dc36c;
  }
  iVar1 = (this->super_ship).effect_alpha;
  if (iVar1 < 1) {
    (this->super_ship).status = 1;
  }
  else {
    iVar1 = iVar1 + -7;
    (this->super_ship).effect_alpha = iVar1;
  }
  if (iVar1 < 0) {
    (this->super_ship).effect_alpha = 0;
  }
  glinterface::solid_cube
            ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,in_stack_00000000,
             in_stack_00000004,in_stack_00000008,in_stack_0000000c,in_stack_00000010);
  glinterface::solid_cube
            ((this->super_ship).printer,3.57331e-43,3.57331e-43,3.57331e-43,(int)in_stack_00000010,
             in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
  return;
}



----------------------------------------

// Function: print_guides @ 08908bc8

/* DWARF original prototype: void print_guides(player * this, int face, int axis) */

void __thiscall player::print_guides(player *this,int face,int axis)

{
  int iVar1;
  int unaff_f20;
  int unaff_f21;
  int unaff_f22;
  int unaff_f23;
  GLfloat unaff_f24;
  int in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  int in_stack_00000024;
  int in_stack_fffffffc;
  
                    /* Unresolved local var: int right_x@[???]
                       Unresolved local var: int right_y@[???]
                       Unresolved local var: int right_z@[???]
                       Unresolved local var: int left_x@[???]
                       Unresolved local var: int left_y@[???]
                       Unresolved local var: int left_z@[???] */
  switch(face) {
  case 1:
    iVar1 = (this->super_ship).advance;
    if ((((iVar1 == -1) || (iVar1 < 0)) || (iVar1 == 1)) || (iVar1 == 2)) break;
  default:
    break;
  case 2:
    break;
  case 3:
    break;
  case 4:
    break;
  case 5:
    break;
  case 6:
  }
  glinterface::square_3D
            ((this->super_ship).printer,3.57331e-43,0.0,0.0,unaff_f20,unaff_f21,unaff_f22,unaff_f23,
             unaff_f24,in_stack_fffffffc);
  glinterface::square_3D
            ((this->super_ship).printer,0.0,0.0,3.57331e-43,in_stack_00000010,in_stack_00000014,
             in_stack_00000018,in_stack_0000001c,in_stack_00000020,in_stack_00000024);
  return;
}



----------------------------------------

// Function: change_state @ 08908f10

/* DWARF original prototype: void change_state(piece * this, int * material, int type) */

void __thiscall piece::change_state(piece *this,int *material,int type)

{
  int iVar1;
  
  this->material[0] = *material;
  iVar1 = material[1];
  this->state = true;
  this->material[1] = iVar1;
  this->material[2] = material[2];
  iVar1 = material[3];
  this->status = 1;
  this->type = type;
  this->material[3] = iVar1;
  return;
}



----------------------------------------

// Function: restart @ 08908f48

/* DWARF original prototype: void restart(piece * this) */

void __thiscall piece::restart(piece *this)

{
  float fVar1;
  float fVar2;
  
  fVar1 = DAT_089dc360;
  this->owner = -2;
  this->material[3] = 200;
  fVar2 = DAT_089dc43c;
  this->material[2] = 0xff;
  this->effect_size = fVar1;
  this->effect_alpha = fVar2;
  this->state = false;
  this->size = fVar1;
  *(undefined4 *)&this->prints_counter = 0;
  *(undefined4 *)((int)&this->prints_counter + 4) = 0;
  this->material[0] = 0xff;
  this->material[1] = 0xff;
  this->type = 0;
  this->status = 0;
  return;
}



----------------------------------------

// Function: print @ 08908f9c

/* DWARF original prototype: void print(piece * this, int axis, bool low_quality) */

void __thiscall piece::print(piece *this,int axis,bool low_quality)

{
  SItype SVar1;
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  glinterface *this_00;
  GLfloat x;
  GLfloat y;
  GLfloat z;
  undefined4 in_f12;
  undefined4 in_f13;
  undefined4 in_f14;
  undefined4 in_f15;
  int in_stack_00000000;
  int in_stack_00000004;
  int in_stack_00000008;
  int in_stack_0000000c;
  GLfloat in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  
  if (this->temporal == false) {
    if (this->status != 2) {
      if (low_quality) {
        glinterface::cube(this->printer,(GLfloat)this->material[0],(GLfloat)this->material[1],
                          (GLfloat)this->material[2],(int)in_stack_00000010,in_stack_00000014,
                          in_stack_00000018,in_stack_0000001c,in_stack_00000020);
        return;
      }
      glinterface::solid_cube
                (this->printer,(GLfloat)this->material[0],(GLfloat)this->material[1],
                 (GLfloat)this->material[2],(int)in_stack_00000010,in_stack_00000014,
                 in_stack_00000018,in_stack_0000001c,in_stack_00000020);
      return;
    }
    glinterface::solid_cube
              (this->printer,(GLfloat)this->material[0],(GLfloat)this->material[1],
               (GLfloat)this->material[2],in_stack_00000000,in_stack_00000004,in_stack_00000008,
               in_stack_0000000c,in_stack_00000010);
    if (this->effect_size < DAT_089dc43c) {
      this->effect_size = this->effect_size + DAT_089dc36c;
    }
    if (this->effect_alpha <= 0.0) {
      restart(this);
      return;
    }
    this->effect_alpha = this->effect_alpha - DAT_089dbcec;
  }
  else {
    SVar1 = __gtdf2((FLO_type_conflict)CONCAT44(in_f13,in_f12),
                    (FLO_type_conflict)CONCAT44(in_f15,in_f14));
    if (SVar1 < 1) {
      __adddf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),(FLO_type_conflict)CONCAT44(in_f15,in_f14)
              );
      this_00 = this->printer;
      x = (GLfloat)this->material[0];
      y = (GLfloat)this->material[1];
      z = (GLfloat)this->material[2];
      *(undefined4 *)&this->prints_counter = extraout_v0;
      *(undefined4 *)((int)&this->prints_counter + 4) = extraout_v1;
      glinterface::solid_cube
                (this_00,x,y,z,(int)in_stack_00000010,in_stack_00000014,in_stack_00000018,
                 in_stack_0000001c,in_stack_00000020);
      return;
    }
    this->state = false;
    *(undefined4 *)&this->prints_counter = 0;
    *(undefined4 *)((int)&this->prints_counter + 4) = 0;
  }
  return;
}



----------------------------------------

// Function: square_3D @ 0890918c

/* DWARF original prototype: void square_3D(glinterface * this, GLfloat x, GLfloat y, GLfloat z, int
   r, int g, int b, int a, GLfloat size, int axis) */

void __thiscall
glinterface::square_3D
          (glinterface *this,GLfloat x,GLfloat y,GLfloat z,int r,int g,int b,int a,GLfloat size,
          int axis)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  float *pfVar5;
  GLubyte in_t0;
  int in_t1;
  undefined4 *puVar6;
  float fVar7;
  float in_f12;
  float in_f13;
  float in_f14;
  float in_f15;
  float fVar8;
  float local_58 [7];
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  
                    /* Unresolved local var: GLfloat[12] square@[???] */
  pfVar5 = local_58;
  puVar6 = &square_3D(float,float,float,int,int,int,int,float,int)::C_0;
  do {
    uVar1 = *puVar6;
    uVar2 = puVar6[1];
    uVar3 = puVar6[2];
    uVar4 = puVar6[3];
    puVar6 = puVar6 + 4;
    *pfVar5 = (float)uVar1;
    pfVar5[1] = (float)uVar2;
    pfVar5[2] = (float)uVar3;
    pfVar5[3] = (float)uVar4;
    pfVar5 = pfVar5 + 4;
  } while (puVar6 != &DAT_089dc484);
  fVar8 = in_f15 * DAT_089dc448;
  if (in_t1 == 2) {
    local_58[0] = -fVar8;
    local_58[1] = local_58[0];
    local_58[2] = fVar8;
    local_58[3] = local_58[0];
    local_58[4] = local_58[0];
    local_58[5] = local_58[0];
    local_58[6] = fVar8;
    local_3c = local_58[0];
    local_38 = fVar8;
    local_34 = fVar8;
    local_30 = local_58[0];
    local_2c = local_58[0];
  }
  else if (in_t1 == 3) {
    local_58[0] = -fVar8;
    local_58[1] = local_58[0];
    local_58[2] = local_58[0];
    local_58[3] = local_58[0];
    local_58[4] = fVar8;
    local_58[5] = local_58[0];
    local_58[6] = fVar8;
    local_3c = local_58[0];
    local_38 = local_58[0];
    local_34 = fVar8;
    local_30 = fVar8;
    local_2c = local_58[0];
  }
  else {
    fVar7 = -fVar8;
    if (in_t1 == 1) {
      local_58[0] = fVar7;
      local_58[1] = fVar7;
      local_58[2] = fVar8;
      local_58[3] = fVar7;
      local_58[4] = fVar8;
      local_58[5] = fVar8;
      local_58[6] = fVar7;
      local_3c = fVar7;
      local_38 = fVar7;
      local_34 = fVar7;
      local_30 = fVar8;
      local_2c = fVar7;
    }
  }
  glPushMatrix();
  glTranslatef(fVar8 + in_f12,fVar8 + in_f13,fVar8 + in_f14);
  glColor4ub(SUB41(x,0),SUB41(y,0),SUB41(z,0),in_t0);
  glVertexPointer(3,0x1406,0,local_58);
  glDrawArrays(5,0,4);
  glPopMatrix();
  return;
}



----------------------------------------

// Function: square @ 0890935c

/* DWARF original prototype: void square(glinterface * this, GLfloat x, GLfloat y, GLfloat z, int r,
   int g, int b, int a, GLfloat size) */

void __thiscall
glinterface::square(glinterface *this,GLfloat x,GLfloat y,GLfloat z,int r,int g,int b,int a,
                   GLfloat size)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  undefined4 *puVar5;
  float *pfVar6;
  GLubyte in_t0;
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  float in_f15;
  float local_88 [12];
  undefined4 local_58 [12];
  
                    /* Unresolved local var: GLfloat[12] square@[???] */
  pfVar6 = local_88;
  local_58[0] = 0;
  local_58[1] = 0;
  local_58[2] = 0;
  local_58[3] = 0;
  local_58[4] = 0;
  local_58[5] = 0;
  local_58[6] = 0;
  local_58[7] = 0;
  local_58[8] = 0;
  local_58[9] = 0;
  local_58[10] = 0;
  local_58[0xb] = 0;
  puVar5 = local_58;
  do {
    uVar1 = *puVar5;
    uVar2 = puVar5[1];
    uVar3 = puVar5[2];
    uVar4 = puVar5[3];
    puVar5 = puVar5 + 4;
    *pfVar6 = (float)uVar1;
    pfVar6[1] = (float)uVar2;
    pfVar6[2] = (float)uVar3;
    pfVar6[3] = (float)uVar4;
    pfVar6 = pfVar6 + 4;
  } while (puVar5 != (undefined4 *)&stack0xffffffd8);
  local_88[0] = -in_f15;
  local_88[1] = local_88[0];
  local_88[4] = local_88[0];
  local_88[6] = local_88[0];
  glPushMatrix();
  glTranslatef(in_f12,in_f13,in_f14);
  glColor4ub(SUB41(x,0),SUB41(y,0),SUB41(z,0),in_t0);
  glVertexPointer(3,0x1406,0,local_88);
  glDrawArrays(5,0,4);
  glPopMatrix();
  return;
}



----------------------------------------

// Function: line @ 089094b4

/* DWARF original prototype: void line(glinterface * this, GLfloat x_origin, GLfloat y_origin,
   GLfloat z_origin, GLfloat x_destination, GLfloat y_destination, GLfloat z_destination, int *
   material) */

void __thiscall
glinterface::line(glinterface *this,GLfloat x_origin,GLfloat y_origin,GLfloat z_origin,
                 GLfloat x_destination,GLfloat y_destination,GLfloat z_destination,int *material)

{
  undefined1 local_38 [24];
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: GLfloat[6] line@[???] */
  local_20 = 0;
  local_1c = 0;
  local_18 = 0;
  local_14 = 0;
  local_10 = 0;
  local_c = 0;
  glPushMatrix();
  glColor4ub(*(GLubyte *)x_origin,*(GLubyte *)((int)x_origin + 4),*(GLubyte *)((int)x_origin + 8),
             *(GLubyte *)((int)x_origin + 0xc));
  glVertexPointer(3,0x1406,0,local_38);
  glDrawArrays(1,0,2);
  glPopMatrix();
  return;
}



----------------------------------------

// Function: cube_skeleton @ 08909548

/* DWARF original prototype: void cube_skeleton(glinterface * this, GLfloat x, GLfloat y, GLfloat z,
   int r, int g, int b, int a, GLfloat size) */

void __thiscall
glinterface::cube_skeleton
          (glinterface *this,GLfloat x,GLfloat y,GLfloat z,int r,int g,int b,int a,GLfloat size)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  float *pfVar5;
  GLubyte in_t0;
  undefined4 *m;
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  float in_f15;
  float local_268 [12];
  float local_238;
  float local_234;
  float local_230;
  float local_22c;
  float local_224;
  float local_21c;
  float local_218;
  float local_20c;
  float local_208;
  float local_204;
  float local_1fc;
  float local_1f0;
  float local_1ec;
  float local_1e8;
  float local_1e4;
  float local_1dc;
  float local_1d4;
  float local_1d0;
  float local_1c4;
  float local_1bc;
  float local_1a8;
  float local_190;
  float local_188;
  float local_17c;
  float local_178;
  float local_174;
  float local_16c;
  float local_168;
  float local_164;
  float local_15c;
  float local_150;
  float local_14c;
  undefined4 local_148 [72];
  
                    /* Unresolved local var: GLfloat[72] box@[???] */
  pfVar5 = local_268;
  m = local_148;
  memset(m,0,0x120);
  do {
    uVar1 = *m;
    uVar2 = m[1];
    uVar3 = m[2];
    uVar4 = m[3];
    m = m + 4;
    *pfVar5 = (float)uVar1;
    pfVar5[1] = (float)uVar2;
    pfVar5[2] = (float)uVar3;
    pfVar5[3] = (float)uVar4;
    pfVar5 = pfVar5 + 4;
  } while (m != (undefined4 *)&stack0xffffffd8);
  local_268[0] = -in_f15;
  local_268[1] = local_268[0];
  local_268[4] = local_268[0];
  local_268[6] = local_268[0];
  local_238 = local_268[0];
  local_234 = local_268[0];
  local_230 = local_268[0];
  local_22c = local_268[0];
  local_224 = local_268[0];
  local_21c = local_268[0];
  local_218 = local_268[0];
  local_20c = local_268[0];
  local_208 = local_268[0];
  local_204 = local_268[0];
  local_1fc = local_268[0];
  local_1f0 = local_268[0];
  local_1ec = local_268[0];
  local_1e8 = local_268[0];
  local_1e4 = local_268[0];
  local_1dc = local_268[0];
  local_1d4 = local_268[0];
  local_1d0 = local_268[0];
  local_1c4 = local_268[0];
  local_1bc = local_268[0];
  local_1a8 = local_268[0];
  local_190 = local_268[0];
  local_188 = local_268[0];
  local_17c = local_268[0];
  local_178 = local_268[0];
  local_174 = local_268[0];
  local_16c = local_268[0];
  local_168 = local_268[0];
  local_164 = local_268[0];
  local_15c = local_268[0];
  local_150 = local_268[0];
  local_14c = local_268[0];
  glPushMatrix();
  glTranslatef(in_f12,in_f13,in_f14);
  glColor4ub(SUB41(x,0),SUB41(y,0),SUB41(z,0),in_t0);
  glVertexPointer(3,0x1406,0,local_268);
  glDrawArrays(1,0,0x18);
  glPopMatrix();
  return;
}



----------------------------------------

// Function: solid_cube @ 08909784

/* DWARF original prototype: void solid_cube(glinterface * this, GLfloat x, GLfloat y, GLfloat z,
   int r, int g, int b, int a, GLfloat size) */

void __thiscall
glinterface::solid_cube
          (glinterface *this,GLfloat x,GLfloat y,GLfloat z,int r,int g,int b,int a,GLfloat size)

{
  int in_t0;
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  float in_f15;
  float x_00;
  
  glPushMatrix();
  x_00 = -in_f15;
  glTranslatef(in_f12,in_f13,in_f14);
  glColor4f((float)(int)x,(float)(int)y,(float)(int)z,(float)in_t0);
  glBegin(9);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(in_f15,in_f15,in_f15);
  glVertex3f(x_00,in_f15,in_f15);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(x_00,in_f15,x_00);
  glVertex3f(in_f15,in_f15,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,in_f15,x_00);
  glVertex3f(in_f15,in_f15,in_f15);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(x_00,in_f15,in_f15);
  glVertex3f(x_00,in_f15,x_00);
  glEnd();
  glPopMatrix();
  return;
}



----------------------------------------

// Function: cube @ 08909974

/* DWARF original prototype: void cube(glinterface * this, GLfloat x, GLfloat y, GLfloat z, int r,
   int g, int b, int a, GLfloat size) */

void __thiscall
glinterface::cube(glinterface *this,GLfloat x,GLfloat y,GLfloat z,int r,int g,int b,int a,
                 GLfloat size)

{
  int in_t0;
  GLfloat in_f12;
  GLfloat in_f13;
  GLfloat in_f14;
  float in_f15;
  float x_00;
  
  glPushMatrix();
  x_00 = -in_f15;
  glTranslatef(in_f12,in_f13,in_f14);
  glColor4f((float)(int)x,(float)(int)y,(float)(int)z,(float)in_t0);
  glBegin(9);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(in_f15,in_f15,in_f15);
  glVertex3f(x_00,in_f15,in_f15);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(x_00,in_f15,x_00);
  glVertex3f(in_f15,in_f15,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,x_00,x_00);
  glVertex3f(in_f15,in_f15,x_00);
  glVertex3f(in_f15,in_f15,in_f15);
  glVertex3f(in_f15,x_00,in_f15);
  glVertex3f(x_00,x_00,x_00);
  glVertex3f(x_00,x_00,in_f15);
  glVertex3f(x_00,in_f15,in_f15);
  glVertex3f(x_00,in_f15,x_00);
  glEnd();
  glPopMatrix();
  return;
}



----------------------------------------

// Function: lookat @ 08909b64

/* DWARF original prototype: void lookat(glinterface * this, GLfloat eyex, GLfloat eyey, GLfloat
   eyez, GLfloat centerx, GLfloat centery, GLfloat centerz, GLfloat upx, GLfloat upy, GLfloat upz)
    */

void __thiscall
glinterface::lookat(glinterface *this,GLfloat eyex,GLfloat eyey,GLfloat eyez,GLfloat centerx,
                   GLfloat centery,GLfloat centerz,GLfloat upx,GLfloat upy,GLfloat upz)

{
  SFtype SVar1;
  float in_f12;
  float fVar2;
  float in_f13;
  float in_f14;
  float in_f15;
  float in_f16;
  float in_f17;
  float in_f18;
  float in_f19;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float local_res0;
  float local_80;
  float local_7c;
  float local_78;
  undefined4 local_74;
  float local_70;
  float local_6c;
  float local_68;
  undefined4 local_64;
  float local_60;
  float local_5c;
  float local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  float local_40;
  
                    /* Unresolved local var: GLfloat[16] m@[???]
                       Unresolved local var: GLfloat[3] x@[???]
                       Unresolved local var: GLfloat[3] y@[???]
                       Unresolved local var: GLfloat[3] z@[???]
                       Unresolved local var: GLfloat mag@[???] */
  fVar8 = in_f13 - in_f16;
  fVar7 = in_f12 - in_f15;
  fVar6 = in_f14 - in_f17;
  fVar2 = fVar7 * fVar7 + fVar8 * fVar8 + fVar6 * fVar6;
  local_40 = in_f13;
  __extendsfdf2(fVar2);
  sqrt((double)CONCAT44(in_f13,fVar2));
  SVar1 = __truncdfsf2((DFtype)CONCAT44(in_f13,fVar2));
  if (SVar1 != 0.0) {
    fVar6 = fVar6 / SVar1;
    fVar7 = fVar7 / SVar1;
    fVar8 = fVar8 / SVar1;
  }
  fVar5 = local_res0 * fVar7 - in_f18 * fVar6;
  fVar3 = in_f19 * fVar6 - local_res0 * fVar8;
  fVar4 = in_f18 * fVar8 - in_f19 * fVar7;
  fVar2 = fVar3 * fVar3 + fVar5 * fVar5 + fVar4 * fVar4;
  fVar11 = fVar4 * fVar8 - fVar5 * fVar6;
  fVar9 = fVar3 * fVar6 - fVar7 * fVar4;
  fVar10 = fVar5 * fVar7 - fVar3 * fVar8;
  __extendsfdf2(fVar2);
  sqrt((double)CONCAT44(in_f13,fVar2));
  SVar1 = __truncdfsf2((DFtype)CONCAT44(in_f13,fVar2));
  if (SVar1 != 0.0) {
    fVar4 = fVar4 / SVar1;
    fVar3 = fVar3 / SVar1;
    fVar5 = fVar5 / SVar1;
  }
  fVar2 = fVar11 * fVar11 + fVar9 * fVar9 + fVar10 * fVar10;
  __extendsfdf2(fVar2);
  sqrt((double)CONCAT44(in_f13,fVar2));
  SVar1 = __truncdfsf2((DFtype)CONCAT44(in_f13,fVar2));
  if (SVar1 != 0.0) {
    fVar10 = fVar10 / SVar1;
    fVar11 = fVar11 / SVar1;
    fVar9 = fVar9 / SVar1;
  }
  local_54 = 0;
  local_44 = DAT_089dbce4;
  local_50 = 0;
  local_4c = 0;
  local_48 = 0;
  local_74 = 0;
  local_64 = 0;
  local_80 = fVar3;
  local_7c = fVar11;
  local_78 = fVar7;
  local_70 = fVar5;
  local_6c = fVar9;
  local_68 = fVar8;
  local_60 = fVar4;
  local_5c = fVar10;
  local_58 = fVar6;
  glMultMatrixf(&local_80);
  glTranslatef(-in_f12,-local_40,-in_f14);
  return;
}



----------------------------------------

// Function: perspective @ 08909d84

/* DWARF original prototype: void perspective(glinterface * this, GLfloat fovy, GLfloat aspect,
   GLfloat zNear, GLfloat zFar) */

void __thiscall
glinterface::perspective(glinterface *this,GLfloat fovy,GLfloat aspect,GLfloat zNear,GLfloat zFar)

{
  undefined4 unaff_s0;
  undefined4 unaff_s1;
  undefined4 unaff_s2;
  undefined4 unaff_s3;
  undefined4 unaff_s4;
  undefined4 unaff_s5;
  undefined4 unaff_s6;
  undefined4 unaff_s7;
  SFtype SVar1;
  float in_f12;
  float fVar2;
  float in_f13;
  float fVar3;
  SFtype in_f14;
  SFtype SVar4;
  SFtype in_f15;
  SFtype SVar5;
  
                    /* Unresolved local var: GLfloat xmin@[???]
                       Unresolved local var: GLfloat xmax@[???]
                       Unresolved local var: GLfloat ymin@[???]
                       Unresolved local var: GLfloat ymax@[???] */
  fVar2 = (in_f12 * DAT_089dc44c) / DAT_089dc450;
  fVar3 = in_f13;
  SVar4 = in_f14;
  SVar5 = in_f15;
  __extendsfdf2(fVar2);
  tan((double)CONCAT44(fVar3,fVar2));
  SVar1 = __truncdfsf2((DFtype)CONCAT44(fVar3,fVar2));
  fVar2 = SVar1 * in_f14;
  __extendsfdf2(-fVar2 * in_f13);
  __extendsfdf2(fVar2 * in_f13);
  __extendsfdf2(-fVar2);
  __extendsfdf2(fVar2);
  __extendsfdf2(in_f14);
  __extendsfdf2(in_f15);
  glFrustum((GLdouble)CONCAT44(fVar3,in_f15),(GLdouble)CONCAT44(SVar5,SVar4),
            (GLdouble)CONCAT44(unaff_s1,unaff_s0),(GLdouble)CONCAT44(unaff_s3,unaff_s2),
            (GLdouble)CONCAT44(unaff_s5,unaff_s4),(GLdouble)CONCAT44(unaff_s7,unaff_s6));
  return;
}



----------------------------------------

// Function: change_color @ 08909ecc

/* DWARF original prototype: void change_color(button * this, int r, int g, int b, int a) */

void __thiscall button::change_color(button *this,int r,int g,int b,int a)

{
  int in_t0;
  
  this->color[3] = in_t0;
  this->color[0] = r;
  this->color[1] = g;
  this->color[2] = b;
  return;
}



----------------------------------------

// Function: show_skeleton @ 08909ee0

/* DWARF original prototype: void show_skeleton(button * this) */

void __thiscall button::show_skeleton(button *this)

{
  GLfloat in_a2;
  GLfloat in_a3;
  int *x_origin;
  GLfloat unaff_f20;
  GLfloat unaff_f21;
  GLfloat in_stack_00000000;
  int *in_stack_00000004;
  GLfloat in_stack_00000010;
  GLfloat in_stack_00000014;
  GLfloat in_stack_00000018;
  int *in_stack_0000001c;
  
  x_origin = this->color;
  glinterface::line(this->printer,(GLfloat)x_origin,in_a2,in_a3,unaff_f20,unaff_f21,
                    in_stack_00000000,in_stack_00000004);
  glinterface::line(this->printer,(GLfloat)x_origin,in_a2,in_a3,unaff_f20,unaff_f21,
                    in_stack_00000000,in_stack_00000004);
  glinterface::line(this->printer,(GLfloat)x_origin,in_a2,in_a3,unaff_f20,unaff_f21,
                    in_stack_00000000,in_stack_00000004);
  glinterface::line(this->printer,(GLfloat)x_origin,in_a2,in_a3,in_stack_00000010,in_stack_00000014,
                    in_stack_00000018,in_stack_0000001c);
  return;
}



----------------------------------------

// Function: print_3D @ 0890a008

/* DWARF original prototype: void print_3D(button * this, float x, float y, float z, int axis, int
   polarity) */

void __thiscall button::print_3D(button *this,float x,float y,float z,int axis,int polarity)

{
  float fVar1;
  int iVar2;
  int iVar3;
  int unaff_s2;
  int iVar4;
  int unaff_s3;
  button *pbVar5;
  int unaff_s4;
  int unaff_s5;
  GLfloat unaff_s6;
  int unaff_s7;
  float in_f12;
  float in_f13;
  float in_f14;
  float fVar6;
  
                    /* Unresolved local var: float offsetx@[???]
                       Unresolved local var: float offsety@[???] */
  fVar1 = DAT_089dc48c;
  fVar6 = 0.0;
  this->x = in_f12;
  this->y = in_f13;
  this->z = in_f14;
  pbVar5 = this;
LAB_0890a0b0:
                    /* Unresolved local var: int i@[???] */
  iVar2 = pbVar5->characters[0];
LAB_0890a0b4:
  if (iVar2 < 0) goto LAB_0890a1e0;
  if ((int)y < 1) {
    iVar4 = 5;
    do {
      iVar3 = 5;
LAB_0890a2c4:
      if (::::FONT[iVar2][iVar4][iVar3] == 0) {
LAB_0890a2b4:
        if (iVar3 + -1 == -1) goto LAB_0890a360;
        iVar2 = pbVar5->characters[0];
        iVar3 = iVar3 + -1;
        goto LAB_0890a2c4;
      }
      if (x != 1.4013e-45) {
                    /* Unresolved local var: int y@[???]
                       Unresolved local var: int x@[???] */
        glinterface::square_3D
                  (this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],
                   (GLfloat)this->color[2],unaff_s2,unaff_s3,unaff_s4,unaff_s5,unaff_s6,unaff_s7);
        goto LAB_0890a2b4;
      }
      glinterface::square_3D
                (this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],
                 (GLfloat)this->color[2],unaff_s2,unaff_s3,unaff_s4,unaff_s5,unaff_s6,unaff_s7);
      if (iVar3 + -1 != -1) {
        iVar2 = pbVar5->characters[0];
        iVar3 = iVar3 + -1;
        goto LAB_0890a2c4;
      }
LAB_0890a360:
      iVar4 = iVar4 + -1;
      if (iVar4 == iVar3 + -1) goto LAB_0890a360;
      iVar2 = pbVar5->characters[0];
    } while( true );
  }
  iVar4 = 0;
  do {
    iVar3 = 0;
LAB_0890a138:
    if (::::FONT[iVar2][iVar4][iVar3] == 0) {
LAB_0890a12c:
      if (iVar3 + 1 == 6) goto LAB_0890a1d0;
      iVar2 = pbVar5->characters[0];
      iVar3 = iVar3 + 1;
      goto LAB_0890a138;
    }
    if (x != 1.4013e-45) {
                    /* Unresolved local var: int y@[???]
                       Unresolved local var: int x@[???] */
      glinterface::square_3D
                (this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],
                 (GLfloat)this->color[2],unaff_s2,unaff_s3,unaff_s4,unaff_s5,unaff_s6,unaff_s7);
      goto LAB_0890a12c;
    }
    glinterface::square_3D
              (this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],(GLfloat)this->color[2]
               ,unaff_s2,unaff_s3,unaff_s4,unaff_s5,unaff_s6,unaff_s7);
    if (iVar3 + 1 != 6) {
      iVar2 = pbVar5->characters[0];
      iVar3 = iVar3 + 1;
      goto LAB_0890a138;
    }
LAB_0890a1d0:
    iVar4 = iVar4 + 1;
    if (iVar4 == iVar3 + 1) goto LAB_0890a23c;
    iVar2 = pbVar5->characters[0];
  } while( true );
LAB_0890a360:
  fVar6 = fVar6 - fVar1;
LAB_0890a1e0:
  if (&pbVar5->x == (float *)(this->characters + 0x31)) {
    this->width = fVar6;
    return;
  }
  iVar2 = pbVar5->characters[1];
  pbVar5 = (button *)&pbVar5->x;
  goto LAB_0890a0b4;
LAB_0890a23c:
  pbVar5 = (button *)&pbVar5->x;
  fVar6 = fVar6 + fVar1;
  if (pbVar5 == (button *)(this->characters + 0x31)) {
    this->width = fVar6;
    return;
  }
  goto LAB_0890a0b0;
}



----------------------------------------

// Function: print_2D @ 0890a370

/* DWARF original prototype: void print_2D(button * this, float x, float y, float z) */

void __thiscall button::print_2D(button *this,float x,float y,float z)

{
  float fVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  button *pbVar5;
  int unaff_s4;
  int unaff_s5;
  int unaff_s6;
  int unaff_s7;
  GLfloat unaff_retaddr;
  float in_f12;
  float in_f13;
  float in_f14;
  float fVar6;
  
                    /* Unresolved local var: float offsetx@[???]
                       Unresolved local var: float offsety@[???] */
  this->x = in_f12;
  this->y = in_f13;
  this->z = in_f14;
  if (this->isFadeing != false) {
    iVar2 = this->color[3] + 10;
    if (iVar2 < this->effect_alpha) {
      this->color[3] = iVar2;
    }
    else {
      this->color[3] = this->effect_alpha;
      this->isFadeing = false;
    }
  }
  fVar1 = DAT_089dc498;
  fVar6 = 0.0;
                    /* Unresolved local var: int i@[???] */
  iVar2 = this->characters[0];
  pbVar5 = this;
LAB_0890a41c:
  iVar4 = 0;
  if (-1 < iVar2) {
    do {
      iVar3 = 0;
      while( true ) {
        while (::::FONT[iVar2][iVar4][iVar3] == 0) {
                    /* Unresolved local var: int y@[???]
                       Unresolved local var: int x@[???] */
          if (iVar3 + 1 == 6) goto LAB_0890a4cc;
          iVar2 = pbVar5->characters[0];
          iVar3 = iVar3 + 1;
        }
        glinterface::square(this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],
                            (GLfloat)this->color[2],unaff_s4,unaff_s5,unaff_s6,unaff_s7,
                            unaff_retaddr);
        if (iVar3 + 1 == 6) break;
        iVar2 = pbVar5->characters[0];
        iVar3 = iVar3 + 1;
      }
LAB_0890a4cc:
      iVar4 = iVar4 + 1;
      if (iVar4 == iVar3 + 1) goto LAB_0890a4cc;
      iVar2 = pbVar5->characters[0];
    } while( true );
  }
  goto LAB_0890a4dc;
LAB_0890a4cc:
  fVar6 = fVar6 + fVar1;
LAB_0890a4dc:
  if ((float *)(this->characters + 0x31) == &pbVar5->x) {
    this->width = fVar6;
    return;
  }
  iVar2 = pbVar5->characters[1];
  pbVar5 = (button *)&pbVar5->x;
  goto LAB_0890a41c;
}



----------------------------------------

// Function: print @ 0890a534

/* DWARF original prototype: void print(button * this, float x, float y, float z, int method) */

void __thiscall button::print(button *this,float x,float y,float z,int method)

{
  int in_stack_00000014;
  
  if (x == 0.0) {
    print_2D(this,0.0,y,z);
    return;
  }
  if (x == 2.8026e-45) {
    print_3D(this,1.4013e-45,-NAN,z,method,in_stack_00000014);
    return;
  }
  if ((int)x < 3) {
    if (x == 1.4013e-45) {
LAB_0890a58c:
      print_3D(this,x,1.4013e-45,z,method,in_stack_00000014);
      return;
    }
  }
  else {
    if (x == 4.2039e-45) goto LAB_0890a58c;
    if (x == 5.60519e-45) {
      print_3D(this,4.2039e-45,-NAN,z,method,in_stack_00000014);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: load_text @ 0890a594

/* DWARF original prototype: void load_text(button * this, char * word, int fade_alpha) */

void __thiscall button::load_text(button *this,char *word,int fade_alpha)

{
  size_t sVar1;
  int iVar2;
  int iVar3;
  button *pbVar4;
  size_t sVar5;
  
                    /* Unresolved local var: int length@[???] */
  sVar1 = strlen(word);
  this->height = DAT_089dc49c;
  this->width = (float)(int)(sVar1 * 5);
  iVar2 = 0;
  do {
                    /* Unresolved local var: int i@[???] */
    iVar3 = iVar2 + 4;
    *(undefined4 *)((int)this->characters + iVar2) = 0xffffffff;
    iVar2 = iVar3;
  } while (iVar3 != 0x104);
                    /* Unresolved local var: int i@[DW_OP_reg6(a2)] */
  if ((int)sVar1 < 1) {
LAB_0890a668:
    if (0 < fade_alpha) {
      this->isFadeing = true;
      this->effect_alpha = fade_alpha;
      this->color[3] = 0;
    }
    return;
  }
  sVar5 = 0;
  pbVar4 = this;
LAB_0890a614:
  do {
    pbVar4->characters[0] = -1;
    switch(word[sVar5] + -0x20) {
    case '\0':
      pbVar4->characters[0] = 0x24;
      break;
    case '\x01':
    case '\x02':
    case '\x04':
    case '\x05':
    case '\x06':
    case '\a':
    case '\b':
    case '\t':
    case '\n':
    case '\v':
    case '\r':
    case '\x0f':
    case '\x1b':
    case '\x1d':
    case '\x1f':
    case ' ':
    case '!':
    case '\"':
    case '#':
    case '$':
    case '%':
    case '&':
    case '\'':
    case '(':
    case ')':
    case '*':
    case '+':
    case ',':
    case '-':
    case '.':
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '7':
    case '9':
    case ':':
    case '<':
    case '>':
    case '?':
    case '@':
    case '[':
      break;
    case '\x03':
      pbVar4->characters[0] = 0x2c;
      break;
    case '\f':
      pbVar4->characters[0] = 0x29;
      break;
    case '\x0e':
      pbVar4->characters[0] = 0x28;
      break;
    case '\x10':
      pbVar4->characters[0] = 0x1a;
      break;
    case '\x11':
      pbVar4->characters[0] = 0x1b;
      break;
    case '\x12':
      pbVar4->characters[0] = 0x1c;
      break;
    case '\x13':
      pbVar4->characters[0] = 0x1d;
      break;
    case '\x14':
      pbVar4->characters[0] = 0x1e;
      break;
    case '\x15':
      pbVar4->characters[0] = 0x1f;
      break;
    case '\x16':
      pbVar4->characters[0] = 0x20;
      break;
    case '\x17':
      pbVar4->characters[0] = 0x21;
      break;
    case '\x18':
      pbVar4->characters[0] = 0x22;
      break;
    case '\x19':
      pbVar4->characters[0] = 0x23;
      break;
    case '\x1a':
      pbVar4->characters[0] = 0x25;
      break;
    case '\x1c':
      pbVar4->characters[0] = 0x26;
      break;
    case '\x1e':
      pbVar4->characters[0] = 0x27;
      break;
    case '/':
      pbVar4->characters[0] = 0x2d;
      break;
    case '6':
      pbVar4->characters[0] = 0x2e;
      break;
    case '8':
      pbVar4->characters[0] = 0x2f;
      break;
    case ';':
    case '\\':
      goto switchD_0890a64c_caseD_3b;
    case '=':
      pbVar4->characters[0] = 0x2b;
      break;
    case 'A':
      pbVar4->characters[0] = 0;
      break;
    case 'B':
      pbVar4->characters[0] = 1;
      break;
    case 'C':
      pbVar4->characters[0] = 2;
      break;
    case 'D':
      pbVar4->characters[0] = 3;
      break;
    case 'E':
      pbVar4->characters[0] = 4;
      break;
    case 'F':
      pbVar4->characters[0] = 5;
      break;
    case 'G':
      pbVar4->characters[0] = 6;
      break;
    case 'H':
      pbVar4->characters[0] = 7;
      break;
    case 'I':
      pbVar4->characters[0] = 8;
      break;
    case 'J':
      pbVar4->characters[0] = 9;
      break;
    case 'K':
      pbVar4->characters[0] = 10;
      break;
    case 'L':
      pbVar4->characters[0] = 0xb;
      break;
    case 'M':
      pbVar4->characters[0] = 0xc;
      break;
    case 'N':
      pbVar4->characters[0] = 0xd;
      break;
    case 'O':
      pbVar4->characters[0] = 0xe;
      break;
    case 'P':
      pbVar4->characters[0] = 0xf;
      break;
    case 'Q':
      pbVar4->characters[0] = 0x10;
      break;
    case 'R':
      pbVar4->characters[0] = 0x11;
      break;
    case 'S':
      pbVar4->characters[0] = 0x12;
      break;
    case 'T':
      pbVar4->characters[0] = 0x13;
      break;
    case 'U':
      pbVar4->characters[0] = 0x14;
      break;
    case 'V':
      pbVar4->characters[0] = 0x15;
      break;
    case 'W':
      pbVar4->characters[0] = 0x16;
      break;
    case 'X':
      pbVar4->characters[0] = 0x17;
      break;
    case 'Y':
      pbVar4->characters[0] = 0x18;
      break;
    case 'Z':
      pbVar4->characters[0] = 0x19;
      break;
    default:
      goto switchD_0890a64c_default;
    }
switchD_0890a64c_default:
    sVar5 = sVar5 + 1;
    pbVar4 = (button *)&pbVar4->x;
  } while (sVar1 != sVar5);
  goto LAB_0890a668;
switchD_0890a64c_caseD_3b:
  sVar5 = sVar5 + 1;
  pbVar4->characters[0] = 0x2a;
  pbVar4 = (button *)&pbVar4->x;
  if (sVar1 == sVar5) goto LAB_0890a668;
  goto LAB_0890a614;
}



----------------------------------------

// Function: who_is @ 0890a8d4

/* DWARF original prototype: int who_is(stage_interface * this, int x, int y) */

int __thiscall stage_interface::who_is(stage_interface *this,int x,int y)

{
  button *pbVar1;
  button **ppbVar2;
  int iVar3;
  
                    /* Unresolved local var: int who@[???] */
  ppbVar2 = this->buttons;
  iVar3 = 0;
                    /* Unresolved local var: int i@[DW_OP_reg11(t3)] */
  pbVar1 = *ppbVar2;
  while( true ) {
    ppbVar2 = ppbVar2 + 1;
    if ((((0 < pbVar1->left + pbVar1->top + pbVar1->right + pbVar1->bottom) && (pbVar1->left <= x))
        && (x <= pbVar1->right)) && ((y <= pbVar1->top && (pbVar1->bottom <= y)))) break;
    iVar3 = iVar3 + 1;
    if (iVar3 == 0x28) {
      return -1;
    }
    pbVar1 = *ppbVar2;
  }
  return iVar3;
}



----------------------------------------

// Function: catch_key @ 0890a948

/* DWARF original prototype: int catch_key(stage_interface * this, int key) */

int __thiscall stage_interface::catch_key(stage_interface *this,int key)

{
  stage_interface *psVar1;
  int iVar2;
  button *pbVar3;
  
                    /* Unresolved local var: int who@[???]
                       Unresolved local var: int action@[???] */
                    /* Unresolved local var: int i@[???] */
  psVar1 = this;
  iVar2 = 0;
  while( true ) {
    pbVar3 = psVar1->buttons[0];
    if ((pbVar3->key == key) && (pbVar3->enabled != false)) break;
    if (iVar2 + 4 == 0xa0) {
      pbVar3 = this->buttons[5];
      this->buttons[4]->color[3] = 0;
      pbVar3->color[3] = 0;
      return -1;
    }
    psVar1 = (stage_interface *)((int)this->buttons + iVar2);
    iVar2 = iVar2 + 4;
  }
  iVar2 = pbVar3->action;
  pbVar3 = this->buttons[5];
  this->buttons[4]->color[3] = 0;
  pbVar3->color[3] = 0;
  return iVar2;
}



----------------------------------------

// Function: catch_tap @ 0890a9a8

/* DWARF original prototype: int catch_tap(stage_interface * this, int x, int y, int type) */

int __thiscall stage_interface::catch_tap(stage_interface *this,int x,int y,int type)

{
  button *pbVar1;
  int iVar2;
  button *pbVar3;
  button **ppbVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int who@[DW_OP_reg24(t8)]
                       Unresolved local var: int action@[???] */
  ppbVar4 = this->buttons;
  iVar5 = 0;
  iVar6 = -1;
                    /* Unresolved local var: int i@[DW_OP_reg14(t6)] */
  pbVar3 = *ppbVar4;
  while( true ) {
    ppbVar4 = ppbVar4 + 1;
    if ((((0 < pbVar3->left + pbVar3->top + pbVar3->right + pbVar3->bottom) &&
         (pbVar3->enabled != false)) && (pbVar3->left <= x)) &&
       (((x <= pbVar3->right && (y <= pbVar3->top)) &&
        ((pbVar3->bottom <= y && (iVar6 = iVar5, type == pbVar3->action_type)))))) break;
    iVar5 = iVar5 + 1;
    if (iVar5 == 0x28) {
      iVar2 = -1;
      iVar5 = iVar6;
LAB_0890aa28:
      pbVar3 = this->buttons[5];
      pbVar1 = this->buttons[4];
      pbVar1->color[3] = 0;
      pbVar3->color[3] = 0;
      if (type == 0) {
        if (iVar5 == 4) {
          pbVar1->color[3] = 0x19;
          return iVar2;
        }
        if (iVar5 == 5) {
          pbVar3->color[3] = 0x19;
          return iVar2;
        }
      }
      return iVar2;
    }
    pbVar3 = *ppbVar4;
  }
  iVar2 = pbVar3->action;
  goto LAB_0890aa28;
}



----------------------------------------

// Function: activate_buttons @ 0890aa7c

/* DWARF original prototype: void activate_buttons(stage_interface * this, int * id_enableds, int
   enableds) */

void __thiscall
stage_interface::activate_buttons(stage_interface *this,int *id_enableds,int enableds)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  button *pbVar4;
  int iVar5;
  stage_interface *psVar6;
  uint uVar7;
  
  iVar5 = 0;
  uVar7 = 0xfffffffc;
  psVar6 = this;
  do {
    psVar6 = (stage_interface *)psVar6->buttons;
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
    pbVar4 = *(button **)psVar6;
    if (pbVar4->action != -1) {
      if (1 < uVar7) {
        pbVar4->color[3] = 0x28;
      }
      if (iVar5 == 0x1e) {
        this->buttons[0x1e]->color[3] = 0x96;
      }
                    /* Unresolved local var: int j@[DW_OP_reg7(a3)] */
      pbVar4->enabled = false;
      if (0 < enableds) {
        iVar3 = 0;
        piVar2 = id_enableds;
LAB_0890aae4:
        iVar1 = *piVar2;
        do {
          iVar3 = iVar3 + 1;
          piVar2 = piVar2 + 1;
          if (iVar1 == iVar5) {
            pbVar4->enabled = true;
            if (1 < uVar7) {
              pbVar4->color[3] = 0xff;
            }
            if (iVar5 == 0x1d) goto code_r0x0890ab30;
          }
          if (enableds == iVar3) break;
          iVar1 = *piVar2;
        } while( true );
      }
    }
LAB_0890ab00:
    iVar5 = iVar5 + 1;
    uVar7 = uVar7 + 1;
    if (iVar5 == 0x28) {
      return;
    }
  } while( true );
code_r0x0890ab30:
  this->buttons[0x1e]->color[3] = 0xff;
  if (enableds == iVar3) goto LAB_0890ab00;
  goto LAB_0890aae4;
}



----------------------------------------

// Function: print_staff @ 0890ab4c

/* DWARF original prototype: void print_staff(stage_interface * this, int zNear) */

void __thiscall stage_interface::print_staff(stage_interface *this,int zNear)

{
  return;
}



----------------------------------------

// Function: print_solo_interface @ 0890ab54

/* DWARF original prototype: void print_solo_interface(stage_interface * this, int zNear) */

void __thiscall stage_interface::print_solo_interface(stage_interface *this,int zNear)

{
  button *this_00;
  float in_a2;
  float in_a3;
  GLfloat unaff_retaddr;
  GLfloat unaff_f20;
  GLfloat unaff_f21;
  GLfloat unaff_f22;
  int in_stack_00000010;
  GLfloat in_stack_ffffffec;
  GLfloat in_stack_fffffffc;
  
  glinterface::lookat(this->locator,(GLfloat)zNear,in_a2,in_a3,unaff_retaddr,in_stack_ffffffec,
                      unaff_f20,unaff_f21,unaff_f22,in_stack_fffffffc);
  button::print(this->buttons[0xd],0.0,in_a2,in_a3,(int)unaff_retaddr);
  button::show_skeleton(this->buttons[0xd]);
  button::print(this->buttons[6],0.0,in_a2,in_a3,(int)unaff_retaddr);
  button::print(this->buttons[0x1d],0.0,in_a2,in_a3,(int)unaff_retaddr);
  button::show_skeleton(this->buttons[0x1d]);
  button::print(this->buttons[0],0.0,in_a2,in_a3,(int)unaff_retaddr);
  this_00 = this->buttons[1];
  this_00->color[1] = 0x96;
  this_00->color[0] = 0;
  this_00->color[2] = 0;
  button::print(this_00,0.0,in_a2,in_a3,in_stack_00000010);
  return;
}



----------------------------------------

// Function: print_tutorial_interface @ 0890ac94

/* DWARF original prototype: void print_tutorial_interface(stage_interface * this, int zNear, bool
   isTutorial) */

void __thiscall
stage_interface::print_tutorial_interface(stage_interface *this,int zNear,bool isTutorial)

{
  button *pbVar1;
  undefined3 in_register_00000019;
  float fVar2;
  float in_a3;
  GLfloat unaff_s2;
  GLfloat unaff_s3;
  GLfloat unaff_retaddr;
  GLfloat unaff_f20;
  int in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  GLfloat in_stack_fffffff4;
  GLfloat in_stack_fffffffc;
  
  fVar2 = (float)CONCAT31(in_register_00000019,isTutorial);
  glinterface::lookat(this->locator,(GLfloat)zNear,fVar2,in_a3,unaff_s2,unaff_s3,unaff_retaddr,
                      in_stack_fffffff4,unaff_f20,in_stack_fffffffc);
  button::print(this->buttons[0xd],0.0,fVar2,in_a3,(int)unaff_s2);
  button::show_skeleton(this->buttons[0xd]);
  fVar2 = (float)(zNear * -10);
  button::print(this->buttons[6],0.0,fVar2,in_a3,(int)unaff_s2);
  if (isTutorial) {
    button::print(this->buttons[0x1e],0.0,fVar2,in_a3,(int)unaff_s2);
    button::show_skeleton(this->buttons[0x1e]);
    pbVar1 = this->buttons[4];
  }
  else {
    pbVar1 = this->buttons[4];
  }
  if (0 < pbVar1->color[3]) {
    glinterface::square(pbVar1->printer,3.57331e-43,0.0,0.0,(int)unaff_s2,(int)unaff_s3,
                        (int)unaff_retaddr,(int)in_stack_fffffff4,unaff_f20);
  }
  if (0 < this->buttons[5]->color[3]) {
    glinterface::square(this->buttons[5]->printer,0.0,0.0,3.57331e-43,in_stack_00000010,
                        in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
    return;
  }
  return;
}



----------------------------------------

// Function: print_train_interface @ 0890ae50

/* DWARF original prototype: void print_train_interface(stage_interface * this, int zNear) */

void __thiscall stage_interface::print_train_interface(stage_interface *this,int zNear)

{
  float in_a2;
  float y;
  float in_a3;
  float z;
  GLfloat unaff_retaddr;
  GLfloat unaff_f20;
  GLfloat unaff_f21;
  GLfloat in_stack_00000000;
  GLfloat in_stack_00000004;
  int in_stack_00000010;
  GLfloat in_stack_fffffff4;
  
  glinterface::lookat(this->locator,(GLfloat)zNear,in_a2,in_a3,unaff_retaddr,in_stack_fffffff4,
                      unaff_f20,unaff_f21,in_stack_00000000,in_stack_00000004);
  button::print(this->buttons[0xe],0.0,in_a2,in_a3,(int)unaff_retaddr);
  button::show_skeleton(this->buttons[0xe]);
  button::print(this->buttons[0xd],0.0,in_a2,in_a3,(int)unaff_retaddr);
  button::show_skeleton(this->buttons[0xd]);
  if (0 < this->buttons[4]->color[3]) {
    glinterface::square(this->buttons[4]->printer,3.57331e-43,0.0,0.0,(int)unaff_retaddr,
                        (int)in_stack_fffffff4,(int)unaff_f20,(int)unaff_f21,in_stack_00000000);
  }
  y = 0.0;
  z = 3.57331e-43;
  if (0 < this->buttons[5]->color[3]) {
    glinterface::square(this->buttons[5]->printer,0.0,0.0,3.57331e-43,(int)unaff_retaddr,
                        (int)in_stack_fffffff4,(int)unaff_f20,(int)unaff_f21,in_stack_00000000);
  }
  button::print(this->buttons[6],0.0,y,z,in_stack_00000010);
  return;
}



----------------------------------------

// Function: print_game_interface @ 0890afc0

/* DWARF original prototype: void print_game_interface(stage_interface * this, int zNear, int
   game_status, int colision) */

void __thiscall
stage_interface::print_game_interface(stage_interface *this,int zNear,int game_status,int colision)

{
  button *pbVar1;
  button *pbVar2;
  float y;
  GLfloat unaff_s2;
  GLfloat unaff_s3;
  GLfloat unaff_s4;
  GLfloat unaff_s5;
  GLfloat unaff_retaddr;
  GLfloat in_stack_ffffffec;
  
  y = (float)game_status;
  glinterface::lookat(this->locator,(GLfloat)zNear,(GLfloat)game_status,(GLfloat)colision,unaff_s2,
                      unaff_s3,unaff_s4,unaff_s5,unaff_retaddr,in_stack_ffffffec);
  if (game_status == 0xc) {
    button::print(this->buttons[0x25],0.0,y,(float)colision,(int)unaff_s2);
    button::show_skeleton(this->buttons[0x25]);
    button::print(this->buttons[0x24],0.0,y,(float)colision,(int)unaff_s2);
    button::show_skeleton(this->buttons[0x24]);
    button::print(this->buttons[2],0.0,y,(float)colision,(int)unaff_s2);
    button::print(this->buttons[0],0.0,y,(float)colision,(int)unaff_s2);
  }
  else {
    button::print(this->buttons[6],0.0,y,(float)colision,(int)unaff_s2);
    button::print(this->buttons[2],0.0,y,(float)colision,(int)unaff_s2);
    button::print(this->buttons[0],0.0,y,(float)colision,(int)unaff_s2);
    if (game_status == 8) {
      pbVar1 = this->buttons[1];
      pbVar2 = this->buttons[3];
      pbVar2->color[0] = 0x96;
      pbVar2->color[1] = 0;
      pbVar2->color[2] = 0;
      pbVar1->color[1] = 0x96;
      pbVar1->color[2] = 0;
      pbVar1->color[0] = 0;
      button::print(pbVar2,0.0,y,(float)colision,(int)unaff_s2);
      button::print(this->buttons[1],0.0,y,(float)colision,(int)unaff_s2);
      y = (float)(zNear * -2);
      button::print(this->buttons[0x1a],0.0,y,(float)colision,(int)unaff_s2);
      button::show_skeleton(this->buttons[0x1a]);
      goto LAB_0890b1bc;
    }
  }
  if (0 < this->buttons[4]->color[3]) {
    y = 0.0;
    colision = 0;
    glinterface::square(this->buttons[4]->printer,3.57331e-43,0.0,0.0,(int)unaff_s2,(int)unaff_s3,
                        (int)unaff_s4,(int)unaff_s5,unaff_retaddr);
  }
  if (0 < this->buttons[5]->color[3]) {
    y = 0.0;
    colision = 0xff;
    glinterface::square(this->buttons[5]->printer,0.0,0.0,3.57331e-43,(int)unaff_s2,(int)unaff_s3,
                        (int)unaff_s4,(int)unaff_s5,unaff_retaddr);
  }
  pbVar2 = this->buttons[1];
  pbVar1 = this->buttons[3];
  pbVar1->color[2] = 0xff;
  pbVar1->color[0] = 0xff;
  pbVar1->color[1] = 0xff;
  pbVar2->color[2] = 0xff;
  pbVar2->color[0] = 0xff;
  pbVar2->color[1] = 0xff;
  button::print(pbVar2,0.0,y,(float)colision,(int)unaff_s2);
  button::print(this->buttons[3],0.0,y,(float)colision,(int)unaff_s2);
LAB_0890b1bc:
  button::print(this->buttons[0xd],0.0,y,(float)colision,(int)unaff_s2);
  button::show_skeleton(this->buttons[0xd]);
  return;
}



----------------------------------------

// Function: print_menu_interface @ 0890b364

/* DWARF original prototype: void print_menu_interface(stage_interface * this, int zNear) */

void __thiscall stage_interface::print_menu_interface(stage_interface *this,int zNear)

{
  button *pbVar1;
  float fVar2;
  float z;
  int unaff_s0;
  int unaff_retaddr;
  int unaff_f20;
  int unaff_f21;
  GLfloat unaff_f22;
  int in_stack_00000010;
  int in_stack_00000014;
  int in_stack_00000018;
  int in_stack_0000001c;
  GLfloat in_stack_00000020;
  float local_30 [4];
  
                    /* Unresolved local var: int[3] alphas@[???] */
  z = (float)this->actual_option;
  local_30[0] = print_menu_interface(int)::C_11;
  local_30[1] = (float)DAT_089de214;
  local_30[2] = DAT_089de218;
  if ((int)z < 4) {
    fVar2 = DAT_089de218;
    button::print(this->buttons[7],1.4013e-45,DAT_089de218,z,unaff_s0);
    button::print(this->buttons[8],5.60519e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[9],2.8026e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[10],4.2039e-45,fVar2,z,in_stack_00000010);
    return;
  }
  if ((int)z - 4U < 4) {
    fVar2 = DAT_089de218;
    button::print(this->buttons[0xf],1.4013e-45,DAT_089de218,z,unaff_s0);
    button::print(this->buttons[0x20],1.4013e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[0x10],5.60519e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[0x1f],5.60519e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[0x11],2.8026e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[0x21],2.8026e-45,fVar2,z,unaff_s0);
    button::print(this->buttons[0x12],4.2039e-45,fVar2,z,in_stack_00000010);
    return;
  }
  fVar2 = DAT_089de218;
  button::print(this->buttons[0x15],1.4013e-45,DAT_089de218,z,unaff_s0);
  if (this->actual_option == 8) {
    button::print(this->buttons[0x19],1.4013e-45,fVar2,z,unaff_s0);
  }
  button::print(this->buttons[0x17],5.60519e-45,fVar2,z,unaff_s0);
  button::print(this->buttons[0x16],2.8026e-45,fVar2,z,unaff_s0);
  button::print(this->buttons[0x18],4.2039e-45,fVar2,z,unaff_s0);
  if (this->actual_option == 10) {
    pbVar1 = this->buttons[0x16];
    local_30[this->choosen_color] = 2.10195e-43;
    glinterface::solid_cube
              (pbVar1->printer,0.0,1.4013e-43,2.10195e-44,unaff_s0,unaff_retaddr,unaff_f20,unaff_f21
               ,unaff_f22);
    glinterface::solid_cube
              (this->buttons[0x16]->printer,1.4013e-43,1.4013e-44,1.4013e-43,unaff_s0,unaff_retaddr,
               unaff_f20,unaff_f21,unaff_f22);
    glinterface::solid_cube
              (this->buttons[0x16]->printer,0.0,9.80909e-44,2.10195e-43,in_stack_00000010,
               in_stack_00000014,in_stack_00000018,in_stack_0000001c,in_stack_00000020);
    return;
  }
  return;
}



----------------------------------------

// Function: print_intro @ 0890b718

/* DWARF original prototype: void print_intro(stage_interface * this, int intro_step) */

void __thiscall stage_interface::print_intro(stage_interface *this,int intro_step)

{
  int iVar1;
  int unaff_s4;
  int unaff_s5;
  int unaff_s6;
  int unaff_s7;
  GLfloat unaff_retaddr;
  int in_stack_fffffffc;
  
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???] */
  iVar1 = 0;
  do {
    if (iVar1 <= intro_step) {
      if ((intro_step == iVar1) || (iVar1 == 0x5d)) {
        glinterface::square_3D
                  (this->locator,0.0,3.57331e-43,0.0,unaff_s4,unaff_s5,unaff_s6,unaff_s7,
                   unaff_retaddr,in_stack_fffffffc);
      }
      else {
                    /* Unresolved local var: int i@[???] */
        glinterface::square_3D
                  (this->locator,3.57331e-43,3.57331e-43,3.57331e-43,unaff_s4,unaff_s5,unaff_s6,
                   unaff_s7,unaff_retaddr,in_stack_fffffffc);
      }
    }
    iVar1 = iVar1 + 1;
  } while (iVar1 != 0x5e);
  return;
}



----------------------------------------

// Function: change_color @ 0890b830

/* DWARF original prototype: void change_color(miniature * this, int r, int g, int b, int a) */

void __thiscall miniature::change_color(miniature *this,int r,int g,int b,int a)

{
  int in_t0;
  
  this->color[3] = in_t0;
  this->color[0] = r;
  this->color[1] = g;
  this->color[2] = b;
  return;
}



----------------------------------------

// Function: convert_to_plane @ 0890b844

/* WARNING: Removing unreachable block (ram,0x0890ba90) */
/* WARNING: Removing unreachable block (ram,0x0890ba20) */
/* WARNING: Removing unreachable block (ram,0x0890ba00) */
/* WARNING: Removing unreachable block (ram,0x0890ba10) */
/* WARNING: Removing unreachable block (ram,0x0890ba80) */
/* WARNING: Removing unreachable block (ram,0x0890baa0) */
/* DWARF original prototype: plane * convert_to_plane(miniature * this, int cube, int face_number,
   int id_plane, int side_size) */

plane * __thiscall
miniature::convert_to_plane(miniature *this,int cube,int face_number,int id_plane,int side_size)

{
  plane *ppVar1;
  plane *ppVar2;
  int (*paiVar3) [20];
  int iVar4;
  int in_t0;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int dead_offset@[???]
                       Unresolved local var: int dead_axis@[???]
                       Unresolved local var: int axis_polarity@[???]
                       Unresolved local var: int[7] data@[???]
                       Unresolved local var: plane * temp_plane@[???] */
  switch(face_number) {
  default:
    iVar7 = 0;
    iVar5 = 0;
    iVar6 = 0;
    iVar9 = 0;
    iVar8 = 0;
    goto LAB_0890b8b4;
  case 1:
    iVar9 = 3;
    iVar6 = this->vertex[cube][2];
    iVar7 = this->vertex[cube][0];
    iVar4 = this->vertex[cube][1];
    break;
  case 2:
    iVar9 = 2;
    iVar6 = this->vertex[cube][1];
    iVar7 = this->vertex[cube][0];
    iVar4 = this->vertex[cube][2];
    goto LAB_0890ba78;
  case 3:
    iVar9 = 1;
    iVar6 = this->vertex[cube][0];
    iVar7 = this->vertex[cube][1];
    iVar4 = this->vertex[cube][2];
    break;
  case 4:
    iVar9 = 3;
    iVar6 = this->vertex[cube][2];
    iVar7 = this->vertex[cube][0];
    iVar4 = this->vertex[cube][1];
    goto LAB_0890ba78;
  case 5:
    iVar9 = 2;
    iVar6 = this->vertex[cube][1];
    iVar7 = this->vertex[cube][0];
    iVar4 = this->vertex[cube][2];
    break;
  case 6:
    iVar9 = 1;
    iVar6 = this->vertex[cube][0];
    iVar7 = this->vertex[cube][1];
    iVar4 = this->vertex[cube][2];
LAB_0890ba78:
    iVar8 = -1;
    iVar5 = in_t0 + -1;
    iVar6 = iVar5 * (iVar6 / 2);
    iVar7 = (iVar7 / 2) * iVar5;
    iVar5 = iVar5 * (iVar4 / 2);
    goto LAB_0890b8b4;
  }
  iVar8 = 1;
  iVar5 = in_t0 + -1;
  iVar6 = in_t0 + iVar5 * (iVar6 / 2) + -1;
  iVar7 = (iVar7 / 2) * iVar5;
  iVar5 = iVar5 * (iVar4 / 2);
LAB_0890b8b4:
  ppVar1 = operator_new(0x1fb0);
  ppVar1->ident = id_plane;
  ppVar1->i = iVar7;
  ppVar1->j = iVar5;
  ppVar1->side_size = in_t0;
  ppVar1->dead_axis = iVar9;
  ppVar1->dead_offset = iVar6;
  ppVar1->face_number = face_number;
  ppVar1->axis_polarity = iVar8;
  ppVar1->id_union_right = -1;
  ppVar1->id_union_top = -1;
  ppVar1->id_union_left = -1;
  ppVar1->id_union_bottom = -1;
  ppVar2 = ppVar1;
  iVar6 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar7 = iVar6 + 4;
    ppVar2->cam_positions[0][0] = 0;
    ppVar2->cam_positions[0][1] = 0;
    ppVar2->cam_positions[0][2] = 0;
    *(undefined4 *)((int)ppVar1->pieces + iVar6) = 0;
    ppVar2 = (plane *)&ppVar2->side_size;
    iVar6 = iVar7;
  } while (iVar7 != 0x640);
  iVar6 = 0;
  do {
    iVar7 = 0;
    paiVar3 = ppVar1->index + iVar6;
    do {
                    /* Unresolved local var: void anon_var_0@[???] */
      iVar7 = iVar7 + 1;
      (*paiVar3)[0] = 0;
      paiVar3 = (int (*) [20])(*paiVar3 + 1);
    } while (iVar7 != 0x14);
    iVar6 = iVar6 + 1;
  } while (iVar6 != 0x14);
  ppVar1->a_vertex[0] = 0;
  ppVar1->a_vertex[1] = 0;
  ppVar1->a_vertex[2] = 0;
  ppVar1->b_vertex[0] = 0;
  ppVar1->b_vertex[1] = 0;
  ppVar1->b_vertex[2] = 0;
  ppVar1->c_vertex[0] = 0;
  ppVar1->c_vertex[1] = 0;
  ppVar1->c_vertex[2] = 0;
  ppVar1->d_vertex[0] = 0;
  ppVar1->d_vertex[1] = 0;
  ppVar1->d_vertex[2] = 0;
  ppVar1->max_vertex[0] = 0;
  ppVar1->max_vertex[1] = 0;
  ppVar1->max_vertex[2] = 0;
  ppVar1->visited = false;
  return ppVar1;
}



----------------------------------------

// Function: print @ 0890bb84

/* WARNING: Removing unreachable block (ram,0x0890bbc8) */
/* WARNING: Removing unreachable block (ram,0x0890bbf4) */
/* DWARF original prototype: void print(miniature * this) */

void __thiscall miniature::print(miniature *this)

{
  int iVar1;
  int iVar2;
  int unaff_f20;
  int unaff_f21;
  int unaff_f22;
  GLfloat in_stack_00000000;
  int in_stack_fffffffc;
  
                    /* Unresolved local var: float x_pos@[???]
                       Unresolved local var: float z_pos@[???] */
  iVar1 = this->min_vertex[2] + this->offset[2] +
          ((this->max_vertex[2] - this->min_vertex[2]) / 4) * 2;
  iVar2 = this->min_vertex[0] + this->offset[0] +
          ((this->max_vertex[0] - this->min_vertex[0]) / 4) * 2;
  glPushMatrix();
  glTranslatef((float)iVar2,(float)this->paint_pos[0][1],(float)iVar1);
  glRotatef((float)this->rotation,0.0,DAT_089dbce4,0.0);
  glTranslatef(-(float)iVar2,(float)-this->paint_pos[0][1],-(float)iVar1);
                    /* Unresolved local var: int i@[???] */
  if (0 < this->cubes) {
    iVar1 = 0;
    do {
      glinterface::solid_cube
                (this->printer,(GLfloat)this->color[0],(GLfloat)this->color[1],
                 (GLfloat)this->color[2],unaff_f20,unaff_f21,unaff_f22,in_stack_fffffffc,
                 in_stack_00000000);
      glinterface::cube_skeleton
                (this->printer,3.57331e-43,3.57331e-43,3.57331e-43,unaff_f20,unaff_f21,unaff_f22,
                 in_stack_fffffffc,in_stack_00000000);
      iVar1 = iVar1 + 1;
    } while (iVar1 < this->cubes);
  }
  glPopMatrix();
  return;
}



----------------------------------------

// Function: play_effect @ 0890bd18

/* DWARF original prototype: void play_effect(sound_mixer * this, int ident) */

void __thiscall sound_mixer::play_effect(sound_mixer *this,int ident)

{
  if (this->refresh_effects == false) {
    this->refresh_effects = true;
  }
  this->effects[ident] = true;
  return;
}



----------------------------------------

// Function: play_music @ 0890bd38

/* DWARF original prototype: void play_music(sound_mixer * this, int ident) */

void __thiscall sound_mixer::play_music(sound_mixer *this,int ident)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  if (this->refresh_music == false) {
    this->refresh_music = true;
                    /* Unresolved local var: int i@[DW_OP_reg6(a2)] */
    iVar3 = this->TOTAL_MUSIC;
  }
  else {
    iVar3 = this->TOTAL_MUSIC;
  }
  if (0 < iVar3) {
    iVar1 = 0;
    do {
      iVar2 = iVar1 + 1;
      this->music[iVar1] = false;
      iVar1 = iVar2;
    } while (iVar2 < iVar3);
  }
  this->music[ident] = true;
  return;
}



----------------------------------------

// Function: stop_all @ 0890bd80

/* DWARF original prototype: void stop_all(sound_mixer * this, int type) */

void __thiscall sound_mixer::stop_all(sound_mixer *this,int type)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  if (type == 0) {
                    /* Unresolved local var: int i@[???] */
    iVar3 = this->TOTAL_SOUNDS;
    this->refresh_effects = true;
    iVar2 = 0;
    if (0 < iVar3) {
      do {
        iVar1 = iVar2 + 1;
        this->effects[iVar2] = false;
        iVar2 = iVar1;
      } while (iVar1 < iVar3);
    }
  }
  else {
    iVar2 = this->TOTAL_MUSIC;
                    /* Unresolved local var: int i@[DW_OP_reg5(a1)] */
    this->refresh_music = true;
    if (0 < iVar2) {
      iVar3 = 0;
      do {
        iVar1 = iVar3 + 1;
        this->music[iVar3] = false;
        iVar3 = iVar1;
      } while (iVar1 < iVar2);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: move_lookat @ 0890bde0

/* DWARF original prototype: bool move_lookat(neutron * this, camera * cam, float x, float y, float
   z, int speed) */

bool __thiscall neutron::move_lookat(neutron *this,camera *cam,float x,float y,float z,int speed)

{
  float fVar1;
  float in_f12;
  float in_f13;
  float in_f14;
  
  fVar1 = cam->x_dir;
  if (fVar1 != in_f12) {
    if (in_f12 < fVar1) {
      cam->x_dir = fVar1 - (float)(int)x;
      return false;
    }
    cam->x_dir = fVar1 + (float)(int)x;
    return false;
  }
  fVar1 = cam->z_dir;
  if (fVar1 != in_f14) {
    if (in_f14 < fVar1) {
      cam->z_dir = fVar1 - (float)(int)x;
      return false;
    }
    cam->z_dir = fVar1 + (float)(int)x;
    return false;
  }
  fVar1 = cam->y_dir;
  if (fVar1 == in_f13) {
    return true;
  }
  if (fVar1 <= in_f13) {
    cam->y_dir = fVar1 + (float)(int)x;
    return false;
  }
  cam->y_dir = fVar1 - (float)(int)x;
  return false;
}



----------------------------------------

// Function: move_camera @ 0890bee0

/* DWARF original prototype: bool move_camera(neutron * this, camera * cam, float x, float y, float
   z, int speed) */

bool __thiscall neutron::move_camera(neutron *this,camera *cam,float x,float y,float z,int speed)

{
  float fVar1;
  float in_f12;
  float in_f13;
  float in_f14;
  
  fVar1 = cam->x;
  if (fVar1 != in_f12) {
    if (in_f12 < fVar1) {
      cam->x = fVar1 - (float)(int)x;
      return false;
    }
    cam->x = fVar1 + (float)(int)x;
    return false;
  }
  fVar1 = cam->z;
  if (fVar1 != in_f14) {
    if (in_f14 < fVar1) {
      cam->z = fVar1 - (float)(int)x;
      return false;
    }
    cam->z = fVar1 + (float)(int)x;
    return false;
  }
  fVar1 = cam->y;
  if (fVar1 == in_f13) {
    return true;
  }
  if (fVar1 <= in_f13) {
    cam->y = fVar1 + (float)(int)x;
    return false;
  }
  cam->y = fVar1 - (float)(int)x;
  return false;
}



----------------------------------------

// Function: level_complete @ 0890bfe0

/* DWARF original prototype: int level_complete(neutron * this) */

int __thiscall neutron::level_complete(neutron *this)

{
  float in_a3;
  float in_stack_00000008;
  int in_stack_0000000c;
  
  move_camera(this,(this->proton->super_ship).cam_ship,1.4013e-45,in_a3,in_stack_00000008,
              in_stack_0000000c);
  return this->game_status;
}



----------------------------------------

// Function: wait_option @ 0890c024

/* DWARF original prototype: int wait_option(neutron * this) */

int __thiscall neutron::wait_option(neutron *this)

{
  return this->game_status;
}



----------------------------------------

// Function: show_miniatures @ 0890c02c

/* DWARF original prototype: int show_miniatures(neutron * this) */

int __thiscall neutron::show_miniatures(neutron *this)

{
  float in_a3;
  float in_stack_00000008;
  int in_stack_0000000c;
  
  move_camera(this,this->game_cam,1.4013e-45,in_a3,in_stack_00000008,in_stack_0000000c);
  move_lookat(this,this->game_cam,1.4013e-45,in_a3,in_stack_00000008,in_stack_0000000c);
  return this->game_status;
}



----------------------------------------

// Function: are_you_sure @ 0890c0bc

/* DWARF original prototype: int are_you_sure(neutron * this) */

int __thiscall neutron::are_you_sure(neutron *this)

{
  return this->game_status;
}



----------------------------------------

// Function: show_staff @ 0890c0c4

/* DWARF original prototype: int show_staff(neutron * this) */

int __thiscall neutron::show_staff(neutron *this)

{
  button *this_00;
  char *word;
  stage_interface *psVar1;
  
  psVar1 = this->interface;
  if (psVar1->actual_staff < 5) {
    if (99 < this->time) {
      this->time = 0;
      this_00 = psVar1->buttons[0x26];
      word = psVar1->whats[psVar1->actual_staff + 1];
      psVar1->actual_staff = psVar1->actual_staff + 1;
      button::load_text(this_00,word,200);
      psVar1 = this->interface;
      button::load_text(psVar1->buttons[0x27],psVar1->whos[psVar1->actual_staff],200);
      return this->game_status;
    }
    this->time = this->time + 1;
  }
  return this->game_status;
}



----------------------------------------

// Function: on_miniature_change @ 0890c168

/* WARNING: Removing unreachable block (ram,0x0890c22c) */
/* WARNING: Removing unreachable block (ram,0x0890c1fc) */
/* WARNING: Removing unreachable block (ram,0x0890c1d0) */
/* WARNING: Removing unreachable block (ram,0x0890c1a4) */
/* WARNING: Removing unreachable block (ram,0x0890c1c0) */
/* WARNING: Removing unreachable block (ram,0x0890c1e0) */
/* WARNING: Removing unreachable block (ram,0x0890c214) */
/* WARNING: Removing unreachable block (ram,0x0890c244) */
/* DWARF original prototype: void on_miniature_change(neutron * this) */

void __thiscall neutron::on_miniature_change(neutron *this)

{
  int iVar1;
  char local_10;
  char local_f;
  char local_e;
  char local_d;
  char local_c;
  char local_b;
  
                    /* Unresolved local var: char * score_string@[???]
                       Unresolved local var: char[6] score_buffer@[???]
                       Unresolved local var: int a@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int d@[???]
                       Unresolved local var: int e@[???]
                       Unresolved local var: int f@[???] */
  iVar1 = this->miniatures[this->actual_miniature]->high_score;
  local_10 = (char)(iVar1 / 100000) + '0';
  local_d = (char)((iVar1 % 1000) / 100) + '0';
  local_f = (char)((iVar1 % 100000) / 10000) + '0';
  local_e = (char)((iVar1 % 10000) / 1000) + '0';
  local_b = (char)((iVar1 % 100) % 10) + '0';
  local_c = (char)((iVar1 % 100) / 10) + '0';
  button::load_text(this->interface->buttons[1],&local_10,-1);
  return;
}



----------------------------------------

// Function: game_intro @ 0890c274

/* DWARF original prototype: int game_intro(neutron * this) */

int __thiscall neutron::game_intro(neutron *this)

{
  int iVar1;
  
  if (this->intro_step < 0x5e) {
    iVar1 = this->game_status;
    this->intro_step = this->intro_step + 1;
  }
  else {
    sound_mixer::play_effect(this->mixer,0);
    this->go_status = 0xb;
    this->time = 0x50;
    iVar1 = 4;
  }
  return iVar1;
}



----------------------------------------

// Function: load_miniatures @ 0890c2d0

/* DWARF original prototype: void load_miniatures(neutron * this) */

void __thiscall neutron::load_miniatures(neutron *this)

{
  miniature **ppmVar1;
  miniature *pmVar2;
  camera *pcVar3;
  neutron *pnVar4;
  int iVar5;
  int unaff_s4;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  
  pmVar2 = this->miniatures[0];
  this->actual_miniature = 0;
  pcVar3 = this->game_cam;
  iVar6 = pmVar2->cam[0];
  iVar7 = pmVar2->cam[1];
  iVar8 = pmVar2->cam[2];
  iVar9 = pmVar2->cam_center[0];
  iVar10 = pmVar2->cam_center[1];
  iVar5 = 0;
  pcVar3->z_dir = (float)pmVar2->cam_center[2];
  pcVar3->x = (float)iVar6;
  pcVar3->y = (float)iVar7;
  pcVar3->z = (float)iVar8;
  pcVar3->x_dir = (float)iVar9;
  pcVar3->y_dir = (float)iVar10;
  pnVar4 = this;
LAB_0890c3a0:
  iVar6 = this->user_stage;
  do {
    iVar5 = iVar5 + 1;
    iVar7 = 100;
    iVar8 = 100;
    iVar9 = 100;
    if (iVar5 <= iVar6) {
                    /* Unresolved local var: int i@[???] */
      iVar7 = 0;
      iVar8 = 0x82;
      iVar9 = 5;
      if (this->user_color != 0) {
        iVar7 = 0x82;
        iVar8 = 8;
        iVar9 = 0x82;
        if (this->user_color != 1) break;
      }
    }
    ppmVar1 = pnVar4->miniatures;
    pnVar4 = (neutron *)&pnVar4->user_stage;
    miniature::change_color(*ppmVar1,iVar7,iVar8,iVar9,unaff_s4);
    if (iVar5 == 0x19) goto LAB_0890c3d4;
    iVar6 = this->user_stage;
  } while( true );
  miniature::change_color(pnVar4->miniatures[0],8,0xaf,0xe1,unaff_s4);
  pnVar4 = (neutron *)&pnVar4->user_stage;
  if (iVar5 == 0x19) {
LAB_0890c3d4:
    this->miniatures[this->actual_miniature]->color[3] = 0xff;
    return;
  }
  goto LAB_0890c3a0;
}



----------------------------------------

// Function: create_miniatures @ 0890c40c

/* DWARF original prototype: void create_miniatures(neutron * this) */

void __thiscall neutron::create_miniatures(neutron *this)

{
  miniature *pmVar1;
  int unaff_s2;
  int unaff_s3;
  int iVar2;
  char *unaff_s4;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: int h_count@[???]
                       Unresolved local var: int v_count@[???]
                       Unresolved local var: int v_pos@[???]
                       Unresolved local var: int h_pos@[???] */
  iVar4 = 0;
  iVar3 = 0;
  do {
                    /* Unresolved local var: int i@[???] */
    iVar2 = iVar3 + 1;
    switch(iVar2) {
    case 1:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CUBE_MINI_DATA,1,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 2:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::RECTANGLE_MINI_DATA,2,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 3:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::ELLE_MINI_DATA,3,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 4:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::TE_MINI_DATA,4,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 5:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::DOUBLECUBE_MINI_DATA,2,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 6:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::ESE_MINI_DATA,4,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 7:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::V_MINI_DATA,3,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 8:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CRAZY_CROSS_MINI_DATA,4,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 9:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::DEATH_STAIRS_MINI_DATA,3,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 10:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CROSS_MINI_DATA,5,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0xb:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::ESE_CURVE_MINI_DATA,5,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0xc:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::TRIPOD_MINI_DATA,4,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0xd:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::KEOPS_MINI_DATA,9,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0xe:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::DOUBLE_CROSS_MINI_DATA,7,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0xf:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CORNER_MINI_DATA,8,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x10:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::MAGNET_MINI_DATA,7,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x11:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::DONUT_MINI_DATA,8,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x12:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CURVE_MINI_DATA,7,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x13:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::CASTLE_MINI_DATA,8,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x14:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::PIRAMID_MINI_DATA,8,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x15:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::KNOT_MINI_DATA,5,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x16:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::BLENDER_MINI_DATA,8,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x17:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::SHOES_MINI_DATA,9,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x18:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::DEATH_STAR_MINI_DATA,0xc,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
      break;
    case 0x19:
      pmVar1 = operator_new(0x1c8);
      miniature::miniature(pmVar1,::::HELIX_MINI_DATA,0xb,0,unaff_s2,unaff_s3,unaff_s4);
      this->miniatures[0] = pmVar1;
    }
    pmVar1 = this->miniatures[0];
    pmVar1->cam[0] = pmVar1->max_vertex[0] + -0xe;
    if (iVar3 < 5) {
      pmVar1->cam[1] = 4;
LAB_0890c4d4:
      pmVar1->cam[2] = pmVar1->cam_center[2];
      if (iVar4 < 4) goto LAB_0890c4e4;
LAB_0890c520:
      iVar4 = 0;
    }
    else {
      if (9 < iVar3) {
        if (iVar3 < 0xf) {
          pmVar1->cam[1] = -0x1c;
        }
        else if (iVar3 < 0x14) {
          pmVar1->cam[1] = -0x2a;
        }
        else {
          pmVar1->cam[1] = -0x38;
        }
        goto LAB_0890c4d4;
      }
      pmVar1->cam[1] = -0xc;
      pmVar1->cam[2] = pmVar1->cam_center[2];
      if (3 < iVar4) goto LAB_0890c520;
LAB_0890c4e4:
      iVar4 = iVar4 + 1;
    }
    if (iVar2 == 0x19) {
      return;
    }
    this = (neutron *)&this->user_stage;
    iVar3 = iVar2;
  } while( true );
}



----------------------------------------

// Function: delay_artifact @ 0890cb2c

/* WARNING: Removing unreachable block (ram,0x0890cb54) */
/* DWARF original prototype: void delay_artifact(neutron * this) */

void __thiscall neutron::delay_artifact(neutron *this)

{
  int iVar1;
  int iVar2;
  
  iVar2 = this->timer_artifact;
  iVar1 = rand();
  if (iVar1 % 200 + 100 <= iVar2) {
    this->actual_artifact = 1;
    this->timer_artifact = 0;
    return;
  }
  this->timer_artifact = this->timer_artifact + 1;
  return;
}



----------------------------------------

// Function: delay @ 0890cba8

/* DWARF original prototype: int delay(neutron * this, int status, int time) */

int __thiscall neutron::delay(neutron *this,int status,int time)

{
  int local_20;
  undefined4 local_1c;
  undefined4 local_18;
  
  if (this->timer < time) {
    status = this->game_status;
    this->timer = this->timer + 1;
  }
  else {
                    /* Unresolved local var: int[3] buttons@[???] */
    this->timer = 0;
    local_18 = DAT_089df1f8;
    local_1c = DAT_089df1f4;
    local_20 = delay(int,int)::C_30;
    if (status == 0xb) {
      this->vision = 1;
      stage_interface::activate_buttons(this->interface,&local_20,3);
      if (this->user_sound != false) {
        sound_mixer::play_music(this->mixer,0);
        return 0xb;
      }
    }
  }
  return status;
}



----------------------------------------

// Function: menu_move @ 0890cc60

/* DWARF original prototype: void menu_move(neutron * this, int side) */

void __thiscall neutron::menu_move(neutron *this,int side)

{
  int iVar1;
  uint uVar2;
  plane *ppVar3;
  terrain *ptVar4;
  stage_interface *this_00;
  int local_18;
  undefined4 local_14;
  undefined4 local_10;
  
                    /* Unresolved local var: int[3] buttons@[???] */
  if (side == 0) {
    this_00 = this->interface;
    iVar1 = this_00->actual_option;
    if (iVar1 < 4) {
      if (0 < iVar1) goto LAB_0890ce30;
      this_00->actual_option = 3;
    }
    else if (iVar1 - 4U < 4) {
      if (iVar1 != 4) goto LAB_0890ce30;
      this_00->actual_option = 7;
    }
    else if (iVar1 < 9) {
      this_00->actual_option = 0xb;
    }
    else {
LAB_0890ce30:
      this_00->actual_option = iVar1 + -1;
    }
LAB_0890ce34:
    iVar1 = this_00->actual_option;
LAB_0890ce38:
    ptVar4 = this->ground;
    ppVar3 = ptVar4->map[this_00->menu_option[iVar1]];
    iVar1 = ppVar3->dead_axis;
  }
  else {
    if (side == 1) {
      this_00 = this->interface;
      iVar1 = this_00->actual_option;
      if (iVar1 < 4) {
        if (iVar1 == 3) {
          this_00->actual_option = 0;
          goto LAB_0890cce0;
        }
LAB_0890cfa4:
        this_00->actual_option = iVar1 + 1;
      }
      else if (iVar1 - 4U < 4) {
        if (iVar1 < 7) goto LAB_0890cfa4;
        this_00->actual_option = 4;
      }
      else {
        if (iVar1 < 0xb) goto LAB_0890cfa4;
        this_00->actual_option = 8;
      }
      goto LAB_0890ce34;
    }
    this_00 = this->interface;
    if (side == 3) {
      if (this_00->actual_option == 0) {
        if (this->user_stage < 2) {
          this_00->actual_option = 4;
        }
        else {
          this_00->actual_option = 5;
        }
        iVar1 = this_00->actual_option;
      }
      else {
        iVar1 = this_00->actual_option;
      }
      if (iVar1 == 0xb) {
        this_00->actual_option = 0;
        goto LAB_0890cce0;
      }
      iVar1 = this_00->actual_option;
      goto LAB_0890ce38;
    }
    if (this_00->actual_option == 1) {
      this_00->actual_option = 9;
    }
    if (this_00->actual_option != 7) {
      iVar1 = this_00->actual_option;
      goto LAB_0890ce38;
    }
    this_00->actual_option = 0;
LAB_0890cce0:
    ptVar4 = this->ground;
    ppVar3 = ptVar4->map[this_00->menu_option[this_00->actual_option]];
    iVar1 = ppVar3->dead_axis;
  }
  if (iVar1 == 2) {
    this->move_ship[0] = ppVar3->a_vertex[0] + 10;
    this->move_ship[1] = ptVar4->map[this_00->menu_option[this_00->actual_option]]->dead_offset + 2;
    this->move_ship[2] = ptVar4->map[this_00->menu_option[this_00->actual_option]]->a_vertex[2] + 10
    ;
    uVar2 = this_00->actual_option;
    if (0xb < uVar2) {
      uVar2 = this_00->actual_option;
      goto LAB_0890cda4;
    }
  }
  else {
    if (iVar1 == 3) {
      this->move_ship[0] = ppVar3->a_vertex[0] + 10;
      this->move_ship[1] =
           ptVar4->map[this_00->menu_option[this_00->actual_option]]->a_vertex[1] + 0xc;
      this->move_ship[2] = ptVar4->map[this_00->menu_option[this_00->actual_option]]->dead_offset;
    }
    else if (iVar1 == 1) {
      this->move_ship[0] = ppVar3->dead_offset;
      this->move_ship[1] =
           ptVar4->map[this_00->menu_option[this_00->actual_option]]->a_vertex[1] + 0xc;
      this->move_ship[2] =
           ptVar4->map[this_00->menu_option[this_00->actual_option]]->a_vertex[2] + 10;
    }
    uVar2 = this_00->actual_option;
    if (0xb < uVar2) {
LAB_0890cda4:
      local_10 = DAT_089df214;
      local_14 = DAT_089df210;
      local_18 = menu_move(int)::C_20;
      if (uVar2 == 8) {
        this_00->buttons[0x19]->color[3] = 0xff;
      }
      else {
        this_00->buttons[0x19]->color[3] = 0x28;
      }
      if (this_00->actual_option == 5) {
        this_00->buttons[0x1f]->color[3] = 0xff;
      }
      else {
        this_00->buttons[0x1f]->color[3] = 0x28;
      }
      if (this_00->actual_option == 4) {
        this_00->buttons[0x20]->color[3] = 0xff;
      }
      else {
        this_00->buttons[0x20]->color[3] = 0x28;
      }
      if (this_00->actual_option != 6) {
        this_00->buttons[0x21]->color[3] = 0x28;
        stage_interface::activate_buttons(this_00,&local_18,3);
        this->game_status = 0xb;
        return;
      }
      this_00->buttons[0x21]->color[3] = 0xff;
      stage_interface::activate_buttons(this_00,&local_18,3);
      this->game_status = 0xb;
      return;
    }
  }
  local_18 = menu_move(int)::C_20;
  local_14 = DAT_089df210;
  local_10 = DAT_089df214;
                    /* WARNING: Could not recover jumptable at 0x0890ceb8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(code *)(&PTR_LAB_089de840)[uVar2])();
  return;
}



----------------------------------------

// Function: print_stars @ 0890d254

/* DWARF original prototype: void print_stars(neutron * this) */

void __thiscall neutron::print_stars(neutron *this)

{
  int (*paiVar1) [13];
  int (*paiVar2) [13];
  int (*paiVar3) [13];
  neutron *pnVar4;
  int unaff_retaddr;
  int in_stack_00000000;
  int in_stack_00000004;
  GLfloat in_stack_00000008;
  int in_stack_0000000c;
  int in_stack_fffffffc;
  
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int z@[???]
                       Unresolved local var: int i@[???] */
  pnVar4 = this;
  do {
    glPushMatrix();
    glRotatef((float)pnVar4->background_colors[0][9],(float)pnVar4->background_colors[0][10],
              (float)pnVar4->background_colors[0][0xb],(float)pnVar4->background_colors[0][0xc]);
    paiVar1 = pnVar4->background_colors;
    paiVar2 = pnVar4->background_colors;
    paiVar3 = pnVar4->background_colors;
    pnVar4 = (neutron *)(pnVar4->miniatures + 7);
    glinterface::square_3D
              (this->ground->printer,(GLfloat)(*paiVar1)[3],(GLfloat)(*paiVar2)[4],
               (GLfloat)(*paiVar3)[5],unaff_retaddr,in_stack_fffffffc,in_stack_00000000,
               in_stack_00000004,in_stack_00000008,in_stack_0000000c);
    glPopMatrix();
  } while (pnVar4 != (neutron *)(this->background_colors[0x2a] + 8));
  return;
}



----------------------------------------

// Function: print_background @ 0890d308

/* WARNING: Removing unreachable block (ram,0x0890d3b8) */
/* WARNING: Removing unreachable block (ram,0x0890d478) */
/* DWARF original prototype: void print_background(neutron * this) */

void __thiscall neutron::print_background(neutron *this)

{
  int iVar1;
  player *ppVar2;
  terrain *ptVar3;
  int iVar4;
  neutron *pnVar5;
  neutron *pnVar6;
  int unaff_s4;
  int unaff_s5;
  int unaff_s6;
  int unaff_retaddr;
  GLfloat in_stack_00000000;
  
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int i@[???] */
  pnVar6 = (neutron *)(this->background_colors[0x2a] + 8);
  pnVar5 = this;
LAB_0890d3dc:
  ppVar2 = this->proton;
  do {
    ptVar3 = this->ground;
    if (ptVar3->map[(ppVar2->super_ship).actual_plane]->dead_axis == 0) {
      glinterface::square(ptVar3->printer,(GLfloat)pnVar5->background_colors[0][3],
                          (GLfloat)pnVar5->background_colors[0][4],
                          (GLfloat)pnVar5->background_colors[0][5],unaff_s4,unaff_s5,unaff_s6,
                          unaff_retaddr,in_stack_00000000);
      iVar4 = pnVar5->background_colors[0][6];
      if (pnVar5->background_colors[0][8] == 0) goto LAB_0890d37c;
LAB_0890d43c:
      iVar4 = iVar4 + 1;
      pnVar5->background_colors[0][6] = iVar4;
    }
    else {
      glinterface::square(ptVar3->printer,(GLfloat)pnVar5->background_colors[0][3],
                          (GLfloat)pnVar5->background_colors[0][4],
                          (GLfloat)pnVar5->background_colors[0][5],unaff_s4,unaff_s5,unaff_s6,
                          unaff_retaddr,in_stack_00000000);
      iVar4 = pnVar5->background_colors[0][6];
      if (pnVar5->background_colors[0][8] != 0) goto LAB_0890d43c;
LAB_0890d37c:
      iVar4 = iVar4 + -1;
      pnVar5->background_colors[0][6] = iVar4;
    }
    if (0.0 < (float)iVar4) break;
    iVar4 = rand();
    pnVar5->background_colors[0][8] = 1;
    pnVar5->background_colors[0][0] = iVar4 % 500 + -0xfa;
    pnVar5 = (neutron *)(pnVar5->miniatures + 7);
    if (pnVar6 == pnVar5) {
      return;
    }
    ppVar2 = this->proton;
  } while( true );
  iVar1 = rand();
  if (iVar1 % 200 + 10 <= iVar4) {
    pnVar5->background_colors[0][8] = 0;
  }
  pnVar5 = (neutron *)(pnVar5->miniatures + 7);
  if (pnVar6 == pnVar5) {
    return;
  }
  goto LAB_0890d3dc;
}



----------------------------------------

// Function: print_stage @ 0890d4c4

/* DWARF original prototype: void print_stage(neutron * this) */

void __thiscall neutron::print_stage(neutron *this)

{
  char cVar1;
  player *ppVar2;
  enemy *peVar3;
  int iVar4;
  miniature *pmVar5;
  plane *ppVar6;
  miniature *this_00;
  neutron *pnVar7;
  int iVar8;
  int unaff_retaddr;
  int in_stack_00000000;
  int in_stack_00000004;
  GLfloat in_stack_00000008;
  int in_stack_0000000c;
  int in_stack_fffffffc;
  
  iVar4 = this->vision;
  if (iVar4 == 1) {
    camera::locate((this->proton->super_ship).cam_ship);
    iVar4 = this->game_status;
LAB_0890d504:
    if (iVar4 == 9) {
      iVar4 = this->user_stage;
LAB_0890d6f8:
      if (0x19 < iVar4) {
        return;
      }
      if (iVar4 < 6) {
        iVar8 = 5;
      }
      else {
        iVar8 = 10;
        if (10 < iVar4) {
          if (iVar4 < 0x10) {
            iVar8 = 0xf;
          }
          else if (iVar4 < 0x15) {
            iVar8 = 0x14;
          }
          else {
            iVar8 = 0x19;
          }
        }
      }
                    /* Unresolved local var: int i@[???] */
      iVar4 = 0;
      pnVar7 = this;
      do {
        while (this->actual_miniature != iVar4) {
          this_00 = pnVar7->miniatures[0];
          this_00->rotation = 0;
LAB_0890d728:
          iVar4 = iVar4 + 1;
          miniature::print(this_00);
          pnVar7 = (neutron *)&pnVar7->user_stage;
          if (iVar8 <= iVar4) {
            return;
          }
        }
        pmVar5 = this->miniatures[iVar4];
        this_00 = pnVar7->miniatures[0];
        if (0x167 < pmVar5->rotation) {
          pmVar5->rotation = 0;
          goto LAB_0890d728;
        }
        pmVar5->rotation = pmVar5->rotation + 5;
        iVar4 = iVar4 + 1;
        miniature::print(this_00);
        pnVar7 = (neutron *)&pnVar7->user_stage;
        if (iVar8 <= iVar4) {
          return;
        }
      } while( true );
    }
  }
  else {
    if (iVar4 == 2) {
                    /* Unresolved local var: int i@[???] */
      if (this->N_SHIPS + -1 < 1) goto LAB_0890d500;
      iVar4 = 0;
      peVar3 = this->electron[0];
      pnVar7 = this;
      while( true ) {
        iVar4 = iVar4 + 1;
        camera::locate((peVar3->super_ship).cam_ship);
        if (this->N_SHIPS + -1 <= iVar4) break;
        peVar3 = pnVar7->electron[1];
        pnVar7 = (neutron *)&pnVar7->user_stage;
      }
      iVar4 = this->game_status;
      goto LAB_0890d504;
    }
    if (iVar4 != 0) {
LAB_0890d500:
      iVar4 = this->game_status;
      goto LAB_0890d504;
    }
    camera::locate(this->game_cam);
    iVar4 = this->game_status;
    if (iVar4 == 9) {
                    /* Unresolved local var: int show_to@[???] */
      iVar4 = this->user_stage;
      goto LAB_0890d6f8;
    }
  }
  if (((iVar4 == 6) || (iVar4 == 0xd)) || (iVar4 == 0xb)) {
    ppVar2 = this->proton;
LAB_0890d650:
    iVar4 = terrain::print(this->ground,false,(ppVar2->super_ship).actual_plane,this->low_quality);
    this->prints = iVar4;
    player::print(this->proton,this->ground->map[(this->proton->super_ship).actual_plane]->dead_axis
                  ,this->low_quality);
    iVar4 = this->actual_stage;
    if (this->user_difficulty != 0) goto LAB_0890d57c;
LAB_0890d698:
    if (iVar4 != 1000) {
      iVar4 = this->game_status;
      goto LAB_0890d6a8;
    }
    cVar1 = this->isTutorial;
  }
  else {
    ppVar2 = this->proton;
    if (iVar4 == 3) goto LAB_0890d650;
    iVar4 = terrain::print(this->ground,true,(ppVar2->super_ship).actual_plane,this->low_quality);
    this->prints = iVar4;
    player::print(this->proton,this->ground->map[(this->proton->super_ship).actual_plane]->dead_axis
                  ,this->low_quality);
    iVar4 = this->actual_stage;
    if (this->user_difficulty == 0) goto LAB_0890d698;
LAB_0890d57c:
    if (iVar4 == 2000) {
      iVar4 = this->game_status;
LAB_0890d6a8:
      if (iVar4 == 0) {
        ppVar6 = this->ground->map[(this->proton->super_ship).actual_plane];
        player::print_guides(this->proton,ppVar6->face_number,ppVar6->dead_axis);
        cVar1 = this->isTutorial;
      }
      else {
        cVar1 = this->isTutorial;
      }
    }
    else {
      cVar1 = this->isTutorial;
    }
  }
  if (cVar1 == '\0') {
    iVar4 = this->game_mode;
  }
  else if (this->tutorial_step < 3) {
    iVar4 = this->game_mode;
  }
  else {
    ppVar6 = this->ground->map[(this->proton->super_ship).actual_plane];
    player::print_guides(this->proton,ppVar6->face_number,ppVar6->dead_axis);
    iVar4 = this->game_mode;
  }
  if ((iVar4 == 0) && (this->game_status == 0)) {
                    /* Unresolved local var: int i@[???] */
    iVar4 = this->N_SHIPS;
  }
  else {
    if (this->game_status != 10) {
      iVar4 = this->N_SHIPS;
      goto LAB_0890d7ac;
    }
    iVar4 = this->N_SHIPS;
    if (this->tutorial_step != 10) goto LAB_0890d7ac;
  }
  if (iVar4 + -1 < 1) {
    return;
  }
  iVar8 = 0;
  pnVar7 = this;
  do {
    peVar3 = pnVar7->electron[0];
    iVar8 = iVar8 + 1;
    pnVar7 = (neutron *)&pnVar7->user_stage;
    if ((peVar3->super_ship).status == 0) {
      glinterface::square_3D
                ((peVar3->super_ship).printer,(GLfloat)(peVar3->super_ship).material[0],
                 (GLfloat)(peVar3->super_ship).material[1],(GLfloat)(peVar3->super_ship).material[2]
                 ,unaff_retaddr,in_stack_fffffffc,in_stack_00000000,in_stack_00000004,
                 in_stack_00000008,in_stack_0000000c);
      iVar4 = this->N_SHIPS;
    }
  } while (iVar8 < iVar4 + -1);
LAB_0890d7ac:
  if (0 < iVar4 + -1) {
    iVar8 = 0;
    pnVar7 = this;
    do {
      peVar3 = pnVar7->electron[0];
      iVar8 = iVar8 + 1;
      pnVar7 = (neutron *)&pnVar7->user_stage;
      if ((peVar3->super_ship).status != 0) {
        enemy::print(peVar3,this->ground->map[(peVar3->super_ship).actual_plane]->dead_axis,
                     this->low_quality);
        iVar4 = this->N_SHIPS;
      }
    } while (iVar8 < iVar4 + -1);
    return;
  }
  return;
}



----------------------------------------

// Function: print @ 0890d8cc

/* DWARF original prototype: void print(neutron * this) */

void __thiscall neutron::print(neutron *this)

{
  char cVar1;
  int iVar2;
  stage_interface *this_00;
  float in_a2;
  float in_a3;
  int in_stack_00000000;
  
  iVar2 = this->actual_stage;
  if (iVar2 == 1000) {
    iVar2 = this->game_status;
    if ((iVar2 != 1000) && (iVar2 != 4)) {
      if (iVar2 == 6) {
        button::print(this->interface->buttons[0x1e],0.0,in_a2,in_a3,in_stack_00000000);
        iVar2 = this->game_status;
      }
      if (iVar2 == 0xd) {
        button::print(this->interface->buttons[0x26],0.0,in_a2,in_a3,in_stack_00000000);
        button::print(this->interface->buttons[0x27],0.0,in_a2,in_a3,in_stack_00000000);
      }
      print_stage(this);
      stage_interface::print_menu_interface(this->interface,this->proton->start_z);
      return;
    }
    camera::locate(this->game_cam);
    stage_interface::print_intro(this->interface,this->intro_step);
    return;
  }
  if (iVar2 < 0x3e9) {
    if (iVar2 != 1) {
      cVar1 = this->game_over;
      goto LAB_0890d90c;
    }
    if (-1 < this->tutorial_step) {
      stage_interface::print_tutorial_interface(this->interface,10,this->isTutorial);
      goto LAB_0890d92c;
    }
    this_00 = this->interface;
  }
  else {
    if (iVar2 == 2000) {
      stage_interface::print_train_interface(this->interface,10);
      print_stage(this);
      return;
    }
    if (iVar2 == 3000) {
      stage_interface::print_solo_interface(this->interface,10);
      goto LAB_0890d92c;
    }
    cVar1 = this->game_over;
LAB_0890d90c:
    if (cVar1 == '\0') {
      this_00 = this->interface;
    }
    else {
      print_background(this);
      this_00 = this->interface;
    }
  }
  stage_interface::print_game_interface(this_00,10,this->game_status,this->colision);
LAB_0890d92c:
  print_stage(this);
  return;
}



----------------------------------------

// Function: change_option @ 0890dac4

/* DWARF original prototype: int change_option(neutron * this) */

int __thiscall neutron::change_option(neutron *this)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  int iVar2;
  player *this_00;
  terrain *ptVar3;
  plane **x;
  float in_a3;
  plane **in_stack_00000008;
  int in_stack_0000000c;
  
                    /* Unresolved local var: int index@[???]
                       Unresolved local var: int cam_x@[???]
                       Unresolved local var: int cam_y@[???]
                       Unresolved local var: int cam_z@[???] */
  this_00 = this->proton;
  ptVar3 = this->ground;
  (this_00->super_ship).material[3] = 0x4b;
  x = ptVar3->map;
  bVar1 = ship::go_to(&this_00->super_ship,(float)x,(float)ptVar3->N_PLANES,in_a3,in_stack_00000008,
                      in_stack_0000000c);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    player::move(this->proton,this->ground->map,0);
    iVar2 = this->game_status;
  }
  else {
    plane::find_piece_index
              (this->ground->map[(this->proton->super_ship).actual_plane],(float)x,0.0,in_a3);
    bVar1 = move_camera(this,(this->proton->super_ship).cam_ship,1.4013e-45,
                        (float)this->ground->map[(this->proton->super_ship).actual_plane],
                        (float)in_stack_00000008,in_stack_0000000c);
    iVar2 = 6;
    if (CONCAT31(extraout_var_00,bVar1) == 0) {
      iVar2 = this->game_status;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: show_stage @ 0890dbd8

/* DWARF original prototype: int show_stage(neutron * this) */

int __thiscall neutron::show_stage(neutron *this)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  int iVar2;
  undefined3 extraout_var_01;
  button *this_00;
  float in_a1;
  float in_a2;
  player *ppVar3;
  float in_a3;
  float y;
  float unaff_retaddr;
  int local_18 [2];
  int in_stack_fffffffc;
  
                    /* Unresolved local var: int index@[???]
                       Unresolved local var: int cam_x@[???]
                       Unresolved local var: int cam_y@[???]
                       Unresolved local var: int cam_z@[???] */
  plane::find_piece_index
            (this->ground->map[(this->proton->super_ship).actual_plane],in_a1,in_a2,in_a3);
  ppVar3 = this->proton;
  y = (float)this->camera_passes;
  if (y == 0.0) {
    bVar1 = move_camera(this,(ppVar3->super_ship).cam_ship,1.4013e-45,0.0,unaff_retaddr,
                        in_stack_fffffffc);
    if (CONCAT31(extraout_var_01,bVar1) == 0) {
      iVar2 = this->game_status;
    }
    else {
      this->camera_passes = 1;
      iVar2 = this->game_status;
    }
  }
  else if (y == 1.4013e-45) {
    bVar1 = move_camera(this,(ppVar3->super_ship).cam_ship,1.4013e-45,1.4013e-45,unaff_retaddr,
                        in_stack_fffffffc);
    if (CONCAT31(extraout_var_00,bVar1) == 0) {
      iVar2 = this->game_status;
    }
    else {
      this->camera_passes = 2;
      iVar2 = this->game_status;
    }
  }
  else {
    bVar1 = move_camera(this,(ppVar3->super_ship).cam_ship,1.4013e-45,y,unaff_retaddr,
                        in_stack_fffffffc);
    if (CONCAT31(extraout_var,bVar1) != 0) {
      this->timer = 0;
      if ((this->actual_stage == 1) && (this->isTutorial != false)) {
                    /* Unresolved local var: int[2] buttons@[???] */
        local_18[0] = 0x1e;
        local_18[1] = 0xd;
        stage_interface::activate_buttons(this->interface,local_18,2);
        terrain::change_color(this->ground,100,100,100,(int)unaff_retaddr);
        iVar2 = 10;
      }
      else {
        ppVar3 = this->proton;
        this_00 = this->interface->buttons[6];
        (ppVar3->super_ship).effect_size = DAT_089dc368;
        (ppVar3->super_ship).status = 3;
        button::load_text(this_00,"navigation mode",0xff);
        terrain::change_color(this->ground,100,100,100,(int)unaff_retaddr);
        this->time = 0x19;
        this->go_status = 0;
        sound_mixer::play_effect(this->mixer,0xb);
        iVar2 = 4;
      }
      return iVar2;
    }
    iVar2 = this->game_status;
  }
  return iVar2;
}



----------------------------------------

// Function: execute_artifact @ 0890de00

/* DWARF original prototype: void execute_artifact(neutron * this) */

void __thiscall neutron::execute_artifact(neutron *this)

{
  int iVar1;
  plane *ppVar2;
  piece *ppVar3;
  terrain *ptVar4;
  int iVar5;
  terrain *ptVar6;
  int iVar7;
  int iVar8;
  
  ptVar4 = this->ground;
  iVar8 = ptVar4->N_PLANES;
  if (0 < iVar8) {
    iVar7 = 0;
    ptVar6 = ptVar4;
    do {
      ptVar6 = (terrain *)ptVar6->map;
      ppVar2 = *(plane **)ptVar6;
      iVar1 = ppVar2->side_size * ppVar2->side_size;
      if (0 < iVar1) {
        iVar5 = 0;
        do {
          ppVar3 = ppVar2->pieces[0];
          iVar5 = iVar5 + 1;
          ppVar3->temporal = true;
          ppVar3->type = 0;
          ppVar3->state = false;
          ppVar3->status = 0;
          ppVar2 = (plane *)&ppVar2->i;
        } while (iVar1 != iVar5);
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 != iVar8);
  }
  ptVar4->time = 0;
  return;
}



----------------------------------------

// Function: restart @ 0890de08

/* DWARF original prototype: void restart(neutron * this) */

void __thiscall neutron::restart(neutron *this)

{
  enemy *this_00;
  neutron *pnVar1;
  int iVar2;
  
  if (this->actual_stage != 3000) {
    terrain::restart(this->ground);
  }
                    /* Unresolved local var: int i@[???] */
  this->last_charged_electron = 0;
  this->charged_electrons = 0;
  this->uncharged_electrons = 0;
  this->colision = 0;
  this->low_quality = false;
  this->game_over = false;
  if (0 < this->N_SHIPS + -1) {
    iVar2 = 0;
    this_00 = this->electron[0];
    pnVar1 = this;
    while( true ) {
      iVar2 = iVar2 + 1;
      enemy::restart(this_00);
      if (this->N_SHIPS + -1 <= iVar2) break;
      this_00 = pnVar1->electron[1];
      pnVar1 = (neutron *)&pnVar1->user_stage;
    }
  }
  return;
}



----------------------------------------

// Function: combat @ 0890de9c

/* WARNING: Removing unreachable block (ram,0x0890e350) */
/* WARNING: Removing unreachable block (ram,0x0890e320) */
/* WARNING: Removing unreachable block (ram,0x0890e2ec) */
/* WARNING: Removing unreachable block (ram,0x0890e2cc) */
/* WARNING: Removing unreachable block (ram,0x0890e298) */
/* WARNING: Removing unreachable block (ram,0x0890e2dc) */
/* WARNING: Removing unreachable block (ram,0x0890e308) */
/* WARNING: Removing unreachable block (ram,0x0890e338) */
/* WARNING: Removing unreachable block (ram,0x0890e06c) */
/* WARNING: Removing unreachable block (ram,0x0890e094) */
/* DWARF original prototype: int combat(neutron * this) */

int __thiscall neutron::combat(neutron *this)

{
  bool bVar1;
  stage_interface *psVar2;
  int iVar3;
  undefined3 extraout_var;
  int iVar4;
  int iVar5;
  enemy *peVar6;
  player *ppVar7;
  sound_mixer *this_00;
  camera *pcVar8;
  terrain *ptVar9;
  button *this_01;
  int iVar10;
  int unaff_s4;
  GLfloat GVar11;
  
                    /* Unresolved local var: int piece_type@[???] */
  ppVar7 = this->proton;
  iVar4 = (ppVar7->super_ship).step_counter;
  if (iVar4 < (ppVar7->super_ship).step_speed) {
    (ppVar7->super_ship).step_counter = iVar4 + 1;
    iVar4 = this->colision;
LAB_0890dedc:
    if (iVar4 == 1) {
      psVar2 = this->interface;
      goto LAB_0890e164;
    }
                    /* Unresolved local var: int i@[???] */
    iVar4 = this->N_SHIPS;
LAB_0890deec:
    iVar5 = iVar4 + -1;
    if (iVar5 < 1) {
      iVar4 = this->uncharged_electrons;
    }
    else {
      iVar10 = 0;
      iVar3 = 0;
      do {
        peVar6 = *(enemy **)((int)this->electron + iVar3);
        iVar5 = (peVar6->super_ship).status;
        if (iVar5 == 1) {
          iVar4 = (peVar6->super_ship).step_counter;
          if (iVar4 < (peVar6->super_ship).step_speed) {
            (peVar6->super_ship).step_counter = iVar4 + 1;
            iVar4 = this->N_SHIPS;
          }
          else {
            ppVar7 = this->proton;
            ptVar9 = this->ground;
            (peVar6->super_ship).step_counter = 0;
            iVar4 = enemy::move(peVar6,ptVar9->map,(ppVar7->super_ship).actual_face);
            if (iVar4 == 0) {
              iVar4 = this->N_SHIPS;
            }
            else {
                    /* Unresolved local var: int a@[???]
                       Unresolved local var: int b@[???] */
              ptVar9 = this->ground;
              *(undefined4 *)(*(int *)((int)this->electron + iVar3) + 0x60) = 6;
              terrain::fire_up_cue(ptVar9,iVar10 + 1);
              iVar4 = this->uncharged_electrons + 1;
              iVar5 = ((this->N_SHIPS - iVar4) + -1) % 100;
              psVar2 = this->interface;
              this->uncharged_electrons = iVar4;
              this->n_enemies = this->enemies_buffer;
              this->enemies_buffer[1] = (char)(iVar5 % 10) + '0';
              this->enemies_buffer[0] = (char)(iVar5 / 10) + '0';
              button::load_text(psVar2->buttons[3],this->enemies_buffer,-1);
              sound_mixer::play_effect(this->mixer,4);
              iVar4 = this->N_SHIPS;
            }
          }
        }
        else if (((this->proton->super_ship).actual_plane == (peVar6->super_ship).actual_plane) &&
                (iVar5 == 0)) {
          (peVar6->super_ship).status = 1;
          this->last_charged_electron = iVar10;
          this->charged_electrons = this->charged_electrons + 1;
          terrain::change_color
                    (this->ground,(peVar6->super_ship).material[0],(peVar6->super_ship).material[1],
                     (peVar6->super_ship).material[2],unaff_s4);
          sound_mixer::play_effect(this->mixer,5);
          iVar4 = this->N_SHIPS;
        }
        iVar10 = iVar10 + 1;
        iVar5 = iVar4 + -1;
        iVar3 = iVar10 * 4;
      } while (iVar10 < iVar5);
      iVar4 = this->uncharged_electrons;
    }
    if (iVar4 == iVar5) {
      if (iVar4 == this->charged_electrons) {
        peVar6 = this->electron[this->last_charged_electron];
        pcVar8 = (this->proton->super_ship).cam_ship;
        GVar11 = (peVar6->super_ship).x;
        this->colision = 2;
        pcVar8->x_dir = GVar11;
        pcVar8->y_dir = (peVar6->super_ship).y;
        pcVar8->z_dir = (peVar6->super_ship).z;
        goto LAB_0890df58;
      }
      iVar4 = this->colision;
    }
    else if (iVar4 == this->charged_electrons) {
      bVar1 = terrain::am_i_clear(this->ground);
      if (CONCAT31(extraout_var,bVar1) == 0) {
        iVar4 = this->colision;
      }
      else {
        terrain::navigation_mode(this->ground);
        ptVar9 = this->ground;
        terrain::change_color
                  (ptVar9,ptVar9->material[0],ptVar9->material[1],ptVar9->material[2],unaff_s4);
        this_01 = this->interface->buttons[6];
        this->game_mode = 0;
        button::load_text(this_01,"navigation mode",0xff);
        ptVar9 = this->ground;
        terrain::change_color
                  (ptVar9,ptVar9->material[0],ptVar9->material[1],ptVar9->material[2],unaff_s4);
        iVar4 = this->colision;
      }
    }
    else {
LAB_0890df58:
      iVar4 = this->colision;
    }
    if (iVar4 < 1) {
      return this->game_status;
    }
    if (iVar4 != 1) {
      button::load_text(this->interface->buttons[6],"you win",-1);
      return 1;
    }
  }
  else {
    (ppVar7->super_ship).step_counter = 0;
    iVar4 = player::move(ppVar7,this->ground->map,this->game_mode);
    ppVar7 = this->proton;
    if (((ppVar7->super_ship).actual_plane != (ppVar7->super_ship).last_plane) &&
       ((ppVar7->super_ship).last_advance != (ppVar7->super_ship).advance)) {
      sound_mixer::play_effect(this->mixer,7);
    }
    if (iVar4 == 0) {
                    /* Unresolved local var: int a@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int d@[???]
                       Unresolved local var: int e@[???]
                       Unresolved local var: int f@[???] */
      iVar4 = this->score + -1;
      this->score = iVar4;
      psVar2 = this->interface;
      this->n_score = this->score_buffer;
      this->score_buffer[0] = (char)(iVar4 / 100000) + '0';
      this->score_buffer[3] = (char)((iVar4 % 1000) / 100) + '0';
      this->score_buffer[1] = (char)((iVar4 % 100000) / 10000) + '0';
      this->score_buffer[2] = (char)((iVar4 % 10000) / 1000) + '0';
      this->score_buffer[5] = (char)((iVar4 % 100) % 10) + '0';
      this->score_buffer[4] = (char)((iVar4 % 100) / 10) + '0';
      button::load_text(psVar2->buttons[1],this->score_buffer,-1);
      iVar4 = this->colision;
      goto LAB_0890dedc;
    }
    if (iVar4 == 3) {
      execute_artifact(this);
      iVar4 = this->colision;
      goto LAB_0890dedc;
    }
    terrain::fire_up_cue(this->ground,0);
    this_00 = this->mixer;
    this->colision = 1;
    (this->proton->super_ship).status = 6;
    sound_mixer::play_effect(this_00,4);
    if (this->colision != 1) {
      iVar4 = this->N_SHIPS;
      goto LAB_0890deec;
    }
  }
  psVar2 = this->interface;
LAB_0890e164:
  button::load_text(psVar2->buttons[6],"you lose",-1);
  return 1;
}



----------------------------------------

// Function: navigate @ 0890e37c

/* DWARF original prototype: int navigate(neutron * this) */

int __thiscall neutron::navigate(neutron *this)

{
  enemy **ppeVar1;
  int iVar2;
  neutron *pnVar3;
  enemy *peVar4;
  player *ppVar5;
  button *this_00;
  sound_mixer *this_01;
  int iVar6;
  int in_stack_00000000;
  
                    /* Unresolved local var: int piece_type@[???] */
  ppVar5 = this->proton;
  iVar2 = (ppVar5->super_ship).step_counter;
  if (iVar2 < (ppVar5->super_ship).step_speed) {
    (ppVar5->super_ship).step_counter = iVar2 + 1;
                    /* Unresolved local var: int i@[???] */
    iVar2 = this->N_SHIPS;
  }
  else {
    (ppVar5->super_ship).step_counter = 0;
    player::move(ppVar5,this->ground->map,this->game_mode);
    ppVar5 = this->proton;
    if ((ppVar5->super_ship).actual_plane == (ppVar5->super_ship).last_plane) {
      iVar2 = this->N_SHIPS;
    }
    else if ((ppVar5->super_ship).last_advance == (ppVar5->super_ship).advance) {
      iVar2 = this->N_SHIPS;
    }
    else {
      sound_mixer::play_effect(this->mixer,7);
      iVar2 = this->N_SHIPS;
    }
  }
  if (iVar2 + -1 < 1) {
LAB_0890e474:
    iVar2 = this->game_status;
  }
  else {
    iVar6 = 0;
    pnVar3 = this;
    do {
      ppeVar1 = pnVar3->electron;
      pnVar3 = (neutron *)&pnVar3->user_stage;
      if (((this->proton->super_ship).actual_plane == ((*ppeVar1)->super_ship).actual_plane) &&
         (((*ppeVar1)->super_ship).status == 0)) {
        this_00 = this->interface->buttons[6];
        this->game_mode = 1;
        button::load_text(this_00,"combat mode",0xff);
        terrain::combat_mode(this->ground);
        peVar4 = this->electron[this->last_charged_electron];
        terrain::change_color
                  (this->ground,(peVar4->super_ship).material[0],(peVar4->super_ship).material[1],
                   (peVar4->super_ship).material[2],in_stack_00000000);
        this_01 = this->mixer;
        (this->electron[iVar6]->super_ship).status = 1;
        this->last_charged_electron = iVar6;
        this->charged_electrons = this->charged_electrons + 1;
        sound_mixer::play_effect(this_01,5);
        goto LAB_0890e474;
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 != iVar2 + -1);
    iVar2 = this->game_status;
  }
  return iVar2;
}



----------------------------------------

// Function: run @ 0890e4dc

/* DWARF original prototype: int run(neutron * this) */

int __thiscall neutron::run(neutron *this)

{
  int iVar1;
  
  if (this->prints < 0xea7) {
    this->low_quality = false;
  }
  else {
    this->low_quality = true;
  }
  if ((this->game_mode != 0) && (this->game_mode != 2)) {
    iVar1 = combat(this);
    return iVar1;
  }
  iVar1 = navigate(this);
  return iVar1;
}



----------------------------------------

// Function: load_artifact @ 0890e524

/* WARNING: Removing unreachable block (ram,0x0890e59c) */
/* DWARF original prototype: void load_artifact(neutron * this, int artifact) */

void __thiscall neutron::load_artifact(neutron *this,int artifact)

{
  int iVar1;
  int iVar2;
  int iVar3;
  piece *this_00;
  int local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  
                    /* Unresolved local var: int found@[???]
                       Unresolved local var: int plane@[???]
                       Unresolved local var: int piece@[???]
                       Unresolved local var: int[4] material@[???] */
  local_20 = load_artifact(int)::C_21;
  local_1c = DAT_089df200;
  local_18 = DAT_089df204;
  local_14 = DAT_089df208;
  this->actual_artifact = 0;
  do {
    iVar1 = rand();
    iVar3 = this->ground->N_PLANES;
    if (iVar3 == 0) {
      trap(7);
    }
    iVar2 = rand();
    this_00 = this->ground->map[iVar1 % iVar3]->pieces[iVar2 % 400];
  } while (this_00->state != false);
  piece::change_state(this_00,&local_20,3);
  return;
}



----------------------------------------

// Function: autoload_eletrons @ 0890e5e8

/* WARNING: Removing unreachable block (ram,0x0890eb74) */
/* WARNING: Removing unreachable block (ram,0x0890ec78) */
/* WARNING: Removing unreachable block (ram,0x0890ea18) */
/* WARNING: Removing unreachable block (ram,0x0890eb34) */
/* WARNING: Removing unreachable block (ram,0x0890ebec) */
/* WARNING: Removing unreachable block (ram,0x0890ec04) */
/* WARNING: Removing unreachable block (ram,0x0890e7d0) */
/* WARNING: Removing unreachable block (ram,0x0890ead0) */
/* WARNING: Removing unreachable block (ram,0x0890eb4c) */
/* WARNING: Removing unreachable block (ram,0x0890eb8c) */
/* WARNING: Removing unreachable block (ram,0x0890ec30) */
/* WARNING: Removing unreachable block (ram,0x0890eba4) */
/* WARNING: Removing unreachable block (ram,0x0890ec48) */
/* WARNING: Removing unreachable block (ram,0x0890ea94) */
/* WARNING: Removing unreachable block (ram,0x0890eaac) */
/* WARNING: Removing unreachable block (ram,0x0890eae8) */
/* DWARF original prototype: void autoload_eletrons(neutron * this, int n_enemies) */

void __thiscall neutron::autoload_eletrons(neutron *this,int n_enemies)

{
  int iVar1;
  bool bVar2;
  enemy *this_00;
  int *piVar3;
  camera *pcVar4;
  glinterface *pgVar5;
  undefined1 *puVar6;
  int iVar7;
  plane *ppVar8;
  int iVar9;
  player *ppVar10;
  int iVar11;
  int iVar12;
  terrain *ptVar13;
  int iVar14;
  int *piVar15;
  int *piVar16;
  neutron *pnVar17;
  float fVar18;
  GLfloat GVar19;
  float fVar20;
  float fVar21;
  int local_40;
  undefined1 *local_3c;
  int aiStack_38 [4];
  
                    /* Unresolved local var: bool allready_used@[???]
                       Unresolved local var: int[0][7] ELECTRON@[???]
                       Unresolved local var: int[0][3] CAM@[???]
                       Unresolved local var: int choosen_plane@[???] */
  ppVar10 = this->proton;
  local_3c = (undefined1 *)&local_40;
  local_40 = n_enemies + this->ground->N_PLANES + -1;
  iVar1 = -((n_enemies + -1) * 0x1c + 0x2aU & 0xfffffff8);
  piVar15 = (int *)((int)&local_40 + iVar1);
  iVar12 = (ppVar10->super_ship).actual_plane;
                    /* Unresolved local var: int i@[???] */
  piVar16 = (int *)((int)&local_40 + (iVar1 - ((n_enemies + -1) * 0xc + 0x1aU & 0xfffffff8)));
  if (local_40 < 1) {
    return;
  }
  iVar14 = 0;
  pnVar17 = this;
LAB_0890e690:
                    /* Unresolved local var: int j@[???] */
  bVar2 = false;
  do {
    if ((iVar12 != (ppVar10->super_ship).actual_plane) && (!bVar2)) {
      ptVar13 = this->ground;
      ppVar8 = ptVar13->map[iVar12];
      iVar7 = ppVar8->dead_axis;
      if (iVar7 == 1) {
        iVar7 = ppVar8->dead_offset;
        *piVar15 = iVar7;
        iVar7 = iVar7 << 1;
        piVar15[1] = ppVar8->i + 0xb;
        iVar9 = ppVar8->j + 0xb;
        piVar15[2] = iVar9;
LAB_0890ea80:
        *piVar16 = iVar7;
        piVar16[1] = piVar15[1] * 3 +
                     ((ptVar13->max_vertex[1] / 0x14 + ptVar13->max_vertex[1] + 1) / 2) * -2;
        piVar16[2] = iVar9 * 3 +
                     ((ptVar13->max_vertex[2] / 0x14 + ptVar13->max_vertex[2] + 1) / 2) * -2;
      }
      else {
        if (iVar7 == 2) {
          iVar7 = ppVar8->i + 0xb;
          *piVar15 = iVar7;
          piVar15[1] = ppVar8->dead_offset;
          iVar9 = ppVar8->j + 0xb;
          piVar15[2] = iVar9;
          iVar7 = iVar7 * 3 +
                  ((ptVar13->max_vertex[0] / 0x14 + ptVar13->max_vertex[0] + 1) / 2) * -2;
          goto LAB_0890ea80;
        }
        if (iVar7 == 3) {
          iVar7 = ppVar8->i + 0xb;
          *piVar15 = iVar7;
          piVar15[1] = ppVar8->j + 0xb;
          iVar11 = ppVar8->dead_offset;
          piVar15[2] = iVar11;
          *piVar16 = iVar7 * 3 +
                     ((ptVar13->max_vertex[0] / 0x14 + ptVar13->max_vertex[0] + 1) / 2) * -2;
          iVar7 = ptVar13->max_vertex[1];
          iVar9 = piVar15[1];
          piVar16[2] = iVar11 << 1;
          piVar16[1] = iVar9 * 3 + ((iVar7 / 0x14 + iVar7 + 1) / 2) * -2;
        }
      }
      ppVar8 = ptVar13->map[iVar12];
      piVar15[3] = ppVar8->face_number;
      iVar7 = ppVar8->face_number;
      if (iVar7 < 6) {
        piVar15[4] = iVar7 + 1;
        if (piVar15[4] < 1) goto LAB_0890e9dc;
        piVar15[5] = iVar12;
LAB_0890e780:
        iVar12 = this->actual_stage;
        if (iVar12 != 2000) {
          iVar7 = this->user_difficulty;
          goto LAB_0890e794;
        }
        piVar15[6] = 0;
      }
      else {
        piVar15[4] = iVar7 + -1;
        if (0 < piVar15[4]) {
          piVar15[5] = iVar12;
          goto LAB_0890e780;
        }
LAB_0890e9dc:
        piVar15[4] = 2;
        piVar15[5] = iVar12;
        iVar12 = this->actual_stage;
        if (iVar12 == 2000) {
          piVar15[6] = 0;
        }
        else {
          iVar7 = this->user_difficulty;
LAB_0890e794:
          if (iVar7 == 0) {
            if (iVar12 < 3) {
              piVar15[6] = 0;
            }
            else {
              if (9 < iVar12) {
                if (iVar12 < 0xf) goto LAB_0890ea04;
                goto LAB_0890e7bc;
              }
              iVar12 = rand();
              piVar15[6] = iVar12 % 2;
            }
          }
          else if (iVar12 < 10) {
LAB_0890ea04:
            iVar12 = rand();
            piVar15[6] = iVar12 % 3;
          }
          else {
LAB_0890e7bc:
            iVar12 = rand();
            piVar15[6] = iVar12 % 4;
          }
        }
      }
      this_00 = operator_new(0x94);
      GVar19 = DAT_089dbcec;
      (this_00->super_ship).size = DAT_089dc360;
      (this_00->super_ship).parts = GVar19;
      (this_00->super_ship).path_found = false;
      piVar3 = (int *)((int)&local_40 + iVar14 * 0x1c + iVar1);
      iVar12 = *piVar3;
      this_00->start_x = iVar12;
      iVar9 = piVar3[1];
      this_00->start_y = iVar9;
      iVar7 = piVar3[2];
      fVar21 = (float)iVar12;
      this_00->start_z = iVar7;
      iVar11 = piVar3[3];
      fVar20 = (float)iVar9;
      this_00->start_actual_face = iVar11;
      iVar9 = piVar3[4];
      fVar18 = (float)iVar7;
      (this_00->super_ship).x_predict = fVar21;
      this_00->start_previous_face = iVar9;
      iVar7 = piVar3[5];
      (this_00->super_ship).y_predict = fVar20;
      (this_00->super_ship).x = fVar21;
      this_00->start_plane = iVar7;
      iVar12 = piVar3[6];
      (this_00->super_ship).y = fVar20;
      (this_00->super_ship).actual_face = iVar11;
      this_00->type = iVar12;
      (this_00->super_ship).previous_face = iVar9;
      (this_00->super_ship).actual_plane = iVar7;
      (this_00->super_ship).plane_path = -1;
      (this_00->super_ship).ident = -1;
      (this_00->super_ship).z_predict = fVar18;
      (this_00->super_ship).z = fVar18;
      (this_00->super_ship).cue_counter = 0;
      pcVar4 = operator_new(0x38);
      GVar19 = DAT_089dbce4;
      pcVar4->x = 0.0;
      pcVar4->y_ori = GVar19;
      pcVar4->y = 0.0;
      pcVar4->z = 0.0;
      pcVar4->x_dir = 0.0;
      pcVar4->y_dir = 0.0;
      pcVar4->z_dir = 0.0;
      pcVar4->x_ori = 0.0;
      pcVar4->z_ori = 0.0;
      pcVar4->degrees = 0;
      pgVar5 = operator_new(1);
      pcVar4->locator = pgVar5;
      (this_00->super_ship).cam_ship = pcVar4;
      pcVar4->last_x = 0.0;
      pcVar4->last_y = 0.0;
      pcVar4->last_z = 0.0;
      (this_00->super_ship).status = 0;
      pgVar5 = operator_new(1);
      iVar12 = this_00->type;
      (this_00->super_ship).printer = pgVar5;
      (this_00->super_ship).step_counter = 0;
      (this_00->super_ship).step_speed = 0;
      if (iVar12 == 2) {
        iVar12 = 0x78;
LAB_0890e920:
        (this_00->super_ship).material[0] = iVar12;
        (this_00->super_ship).material[3] = 0xff;
        (this_00->super_ship).material[1] = 0;
        (this_00->super_ship).material[2] = 0;
      }
      else {
        if (iVar12 == 0) {
          iVar12 = 100;
          goto LAB_0890e920;
        }
        if (iVar12 == 1) {
          (this_00->super_ship).material[0] = 0xdc;
          (this_00->super_ship).material[1] = 0x5a;
          (this_00->super_ship).material[2] = 5;
          (this_00->super_ship).material[3] = 0xff;
        }
        else {
          iVar12 = rand();
          (this_00->super_ship).material[0] = iVar12 % 200;
          iVar12 = rand();
          (this_00->super_ship).material[1] = iVar12 % 200;
          iVar12 = rand();
          (this_00->super_ship).material[3] = 0xff;
          (this_00->super_ship).material[2] = iVar12 % 200;
        }
      }
      GVar19 = (this_00->super_ship).size;
      iVar12 = (this_00->super_ship).material[3];
      ptVar13 = this->ground;
      this_00->active = true;
      (this_00->super_ship).effect_size = GVar19;
      (this_00->super_ship).effect_alpha = iVar12;
      pnVar17->electron[0] = this_00;
      ship::init(&this_00->super_ship,ptVar13->map);
      iVar14 = iVar14 + 1;
      ppVar10 = this->proton;
      (pnVar17->electron[0]->super_ship).ident = iVar14;
      iVar12 = (ppVar10->super_ship).actual_plane;
      if (iVar14 == local_40) {
        return;
      }
      pnVar17 = (neutron *)&pnVar17->user_stage;
      piVar15 = piVar15 + 7;
      piVar16 = piVar16 + 3;
      if (iVar14 == 0x1e) {
        return;
      }
      goto LAB_0890e690;
    }
    iVar12 = rand();
    iVar7 = this->ground->N_PLANES;
    iVar12 = iVar12 % iVar7;
    if (iVar7 == 0) {
      trap(7);
    }
    if (iVar14 == 0) {
LAB_0890e700:
      ppVar10 = this->proton;
      goto LAB_0890e690;
    }
    if (iVar14 < 1) break;
    iVar7 = 0;
    iVar9 = *(int *)((int)aiStack_38 + iVar1 + 0xc);
    puVar6 = (undefined1 *)((int)&local_40 + iVar1);
    while (iVar12 != iVar9) {
      iVar7 = iVar7 + 1;
      if (iVar7 == iVar14) goto LAB_0890e700;
      piVar3 = (int *)(puVar6 + 0x30);
      puVar6 = puVar6 + 0x1c;
      iVar9 = *piVar3;
    }
    ppVar10 = this->proton;
    bVar2 = true;
    iVar12 = (ppVar10->super_ship).actual_plane;
  } while( true );
  ppVar10 = this->proton;
  goto LAB_0890e690;
}



----------------------------------------

// Function: load_new_enemy @ 0890ec88

/* DWARF original prototype: void load_new_enemy(neutron * this) */

void __thiscall neutron::load_new_enemy(neutron *this)

{
  int iVar1;
  player *ppVar2;
  camera *ptr;
  enemy *ptr_00;
  neutron *pnVar3;
  int iVar4;
  
  if ((this->game_mode == 2) || (this->game_mode == 0)) {
                    /* Unresolved local var: int i@[???] */
    iVar1 = this->N_SHIPS;
    if (0 < iVar1 + -1) {
      iVar4 = 0;
      pnVar3 = this;
      do {
        ptr_00 = pnVar3->electron[0];
        iVar4 = iVar4 + 1;
        if (ptr_00 != (enemy *)0x0) {
          ptr = (ptr_00->super_ship).cam_ship;
          if (ptr != (camera *)0x0) {
            if (ptr->locator != (glinterface *)0x0) {
              operator_delete(ptr->locator);
              ptr->locator = (glinterface *)0x0;
            }
            operator_delete(ptr);
          }
          operator_delete((ptr_00->super_ship).printer);
          operator_delete(ptr_00);
          iVar1 = this->N_SHIPS;
          pnVar3->electron[0] = (enemy *)0x0;
        }
        pnVar3 = (neutron *)&pnVar3->user_stage;
      } while (iVar4 < iVar1 + -1);
    }
    this->N_SHIPS = 2;
    autoload_eletrons(this,1);
    this->game_mode = 0;
    button::load_text(this->interface->buttons[6],"navigation mode",0xff);
    ppVar2 = this->proton;
    this->last_charged_electron = 0;
    this->charged_electrons = 0;
    this->uncharged_electrons = 0;
    this->colision = 0;
    (ppVar2->super_ship).effect_size = 0.0;
    (ppVar2->super_ship).status = 1;
    (ppVar2->super_ship).effect_alpha = 100;
  }
  return;
}



----------------------------------------

// Function: load_proton @ 0890eda8

/* DWARF original prototype: void load_proton(neutron * this, bool setup_cams) */

void __thiscall neutron::load_proton(neutron *this,bool setup_cams)

{
  float fVar1;
  player *ppVar2;
  camera *pcVar3;
  glinterface *pgVar4;
  int iVar5;
  plane *ppVar6;
  int iVar7;
  int iVar8;
  terrain *ptVar9;
  GLfloat GVar10;
  int iVar11;
  int iVar12;
  int local_38;
  int local_34;
  int local_30;
  int local_28;
  
                    /* Unresolved local var: int[6] PROTON@[???]
                       Unresolved local var: int[3] CAM@[???] */
  iVar8 = this->ground->start_on_plane;
  ppVar6 = this->ground->map[iVar8];
  if (ppVar6->dead_axis == 1) {
    local_38 = ppVar6->dead_offset;
    local_34 = ppVar6->i + 0xc;
    local_30 = ppVar6->j + 10;
    iVar7 = ppVar6->face_number;
    iVar5 = this->actual_stage;
  }
  else {
    if (ppVar6->dead_axis == 2) {
      local_34 = ppVar6->dead_offset;
      local_30 = ppVar6->j + 10;
    }
    else {
      local_34 = ppVar6->j + 0xc;
      local_30 = ppVar6->dead_offset;
    }
    local_38 = ppVar6->i + 10;
    iVar7 = ppVar6->face_number;
    iVar5 = this->actual_stage;
  }
  if (iVar5 == 1000) {
    local_28 = iVar7 + 1;
  }
  else {
    local_28 = iVar7 + -2;
  }
  iVar5 = this->user_color;
  ppVar2 = operator_new(0x94);
  ppVar2->start_x = local_38;
  ppVar2->start_y = local_34;
  ppVar2->start_z = local_30;
  ppVar2->start_actual_face = iVar7;
  ppVar2->start_previous_face = local_28;
  ppVar2->start_plane = iVar8;
  ppVar2->user_color = iVar5;
  if (iVar5 == 0) {
    (ppVar2->super_ship).material[1] = 100;
    (ppVar2->super_ship).material[2] = 0xf;
    (ppVar2->super_ship).material[3] = 0xff;
    (ppVar2->super_ship).material[0] = 0;
  }
  else if (iVar5 == 1) {
    (ppVar2->super_ship).material[1] = 10;
    (ppVar2->super_ship).material[2] = 100;
    (ppVar2->super_ship).material[3] = 0xff;
    (ppVar2->super_ship).material[0] = 100;
  }
  else {
    (ppVar2->super_ship).material[1] = 0x46;
    (ppVar2->super_ship).material[2] = 0x96;
    (ppVar2->super_ship).material[3] = 0xff;
    (ppVar2->super_ship).material[0] = 0;
  }
  iVar5 = ppVar2->start_x;
  iVar11 = ppVar2->start_y;
  (ppVar2->super_ship).actual_face = ppVar2->start_actual_face;
  iVar12 = ppVar2->start_z;
  iVar7 = ppVar2->start_plane;
  iVar8 = ppVar2->start_previous_face;
  (ppVar2->super_ship).size = DAT_089dc360;
  GVar10 = DAT_089dbcec;
  (ppVar2->super_ship).last_plane = iVar7;
  (ppVar2->super_ship).actual_plane = iVar7;
  (ppVar2->super_ship).x_predict = (float)iVar5;
  (ppVar2->super_ship).y_predict = (float)iVar11;
  (ppVar2->super_ship).z_predict = (float)iVar12;
  (ppVar2->super_ship).x = (float)iVar5;
  (ppVar2->super_ship).y = (float)iVar11;
  (ppVar2->super_ship).z = (float)iVar12;
  (ppVar2->super_ship).previous_face = iVar8;
  (ppVar2->super_ship).parts = GVar10;
  (ppVar2->super_ship).plane_path = -1;
  (ppVar2->super_ship).ident = -1;
  (ppVar2->super_ship).cue_counter = 0;
  (ppVar2->super_ship).path_found = false;
  pcVar3 = operator_new(0x38);
  GVar10 = DAT_089dbce4;
  pcVar3->x = 0.0;
  pcVar3->y = 0.0;
  pcVar3->z = 0.0;
  pcVar3->x_dir = 0.0;
  pcVar3->y_dir = 0.0;
  pcVar3->z_dir = 0.0;
  pcVar3->x_ori = 0.0;
  pcVar3->y_ori = GVar10;
  pcVar3->z_ori = 0.0;
  pcVar3->degrees = 0;
  pgVar4 = operator_new(1);
  pcVar3->locator = pgVar4;
  (ppVar2->super_ship).cam_ship = pcVar3;
  pcVar3->last_x = 0.0;
  pcVar3->last_y = 0.0;
  pcVar3->last_z = 0.0;
  pgVar4 = operator_new(1);
  (ppVar2->super_ship).printer = pgVar4;
  fVar1 = DAT_089dc368;
  (ppVar2->super_ship).last_advance = 1;
  (ppVar2->super_ship).effect_size = fVar1;
  (ppVar2->super_ship).status = 1;
  (ppVar2->super_ship).advance = 1;
  (ppVar2->super_ship).effect_alpha = 0;
  (ppVar2->super_ship).step_counter = 0;
  (ppVar2->super_ship).step_speed = 0;
  pcVar3 = operator_new(0x38);
  pcVar3->y_ori = GVar10;
  pcVar3->x = 0.0;
  pcVar3->y = 0.0;
  pcVar3->z = 0.0;
  pcVar3->x_dir = 0.0;
  pcVar3->y_dir = 0.0;
  pcVar3->z_dir = 0.0;
  pcVar3->x_ori = 0.0;
  pcVar3->z_ori = 0.0;
  pcVar3->degrees = 0;
  pgVar4 = operator_new(1);
  pcVar3->last_x = 0.0;
  pcVar3->last_y = 0.0;
  pcVar3->last_z = 0.0;
  GVar10 = (ppVar2->super_ship).x;
  ptVar9 = this->ground;
  pcVar3->locator = pgVar4;
  pcVar3->x = GVar10;
  GVar10 = (ppVar2->super_ship).y;
  ppVar2->cam_first_person = pcVar3;
  this->proton = ppVar2;
  pcVar3->y = GVar10;
  pcVar3->z = (ppVar2->super_ship).z;
  ship::init(&ppVar2->super_ship,ptVar9->map);
  if (setup_cams) {
    ptVar9 = this->ground;
    if (this->actual_stage == 1000) {
      ppVar2 = this->proton;
      ((ppVar2->super_ship).cam_ship)->y = (float)ptVar9->max_vertex[1];
    }
    else {
      ppVar2 = this->proton;
      iVar8 = ptVar9->max_vertex[0];
      iVar7 = ptVar9->max_vertex[1];
      pcVar3 = (ppVar2->super_ship).cam_ship;
      pcVar3->z = (float)(ptVar9->max_vertex[2] + 0x14);
      pcVar3->x = (float)(iVar8 + 0x14);
      pcVar3->y = (float)(iVar7 + 0x14);
    }
  }
  else {
    ppVar2 = this->proton;
  }
  this->camera_passes = 0;
  (ppVar2->super_ship).ident = 0;
  this->move_ship[1] = local_34;
  this->move_ship[2] = local_30;
  this->move_ship[0] = local_38;
  return;
}



----------------------------------------

// Function: unload_stage @ 0890f180

/* DWARF original prototype: void unload_stage(neutron * this) */

void __thiscall neutron::unload_stage(neutron *this)

{
  camera *pcVar1;
  piece *ptr;
  player *ptr_00;
  enemy *ptr_01;
  plane *ppVar2;
  neutron *pnVar3;
  int iVar4;
  plane *ptr_02;
  terrain *ptVar5;
  int iVar6;
  terrain *ptr_03;
  
  ptr_00 = this->proton;
  if (ptr_00 != (player *)0x0) {
    pcVar1 = (ptr_00->super_ship).cam_ship;
    if (pcVar1 == (camera *)0x0) {
      pcVar1 = ptr_00->cam_first_person;
    }
    else {
      if (pcVar1->locator != (glinterface *)0x0) {
        operator_delete(pcVar1->locator);
        pcVar1->locator = (glinterface *)0x0;
      }
      operator_delete(pcVar1);
      pcVar1 = ptr_00->cam_first_person;
    }
    if (pcVar1 != (camera *)0x0) {
      if (pcVar1->locator != (glinterface *)0x0) {
        operator_delete(pcVar1->locator);
        pcVar1->locator = (glinterface *)0x0;
      }
      operator_delete(pcVar1);
    }
    operator_delete((ptr_00->super_ship).printer);
    operator_delete(ptr_00);
    this->proton = (player *)0x0;
  }
  iVar4 = 0;
  pnVar3 = this;
  do {
                    /* Unresolved local var: int i@[???] */
    ptr_01 = pnVar3->electron[0];
    iVar4 = iVar4 + 1;
    if (ptr_01 != (enemy *)0x0) {
      pcVar1 = (ptr_01->super_ship).cam_ship;
      if (pcVar1 != (camera *)0x0) {
        if (pcVar1->locator != (glinterface *)0x0) {
          operator_delete(pcVar1->locator);
          pcVar1->locator = (glinterface *)0x0;
        }
        operator_delete(pcVar1);
      }
      operator_delete((ptr_01->super_ship).printer);
      operator_delete(ptr_01);
      pnVar3->electron[0] = (enemy *)0x0;
    }
    pnVar3 = (neutron *)&pnVar3->user_stage;
  } while (iVar4 != 0x1e);
  ptr_03 = this->ground;
  if (ptr_03 != (terrain *)0x0) {
    pcVar1 = ptr_03->cam_terrain;
    if (pcVar1 == (camera *)0x0) {
      iVar4 = ptr_03->N_PLANES;
    }
    else {
      if (pcVar1->locator != (glinterface *)0x0) {
        operator_delete(pcVar1->locator);
        pcVar1->locator = (glinterface *)0x0;
      }
      operator_delete(pcVar1);
                    /* Unresolved local var: void anon_var_0@[???] */
      iVar4 = ptr_03->N_PLANES;
    }
    if (0 < iVar4) {
      iVar6 = 0;
      ptVar5 = ptr_03;
      do {
        ptVar5 = (terrain *)ptVar5->map;
        ptr_02 = *(plane **)ptVar5;
        if (ptr_02 != (plane *)0x0) {
          iVar4 = 0;
          ppVar2 = ptr_02;
          do {
                    /* Unresolved local var: void anon_var_0@[???] */
            ptr = ppVar2->pieces[0];
            iVar4 = iVar4 + 1;
            if (ptr != (piece *)0x0) {
              if (ptr->printer != (glinterface *)0x0) {
                operator_delete(ptr->printer);
                ptr->printer = (glinterface *)0x0;
              }
              operator_delete(ptr);
              ppVar2->pieces[0] = (piece *)0x0;
            }
            ppVar2 = (plane *)&ppVar2->i;
          } while (iVar4 != 400);
          operator_delete(ptr_02);
          iVar4 = ptr_03->N_PLANES;
          *(plane **)ptVar5 = (plane *)0x0;
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 < iVar4);
    }
    operator_delete(ptr_03->printer);
    operator_delete(ptr_03);
    this->ground = (terrain *)0x0;
  }
  return;
}



----------------------------------------

// Function: stage_over @ 0890f380

/* DWARF original prototype: int stage_over(neutron * this) */

int __thiscall neutron::stage_over(neutron *this)

{
  bool bVar1;
  undefined3 extraout_var;
  stage_interface *psVar2;
  int iVar3;
  terrain *this_00;
  camera *ptr;
  enemy *ptr_00;
  float unaff_s2;
  neutron *pnVar4;
  int unaff_s3;
  int iVar5;
  int local_20;
  undefined4 local_1c;
  
  if (this->actual_stage != 2000) {
    bVar1 = move_camera(this,(this->proton->super_ship).cam_ship,1.4013e-45,(float)this->proton,
                        unaff_s2,unaff_s3);
    if (CONCAT31(extraout_var,bVar1) == 0) {
      iVar3 = this->game_status;
    }
    else {
                    /* Unresolved local var: int[2] buttons@[???] */
      local_20 = stage_over()::C_32;
      local_1c = DAT_089df1ec;
      stage_interface::activate_buttons(this->interface,&local_20,2);
      if (this->colision == 1) {
        button::load_text(this->interface->buttons[0x1a],"try again",-1);
        sound_mixer::play_effect(this->mixer,6);
        return 8;
      }
      if (this->isSolo == false) {
        if (this->miniatures[this->actual_stage + -1]->high_score < this->score) {
          psVar2 = this->interface;
          this->miniatures[this->actual_stage + -1]->high_score = this->score;
          button::load_text(psVar2->buttons[6],"new high score",0xff);
          this->save_game = true;
          sound_mixer::play_effect(this->mixer,9);
          psVar2 = this->interface;
        }
        else {
          sound_mixer::play_effect(this->mixer,8);
          psVar2 = this->interface;
        }
        button::load_text(psVar2->buttons[0x1a],"load next",-1);
        if (this->actual_stage == 0x19) {
          if (this->isSolo == false) {
            button::load_text(this->interface->buttons[0x1a],"game over",-1);
            if (this->user_difficulty == 0) {
              button::load_text(this->interface->buttons[6],"ok, try hard mode",0xff);
            }
            else {
              button::load_text(this->interface->buttons[6],"wow. congratulations",0xff);
              sound_mixer::play_effect(this->mixer,10);
              this->game_over = true;
            }
          }
        }
        else {
          button::load_text(this->interface->buttons[6],"stage clear",0xff);
        }
        iVar3 = 8;
        this->game_mode = 2;
      }
      else {
        if (this->miniatures[this->actual_stage + -1]->high_score < this->score) {
          psVar2 = this->interface;
          this->miniatures[this->actual_stage + -1]->high_score = this->score;
          button::load_text(psVar2->buttons[6],"new high score",0xff);
          this->save_game = true;
          sound_mixer::play_effect(this->mixer,9);
          psVar2 = this->interface;
        }
        else {
          sound_mixer::play_effect(this->mixer,8);
          psVar2 = this->interface;
        }
        button::load_text(psVar2->buttons[0x1a]," restart ",-1);
        iVar3 = 8;
      }
    }
    return iVar3;
  }
  if (this->colision == 1) {
    if ((this->proton->super_ship).status == 6) {
      return this->game_status;
    }
    iVar3 = this->N_SHIPS;
  }
  else if (this->colision == 2) {
    if ((this->electron[0]->super_ship).status == 6) {
      return this->game_status;
    }
    iVar3 = this->N_SHIPS;
  }
  else {
                    /* Unresolved local var: int i@[???] */
    iVar3 = this->N_SHIPS;
  }
  if (0 < iVar3 + -1) {
    iVar5 = 0;
    pnVar4 = this;
    do {
      ptr_00 = pnVar4->electron[0];
      iVar5 = iVar5 + 1;
      if (ptr_00 != (enemy *)0x0) {
        ptr = (ptr_00->super_ship).cam_ship;
        if (ptr != (camera *)0x0) {
          if (ptr->locator != (glinterface *)0x0) {
            operator_delete(ptr->locator);
            ptr->locator = (glinterface *)0x0;
          }
          operator_delete(ptr);
        }
        operator_delete((ptr_00->super_ship).printer);
        operator_delete(ptr_00);
        iVar3 = this->N_SHIPS;
        pnVar4->electron[0] = (enemy *)0x0;
      }
      pnVar4 = (neutron *)&pnVar4->user_stage;
    } while (iVar5 < iVar3 + -1);
  }
  this->N_SHIPS = 1;
  terrain::navigation_mode(this->ground);
  this_00 = this->ground;
  terrain::change_color
            (this_00,this_00->material[0],this_00->material[1],this_00->material[2],(int)unaff_s2);
  this->game_mode = 2;
  return 0;
}



----------------------------------------

// Function: load_stage @ 0890f74c

/* DWARF original prototype: void load_stage(neutron * this, int stage, bool setup_cams) */

void __thiscall neutron::load_stage(neutron *this,int stage,bool setup_cams)

{
  GLfloat GVar1;
  terrain *ptVar2;
  glinterface *pgVar3;
  camera *pcVar4;
  terrain *ptVar5;
  int iVar6;
  miniature *pmVar7;
  int unaff_s4;
  
  this->game_mode = 0;
  this->actual_stage = stage;
  if (stage == 1000) {
    ptVar2 = operator_new(0x1400);
    ptVar2->N_PLANES = 0x5a;
    iVar6 = 0;
    ptVar5 = ptVar2;
    do {
                    /* Unresolved local var: void anon_var_0@[???] */
      iVar6 = iVar6 + 1;
      ptVar5->map[0] = (plane *)0x0;
      ptVar5->painted[0][0] = false;
      ptVar5->painted[0][1] = false;
      ptVar5->painted[0][2] = false;
      ptVar5->painted[0][3] = false;
      ptVar5 = (terrain *)ptVar5->map;
    } while (iVar6 < 0x5a);
    ptVar2->is_clear = true;
    ptVar2->ground_material[2] = 0xff;
    ptVar2->ground_material[0] = 0xff;
    ptVar2->ground_material[1] = 0xff;
    ptVar2->material[3] = 100;
    ptVar2->material[0] = 100;
    ptVar2->material[1] = 100;
    ptVar2->material[2] = 100;
    ptVar2->ground_material[3] = 0x1e;
    ptVar2->max_vertex[0] = 0;
    ptVar2->max_vertex[1] = 0;
    ptVar2->max_vertex[2] = 0;
    pgVar3 = operator_new(1);
    ptVar2->printer = pgVar3;
    ptVar2->status = 4;
    ptVar2->painted_bones = 0;
    ptVar2->painted_planes = 0;
    ptVar2->time = 0;
    pcVar4 = operator_new(0x38);
    pcVar4->x = 0.0;
    pcVar4->y = 0.0;
    GVar1 = DAT_089dbce4;
    pcVar4->z = 0.0;
    pcVar4->x_dir = 0.0;
    pcVar4->y_ori = GVar1;
    pcVar4->y_dir = 0.0;
    pcVar4->z_dir = 0.0;
    pcVar4->x_ori = 0.0;
    pcVar4->z_ori = 0.0;
    pcVar4->degrees = 0;
    pgVar3 = operator_new(1);
    pcVar4->locator = pgVar3;
    ptVar2->start_on_plane = -1;
    ptVar2->cam_terrain = pcVar4;
    this->ground = ptVar2;
    pcVar4->last_x = 0.0;
    pcVar4->last_y = 0.0;
    pcVar4->last_z = 0.0;
    terrain::create_from_array(ptVar2,0xe,::::MENU_DATA);
    terrain::init(this->ground,0,0,0,unaff_s4);
    this->ground->status = 1;
    this->N_SHIPS = 1;
    load_proton(this,setup_cams);
    return;
  }
  if (stage == 2000) {
    ptVar2 = operator_new(0x1400);
    ptVar2->N_PLANES = 0x5a;
    iVar6 = 0;
    ptVar5 = ptVar2;
    do {
                    /* Unresolved local var: void anon_var_0@[???] */
      iVar6 = iVar6 + 1;
      ptVar5->map[0] = (plane *)0x0;
      ptVar5->painted[0][0] = false;
      ptVar5->painted[0][1] = false;
      ptVar5->painted[0][2] = false;
      ptVar5->painted[0][3] = false;
      ptVar5 = (terrain *)ptVar5->map;
    } while (iVar6 < 0x5a);
    ptVar2->is_clear = true;
    ptVar2->ground_material[2] = 0xff;
    ptVar2->ground_material[0] = 0xff;
    ptVar2->ground_material[1] = 0xff;
    ptVar2->material[3] = 100;
    ptVar2->material[0] = 100;
    ptVar2->material[1] = 100;
    ptVar2->material[2] = 100;
    ptVar2->ground_material[3] = 0x1e;
    ptVar2->max_vertex[0] = 0;
    ptVar2->max_vertex[1] = 0;
    ptVar2->max_vertex[2] = 0;
    pgVar3 = operator_new(1);
    ptVar2->printer = pgVar3;
    ptVar2->status = 4;
    ptVar2->painted_bones = 0;
    ptVar2->painted_planes = 0;
    ptVar2->time = 0;
    pcVar4 = operator_new(0x38);
    pcVar4->x = 0.0;
    pcVar4->y = 0.0;
    GVar1 = DAT_089dbce4;
    pcVar4->z = 0.0;
    pcVar4->x_dir = 0.0;
    pcVar4->y_ori = GVar1;
    pcVar4->y_dir = 0.0;
    pcVar4->z_dir = 0.0;
    pcVar4->x_ori = 0.0;
    pcVar4->z_ori = 0.0;
    pcVar4->degrees = 0;
    pgVar3 = operator_new(1);
    pmVar7 = this->miniatures[0];
    pcVar4->locator = pgVar3;
    ptVar2->start_on_plane = -1;
    ptVar2->cam_terrain = pcVar4;
    this->ground = ptVar2;
    pcVar4->last_x = 0.0;
    pcVar4->last_y = 0.0;
    pcVar4->last_z = 0.0;
    terrain::create_from_miniature(ptVar2,pmVar7);
    terrain::init(this->ground,0,0,0,unaff_s4);
    this->N_SHIPS = 1;
    this->game_mode = 2;
    load_proton(this,setup_cams);
    return;
  }
  if (stage == 3000) {
    load_miniatures(this);
    this->N_SHIPS = 0;
    return;
  }
  if (this->user_difficulty == 0) {
    this->N_SHIPS = this->miniatures[stage + -1]->cubes + 1;
  }
  else {
    this->N_SHIPS = this->miniatures[stage + -1]->cubes * 2 + 1;
  }
  ptVar2 = operator_new(0x1400);
  ptVar2->N_PLANES = 0x5a;
  iVar6 = 0;
  ptVar5 = ptVar2;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    iVar6 = iVar6 + 1;
    ptVar5->map[0] = (plane *)0x0;
    ptVar5->painted[0][0] = false;
    ptVar5->painted[0][1] = false;
    ptVar5->painted[0][2] = false;
    ptVar5->painted[0][3] = false;
    ptVar5 = (terrain *)ptVar5->map;
  } while (iVar6 < 0x5a);
  ptVar2->is_clear = true;
  ptVar2->ground_material[2] = 0xff;
  ptVar2->ground_material[0] = 0xff;
  ptVar2->ground_material[1] = 0xff;
  ptVar2->material[3] = 100;
  ptVar2->material[0] = 100;
  ptVar2->material[1] = 100;
  ptVar2->material[2] = 100;
  ptVar2->ground_material[3] = 0x1e;
  ptVar2->max_vertex[0] = 0;
  ptVar2->max_vertex[1] = 0;
  ptVar2->max_vertex[2] = 0;
  pgVar3 = operator_new(1);
  ptVar2->printer = pgVar3;
  ptVar2->status = 4;
  ptVar2->painted_bones = 0;
  ptVar2->painted_planes = 0;
  ptVar2->time = 0;
  pcVar4 = operator_new(0x38);
  pcVar4->x = 0.0;
  pcVar4->y = 0.0;
  pcVar4->y_ori = DAT_089dbce4;
  pcVar4->z = 0.0;
  pcVar4->x_dir = 0.0;
  pcVar4->y_dir = 0.0;
  pcVar4->z_dir = 0.0;
  pcVar4->x_ori = 0.0;
  pcVar4->z_ori = 0.0;
  pcVar4->degrees = 0;
  pgVar3 = operator_new(1);
  pmVar7 = this->miniatures[stage + -1];
  pcVar4->locator = pgVar3;
  ptVar2->start_on_plane = -1;
  ptVar2->cam_terrain = pcVar4;
  pcVar4->last_x = 0.0;
  pcVar4->last_y = 0.0;
  pcVar4->last_z = 0.0;
  this->ground = ptVar2;
  terrain::create_from_miniature(ptVar2,pmVar7);
  if (this->miniatures[stage + -1]->cubes < 8) {
    terrain::init(this->ground,0,0,0,unaff_s4);
    load_proton(this,setup_cams);
    autoload_eletrons(this,this->N_SHIPS + -1);
    return;
  }
  terrain::init(this->ground,0,0,0,unaff_s4);
  load_proton(this,setup_cams);
  autoload_eletrons(this,this->N_SHIPS + -1);
  return;
}



----------------------------------------

// Function: change_stage @ 0890fc90

/* WARNING: Removing unreachable block (ram,0x0890fe98) */
/* WARNING: Removing unreachable block (ram,0x0890fe68) */
/* WARNING: Removing unreachable block (ram,0x0890fe3c) */
/* WARNING: Removing unreachable block (ram,0x0890fe1c) */
/* WARNING: Removing unreachable block (ram,0x0890fd88) */
/* WARNING: Removing unreachable block (ram,0x0890fffc) */
/* WARNING: Removing unreachable block (ram,0x0890fdac) */
/* WARNING: Removing unreachable block (ram,0x0890fe2c) */
/* WARNING: Removing unreachable block (ram,0x0890fe4c) */
/* WARNING: Removing unreachable block (ram,0x0890fe80) */
/* WARNING: Removing unreachable block (ram,0x0890feb0) */
/* DWARF original prototype: int change_stage(neutron * this, int stage, bool show_it) */

int __thiscall neutron::change_stage(neutron *this,int stage,bool show_it)

{
  float fVar1;
  player *ppVar2;
  int iVar3;
  int *piVar4;
  terrain *ptVar5;
  sound_mixer *psVar6;
  button *pbVar7;
  stage_interface *psVar8;
  int iVar9;
  int unaff_retaddr;
  
                    /* Unresolved local var: int * buttons@[???] */
  restart(this);
  unload_stage(this);
  load_stage(this,stage,show_it);
  if (stage == 1000) {
    if (this->user_sound == false) {
      psVar8 = this->interface;
    }
    else {
      sound_mixer::play_music(this->mixer,0);
      psVar8 = this->interface;
    }
    pbVar7 = psVar8->buttons[0x1e];
    this->vision = 1;
    button::load_text(pbVar7,"tap to select or drag to move",-1);
    return 0xb;
  }
  if (stage == 3000) {
    this->vision = 0;
    piVar4 = operator_new___(0x18);
    psVar8 = this->interface;
    *piVar4 = 0x1b;
    piVar4[1] = 0x1c;
    piVar4[2] = 0xd;
    piVar4[3] = 0x1d;
    piVar4[5] = 0x23;
    piVar4[4] = 0x22;
    stage_interface::activate_buttons(psVar8,piVar4,6);
    operator_delete___(piVar4);
    button::load_text(this->interface->buttons[6],"cube",0xff);
    on_miniature_change(this);
    return 9;
  }
                    /* Unresolved local var: int a_e@[???]
                       Unresolved local var: int b_e@[???]
                       Unresolved local var: int a@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int d@[???]
                       Unresolved local var: int e@[???]
                       Unresolved local var: int f@[???] */
  if (this->user_sound != false) {
    psVar6 = this->mixer;
    iVar3 = rand();
    sound_mixer::play_music(psVar6,iVar3 % 3 + 1);
  }
  if (stage == 2000) {
    piVar4 = operator_new___(0x18);
    psVar8 = this->interface;
    *piVar4 = 4;
    piVar4[1] = 5;
    piVar4[2] = 0xd;
    piVar4[3] = 0xe;
    piVar4[4] = 0x13;
    piVar4[5] = 0x14;
    stage_interface::activate_buttons(psVar8,piVar4,6);
    button::load_text(this->interface->buttons[6],"welcome to trainer stage",0xff);
    operator_delete___(piVar4);
    iVar3 = this->N_SHIPS;
  }
  else {
    piVar4 = operator_new___(0x14);
    psVar8 = this->interface;
    *piVar4 = 4;
    piVar4[1] = 5;
    piVar4[2] = 0x13;
    piVar4[3] = 0x14;
    piVar4[4] = 0xd;
    stage_interface::activate_buttons(psVar8,piVar4,5);
    button::load_text(this->interface->buttons[6],"get ready",0xff);
    this->tutorial_step = -1;
    operator_delete___(piVar4);
    if (stage == 1) {
      if (this->isTutorial == false) {
        iVar3 = this->N_SHIPS;
      }
      else {
        pbVar7 = this->interface->buttons[6];
        this->tutorial_step = 0;
        button::load_text(pbVar7,"welcome to neutron|s tutorial",0xff);
        button::load_text(this->interface->buttons[0x1e],"next",-1);
        iVar3 = this->N_SHIPS;
      }
    }
    else {
      iVar3 = this->N_SHIPS;
    }
  }
  iVar3 = (iVar3 + -1) % 100;
  psVar8 = this->interface;
  this->n_enemies = this->enemies_buffer;
  this->enemies_buffer[1] = (char)(iVar3 % 10) + '0';
  this->enemies_buffer[0] = (char)(iVar3 / 10) + '0';
  button::load_text(psVar8->buttons[3],this->enemies_buffer,-1);
  iVar9 = this->ground->N_PLANES;
  iVar3 = this->ground->map[0]->side_size;
  psVar8 = this->interface;
  this->n_score = this->score_buffer;
  iVar3 = iVar3 * iVar3 * iVar9;
  this->score = iVar3;
  this->score_buffer[0] = (char)(iVar3 / 100000) + '0';
  this->score_buffer[3] = (char)((iVar3 % 1000) / 100) + '0';
  this->score_buffer[1] = (char)((iVar3 % 100000) / 10000) + '0';
  this->score_buffer[2] = (char)((iVar3 % 10000) / 1000) + '0';
  this->score_buffer[5] = (char)((iVar3 % 100) % 10) + '0';
  this->score_buffer[4] = (char)((iVar3 % 100) / 10) + '0';
  button::load_text(psVar8->buttons[1],this->score_buffer,-1);
  this->vision = 1;
  fVar1 = DAT_089dc368;
  if (!show_it) {
    ppVar2 = this->proton;
    ptVar5 = this->ground;
    psVar6 = this->mixer;
    (ppVar2->super_ship).status = 3;
    ptVar5->status = 1;
    ptVar5->painted_planes = 0;
    ptVar5->painted_bones = 0;
    (ppVar2->super_ship).effect_size = fVar1;
    this->time = 0x19;
    this->go_status = 0;
    sound_mixer::play_effect(psVar6,0xb);
    return 4;
  }
  ptVar5 = this->ground;
  psVar6 = this->mixer;
  ptVar5->status = 4;
  ptVar5->painted_planes = 1;
  ptVar5->painted_bones = 1;
  sound_mixer::play_effect(psVar6,3);
  ppVar2 = this->proton;
  terrain::change_color
            (this->ground,(ppVar2->super_ship).material[0],(ppVar2->super_ship).material[1],
             (ppVar2->super_ship).material[2],unaff_retaddr);
  return 5;
}



----------------------------------------

// Function: next_level @ 08910178

/* DWARF original prototype: int next_level(neutron * this) */

int __thiscall neutron::next_level(neutron *this)

{
  int iVar1;
  
  if ((this->isSolo == false) && (this->colision != 1)) {
    iVar1 = this->actual_stage + 1;
    if (this->actual_stage < 0x19) {
      this->actual_stage = iVar1;
      if (this->user_stage < iVar1) {
        this->save_game = true;
        this->user_stage = iVar1;
        iVar1 = change_stage(this,this->actual_stage,true);
        return iVar1;
      }
    }
    else {
      this->actual_stage = 1;
    }
    iVar1 = change_stage(this,this->actual_stage,true);
    return iVar1;
  }
  iVar1 = change_stage(this,this->actual_stage,false);
  return iVar1;
}



----------------------------------------

// Function: step_tutorial @ 089101ec

/* DWARF original prototype: void step_tutorial(neutron * this) */

void __thiscall neutron::step_tutorial(neutron *this)

{
  int iVar1;
  int *id_enableds;
  stage_interface *psVar2;
  char *word;
  
                    /* Unresolved local var: int * buttons@[???] */
  iVar1 = this->tutorial_step + 1;
  this->tutorial_step = iVar1;
  switch(iVar1) {
  default:
    return;
  case 1:
    psVar2 = this->interface;
    word = "you are this blinking cube";
    break;
  case 2:
    psVar2 = this->interface;
    word = "look, you have a tail";
    break;
  case 3:
    psVar2 = this->interface;
    word = "and this colored squares are your guides";
    break;
  case 4:
    psVar2 = this->interface;
    word = "red means pod|s left. blue means pod|s right";
    break;
  case 5:
    id_enableds = operator_new___(0xc);
    psVar2 = this->interface;
    *id_enableds = 0x1e;
    id_enableds[2] = 4;
    id_enableds[1] = 0xd;
    stage_interface::activate_buttons(psVar2,id_enableds,3);
    button::load_text(this->interface->buttons[6],"tap left part of the screen to turn left",0xff);
    goto LAB_089102ec;
  case 6:
    id_enableds = operator_new___(0xc);
    psVar2 = this->interface;
    *id_enableds = 0x1e;
    id_enableds[2] = 5;
    id_enableds[1] = 0xd;
    stage_interface::activate_buttons(psVar2,id_enableds,3);
    button::load_text(this->interface->buttons[6],"now try with right part to turn right",0xff);
    goto LAB_089102ec;
  case 7:
    id_enableds = operator_new___(0x10);
    psVar2 = this->interface;
    *id_enableds = 0x1e;
    id_enableds[1] = 0xd;
    id_enableds[2] = 4;
    id_enableds[3] = 5;
    stage_interface::activate_buttons(psVar2,id_enableds,4);
    button::load_text(this->interface->buttons[6],"ok, good. practice a beat ...",0xff);
    goto LAB_089102ec;
  case 8:
    psVar2 = this->interface;
    word = "navigation mode done, let|s see combat mode";
    break;
  case 9:
    psVar2 = this->interface;
    word = "now, i will load an enemy, tap next to do it";
    break;
  case 10:
    id_enableds = operator_new___(0xc);
    psVar2 = this->interface;
    *id_enableds = 0xd;
    id_enableds[2] = 5;
    id_enableds[1] = 4;
    stage_interface::activate_buttons(psVar2,id_enableds,3);
    load_new_enemy(this);
    button::load_text(this->interface->buttons[6],"enemy|s location is colored ...",0xff);
    goto LAB_089102ec;
  case 0xb:
    id_enableds = operator_new___(0x10);
    psVar2 = this->interface;
    *id_enableds = 0x1e;
    id_enableds[1] = 0xd;
    id_enableds[2] = 4;
    id_enableds[3] = 5;
    stage_interface::activate_buttons(psVar2,id_enableds,4);
    button::load_text(this->interface->buttons[6],"there it is, he also has a tail ...",0xff);
    goto LAB_089102ec;
  case 0xc:
    psVar2 = this->interface;
    word = "his tail is growing, also your|s ...";
    break;
  case 0xe:
    psVar2 = this->interface;
    word = "your mission: don|t crash to any tail";
    break;
  case 0xf:
    psVar2 = this->interface;
    word = "tap next when ready to fight";
    break;
  case 0x10:
    id_enableds = operator_new___(0xc);
    psVar2 = this->interface;
    *id_enableds = 0xd;
    id_enableds[2] = 5;
    id_enableds[1] = 4;
    stage_interface::activate_buttons(psVar2,id_enableds,3);
    button::load_text(this->interface->buttons[6],"combat mode",0xff);
    goto LAB_089102ec;
  case 0x11:
    id_enableds = operator_new___(8);
    psVar2 = this->interface;
    *id_enableds = 0x1e;
    id_enableds[1] = 0xd;
    stage_interface::activate_buttons(psVar2,id_enableds,2);
    if (this->colision == 1) {
      button::load_text(this->interface->buttons[6],"you lose, best luck next time",0xff);
    }
    else {
      button::load_text(this->interface->buttons[6],"you win, congratulations",0xff);
    }
    goto LAB_089102ec;
  case 0x12:
    button::load_text(this->interface->buttons[6],"remeber, left and right are relatives ...",0xff);
    button::load_text(this->interface->buttons[0x1e],"load stage one",0xff);
    restart(this);
    return;
  case 0x13:
    id_enableds = operator_new___(0x14);
    psVar2 = this->interface;
    *id_enableds = 4;
    id_enableds[1] = 5;
    id_enableds[2] = 0x13;
    id_enableds[3] = 0x14;
    id_enableds[4] = 0xd;
    stage_interface::activate_buttons(psVar2,id_enableds,5);
    this->tutorial_step = -1;
    this->isTutorial = false;
    iVar1 = change_stage(this,1,true);
    this->game_status = iVar1;
LAB_089102ec:
    operator_delete___(id_enableds);
    return;
  }
  button::load_text(psVar2->buttons[6],word,0xff);
  return;
}



----------------------------------------

// Function: tutorial @ 08910634

/* DWARF original prototype: int tutorial(neutron * this) */

int __thiscall neutron::tutorial(neutron *this)

{
  float fVar1;
  int iVar2;
  player *ppVar3;
  enemy *peVar4;
  int in_stack_00000000;
  
                    /* Unresolved local var: int piece_type@[???] */
  fVar1 = DAT_089dc368;
  switch(this->tutorial_step) {
  case 0:
  case 0xb:
  case 0xd:
  case 0xe:
  case 0xf:
  case 0x11:
  case 0x12:
    goto switchD_08910668_caseD_0;
  case 1:
    ppVar3 = this->proton;
    if ((ppVar3->super_ship).status != 3) {
      (ppVar3->super_ship).status = 3;
      (ppVar3->super_ship).effect_alpha = 0;
      (ppVar3->super_ship).effect_size = fVar1;
    }
    goto switchD_08910668_caseD_0;
  default:
    player::move(this->proton,this->ground->map,this->game_mode);
    ppVar3 = this->proton;
    if ((ppVar3->super_ship).actual_plane == (ppVar3->super_ship).last_plane) {
      return this->game_status;
    }
    if ((ppVar3->super_ship).last_advance == (ppVar3->super_ship).advance) {
      return this->game_status;
    }
    sound_mixer::play_effect(this->mixer,7);
    return this->game_status;
  case 10:
    player::move(this->proton,this->ground->map,this->game_mode);
    ppVar3 = this->proton;
    iVar2 = (ppVar3->super_ship).actual_plane;
    if (iVar2 == (ppVar3->super_ship).last_plane) {
      peVar4 = this->electron[0];
    }
    else {
      if ((ppVar3->super_ship).last_advance == (ppVar3->super_ship).advance) {
        peVar4 = this->electron[0];
      }
      else {
        sound_mixer::play_effect(this->mixer,7);
        ppVar3 = this->proton;
        peVar4 = this->electron[0];
      }
      iVar2 = (ppVar3->super_ship).actual_plane;
    }
    if (iVar2 == (peVar4->super_ship).actual_plane) {
      if ((peVar4->super_ship).status == 0) {
        this->game_mode = 1;
        terrain::combat_mode(this->ground);
        peVar4 = this->electron[0];
        terrain::change_color
                  (this->ground,(peVar4->super_ship).material[0],(peVar4->super_ship).material[1],
                   (peVar4->super_ship).material[2],in_stack_00000000);
        peVar4 = this->electron[0];
        (peVar4->super_ship).status = 1;
        goto LAB_089106cc;
      }
      iVar2 = (peVar4->super_ship).status;
    }
    else {
LAB_089106cc:
      iVar2 = (peVar4->super_ship).status;
    }
    if (iVar2 == 1) {
      ppVar3 = this->proton;
LAB_089108a4:
      enemy::move(peVar4,this->ground->map,(ppVar3->super_ship).actual_face);
      iVar2 = this->tutorial_counter + 1;
      this->tutorial_counter = iVar2;
    }
    else {
      iVar2 = this->tutorial_counter;
    }
    break;
  case 0xc:
    player::move(this->proton,this->ground->map,this->game_mode);
    ppVar3 = this->proton;
    if ((ppVar3->super_ship).actual_plane == (ppVar3->super_ship).last_plane) {
      peVar4 = this->electron[0];
    }
    else if ((ppVar3->super_ship).last_advance == (ppVar3->super_ship).advance) {
      peVar4 = this->electron[0];
    }
    else {
      sound_mixer::play_effect(this->mixer,7);
      peVar4 = this->electron[0];
    }
    iVar2 = this->tutorial_counter;
    if ((peVar4->super_ship).status == 1) {
      if (iVar2 == 0) {
        ship::change_direction(&peVar4->super_ship,1);
        peVar4 = this->electron[0];
      }
      ppVar3 = this->proton;
      goto LAB_089108a4;
    }
    break;
  case 0x10:
    iVar2 = player::move(this->proton,this->ground->map,this->game_mode);
    ppVar3 = this->proton;
    if (((ppVar3->super_ship).actual_plane != (ppVar3->super_ship).last_plane) &&
       ((ppVar3->super_ship).last_advance != (ppVar3->super_ship).advance)) {
      sound_mixer::play_effect(this->mixer,7);
    }
    if (iVar2 == 0) {
      ppVar3 = this->proton;
    }
    else {
      terrain::fire_up_cue(this->ground,0);
      this->colision = 1;
      (this->proton->super_ship).status = 6;
      step_tutorial(this);
      sound_mixer::play_effect(this->mixer,4);
      ppVar3 = this->proton;
    }
    iVar2 = enemy::move(this->electron[0],this->ground->map,(ppVar3->super_ship).actual_face);
    if (iVar2 == 0) {
      return this->game_status;
    }
    terrain::fire_up_cue(this->ground,1);
    this->colision = 2;
    (this->electron[0]->super_ship).status = 6;
    step_tutorial(this);
    sound_mixer::play_effect(this->mixer,4);
    return this->game_status;
  }
  if (iVar2 < 2) {
    return this->game_status;
  }
  step_tutorial(this);
  this->tutorial_counter = 0;
switchD_08910668_caseD_0:
  return this->game_status;
}



----------------------------------------

// Function: main_loop @ 0891094c

/* DWARF original prototype: void main_loop(neutron * this) */

void __thiscall neutron::main_loop(neutron *this)

{
  int iVar1;
  
  iVar1 = this->game_status;
  this->speed = DAT_089de254;
  if (iVar1 == 8) {
    iVar1 = level_complete(this);
    this->game_status = iVar1;
  }
  else if (iVar1 < 9) {
    if (iVar1 == 3) {
      iVar1 = next_level(this);
      this->game_status = iVar1;
      return;
    }
    if (iVar1 < 4) {
      if (iVar1 == 0) {
        if (this->user_difficulty == 1) {
          this->speed = DAT_089de25c;
        }
        else {
          this->speed = DAT_089de258;
        }
        iVar1 = run(this);
        this->game_status = iVar1;
      }
      else if (iVar1 == 1) {
        iVar1 = stage_over(this);
        this->game_status = iVar1;
      }
    }
    else if (iVar1 == 5) {
      iVar1 = show_stage(this);
      this->game_status = iVar1;
    }
    else if (iVar1 < 5) {
      iVar1 = delay(this,this->go_status,this->time);
      this->game_status = iVar1;
    }
    else if (iVar1 == 6) {
      iVar1 = wait_option(this);
      this->game_status = iVar1;
    }
  }
  else {
    if (iVar1 == 0xb) {
      iVar1 = change_option(this);
      this->game_status = iVar1;
      return;
    }
    if (iVar1 < 0xc) {
      if (iVar1 == 9) {
        iVar1 = show_miniatures(this);
        this->game_status = iVar1;
      }
      else if (iVar1 == 10) {
        this->speed = DAT_089de258;
        iVar1 = tutorial(this);
        this->game_status = iVar1;
      }
    }
    else if (iVar1 == 0xd) {
      iVar1 = show_staff(this);
      this->game_status = iVar1;
    }
    else if (iVar1 < 0xd) {
      iVar1 = are_you_sure(this);
      this->game_status = iVar1;
    }
    else if (iVar1 == 1000) {
      iVar1 = game_intro(this);
      this->game_status = iVar1;
    }
  }
  return;
}



----------------------------------------

// Function: execute_action @ 08910b20

/* DWARF original prototype: void execute_action(neutron * this, int action) */

void __thiscall neutron::execute_action(neutron *this,int action)

{
  bool bVar1;
  int iVar2;
  int *id_enableds;
  stage_interface *psVar3;
  int iVar4;
  sound_mixer *psVar5;
  button *pbVar6;
  player *this_00;
  
                    /* Unresolved local var: int * buttons@[???] */
  switch(action) {
  case 0:
    this_00 = this->proton;
    iVar2 = 0;
    goto LAB_08910ff4;
  case 1:
    this_00 = this->proton;
    iVar2 = 1;
LAB_08910ff4:
    ship::change_direction(&this_00->super_ship,iVar2);
    return;
  case 2:
    menu_move(this,3);
    psVar5 = this->mixer;
    iVar2 = 1;
    break;
  case 3:
  case 0xd:
    menu_move(this,2);
    psVar5 = this->mixer;
    iVar2 = 1;
    break;
  default:
    return;
  case 5:
    iVar2 = 2000;
    goto LAB_08911034;
  case 6:
    menu_move(this,0);
    psVar5 = this->mixer;
    iVar2 = 2;
    break;
  case 7:
    menu_move(this,1);
    psVar5 = this->mixer;
    iVar2 = 2;
    break;
  case 8:
    if ((this->game_status == 0) && (this->actual_stage != 2000)) {
      id_enableds = operator_new___(8);
      psVar3 = this->interface;
      *id_enableds = 0x25;
      id_enableds[1] = 0x24;
      stage_interface::activate_buttons(psVar3,id_enableds,2);
      this->game_status = 0xc;
LAB_089110c8:
      psVar5 = this->mixer;
    }
    else {
      id_enableds = operator_new___(0xc);
      psVar3 = this->interface;
      *id_enableds = 7;
      id_enableds[1] = 0xb;
      id_enableds[2] = 0xc;
      stage_interface::activate_buttons(psVar3,id_enableds,3);
      bVar1 = this->isSolo;
      this->interface->actual_option = 0;
      if (bVar1 != false) {
        this->isSolo = false;
      }
      if (-1 < this->tutorial_step) {
        this->tutorial_step = -1;
      }
      iVar2 = change_stage(this,1000,true);
      this->game_status = iVar2;
      if (this->user_sound == false) goto LAB_089110c8;
      sound_mixer::play_music(this->mixer,0);
      psVar5 = this->mixer;
    }
    sound_mixer::play_effect(psVar5,1);
    goto LAB_08910f34;
  case 9:
    load_new_enemy(this);
    psVar5 = this->mixer;
    iVar2 = 1;
    break;
  case 10:
    iVar2 = 1;
    this->isTutorial = true;
    goto LAB_08911034;
  case 0xb:
    iVar2 = this->user_stage;
    goto LAB_08911034;
  case 0xc:
    load_miniatures(this);
    iVar2 = 3000;
LAB_08911034:
    iVar4 = change_stage(this,iVar2,true);
    psVar5 = this->mixer;
    iVar2 = 1;
    this->game_status = iVar4;
    break;
  case 0xe:
    menu_move(this,3);
    psVar5 = this->mixer;
    iVar2 = 1;
    this->save_game = true;
    break;
  case 0xf:
    psVar3 = this->interface;
    if (psVar3->choosen_color < 2) {
      psVar3->choosen_color = psVar3->choosen_color + 1;
    }
    else {
      psVar3->choosen_color = 0;
    }
    iVar2 = psVar3->choosen_color;
    this->user_color = iVar2;
    player::change_color(this->proton,iVar2);
    psVar5 = this->mixer;
    iVar2 = 1;
    break;
  case 0x10:
    if (this->user_difficulty == 0) {
      pbVar6 = this->interface->buttons[0x17];
      this->user_difficulty = 1;
      button::load_text(pbVar6,"hard",-1);
      psVar5 = this->mixer;
      iVar2 = 1;
    }
    else {
      pbVar6 = this->interface->buttons[0x17];
      this->user_difficulty = 0;
      button::load_text(pbVar6,"easy",-1);
      psVar5 = this->mixer;
      iVar2 = 1;
    }
    break;
  case 0x11:
    if (this->user_sound == false) {
      pbVar6 = this->interface->buttons[0x19];
      this->user_sound = true;
      button::load_text(pbVar6,"on",-1);
      sound_mixer::stop_all(this->mixer,0);
      sound_mixer::stop_all(this->mixer,1);
      sound_mixer::play_music(this->mixer,0);
      psVar5 = this->mixer;
      iVar2 = 1;
    }
    else {
      pbVar6 = this->interface->buttons[0x19];
      this->user_sound = false;
      button::load_text(pbVar6,"off",-1);
      sound_mixer::stop_all(this->mixer,1);
      psVar5 = this->mixer;
      iVar2 = 1;
    }
    break;
  case 0x12:
    psVar5 = this->mixer;
    iVar2 = 1;
    this->game_status = 3;
    break;
  case 0x13:
    this->miniatures[this->actual_miniature]->color[3] = 0x4b;
    iVar2 = this->actual_miniature;
    if (iVar2 < 1) {
      iVar2 = this->user_stage;
    }
    this->actual_miniature = iVar2 + -1;
    pbVar6 = this->interface->buttons[6];
    this->miniatures[this->actual_miniature]->color[3] = 0xff;
    button::load_text(pbVar6,this->miniatures[this->actual_miniature]->name,0xff);
    psVar5 = this->mixer;
    goto LAB_08910d54;
  case 0x14:
    this->miniatures[this->actual_miniature]->color[3] = 0x4b;
    if (this->actual_miniature < 0x18) {
      iVar2 = this->actual_miniature + 1;
      if (iVar2 < this->user_stage) {
        this->actual_miniature = iVar2;
      }
      else {
        this->actual_miniature = 0;
      }
    }
    else {
      this->actual_miniature = 0;
    }
    button::load_text(this->interface->buttons[6],this->miniatures[this->actual_miniature]->name,
                      0xff);
    psVar5 = this->mixer;
    this->miniatures[this->actual_miniature]->color[3] = 0xff;
LAB_08910d54:
    sound_mixer::play_effect(psVar5,2);
    on_miniature_change(this);
    return;
  case 0x15:
    iVar2 = change_stage(this,this->actual_miniature + 1,true);
    psVar5 = this->mixer;
    this->game_status = iVar2;
    iVar2 = 1;
    this->isSolo = true;
    break;
  case 0x16:
    step_tutorial(this);
    psVar5 = this->mixer;
    iVar2 = 1;
    break;
  case 0x17:
    this->miniatures[this->actual_miniature]->color[3] = 0x4b;
    iVar2 = this->actual_miniature;
    if (4 < iVar2) {
      this->actual_miniature = iVar2 + -5;
      sound_mixer::play_effect(this->mixer,2);
      on_miniature_change(this);
      iVar2 = this->actual_miniature;
    }
    psVar3 = this->interface;
    this->miniatures[iVar2]->color[3] = 0xff;
    button::load_text(psVar3->buttons[6],this->miniatures[this->actual_miniature]->name,0xff);
    return;
  case 0x18:
    this->miniatures[this->actual_miniature]->color[3] = 0x4b;
    iVar2 = this->actual_miniature;
    if ((iVar2 < 0x14) && (iVar2 + 5 < this->user_stage)) {
      this->actual_miniature = iVar2 + 5;
      sound_mixer::play_effect(this->mixer,2);
      on_miniature_change(this);
      iVar2 = this->actual_miniature;
    }
    button::load_text(this->interface->buttons[6],this->miniatures[iVar2]->name,0xff);
    this->miniatures[this->actual_miniature]->color[3] = 0xff;
    return;
  case 0x19:
    id_enableds = operator_new___(0xc);
    psVar3 = this->interface;
    *id_enableds = 7;
    id_enableds[1] = 0xb;
    id_enableds[2] = 0xc;
    stage_interface::activate_buttons(psVar3,id_enableds,3);
    bVar1 = this->isSolo;
    this->interface->actual_option = 0;
    if (bVar1 != false) {
      this->isSolo = false;
    }
    if (-1 < this->tutorial_step) {
      this->tutorial_step = -1;
    }
    iVar2 = change_stage(this,1000,true);
    this->game_status = iVar2;
    sound_mixer::play_effect(this->mixer,1);
    if (this->user_sound != false) {
      sound_mixer::play_music(this->mixer,0);
    }
    goto LAB_08910f34;
  case 0x1a:
    id_enableds = operator_new___(0x14);
    psVar3 = this->interface;
    *id_enableds = 4;
    id_enableds[1] = 5;
    id_enableds[2] = 0x13;
    id_enableds[3] = 0x14;
    id_enableds[4] = 0xd;
    stage_interface::activate_buttons(psVar3,id_enableds,5);
    this->game_status = 0;
    sound_mixer::play_effect(this->mixer,1);
LAB_08910f34:
    operator_delete___(id_enableds);
    return;
  case 0x1b:
    psVar3 = this->interface;
    this->time = 0;
    pbVar6 = psVar3->buttons[0x26];
    psVar3->actual_staff = 0;
    button::load_text(pbVar6,psVar3->whats[0],200);
    psVar3 = this->interface;
    button::load_text(psVar3->buttons[0x27],psVar3->whos[psVar3->actual_staff],200);
    this->game_status = 0xd;
    return;
  }
  sound_mixer::play_effect(psVar5,iVar2);
  return;
}



----------------------------------------

// Function: miniature @ 08911270

/* WARNING: Removing unreachable block (ram,0x089113c8) */
/* DWARF original prototype: void miniature(miniature * this, int[3] * data, int cubes, int
   offset_x, int offset_y, int offset_z, char * new_name) */

void __thiscall
miniature::miniature
          (miniature *this,int (*data) [3],int cubes,int offset_x,int offset_y,int offset_z,
          char *new_name)

{
  int *piVar1;
  int iVar2;
  glinterface *pgVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int in_t0;
  int in_t1;
  char *in_t2;
  miniature *pmVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  
  this->high_score = 0x1b207;
  this->name = in_t2;
  this->min_vertex[1] = 1000;
  this->rotation = 0;
  this->cubes = cubes;
  this->max_vertex[0] = 0;
  this->max_vertex[1] = 0;
  this->max_vertex[2] = 0;
  this->min_vertex[0] = 1000;
  this->min_vertex[2] = 1000;
  this->cam[0] = 0;
  this->cam[1] = 0;
  this->cam[2] = 0;
  this->cam_center[0] = 0;
  this->cam_center[1] = 0;
  this->cam_center[2] = 0;
  this->offset[0] = offset_x;
  this->offset[1] = in_t0;
  this->offset[2] = in_t1;
                    /* Unresolved local var: void anon_var_0@[???] */
  if (cubes < 1) {
    iVar2 = this->max_vertex[2];
    iVar4 = this->min_vertex[2];
  }
  else {
    iVar9 = 0;
    pmVar7 = this;
    iVar6 = 0;
    iVar10 = 1000;
    do {
      iVar4 = (*data)[0];
      iVar2 = this->max_vertex[0];
      pmVar7->vertex[0][0] = iVar4;
      iVar4 = iVar4 + 2;
      pmVar7->vertex[0][1] = (*data)[1];
      pmVar7->vertex[0][2] = (*data)[2];
      if (iVar2 < iVar4) {
        this->max_vertex[0] = iVar4;
      }
      iVar8 = pmVar7->vertex[0][1];
      if (this->max_vertex[1] < iVar8 + 2) {
        this->max_vertex[1] = iVar8 + 2;
      }
      iVar4 = pmVar7->vertex[0][2];
      iVar2 = iVar4 + 2;
      if (iVar6 < iVar2) {
        this->max_vertex[2] = iVar2;
        iVar5 = pmVar7->vertex[0][0];
      }
      else {
        iVar5 = pmVar7->vertex[0][0];
        iVar2 = iVar6;
      }
      if (iVar5 < this->min_vertex[0]) {
        this->min_vertex[0] = iVar5;
      }
      if (iVar8 < this->min_vertex[1]) {
        this->min_vertex[1] = iVar8;
      }
      if (iVar4 < iVar10) {
        this->min_vertex[2] = iVar4;
        iVar6 = (*data)[0];
      }
      else {
        iVar6 = (*data)[0];
        iVar4 = iVar10;
      }
      iVar9 = iVar9 + 1;
      pmVar7->paint_pos[0][0] = offset_x + iVar6;
      pmVar7->paint_pos[0][1] = in_t0 + (*data)[1];
      piVar1 = *data;
      data = data + 1;
      pmVar7->paint_pos[0][2] = in_t1 + piVar1[2];
      pmVar7 = (miniature *)(pmVar7->color + 3);
      iVar6 = iVar2;
      iVar10 = iVar4;
    } while (iVar9 < cubes);
  }
  this->color[2] = 0xff;
  this->color[0] = 0xff;
  this->color[1] = 0xff;
  this->cam_center[1] = in_t0;
  this->color[3] = 0x4b;
  this->cam_center[0] = 0;
  this->cam_center[2] = in_t1 + iVar2 / 2 + iVar4;
  pgVar3 = operator_new(1);
  this->printer = pgVar3;
  return;
}



----------------------------------------

// Function: glBegin @ 08911424

void glBegin(GLenum mode)

{
  pspgl_context *ppVar1;
  
  ppVar1 = __pspgl_curctx;
  if (mode < 0xb) {
    (__pspgl_curctx->beginend).primitive = mode;
    (ppVar1->beginend).vertex_count = 0;
  }
  else {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glBegin");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x500;
    }
  }
  return;
}



----------------------------------------

// Function: glBlendFunc @ 0891148c

void glBlendFunc(GLenum sfactor,GLenum dfactor)

{
  uint uVar1;
  uint32_t uVar2;
  int iVar3;
  
                    /* Unresolved local var: uint srcfact@[???]
                       Unresolved local var: uint dstfact@[???] */
  if (dfactor == 0x301) {
    iVar3 = 1;
  }
  else if (dfactor < 0x302) {
    if (dfactor == 1) {
      uVar2 = 0xffffff;
    }
    else {
      if (dfactor != 0) {
        if (dfactor != 0x300) goto LAB_0891162c;
        iVar3 = 0;
        goto LAB_08911554;
      }
      uVar2 = 0;
    }
    iVar3 = 10;
    __pspgl_context_writereg(__pspgl_curctx,0xe1,uVar2);
  }
  else if (dfactor == 0x303) {
    iVar3 = 3;
  }
  else {
    iVar3 = 2;
    if (0x302 < dfactor) {
      if (dfactor == 0x304) {
        iVar3 = 4;
      }
      else {
        if (dfactor != 0x305) goto LAB_0891162c;
        iVar3 = 5;
      }
    }
  }
LAB_08911554:
  if (sfactor == 0x303) {
    uVar1 = 3;
  }
  else if (sfactor < 0x304) {
    if (sfactor == 1) {
      uVar2 = 0xffffff;
    }
    else {
      if (sfactor != 0) {
        if (sfactor != 0x302) {
LAB_0891162c:
          __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glBlendFunc");
          if (__pspgl_curctx != (pspgl_context *)0x0) {
            __pspgl_curctx->glerror = 0x500;
          }
          return;
        }
        uVar1 = 2;
        goto LAB_08911604;
      }
      uVar2 = 0;
    }
    __pspgl_context_writereg(__pspgl_curctx,0xe0,uVar2);
    uVar1 = 10;
  }
  else if (sfactor == 0x305) {
    uVar1 = 5;
  }
  else {
    uVar1 = 4;
    if (0x304 < sfactor) {
      if (sfactor == 0x306) {
        uVar1 = 0;
      }
      else {
        if (sfactor != 0x307) goto LAB_0891162c;
        uVar1 = 1;
      }
    }
  }
LAB_08911604:
  __pspgl_context_writereg_masked(__pspgl_curctx,0xdf,iVar3 << 4 | uVar1,0xff);
  return;
}



----------------------------------------

// Function: glClear @ 08911668

void glClear(GLbitfield mask)

{
  pspgl_context *c;
  uint *puVar1;
  pspgl_buffer *ppVar2;
  short sVar3;
  ushort uVar4;
  short sVar5;
  uint uVar6;
  ushort uVar7;
  pspgl_surface *ppVar8;
  uint uVar9;
  void *unaff_retaddr;
  void *in_stack_fffffffc;
  
                    /* Unresolved local var: clear_vertex * vbuf@[???]
                       Unresolved local var: pspgl_surface * s@[???]
                       Unresolved local var: ulong clearmask@[???]
                       Unresolved local var: ulong clearmode@[???]
                       Unresolved local var: uint x@[???]
                       Unresolved local var: uint y@[???]
                       Unresolved local var: uint width@[???]
                       Unresolved local var: uint height@[???] */
  uVar9 = (__pspgl_curctx->clear).color;
  ppVar8 = __pspgl_curctx->draw;
  if ((mask & 0xffffbaff) == 0) {
    puVar1 = __pspgl_dlist_insert_space(0x18);
    if ((mask & 0x4000) == 0) {
      uVar6 = 0;
    }
    else {
      uVar6 = 3;
      if (ppVar8->alpha_mask == 0) {
        uVar6 = 1;
      }
    }
    if (ppVar8->stencil_mask == 0) {
      ppVar2 = ppVar8->depth_buffer;
    }
    else if ((mask & 0x400) == 0) {
      ppVar2 = ppVar8->depth_buffer;
    }
    else {
      uVar9 = uVar9 & 0xffffff |
              (__pspgl_curctx->clear).stencil << ((byte)"glBlendFunc"[ppVar8->pixfmt + 0xb] & 0x1f);
      uVar6 = uVar6 | 2;
      ppVar2 = ppVar8->depth_buffer;
    }
    if ((ppVar2 != (pspgl_buffer *)0x0) && ((mask & 0x100) != 0)) {
      uVar6 = uVar6 | 4;
    }
    if ((__pspgl_curctx->scissor_test).enabled == 0) {
      uVar4 = ppVar8->width;
      uVar7 = ppVar8->height;
      sVar5 = 0;
      sVar3 = 0;
    }
    else {
      uVar7 = (ushort)(__pspgl_curctx->scissor_test).height;
      sVar5 = (short)(__pspgl_curctx->scissor_test).x;
      sVar3 = (short)(__pspgl_curctx->scissor_test).y;
      uVar4 = (ushort)(__pspgl_curctx->scissor_test).width;
    }
    *(short *)(puVar1 + 1) = sVar5;
    c = __pspgl_curctx;
    *(ushort *)((int)puVar1 + 6) = ppVar8->height - sVar3;
    *(ushort *)(puVar1 + 2) = (c->clear).depth;
    *(ushort *)(puVar1 + 4) = sVar5 + uVar4;
    *(ushort *)((int)puVar1 + 0x12) = ppVar8->height - (sVar3 + uVar7);
    uVar4 = (c->clear).depth;
    puVar1[3] = uVar9;
    *puVar1 = uVar9;
    *(ushort *)(puVar1 + 5) = uVar4;
    __pspgl_context_writereg(c,0xd3,uVar6 << 8 | 1);
    __pspgl_context_render_prim(__pspgl_curctx,6,2,0x80011c,unaff_retaddr,in_stack_fffffffc);
    __pspgl_context_writereg(__pspgl_curctx,0xd3,0);
    return;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x501,"glClear");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x501;
  }
  return;
}



----------------------------------------

// Function: update_color @ 08911850

void update_color(ulong c)

{
  uint32_t uVar1;
  pspgl_context *c_00;
  
  c_00 = __pspgl_curctx;
  uVar1 = (__pspgl_curctx->hw).ge_reg[0x17];
  (__pspgl_curctx->current).color = c;
  if ((char)uVar1 == '\0') {
    __pspgl_context_writereg(c_00,0x55,c);
    __pspgl_context_writereg(__pspgl_curctx,0x58,c >> 0x18);
    return;
  }
  return;
}



----------------------------------------

// Function: glColor4ub @ 089118c0

void glColor4ub(GLubyte r,GLubyte g,GLubyte b,GLubyte a)

{
  update_color((uint)g << 8 | (uint)b << 0x10 | (uint)a << 0x18 | (uint)r);
  return;
}



----------------------------------------

// Function: glColor3ub @ 089118e8

void glColor3ub(GLubyte r,GLubyte g,GLubyte b)

{
  update_color((uint)CONCAT11(g,r) | (uint)b << 0x10 | 0xff000000);
  return;
}



----------------------------------------

// Function: glColor4ubv @ 08911910

void glColor4ubv(GLubyte *c)

{
  update_color((uint)c[1] << 8 | (uint)c[3] << 0x18 | (uint)c[2] << 0x10 | (uint)*c);
  return;
}



----------------------------------------

// Function: glColor4f @ 08911940

/* WARNING: Unknown calling convention */

void glColor4f(GLfloat red,GLfloat green,GLfloat blue,GLfloat alpha)

{
  float fVar1;
  
  fVar1 = 0.0;
  if ((alpha < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < alpha)) {
    alpha = fVar1;
  }
  fVar1 = 0.0;
  if ((blue < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < blue)) {
    blue = fVar1;
  }
  fVar1 = 0.0;
  if ((green < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < green)) {
    green = fVar1;
  }
  fVar1 = 0.0;
  if ((red < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < red)) {
    red = fVar1;
  }
  update_color((int)(green * DAT_089df258) << 8 | (int)(blue * DAT_089df258) << 0x10 |
               (int)(alpha * DAT_089df258) << 0x18 | (int)(red * DAT_089df258));
  return;
}



----------------------------------------

// Function: glColor3f @ 08911a54

/* WARNING: Unknown calling convention */

void glColor3f(GLfloat red,GLfloat green,GLfloat blue)

{
  glColor4f(red,green,blue,DAT_089dbce4);
  return;
}



----------------------------------------

// Function: glColor4fv @ 08911a60

void glColor4fv(GLfloat *color)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  
  fVar4 = color[3];
  fVar1 = 0.0;
  if ((fVar4 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar4)) {
    fVar3 = color[2];
    fVar4 = fVar1;
  }
  else {
    fVar3 = color[2];
  }
  fVar1 = 0.0;
  if ((fVar3 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar3)) {
    fVar2 = color[1];
    fVar3 = fVar1;
  }
  else {
    fVar2 = color[1];
  }
  fVar1 = 0.0;
  if ((fVar2 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar2)) {
    fVar5 = *color;
    fVar2 = fVar1;
  }
  else {
    fVar5 = *color;
  }
  fVar1 = 0.0;
  if ((fVar5 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar5)) {
    fVar5 = fVar1;
  }
  update_color((int)(fVar2 * DAT_089df258) << 8 | (int)(fVar3 * DAT_089df258) << 0x10 |
               (int)(fVar4 * DAT_089df258) << 0x18 | (int)(fVar5 * DAT_089df258));
  return;
}



----------------------------------------

// Function: glDrawArrays @ 08911b84

void glDrawArrays(GLenum mode,GLint first,GLsizei count)

{
  varray *pvVar1;
  pspgl_context *c;
  GLboolean GVar2;
  uint uVar3;
  undefined3 extraout_var;
  short *psVar4;
  pspgl_buffer *data;
  GLenum GVar5;
  vertex_format *pvVar6;
  void *unaff_retaddr;
  uint uStackY_88;
  void *in_stack_ffffff88;
  void *in_stack_ffffff8c;
  
  uVar3 = __pspgl_glprim2geprim(mode);
  if ((int)uVar3 < 0) {
    GVar5 = 0x500;
LAB_0891742c:
    __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar5,"__pspgl_varray_draw");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = GVar5;
    }
  }
  else {
    if (count == 0) {
      return;
    }
    GVar2 = __pspgl_cache_arrays();
    if (CONCAT31(extraout_var,GVar2) == 0) {
LAB_08917318:
      __pspgl_ge_vertex_fmt(__pspgl_curctx,(vertex_format *)&uStackY_88);
      if (uStackY_88 == 0) {
        return;
      }
      data = __pspgl_varray_convert((vertex_format *)&uStackY_88,first,count);
      pvVar6 = (vertex_format *)&uStackY_88;
      if (data == (pspgl_buffer *)0x0) {
        GVar5 = 0x505;
        goto LAB_0891742c;
      }
    }
    else {
      data = (__pspgl_curctx->vertex_array).locked.cached_array;
      pvVar1 = &__pspgl_curctx->vertex_array;
      first = first - (__pspgl_curctx->vertex_array).locked.cached_first;
      data->refcount = data->refcount + 1;
      pvVar6 = &(pvVar1->locked).vfmt;
      if (data == (pspgl_buffer *)0x0) goto LAB_08917318;
    }
    __pspgl_context_render_prim
              (__pspgl_curctx,uVar3,count,pvVar6->hwformat,in_stack_ffffff88,in_stack_ffffff8c);
    __pspgl_dlist_pin_buffer(data,1);
    if (mode == 2) {
      psVar4 = __pspgl_dlist_insert_space(4);
      if (psVar4 == (short *)0x0) {
        __pspgl_assert_fail("idx != NULL",unaff_retaddr,"__pspgl_varray_draw","pspgl_varray_draw.c",
                            (int)in_stack_ffffff88);
      }
      c = __pspgl_curctx;
      uVar3 = pvVar6->hwformat;
      *psVar4 = (short)first + (short)count + -1;
      psVar4[1] = (short)first;
      __pspgl_context_render_prim(c,1,2,uVar3 | 0x1000,in_stack_ffffff88,in_stack_ffffff8c);
      __pspgl_dlist_pin_buffer(data,1);
    }
    __pspgl_buffer_free(data);
  }
  return;
}



----------------------------------------

// Function: __pspgl_enable_state @ 08911b8c

void __pspgl_enable_state(GLenum cap,GLboolean enable)

{
  uint uVar1;
  pspgl_matrix_stack *ppVar2;
  uint32_t cmd;
  int iVar3;
  uint uVar4;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: uchar opcode@[???] */
  uVar1 = (uint)enable;
  if (cap == 0xbd0) {
    cmd = 0x20;
  }
  else if (cap < 0xbd1) {
    if (cap == 0xb60) {
      cmd = 0x1f;
    }
    else if (cap < 0xb61) {
      if (cap == 0xb20) {
        cmd = 0x25;
      }
      else if (cap < 0xb21) {
        if (cap != 0xb10) goto LAB_08911e0c;
        cmd = 0x25;
      }
      else if (cap == 0xb44) {
        cmd = 0x1d;
      }
      else {
        if (cap != 0xb50) goto LAB_08911e0c;
                    /* Unresolved local var: ulong c@[???] */
        if (enable == '\0') {
          uVar4 = (__pspgl_curctx->current).color;
        }
        else {
          uVar4 = (__pspgl_curctx->material).ambient;
        }
        __pspgl_context_writereg(__pspgl_curctx,0x55,uVar4);
        __pspgl_context_writereg(__pspgl_curctx,0x58,uVar4 >> 0x18);
        cmd = 0x17;
      }
    }
    else {
      if (cap != 0xb90) {
        if (cap < 0xb91) {
          if (cap == 0xb71) {
            if (enable == '\0') {
              uVar1 = 0;
            }
            else {
              uVar1 = (uint)(__pspgl_curctx->draw->depth_buffer != (pspgl_buffer *)0x0);
            }
            cmd = 0x23;
            goto LAB_08911e48;
          }
        }
        else {
          if (cap == 0xba1) {
            return;
          }
          if (cap == 0xbc0) {
            cmd = 0x22;
            goto LAB_08911e48;
          }
        }
        goto LAB_08911e0c;
      }
      if ((enable == '\0') || (__pspgl_curctx->draw->stencil_mask == 0)) {
        uVar1 = 0;
        __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).alpha);
        cmd = 0x24;
      }
      else {
        uVar1 = 1;
        __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).stencil);
        cmd = 0x24;
      }
    }
  }
  else if (cap < 0xc62) {
    if (0xc5f < cap) {
      return;
    }
    if (cap == 0xbf2) {
      cmd = 0x28;
    }
    else {
      if (cap == 0xc11) {
        (__pspgl_curctx->scissor_test).enabled = uVar1;
        __pspgl_set_scissor();
        return;
      }
      if (cap != 0xbe2) goto LAB_08911e0c;
      cmd = 0x21;
    }
  }
  else {
    if (0x4003 < cap) {
      if (cap == 0x86a7) {
        iVar3 = 0;
        (__pspgl_curctx->vertexblend).enabled = enable;
                    /* Unresolved local var: pspgl_matrix_stack * m@[???] */
        uVar1 = __pspgl_curctx->bone_stacks[0].flags;
        ppVar2 = __pspgl_curctx->bone_stacks;
        while( true ) {
          uVar4 = 2;
          if (enable != '\0') {
            uVar4 = 0;
          }
          iVar3 = iVar3 + 1;
          ppVar2->flags = uVar4 | uVar1 & 0xfffffffd | 1;
          if (iVar3 == 8) break;
          uVar1 = ppVar2[1].flags;
          ppVar2 = ppVar2 + 1;
        }
        return;
      }
LAB_08911e0c:
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_enable_state");
      if (__pspgl_curctx != (pspgl_context *)0x0) {
        __pspgl_curctx->glerror = 0x500;
      }
      return;
    }
    if (cap < 0x4000) {
      if (cap != 0xde1) goto LAB_08911e0c;
      cmd = 0x1e;
    }
    else {
      cmd = cap + 0x18 & 0xff;
      if (cmd == 0) {
        return;
      }
    }
  }
LAB_08911e48:
  __pspgl_context_writereg(__pspgl_curctx,cmd,uVar1);
  return;
}



----------------------------------------

// Function: glDisable @ 08911ea0

/* WARNING: Removing unreachable block (ram,0x08911d40) */
/* WARNING: Removing unreachable block (ram,0x08911d54) */
/* WARNING: Removing unreachable block (ram,0x08911d80) */
/* WARNING: Removing unreachable block (ram,0x08911cd8) */
/* WARNING: Removing unreachable block (ram,0x08911de4) */

void glDisable(GLenum cap)

{
  pspgl_matrix_stack *ppVar1;
  uint32_t cmd;
  int iVar2;
  uint uVar3;
  
  if (cap == 0xbd0) {
    cmd = 0x20;
  }
  else if (cap < 0xbd1) {
    if (cap == 0xb60) {
      cmd = 0x1f;
    }
    else if (cap < 0xb61) {
      if (cap == 0xb20) {
        cmd = 0x25;
      }
      else if (cap < 0xb21) {
        if (cap != 0xb10) goto LAB_08911e0c;
        cmd = 0x25;
      }
      else if (cap == 0xb44) {
        cmd = 0x1d;
      }
      else {
        if (cap != 0xb50) goto LAB_08911e0c;
        uVar3 = (__pspgl_curctx->current).color;
        __pspgl_context_writereg(__pspgl_curctx,0x55,uVar3);
        __pspgl_context_writereg(__pspgl_curctx,0x58,uVar3 >> 0x18);
        cmd = 0x17;
      }
    }
    else {
      if (cap != 0xb90) {
        if (cap < 0xb91) {
          if (cap == 0xb71) {
            cmd = 0x23;
            goto LAB_08911e48;
          }
        }
        else {
          if (cap == 0xba1) {
            return;
          }
          if (cap == 0xbc0) {
            cmd = 0x22;
            goto LAB_08911e48;
          }
        }
        goto LAB_08911e0c;
      }
      __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).alpha);
      cmd = 0x24;
    }
  }
  else if (cap < 0xc62) {
    if (0xc5f < cap) {
      return;
    }
    if (cap == 0xbf2) {
      cmd = 0x28;
    }
    else {
      if (cap == 0xc11) {
        (__pspgl_curctx->scissor_test).enabled = 0;
        __pspgl_set_scissor();
        return;
      }
      if (cap != 0xbe2) goto LAB_08911e0c;
      cmd = 0x21;
    }
  }
  else {
    if (0x4003 < cap) {
      if (cap == 0x86a7) {
        iVar2 = 0;
        (__pspgl_curctx->vertexblend).enabled = '\0';
        uVar3 = __pspgl_curctx->bone_stacks[0].flags;
        ppVar1 = __pspgl_curctx->bone_stacks;
        while( true ) {
          iVar2 = iVar2 + 1;
          ppVar1->flags = uVar3 & 0xfffffffd | 3;
          if (iVar2 == 8) break;
          uVar3 = ppVar1[1].flags;
          ppVar1 = ppVar1 + 1;
        }
        return;
      }
LAB_08911e0c:
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_enable_state");
      if (__pspgl_curctx != (pspgl_context *)0x0) {
        __pspgl_curctx->glerror = 0x500;
      }
      return;
    }
    if (cap < 0x4000) {
      if (cap != 0xde1) goto LAB_08911e0c;
      cmd = 0x1e;
    }
    else {
      cmd = cap + 0x18 & 0xff;
      if (cmd == 0) {
        return;
      }
    }
  }
LAB_08911e48:
  __pspgl_context_writereg(__pspgl_curctx,cmd,0);
  return;
}



----------------------------------------

// Function: glEnable @ 08911ea8

/* WARNING: Removing unreachable block (ram,0x08911ce0) */
/* WARNING: Removing unreachable block (ram,0x08911d78) */

void glEnable(GLenum cap)

{
  pspgl_matrix_stack *ppVar1;
  uint32_t cmd;
  int iVar2;
  uint argi;
  uint uVar3;
  
  uVar3 = 1;
  if (cap == 0xbd0) {
    cmd = 0x20;
  }
  else if (cap < 0xbd1) {
    if (cap == 0xb60) {
      cmd = 0x1f;
    }
    else if (cap < 0xb61) {
      if (cap == 0xb20) {
        cmd = 0x25;
      }
      else if (cap < 0xb21) {
        if (cap != 0xb10) goto LAB_08911e0c;
        cmd = 0x25;
      }
      else if (cap == 0xb44) {
        cmd = 0x1d;
      }
      else {
        if (cap != 0xb50) goto LAB_08911e0c;
        argi = (__pspgl_curctx->material).ambient;
        __pspgl_context_writereg(__pspgl_curctx,0x55,argi);
        __pspgl_context_writereg(__pspgl_curctx,0x58,argi >> 0x18);
        cmd = 0x17;
      }
    }
    else {
      if (cap != 0xb90) {
        if (cap < 0xb91) {
          if (cap == 0xb71) {
            uVar3 = (uint)(__pspgl_curctx->draw->depth_buffer != (pspgl_buffer *)0x0);
            cmd = 0x23;
            goto LAB_08911e48;
          }
        }
        else {
          if (cap == 0xba1) {
            return;
          }
          if (cap == 0xbc0) {
            cmd = 0x22;
            goto LAB_08911e48;
          }
        }
        goto LAB_08911e0c;
      }
      if (__pspgl_curctx->draw->stencil_mask == 0) {
        uVar3 = 0;
        __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).alpha);
        cmd = 0x24;
      }
      else {
        uVar3 = 1;
        __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).stencil);
        cmd = 0x24;
      }
    }
  }
  else if (cap < 0xc62) {
    if (0xc5f < cap) {
      return;
    }
    if (cap == 0xbf2) {
      cmd = 0x28;
    }
    else {
      if (cap == 0xc11) {
        (__pspgl_curctx->scissor_test).enabled = 1;
        __pspgl_set_scissor();
        return;
      }
      if (cap != 0xbe2) goto LAB_08911e0c;
      cmd = 0x21;
    }
  }
  else {
    if (0x4003 < cap) {
      if (cap == 0x86a7) {
        iVar2 = 0;
        (__pspgl_curctx->vertexblend).enabled = '\x01';
        uVar3 = __pspgl_curctx->bone_stacks[0].flags;
        ppVar1 = __pspgl_curctx->bone_stacks;
        while( true ) {
          iVar2 = iVar2 + 1;
          ppVar1->flags = uVar3 & 0xfffffffd | 1;
          if (iVar2 == 8) break;
          uVar3 = ppVar1[1].flags;
          ppVar1 = ppVar1 + 1;
        }
        return;
      }
LAB_08911e0c:
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_enable_state");
      if (__pspgl_curctx != (pspgl_context *)0x0) {
        __pspgl_curctx->glerror = 0x500;
      }
      return;
    }
    if (cap < 0x4000) {
      if (cap != 0xde1) goto LAB_08911e0c;
      cmd = 0x1e;
    }
    else {
      cmd = cap + 0x18 & 0xff;
      if (cmd == 0) {
        return;
      }
    }
  }
LAB_08911e48:
  __pspgl_context_writereg(__pspgl_curctx,cmd,uVar3);
  return;
}



----------------------------------------

// Function: enable_clientstate @ 08911eb0

void enable_clientstate(GLenum array,GLboolean enable)

{
  pspgl_context *ppVar1;
  pspgl_buffer *ppVar2;
  uint uVar3;
  uint uVar4;
  
                    /* Unresolved local var: varray * va@[???] */
  ppVar1 = __pspgl_curctx;
  uVar3 = (uint)enable;
  if (array == 0x8076) {
    (__pspgl_curctx->vertex_array).color.enabled = uVar3;
  }
  else if (array < 0x8077) {
    if (array != 0x8074) {
      if (array != 0x8075) {
LAB_08911f3c:
        __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"enable_clientstate");
        if (__pspgl_curctx == (pspgl_context *)0x0) {
          return;
        }
        __pspgl_curctx->glerror = 0x500;
        return;
      }
      (__pspgl_curctx->vertex_array).normal.enabled = uVar3;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).vertex.enabled = uVar3;
  }
  else {
    if (array != 0x8078) {
      if (array != 0x86ad) goto LAB_08911f3c;
      (__pspgl_curctx->vertex_array).weight.enabled = uVar3;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).texcoord.enabled = uVar3;
  }
  ppVar2 = (ppVar1->vertex_array).locked.cached_array;
LAB_08911f6c:
  if ((ppVar2 != (pspgl_buffer *)0x0) &&
     (uVar4 = (ppVar1->vertex_array).locked.vfmt.arrays, uVar3 = __pspgl_enabled_array_bits(),
     uVar4 != uVar3)) {
    __pspgl_uncache_arrays();
    return;
  }
  return;
}



----------------------------------------

// Function: glDisableClientState @ 08911fa0

void glDisableClientState(GLenum array)

{
  pspgl_context *ppVar1;
  pspgl_buffer *ppVar2;
  uint uVar3;
  uint uVar4;
  
  ppVar1 = __pspgl_curctx;
  if (array == 0x8076) {
    (__pspgl_curctx->vertex_array).color.enabled = 0;
  }
  else if (array < 0x8077) {
    if (array != 0x8074) {
      if (array != 0x8075) {
LAB_08911f3c:
        __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"enable_clientstate");
        if (__pspgl_curctx == (pspgl_context *)0x0) {
          return;
        }
        __pspgl_curctx->glerror = 0x500;
        return;
      }
      (__pspgl_curctx->vertex_array).normal.enabled = 0;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).vertex.enabled = 0;
  }
  else {
    if (array != 0x8078) {
      if (array != 0x86ad) goto LAB_08911f3c;
      (__pspgl_curctx->vertex_array).weight.enabled = 0;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).texcoord.enabled = 0;
  }
  ppVar2 = (ppVar1->vertex_array).locked.cached_array;
LAB_08911f6c:
  if ((ppVar2 != (pspgl_buffer *)0x0) &&
     (uVar4 = (ppVar1->vertex_array).locked.vfmt.arrays, uVar3 = __pspgl_enabled_array_bits(),
     uVar4 != uVar3)) {
    __pspgl_uncache_arrays();
    return;
  }
  return;
}



----------------------------------------

// Function: glEnableClientState @ 08911fa8

void glEnableClientState(GLenum array)

{
  pspgl_context *ppVar1;
  pspgl_buffer *ppVar2;
  uint uVar3;
  uint uVar4;
  
  ppVar1 = __pspgl_curctx;
  if (array == 0x8076) {
    (__pspgl_curctx->vertex_array).color.enabled = 1;
  }
  else if (array < 0x8077) {
    if (array != 0x8074) {
      if (array != 0x8075) {
LAB_08911f3c:
        __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"enable_clientstate");
        if (__pspgl_curctx == (pspgl_context *)0x0) {
          return;
        }
        __pspgl_curctx->glerror = 0x500;
        return;
      }
      (__pspgl_curctx->vertex_array).normal.enabled = 1;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).vertex.enabled = 1;
  }
  else {
    if (array != 0x8078) {
      if (array != 0x86ad) goto LAB_08911f3c;
      (__pspgl_curctx->vertex_array).weight.enabled = 1;
      ppVar2 = (ppVar1->vertex_array).locked.cached_array;
      goto LAB_08911f6c;
    }
    (__pspgl_curctx->vertex_array).texcoord.enabled = 1;
  }
  ppVar2 = (ppVar1->vertex_array).locked.cached_array;
LAB_08911f6c:
  if ((ppVar2 != (pspgl_buffer *)0x0) &&
     (uVar4 = (ppVar1->vertex_array).locked.vfmt.arrays, uVar3 = __pspgl_enabled_array_bits(),
     uVar4 != uVar3)) {
    __pspgl_uncache_arrays();
    return;
  }
  return;
}



----------------------------------------

// Function: glEnd @ 08911fb0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glEnd(void)

{
  GLfloat *pGVar1;
  pspgl_context *ppVar2;
  uint prim;
  GLfloat GVar3;
  GLfloat GVar4;
  GLfloat GVar5;
  t2f_c4ub_n3f_v3f *ptVar6;
  GLfloat *pGVar7;
  void *in_stack_00000000;
  void *in_stack_00000004;
  
                    /* Unresolved local var: pspgl_context * c@[???] */
  ppVar2 = __pspgl_curctx;
  if ((__pspgl_curctx->beginend).vertex_count != 0) {
                    /* Unresolved local var: long prim@[???] */
    prim = __pspgl_glprim2geprim((__pspgl_curctx->beginend).primitive);
    if ((int)prim < 0) {
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glEnd");
      if (__pspgl_curctx == (pspgl_context *)0x0) {
        return;
      }
      __pspgl_curctx->glerror = 0x500;
      return;
    }
    if ((ppVar2->beginend).primitive == 2) {
                    /* Unresolved local var: t2f_c4ub_n3f_v3f * vbuf@[???] */
      ptVar6 = &(ppVar2->beginend).line_loop_start;
      pGVar7 = (GLfloat *)
               ((int)(ppVar2->beginend).vbuf_adr + (ppVar2->beginend).vertex_count * 0x24);
      do {
        pGVar1 = ptVar6->texcoord;
        GVar3 = ptVar6->texcoord[1];
        GVar4 = (GLfloat)ptVar6->color;
        GVar5 = ptVar6->normal[0];
        ptVar6 = (t2f_c4ub_n3f_v3f *)(ptVar6->normal + 1);
        *pGVar7 = *pGVar1;
        pGVar7[1] = GVar3;
        pGVar7[2] = GVar4;
        pGVar7[3] = GVar5;
        pGVar7 = pGVar7 + 4;
      } while (ptVar6 != (t2f_c4ub_n3f_v3f *)((ppVar2->beginend).line_loop_start.vertex + 2));
      *pGVar7 = ptVar6->texcoord[0];
      (ppVar2->beginend).vertex_count = (ppVar2->beginend).vertex_count + 1;
    }
    __pspgl_context_render_prim
              (__pspgl_curctx,prim,(ppVar2->beginend).vertex_count,0x1ff,in_stack_00000000,
               in_stack_00000004);
  }
  (__pspgl_curctx->beginend).primitive = 0xffffffff;
  return;
}



----------------------------------------

// Function: glFrustum @ 089120c4

void glFrustum(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble zNear,
              GLdouble zFar)

{
  SFtype left_00;
  SFtype right_00;
  SFtype bottom_00;
  SFtype top_00;
  SFtype near;
  SFtype far;
  
  left_00 = __truncdfsf2(left);
  right_00 = __truncdfsf2(left);
  bottom_00 = __truncdfsf2(left);
  top_00 = __truncdfsf2(left);
  near = __truncdfsf2(left);
  far = __truncdfsf2(left);
  glFrustumf(left_00,right_00,bottom_00,top_00,near,far);
  return;
}



----------------------------------------

// Function: glLoadIdentity @ 089121b4

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glLoadIdentity(void)

{
  pspgl_context *ppVar1;
  pspgl_matrix *ppVar2;
  pspgl_matrix_stack *ppVar3;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * stk@[???]
                       Unresolved local var: pspgl_matrix * mat@[???] */
  ppVar1 = __pspgl_curctx;
  ppVar2 = __pspgl_curctx->current_matrix;
  ppVar3 = __pspgl_curctx->current_matrix_stack;
  if ((ppVar2->flags & 4) == 0) {
    if ((ppVar3->flags & 8) == 0) {
      __pspgl_assert_fail("stk->flags & MF_VFPU",unaff_retaddr,"glLoadIdentity","glLoadIdentity.c",
                          in_stack_00000000);
    }
    pspvfpu_use_matrices(ppVar1->vfpu_context,0x80,'\0');
    ppVar2->flags = ppVar2->flags | 4;
    if ((ppVar3->flags & 2) == 0) {
      ppVar3->flags = ppVar3->flags | 1;
    }
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  return;
}



----------------------------------------

// Function: glLockArraysEXT @ 08912264

void glLockArraysEXT(GLint first,GLsizei count)

{
  pspgl_context *ppVar1;
  GLenum GVar2;
  
                    /* Unresolved local var: locked_arrays * l@[???]
                       Unresolved local var: GLenum error@[???] */
  ppVar1 = __pspgl_curctx;
  if ((first < 0) || (count < 1)) {
    GVar2 = 0x501;
  }
  else {
    GVar2 = 0x502;
    if ((__pspgl_curctx->vertex_array).locked.count == 0) {
      (__pspgl_curctx->vertex_array).locked.first = first;
      (ppVar1->vertex_array).locked.count = count;
      return;
    }
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar2,"glLockArraysEXT");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar2;
  }
  return;
}



----------------------------------------

// Function: __pspgl_uncache_arrays @ 089122d8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_uncache_arrays(void)

{
  pspgl_context *ppVar1;
  pspgl_buffer *data;
  
                    /* Unresolved local var: locked_arrays * l@[???] */
  ppVar1 = __pspgl_curctx;
  data = (__pspgl_curctx->vertex_array).locked.cached_array;
  if (data != (pspgl_buffer *)0x0) {
    __pspgl_buffer_free(data);
  }
  (ppVar1->vertex_array).locked.vfmt.arrays = 0;
  (ppVar1->vertex_array).locked.cached_array = (pspgl_buffer *)0x0;
  (ppVar1->vertex_array).locked.vfmt.hwformat = 0;
  (ppVar1->vertex_array).locked.vfmt.vertex_size = 0;
  return;
}



----------------------------------------

// Function: glUnlockArraysEXT @ 08912324

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glUnlockArraysEXT(void)

{
  pspgl_context *ppVar1;
  
                    /* Unresolved local var: locked_arrays * l@[???] */
  ppVar1 = __pspgl_curctx;
  if ((__pspgl_curctx->vertex_array).locked.count == 0) {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x502,"glUnlockArraysEXT");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x502;
    }
    return;
  }
  (__pspgl_curctx->vertex_array).locked.count = 0;
  (ppVar1->vertex_array).locked.first = 0;
  __pspgl_uncache_arrays();
  return;
}



----------------------------------------

// Function: __pspgl_cache_arrays @ 0891239c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

GLboolean __pspgl_cache_arrays(void)

{
  bool bVar1;
  vertex_format *pvVar2;
  pspgl_context *ppVar3;
  GLboolean GVar4;
  short sVar5;
  undefined3 extraout_var;
  GLvoid *pGVar6;
  pspgl_buffer *ppVar7;
  GLint GVar8;
  void *to;
  int iVar9;
  pspgl_bufferobj *ppVar10;
  pspgl_bufferobj *ppVar11;
  locked_arrays *plVar12;
  int iVar13;
  locked_arrays *plVar14;
  pspgl_vertex_array *ppVar15;
  vertex_format *vfmt;
  int unaff_s4;
  void *unaff_retaddr;
  
                    /* Unresolved local var: locked_arrays * l@[???]
                       Unresolved local var: pspgl_buffer * cached@[???]
                       Unresolved local var: uint size@[???]
                       Unresolved local var: int count@[???]
                       Unresolved local var: void * p@[???] */
  ppVar3 = __pspgl_curctx;
  plVar14 = &(__pspgl_curctx->vertex_array).locked;
  if ((__pspgl_curctx->vertex_array).locked.cached_array != (pspgl_buffer *)0x0) {
    return '\x01';
  }
  vfmt = &(__pspgl_curctx->vertex_array).locked.vfmt;
  __pspgl_ge_vertex_fmt(__pspgl_curctx,vfmt);
  GVar4 = __pspgl_vertex_is_native(vfmt);
  if (CONCAT31(extraout_var,GVar4) == 0) {
    iVar9 = (ppVar3->vertex_array).locked.count;
  }
  else {
    iVar9 = (ppVar3->vertex_array).locked.vfmt.nattrib;
    if (iVar9 < 1) {
      iVar9 = (ppVar3->vertex_array).locked.count;
    }
    else {
                    /* Unresolved local var: pspgl_vertex_array * va@[???]
                       Unresolved local var: pspgl_bufferobj * buf@[???]
                       Unresolved local var: int i@[???] */
      ppVar15 = (ppVar3->vertex_array).locked.vfmt.attribs[0].array;
      iVar13 = 1;
      ppVar11 = ppVar15->buffer;
      plVar12 = plVar14;
      while (ppVar11 != (pspgl_bufferobj *)0x0) {
        if (iVar13 == iVar9) {
          ppVar7 = ppVar11->data;
          sVar5 = ppVar7->refcount + 1;
          ppVar7->refcount = sVar5;
          if (sVar5 < 2) {
            __pspgl_assert_fail("cached->refcount > 1",unaff_retaddr,"__pspgl_cache_arrays",
                                "glLockArraysEXT.c",unaff_s4);
          }
          pGVar6 = ppVar15->ptr;
          (ppVar3->vertex_array).locked.cached_array = ppVar7;
          (ppVar3->vertex_array).locked.cached_array_offset = (uint)pGVar6;
          (ppVar3->vertex_array).locked.cached_first = 0;
          return '\x01';
        }
        pvVar2 = &plVar12->vfmt;
        iVar13 = iVar13 + 1;
        plVar12 = (locked_arrays *)&(plVar12->vfmt).arrays;
        ppVar10 = (pvVar2->attribs[1].array)->buffer;
        bVar1 = ppVar10 == ppVar11;
        ppVar11 = (pspgl_bufferobj *)0x0;
        if (bVar1) {
          ppVar11 = ppVar10;
        }
      }
      iVar9 = (ppVar3->vertex_array).locked.count;
    }
  }
  if (iVar9 != 0) {
    iVar9 = (ppVar3->vertex_array).locked.vfmt.vertex_size * iVar9;
    if (0x1ffff < iVar9 - 1U) {
      return '\0';
    }
    ppVar7 = __pspgl_buffer_new(iVar9,0x88e4);
    if (ppVar7 != (pspgl_buffer *)0x0) {
      GVar8 = plVar14->first;
      (ppVar3->vertex_array).locked.cached_array = ppVar7;
      (ppVar3->vertex_array).locked.cached_array_offset = 0;
      (ppVar3->vertex_array).locked.cached_first = GVar8;
      to = __pspgl_buffer_map(ppVar7,0x88b9);
      iVar9 = __pspgl_gen_varray(vfmt,plVar14->first,(ppVar3->vertex_array).locked.count,to,unaff_s4
                                );
      __pspgl_buffer_unmap(ppVar7,0x88b9);
      if (iVar9 == (ppVar3->vertex_array).locked.count) {
        return '\x01';
      }
      __pspgl_uncache_arrays();
      return '\0';
    }
  }
  return '\0';
}



----------------------------------------

// Function: glMatrixMode @ 08912558

void glMatrixMode(GLenum mode)

{
  pspgl_matrix_stack *s;
  
                    /* Unresolved local var: pspgl_matrix_stack * s@[???]
                       Unresolved local var: pspgl_context * c@[???] */
  if (mode == 0x1702) {
    s = &__pspgl_curctx->texture_stack;
  }
  else if (mode < 0x1703) {
    if (mode == 0x1700) {
      s = &__pspgl_curctx->modelview_stack;
    }
    else {
      if (mode != 0x1701) goto LAB_08912618;
      s = &__pspgl_curctx->projection_stack;
    }
  }
  else {
    if (mode < 0x11200) {
LAB_08912618:
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glMatrixMode");
      if (__pspgl_curctx != (pspgl_context *)0x0) {
        __pspgl_curctx->glerror = 0x500;
      }
      return;
    }
    if (mode < 0x11208) {
      s = (pspgl_matrix_stack *)((int)__pspgl_curctx + mode * 0x30 + -0x335980);
    }
    else {
      if (mode != 0x11300) goto LAB_08912618;
      s = &__pspgl_curctx->view_stack;
    }
  }
  __pspgl_matrix_select(__pspgl_curctx,s);
  return;
}



----------------------------------------

// Function: glMultMatrixf @ 0891264c

/* WARNING: Control flow encountered bad instruction data */

void glMultMatrixf(GLfloat *m)

{
  pspgl_context *ppVar1;
  pspvfpu_context *c;
  pspgl_matrix *ppVar2;
  pspgl_matrix_stack *ppVar3;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * stk@[???]
                       Unresolved local var: pspgl_matrix * mat@[???] */
  ppVar1 = __pspgl_curctx;
  ppVar3 = __pspgl_curctx->current_matrix_stack;
  ppVar2 = __pspgl_curctx->current_matrix;
  if ((ppVar3->flags & 2) == 0) {
    ppVar3->flags = ppVar3->flags | 1;
  }
  c = ppVar1->vfpu_context;
  ppVar2->flags = ppVar2->flags & 0xfffffffb;
  pspvfpu_use_matrices(c,0x80,'`');
  if ((ppVar3->flags & 8) == 0) {
    __pspgl_assert_fail("stk->flags & MF_VFPU",unaff_retaddr,"glMultMatrixf","glMultMatrixf.c",
                        in_stack_00000000);
  }
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: glPopMatrix @ 08912720

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glPopMatrix(void)

{
  pspgl_context *c;
  uint uVar1;
  uint uVar2;
  pspgl_matrix_stack *s;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * curstk@[???] */
  c = __pspgl_curctx;
  s = __pspgl_curctx->current_matrix_stack;
  if ((s->flags & 8) == 0) {
    __pspgl_assert_fail("curstk->flags & MF_VFPU",unaff_retaddr,"glPopMatrix","glPopMatrix.c",
                        in_stack_00000000);
  }
  uVar2 = s->depth - 1;
  if (s->depth != 0) {
    uVar1 = s->flags;
    s->depth = uVar2;
    c->current_matrix = s->stack + uVar2;
    if ((uVar1 & 2) == 0) {
      s->flags = uVar1 | 1;
    }
    __pspgl_matrix_load(c,s);
    return;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x504,"glPopMatrix");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x504;
  }
  return;
}



----------------------------------------

// Function: glPushMatrix @ 08912814

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glPushMatrix(void)

{
  pspgl_context *c;
  uint uVar1;
  pspgl_matrix *ppVar2;
  uint uVar3;
  pspgl_matrix_stack *s;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * curstk@[???]
                       Unresolved local var: uint flags@[???] */
  c = __pspgl_curctx;
  s = __pspgl_curctx->current_matrix_stack;
  if ((s->flags & 8) == 0) {
    __pspgl_assert_fail("curstk->flags & MF_VFPU",unaff_retaddr,"glPushMatrix","glPushMatrix.c",
                        in_stack_00000000);
  }
  __pspgl_matrix_sync(c,s);
  uVar3 = s->depth;
  uVar1 = uVar3 + 1;
  s->depth = uVar1;
  if (uVar1 == s->limit) {
    s->depth = uVar3;
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x503,"glPushMatrix");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x503;
    }
  }
  else {
    ppVar2 = s->stack;
    ppVar2[uVar1].flags = c->current_matrix->flags;
    c->current_matrix = ppVar2 + uVar1;
  }
  return;
}



----------------------------------------

// Function: glRotatef @ 089128f4

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention */

void glRotatef(GLfloat angle,GLfloat x,GLfloat y,GLfloat z)

{
  undefined4 uVar1;
  pspgl_context *ppVar2;
  uint uVar3;
  pspvfpu_context *c;
  pspgl_matrix *ppVar4;
  float scale;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * stk@[???]
                       Unresolved local var: pspgl_matrix * mat@[???] */
  ppVar2 = __pspgl_curctx;
  uVar3 = __pspgl_curctx->current_matrix_stack->flags;
  ppVar4 = __pspgl_curctx->current_matrix;
  if ((uVar3 & 2) == 0) {
    __pspgl_curctx->current_matrix_stack->flags = uVar3 | 1;
  }
  c = ppVar2->vfpu_context;
  ppVar4->flags = ppVar4->flags & 0xfffffffb;
  pspvfpu_use_matrices(c,0x80,'`');
  uVar1 = getCopReg(2,0x34);
  setCopReg(2,0x34,CONCAT44(angle,uVar1));
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: __pspgl_set_scissor @ 08912b4c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_set_scissor(void)

{
  pspgl_surface *ppVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int l@[???]
                       Unresolved local var: int r@[???]
                       Unresolved local var: pspgl_context * c@[???] */
  iVar2 = 0;
  uVar3 = 0;
  ppVar1 = __pspgl_curctx->draw;
  if ((__pspgl_curctx->scissor_test).enabled == 0) {
    uVar5 = (uint)ppVar1->width;
    uVar4 = (uint)ppVar1->height;
  }
  else {
    uVar3 = (__pspgl_curctx->scissor_test).x;
    uVar4 = (uint)ppVar1->height - (__pspgl_curctx->scissor_test).y;
    iVar2 = uVar4 - (__pspgl_curctx->scissor_test).height;
    uVar5 = uVar3 + (__pspgl_curctx->scissor_test).width;
  }
  __pspgl_context_writereg(__pspgl_curctx,0xd4,iVar2 << 10 | uVar3);
  __pspgl_context_writereg(__pspgl_curctx,0xd5,(uVar4 - 1) * 0x400 | uVar5 - 1);
  return;
}



----------------------------------------

// Function: glScissor @ 08912be8

void glScissor(GLint x,GLint y,GLsizei width,GLsizei height)

{
  pspgl_context *ppVar1;
  
  ppVar1 = __pspgl_curctx;
  (__pspgl_curctx->scissor_test).height = height;
  (ppVar1->scissor_test).x = x;
  (ppVar1->scissor_test).y = y;
  (ppVar1->scissor_test).width = width;
  __pspgl_set_scissor();
  return;
}



----------------------------------------

// Function: glShadeModel @ 08912c04

void glShadeModel(GLenum mode)

{
  if (mode - 0x1d00 < 2) {
    __pspgl_context_writereg(__pspgl_curctx,0x50,mode & 1);
    return;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glShadeModel");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x500;
  }
  return;
}



----------------------------------------

// Function: glTranslatef @ 08912c7c

/* WARNING: Unknown calling convention */

void glTranslatef(GLfloat x,GLfloat y,GLfloat z)

{
  undefined4 uVar1;
  pspgl_context *ppVar2;
  pspvfpu_context *c;
  pspgl_matrix_stack *ppVar3;
  pspgl_matrix *ppVar4;
  void *unaff_retaddr;
  int unaff_f20;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_matrix_stack * stk@[???]
                       Unresolved local var: pspgl_matrix * mat@[???] */
  ppVar2 = __pspgl_curctx;
  ppVar3 = __pspgl_curctx->current_matrix_stack;
  ppVar4 = __pspgl_curctx->current_matrix;
  if ((ppVar3->flags & 8) == 0) {
    __pspgl_assert_fail("stk->flags & MF_VFPU",unaff_retaddr,"glTranslatef","glTranslatef.c",
                        unaff_f20);
  }
  if ((ppVar3->flags & 2) == 0) {
    ppVar3->flags = ppVar3->flags | 1;
  }
  c = ppVar2->vfpu_context;
  ppVar4->flags = ppVar4->flags & 0xfffffffb;
  pspvfpu_use_matrices(c,0x80,'@');
  uVar1 = getCopReg(2,0x1b);
  setCopReg(2,0x1b,CONCAT44(x,uVar1));
  uVar1 = getCopReg(2,0x3b);
  setCopReg(2,0x3b,CONCAT44(y,uVar1));
  uVar1 = getCopReg(2,0x5b);
  setCopReg(2,0x5b,CONCAT44(z,uVar1));
  return;
}



----------------------------------------

// Function: glVertex3f @ 08912d74

/* WARNING: Unknown calling convention */

void glVertex3f(GLfloat x,GLfloat y,GLfloat z)

{
  pspgl_context *c;
  void *pvVar1;
  GLfloat GVar2;
  ulong uVar3;
  uint prim;
  undefined4 *dst0;
  undefined4 uVar4;
  undefined4 uVar5;
  GLenum GVar6;
  GLfloat GVar7;
  undefined4 uVar8;
  GLfloat GVar9;
  undefined4 uVar10;
  GLfloat *pGVar11;
  t2f_c4ub_n3f_v3f *ptVar12;
  undefined4 *puVar13;
  undefined4 *puVar14;
  GLfloat *pGVar15;
  undefined4 *puVar16;
  void *unaff_retaddr;
  GLfloat GVar17;
  void *in_stack_ffffffec;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: t2f_c4ub_n3f_v3f * vbuf@[???] */
  c = __pspgl_curctx;
  if ((__pspgl_curctx->beginend).vertex_count == 0) {
    pvVar1 = __pspgl_dlist_insert_space(0x1b0);
    (c->beginend).vbuf_adr = pvVar1;
  }
  pvVar1 = (c->beginend).vbuf_adr;
  if (pvVar1 == (void *)0x0) {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x505,"glVertex3f");
    if (__pspgl_curctx == (pspgl_context *)0x0) {
      return;
    }
    __pspgl_curctx->glerror = 0x505;
    return;
  }
  GVar2 = (GLfloat)(c->current).color;
  GVar6 = (c->beginend).primitive;
  pGVar15 = (GLfloat *)((int)pvVar1 + (c->beginend).vertex_count * 0x24);
  *pGVar15 = (c->current).texcoord[0];
  GVar17 = (c->current).texcoord[1];
  pGVar15[2] = GVar2;
  pGVar15[1] = GVar17;
  pGVar15[3] = (c->current).normal[0];
  pGVar15[4] = (c->current).normal[1];
  GVar2 = (c->current).normal[2];
  pGVar15[6] = x;
  pGVar15[7] = y;
  pGVar15[5] = GVar2;
  pGVar15[8] = z;
  if (GVar6 == 2) {
    uVar3 = (c->beginend).vertex_count;
    if (uVar3 != 0) goto LAB_08912e78;
    ptVar12 = &(c->beginend).line_loop_start;
    pGVar11 = pGVar15;
    do {
      GVar2 = *pGVar11;
      GVar17 = pGVar11[1];
      GVar7 = pGVar11[2];
      GVar9 = pGVar11[3];
      pGVar11 = pGVar11 + 4;
      ptVar12->texcoord[0] = GVar2;
      ptVar12->texcoord[1] = GVar17;
      ptVar12->color = (ulong)GVar7;
      ptVar12->normal[0] = GVar9;
      ptVar12 = (t2f_c4ub_n3f_v3f *)(ptVar12->normal + 1);
    } while (pGVar11 != pGVar15 + 8);
    ptVar12->texcoord[0] = *pGVar11;
  }
  uVar3 = (c->beginend).vertex_count;
LAB_08912e78:
  uVar3 = uVar3 + 1;
  (c->beginend).vertex_count = uVar3;
  if ((uVar3 == 0xc) || (((c->beginend).primitive == 7 && (uVar3 == 4)))) {
                    /* Unresolved local var: char overhang@[???]
                       Unresolved local var: long prim@[???] */
    GVar6 = (c->beginend).primitive;
    uVar3 = (ulong)""[GVar6];
    prim = __pspgl_glprim2geprim(GVar6);
    __pspgl_context_render_prim
              (c,prim,(c->beginend).vertex_count,0x1ff,unaff_retaddr,in_stack_ffffffec);
    (c->beginend).vertex_count = uVar3;
    if (uVar3 != 0) {
                    /* Unresolved local var: t2f_c4ub_n3f_v3f * vbuf_start@[???]
                       Unresolved local var: t2f_c4ub_n3f_v3f * prev@[???] */
      puVar16 = (c->beginend).vbuf_adr;
      dst0 = __pspgl_dlist_insert_space(0x1b0);
      GVar6 = (c->beginend).primitive;
      (c->beginend).vbuf_adr = dst0;
      if ((GVar6 == 6) || (GVar6 == 9)) {
        puVar14 = puVar16 + 8;
        puVar13 = dst0;
        do {
          uVar4 = *puVar16;
          uVar5 = puVar16[1];
          uVar8 = puVar16[2];
          uVar10 = puVar16[3];
          puVar16 = puVar16 + 4;
          *puVar13 = uVar4;
          puVar13[1] = uVar5;
          puVar13[2] = uVar8;
          puVar13[3] = uVar10;
          puVar13 = puVar13 + 4;
        } while (puVar16 != puVar14);
        dst0 = dst0 + 9;
        *puVar13 = *puVar16;
        (c->beginend).vertex_count = (c->beginend).vertex_count + 1;
      }
      memcpy(dst0,pGVar15 + uVar3 * -9 + 9,uVar3 * 0x24);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: glVertex4fv @ 08912ffc

void glVertex4fv(GLfloat *v)

{
  float fVar1;
  
                    /* Unresolved local var: GLfloat scale@[???] */
  fVar1 = DAT_089dbce4 / v[3];
  glVertex3f(fVar1 * *v,fVar1 * v[1],fVar1 * v[2]);
  return;
}



----------------------------------------

// Function: glVertex3fv @ 08913028

void glVertex3fv(GLfloat *v)

{
  glVertex3f(*v,v[1],v[2]);
  return;
}



----------------------------------------

// Function: glVertex2f @ 08913038

/* WARNING: Unknown calling convention */

void glVertex2f(GLfloat x,GLfloat y)

{
  glVertex3f(x,y,0.0);
  return;
}



----------------------------------------

// Function: glVertexPointer @ 08913044

void glVertexPointer(GLint size,GLenum type,GLsizei stride,GLvoid *pointer)

{
  pspgl_context *ppVar1;
  pspgl_context *ppVar2;
  uint uVar3;
  pspgl_bufferobj *buf;
  GLenum GVar4;
  
                    /* Unresolved local var: pspgl_vertex_array * va@[???]
                       Unresolved local var: GLboolean native@[???]
                       Unresolved local var: GLenum error@[???] */
  ppVar1 = __pspgl_curctx;
  if ((size - 2U < 3) && (-1 < stride)) {
    if (((type == 0x1400) || (type == 0x1402)) || (type == 0x1406)) {
      if (stride == 0) {
        uVar3 = __pspgl_gl_sizeof(type);
        stride = uVar3 * size;
      }
      if ((ppVar1->vertex_array).vertex.type != type) {
        (__pspgl_curctx->modelview_stack).flags = (__pspgl_curctx->modelview_stack).flags | 1;
      }
      (ppVar1->vertex_array).vertex.native = size == 3;
      ppVar2 = __pspgl_curctx;
      (ppVar1->vertex_array).vertex.type = type;
      (ppVar1->vertex_array).vertex.stride = stride;
      buf = (ppVar2->vertex_array).arraybuffer;
      (ppVar1->vertex_array).vertex.ptr = pointer;
      (ppVar1->vertex_array).vertex.size = size;
      __pspgl_varray_bind_buffer(&(ppVar1->vertex_array).vertex,buf);
      return;
    }
    GVar4 = 0x500;
  }
  else {
    GVar4 = 0x501;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar4,"glVertexPointer");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar4;
  }
  return;
}



----------------------------------------

// Function: glViewport @ 08913168

void glViewport(GLint x,GLint y,GLsizei width,GLsizei height)

{
  ushort uVar1;
  float fVar2;
  pspgl_context *c;
  pspgl_surface *ppVar3;
  float fVar4;
  float fVar5;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_surface * s@[???]
                       Unresolved local var: float cx@[???]
                       Unresolved local var: float cy@[???] */
  c = __pspgl_curctx;
  (__pspgl_curctx->viewport).x = x;
  (c->viewport).y = y;
  (c->viewport).width = width;
  (c->viewport).height = height;
  ppVar3 = c->draw;
  if ((((-1 < x) && (-1 < y)) && (-1 < width)) && (-1 < height)) {
    if ((x + width <= (int)(uint)ppVar3->width) &&
       (uVar1 = ppVar3->height, y + height <= (int)(uint)uVar1)) {
      __pspgl_context_writereg(c,0x4c,(uint)ppVar3->width * -8 + 0x8000);
      __pspgl_context_writereg(__pspgl_curctx,0x4d,(uint)ppVar3->height * -8 + 0x8000);
      fVar2 = DAT_089dc448;
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
      fVar5 = (float)width * DAT_089dc448;
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
      __pspgl_context_writereg(__pspgl_curctx,0x42,(int)fVar5 >> 8);
      __pspgl_context_writereg(__pspgl_curctx,0x43,(int)((float)-height * fVar2) >> 8);
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
      fVar4 = (float)ppVar3->height * DAT_089df458 + DAT_089df45c;
      __pspgl_context_writereg
                (__pspgl_curctx,0x45,
                 (int)((float)ppVar3->width * DAT_089df458 + DAT_089df45c + fVar5 + (float)x) >> 8);
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
      __pspgl_context_writereg
                (__pspgl_curctx,0x46,
                 (int)(fVar4 + (float)-height * fVar2 + (float)(int)((uint)uVar1 - y)) >> 8);
      __pspgl_context_writereg(__pspgl_curctx,0x15,0);
      __pspgl_context_writereg(__pspgl_curctx,0x16,(ppVar3->height - 1) * 0x400 | ppVar3->width - 1)
      ;
      return;
    }
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x501,"glViewport");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x501;
  }
  return;
}



----------------------------------------

// Function: __pspgl_bufferobj_deref @ 089133d4

void * __pspgl_bufferobj_deref(pspgl_bufferobj *bufp,void *off)

{
  if ((bufp != (pspgl_bufferobj *)0x0) && (bufp->data != (pspgl_buffer *)0x0)) {
    off = (void *)((int)off + (int)bufp->data->base);
  }
  return off;
}



----------------------------------------

// Function: buffer_synced @ 089133f8

int buffer_synced(void *p)

{
                    /* Unresolved local var: pspgl_buffer * buf@[???] */
  return (uint)((*(byte *)((int)p + 5) & 3) == 0);
}



----------------------------------------

// Function: buffer_insert_after @ 08913408

void buffer_insert_after(pspgl_buffer *after,pspgl_buffer *b)

{
  pspgl_buffer *ppVar1;
  void *unaff_retaddr;
  int in_stack_00000000;
  
  if (b->list_next != (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("b->list_next == NULL",unaff_retaddr,"buffer_insert_after","pspgl_buffers.c"
                        ,in_stack_00000000);
  }
  if (b->list_prev != (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("b->list_prev == NULL",unaff_retaddr,"buffer_insert_after","pspgl_buffers.c"
                        ,in_stack_00000000);
  }
  if (after->list_next == (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("after->list_next != NULL",unaff_retaddr,"buffer_insert_after",
                        "pspgl_buffers.c",in_stack_00000000);
  }
  if (after->list_prev == (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("after->list_prev != NULL",unaff_retaddr,"buffer_insert_after",
                        "pspgl_buffers.c",in_stack_00000000);
  }
  ppVar1 = after->list_next;
  b->list_prev = after;
  b->list_next = ppVar1;
  ppVar1 = after->list_next;
  after->list_next = b;
  ppVar1->list_prev = b;
  return;
}



----------------------------------------

// Function: buffer_insert_tail @ 08913518

void buffer_insert_tail(pspgl_buffer *b)

{
  if (list_base == (pspgl_buffer *)0x0) {
    b->list_next = b;
    b->list_prev = b;
    list_base = b;
    return;
  }
  buffer_insert_after(list_base->list_prev,b);
  return;
}



----------------------------------------

// Function: buffer_remove @ 08913540

void buffer_remove(pspgl_buffer *b)

{
  pspgl_buffer *ppVar1;
  pspgl_buffer *ppVar2;
  void *unaff_retaddr;
  int in_stack_00000000;
  
  if (b->list_next == (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("b->list_next != NULL",unaff_retaddr,"buffer_remove","pspgl_buffers.c",
                        in_stack_00000000);
  }
  if (b->list_prev == (pspgl_buffer *)0x0) {
    __pspgl_assert_fail("b->list_prev != NULL",unaff_retaddr,"buffer_remove","pspgl_buffers.c",
                        in_stack_00000000);
  }
  if (list_base == b) {
    list_base = b->list_next;
    if (list_base == b) {
      list_base = (pspgl_buffer *)0x0;
    }
    ppVar1 = b->list_prev;
  }
  else {
    ppVar1 = b->list_prev;
  }
  ppVar1->list_next = b->list_next;
  ppVar2 = b->list_next;
  b->list_next = (pspgl_buffer *)0x0;
  ppVar2->list_prev = ppVar1;
  b->list_prev = (pspgl_buffer *)0x0;
  return;
}



----------------------------------------

// Function: __pspgl_buffer_want_vidmem @ 08913608

void __pspgl_buffer_want_vidmem(pspgl_buffer *buf)

{
  if (list_pin == 0) {
    buffer_remove(buf);
    buffer_insert_tail(buf);
    return;
  }
  return;
}



----------------------------------------

// Function: __pspgl_buffer_unmap @ 08913650

void __pspgl_buffer_unmap(pspgl_buffer *data,GLenum access)

{
  char cVar1;
  short sVar2;
  void *unaff_retaddr;
  int in_stack_00000000;
  
  if (data->mapped < '\x01') {
    __pspgl_assert_fail("data->mapped > 0",unaff_retaddr,"__pspgl_buffer_unmap","pspgl_buffers.c",
                        in_stack_00000000);
  }
  cVar1 = data->mapped + -1;
  data->mapped = cVar1;
  if ((cVar1 < '\x01') && (34999 < access)) {
    if (access < 0x88ba) {
      if (access == 35000) {
        return;
      }
      sVar2 = data->generation;
    }
    else {
      if (access != 0x88ba) {
        return;
      }
      sceKernelDcacheWritebackInvalidateRange(data->base,data->size);
      sVar2 = data->generation;
    }
    data->generation = sVar2 + 1;
  }
  return;
}



----------------------------------------

// Function: __pspgl_bufferobj_unmap @ 0891370c

void __pspgl_bufferobj_unmap(pspgl_bufferobj *buf,GLenum access)

{
  if ((buf != (pspgl_bufferobj *)0x0) && (buf->data != (pspgl_buffer *)0x0)) {
    __pspgl_buffer_unmap(buf->data,access);
    return;
  }
  return;
}



----------------------------------------

// Function: __pspgl_buffer_map @ 08913730

void * __pspgl_buffer_map(pspgl_buffer *data,GLenum access)

{
  char cVar1;
  void *p;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: void * p@[???] */
  p = data->base;
  if (data->mapped < '\0') {
    __pspgl_assert_fail("data->mapped >= 0",unaff_retaddr,"__pspgl_buffer_map","pspgl_buffers.c",
                        in_stack_00000000);
  }
  if (access == 0x88b9) {
    p = __pspgl_uncached(p,data->size);
  }
  else {
    if ((access != 0x88ba) && (access != 35000)) {
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_buffer_map");
      if (__pspgl_curctx == (pspgl_context *)0x0) {
        return (void *)0x0;
      }
      __pspgl_curctx->glerror = 0x500;
      return (void *)0x0;
    }
    if (data->mapped == '\0') {
      sceKernelDcacheInvalidateRange(data->base,data->size);
    }
  }
  if (list_pin == 0) {
    buffer_remove(data);
    if (list_base == (pspgl_buffer *)0x0) {
      data->list_next = data;
      data->list_prev = data;
    }
    else {
      buffer_insert_after(list_base,data);
    }
    cVar1 = data->mapped;
    list_base = data;
  }
  else {
    cVar1 = data->mapped;
  }
  data->mapped = cVar1 + '\x01';
  return p;
}



----------------------------------------

// Function: __pspgl_bufferobj_map @ 08913870

void * __pspgl_bufferobj_map(pspgl_bufferobj *buf,GLenum access,void *off)

{
  void *pvVar1;
  
  if ((buf != (pspgl_bufferobj *)0x0) && (buf->data != (pspgl_buffer *)0x0)) {
    pvVar1 = __pspgl_buffer_map(buf->data,access);
    off = (void *)((int)off + (int)pvVar1);
  }
  return off;
}



----------------------------------------

// Function: __pspgl_bufferobj_for_target @ 089138b0

pspgl_bufferobj ** __pspgl_bufferobj_for_target(GLenum target)

{
                    /* Unresolved local var: pspgl_bufferobj * * ret@[???] */
  if (target == 0x8893) {
    return &(__pspgl_curctx->vertex_array).indexbuffer;
  }
  if (target < 0x8894) {
    if (target == 0x8892) {
      return &(__pspgl_curctx->vertex_array).arraybuffer;
    }
  }
  else {
    if (target == 0x88eb) {
      return &(__pspgl_curctx->pack).pbo;
    }
    if (target == 0x88ec) {
      return &(__pspgl_curctx->unpack).pbo;
    }
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_bufferobj_for_target");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x500;
  }
  return (pspgl_bufferobj **)0x0;
}



----------------------------------------

// Function: is_edram_addr @ 0891396c

int is_edram_addr(void *p)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  
  if (is_edram_addr::edram_end == (void *)0x0) {
    is_edram_addr::edram_start = (void *)sceGeEdramGetAddr();
    iVar1 = sceGeEdramGetAddr();
    iVar2 = sceGeEdramGetSize();
    is_edram_addr::edram_end = (void *)(iVar1 + iVar2);
  }
  uVar3 = 0;
  if (is_edram_addr::edram_start <= p) {
    uVar3 = (uint)(p < is_edram_addr::edram_end);
  }
  return uVar3;
}



----------------------------------------

// Function: __pspgl_buffer_free @ 089139ec

void __pspgl_buffer_free(pspgl_buffer *data)

{
  short sVar1;
  int iVar2;
  void *unaff_retaddr;
  int in_stack_00000008;
  
  if (data->refcount < 1) {
    __pspgl_assert_fail("data->refcount > 0",unaff_retaddr,"__pspgl_buffer_free","pspgl_buffers.c",
                        in_stack_00000008);
  }
  sVar1 = data->refcount + -1;
  data->refcount = sVar1;
  if (sVar1 == 0) {
    buffer_remove(data);
    if (data->base != (void *)0x0) {
      iVar2 = is_edram_addr(data->base);
      if (iVar2 == 0) {
        free(data->base);
      }
      else {
        __pspgl_vidmem_free(data);
      }
    }
    data->list_next = buffer_freelist;
    buffer_freelist = data;
  }
  return;
}



----------------------------------------

// Function: __pspgl_buffer_dlist_sync @ 08913aa0

void __pspgl_buffer_dlist_sync(pspgl_buffer *data)

{
  void *unaff_retaddr;
  int in_stack_00000000;
  
  data->refcount = data->refcount + 1;
  if ((data->flags & 3) != 0) {
    __pspgl_dlist_submit();
    __pspgl_dlist_await_completion(buffer_synced,data);
  }
  if ((data->flags & 3) != 0) {
    __pspgl_assert_fail("(data->flags & BF_PINNED) == 0",unaff_retaddr,"__pspgl_buffer_dlist_sync",
                        "pspgl_buffers.c",in_stack_00000000);
  }
  __pspgl_buffer_free(data);
  return;
}



----------------------------------------

// Function: __pspgl_bufferobj_free @ 08913b34

void __pspgl_bufferobj_free(pspgl_bufferobj *bufp)

{
  int iVar1;
  void *unaff_retaddr;
  int in_stack_00000008;
  
  if (bufp->refcount < 1) {
    __pspgl_assert_fail("bufp->refcount > 0",unaff_retaddr,"__pspgl_bufferobj_free",
                        "pspgl_buffers.c",in_stack_00000008);
  }
  iVar1 = bufp->refcount + -1;
  bufp->refcount = iVar1;
  if (iVar1 == 0) {
    if (bufp->data != (pspgl_buffer *)0x0) {
      __pspgl_buffer_free(bufp->data);
    }
    free(bufp);
    return;
  }
  return;
}



----------------------------------------

// Function: __pspgl_bufferobj_new @ 08913bbc

pspgl_bufferobj * __pspgl_bufferobj_new(pspgl_buffer *data)

{
  pspgl_bufferobj *ppVar1;
  
                    /* Unresolved local var: pspgl_bufferobj * bufp@[???] */
  ppVar1 = malloc(0x14);
  if (ppVar1 != (pspgl_bufferobj *)0x0) {
    ppVar1->refcount = 1;
    ppVar1->usage = 0;
    ppVar1->access = 0;
    ppVar1->mapped = '\0';
    ppVar1->data = data;
    if (data != (pspgl_buffer *)0x0) {
      data->refcount = data->refcount + 1;
    }
  }
  return ppVar1;
}



----------------------------------------

// Function: __pspgl_buffer_new @ 08913c18

pspgl_buffer * __pspgl_buffer_new(GLsizeiptr size,GLenum usage)

{
  bool bVar1;
  GLboolean GVar2;
  int iVar3;
  size_t sVar4;
  undefined3 extraout_var;
  uint uVar5;
  void *pvVar6;
  pspgl_buffer *buf;
  pspgl_buffer *buf_00;
  uint nbytes;
  uint uVar7;
  
                    /* Unresolved local var: pspgl_buffer * ret@[???] */
  if (buffer_freelist == (pspgl_buffer *)0x0) {
    buf_00 = malloc(0x20);
  }
  else {
    buf_00 = buffer_freelist;
    buffer_freelist = buffer_freelist->list_next;
  }
  if (buf_00 == (pspgl_buffer *)0x0) {
    return (pspgl_buffer *)0x0;
  }
                    /* Unresolved local var: void * p@[???]
                       Unresolved local var: int try_hard@[???] */
  nbytes = size + 0x3fU & 0xffffffc0;
  buf_00->base = (void *)0x0;
  buf_00->size = nbytes;
  if (usage - 0x88e0 < 0xb) {
    uVar5 = 1 << (usage - 0x88e0 & 0x1f);
    if ((uVar5 & 0x444) == 0) {
      if ((uVar5 & 0x103) == 0) {
        bVar1 = false;
        if ((uVar5 & 0x230) == 0) goto LAB_08913db8;
        goto LAB_08913cc0;
      }
LAB_08913df0:
      pvVar6 = memalign(0x40,nbytes);
      if (pvVar6 == (void *)0x0) goto LAB_08913e48;
    }
    else {
      bVar1 = true;
LAB_08913cc0:
      iVar3 = __pspgl_vidmem_alloc(buf_00);
      if (iVar3 == 0) {
        if (bVar1) {
          sVar4 = __pspgl_vidmem_avail();
          if (sVar4 < nbytes) {
                    /* Unresolved local var: size_t evicted@[???] */
            uVar5 = nbytes;
            if (nbytes < 0x10000) {
              uVar5 = nbytes << 2;
            }
            if (list_base != (pspgl_buffer *)0x0) {
                    /* Unresolved local var: pspgl_buffer * buf@[???] */
              uVar7 = 0;
              list_pin = list_pin + 1;
              buf = list_base;
              do {
                iVar3 = is_edram_addr(buf->base);
                if (iVar3 != 0) {
                  sVar4 = __pspgl_vidmem_evict(buf);
                  uVar7 = uVar7 + sVar4;
                  if (uVar5 <= uVar7) break;
                }
                buf = buf->list_next;
              } while (buf != list_base);
              list_pin = list_pin + -1;
              if (uVar7 != 0) {
                __pspgl_moved_textures();
                glFinish();
              }
            }
          }
          iVar3 = __pspgl_vidmem_alloc(buf_00);
          if (iVar3 != 0) {
            pvVar6 = buf_00->base;
            goto LAB_08913de4;
          }
          GVar2 = __pspgl_vidmem_compact();
          if (CONCAT31(extraout_var,GVar2) != 0) {
            __pspgl_moved_textures();
            iVar3 = __pspgl_vidmem_alloc(buf_00);
            if (iVar3 != 0) {
              pvVar6 = buf_00->base;
              goto LAB_08913de4;
            }
          }
        }
        goto LAB_08913df0;
      }
      pvVar6 = buf_00->base;
LAB_08913de4:
      if (pvVar6 == (void *)0x0) goto LAB_08913df0;
    }
    sceKernelDcacheWritebackInvalidateRange(pvVar6,nbytes);
    buf_00->refcount = 1;
    buf_00->base = pvVar6;
    buf_00->size = nbytes;
    buf_00->mapped = '\0';
    buf_00->flags = '\0';
    buf_00->generation = 0;
    buf_00->pin_prevp = (pspgl_buffer **)0x0;
    buf_00->pin_next = (pspgl_buffer *)0x0;
    buf_00->list_prev = (pspgl_buffer *)0x0;
    buf_00->list_next = (pspgl_buffer *)0x0;
    buffer_insert_tail(buf_00);
  }
  else {
LAB_08913db8:
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"__pspgl_buffer_init");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x500;
    }
LAB_08913e48:
    free(buf_00);
    buf_00 = (pspgl_buffer *)0x0;
  }
  return buf_00;
}



----------------------------------------

// Function: __pspgl_context_writereg @ 08913e78

void __pspgl_context_writereg(pspgl_context *c,uint32_t cmd,uint32_t argi)

{
  uint uVar1;
  uint uVar2;
  
                    /* Unresolved local var: uint32_t new@[DW_OP_reg5(a1)] */
  uVar2 = cmd << 0x18 | argi & 0xffffff;
  if (uVar2 != (c->hw).ge_reg[cmd]) {
    uVar1 = (c->hw).ge_reg_touched[cmd >> 5];
    (c->hw).ge_reg[cmd] = uVar2;
    (c->hw).ge_reg_touched[cmd >> 5] = uVar1 | 1 << (cmd & 0x1f);
  }
  return;
}



----------------------------------------

// Function: __pspgl_context_writereg_masked @ 08913ecc

void __pspgl_context_writereg_masked(pspgl_context *c,uint32_t cmd,uint32_t argi,uint32_t mask)

{
  uint uVar1;
  uint uVar2;
  
                    /* Unresolved local var: uint32_t new@[DW_OP_reg5(a1)] */
  uVar1 = (c->hw).ge_reg[cmd];
  uVar2 = cmd << 0x18 | uVar1 & ~mask | mask & argi & 0xffffff;
  if (uVar2 != uVar1) {
    uVar1 = (c->hw).ge_reg_touched[cmd >> 5];
    (c->hw).ge_reg[cmd] = uVar2;
    (c->hw).ge_reg_touched[cmd >> 5] = uVar1 | 1 << (cmd & 0x1f);
  }
  return;
}



----------------------------------------

// Function: __pspgl_context_writereg_uncached @ 08913f30

void __pspgl_context_writereg_uncached(pspgl_context *c,uint32_t cmd,uint32_t argi)

{
  uint cmd_00;
  
                    /* Unresolved local var: uint32_t val@[???] */
  cmd_00 = cmd << 0x18 | argi & 0xffffff;
  (c->hw).ge_reg_touched[cmd >> 5] = (c->hw).ge_reg_touched[cmd >> 5] & ~(1 << (cmd & 0x1f));
  (c->hw).ge_reg[cmd] = cmd_00;
  __pspgl_dlist_enqueue_cmd(cmd_00);
  return;
}



----------------------------------------

// Function: flush_matrix @ 08913f7c

/* WARNING: Control flow encountered bad instruction data */

void flush_matrix(pspgl_context *c,uint opcode,int index,pspgl_matrix_stack *stk)

{
  int iVar1;
  uint uVar2;
  pspgl_matrix *ppVar3;
  GLfloat *pGVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: GLfloat * m@[???]
                       Unresolved local var: GLfloat[16] adjusted@[???]
                       Unresolved local var: int skip@[???]
                       Unresolved local var: int n@[???] */
  uVar2 = stk->flags;
  if ((uVar2 & 1) == 0) {
    return;
  }
  stk->flags = uVar2 & 0xfffffffe;
  if ((uVar2 & 2) == 0) {
    __pspgl_matrix_sync(c,stk);
    pGVar4 = stk->stack[stk->depth].mat;
  }
  else {
    pGVar4 = __pspgl_identity;
  }
  if ((stk->flags & 0x10) != 0) {
    pspvfpu_use_matrices(c->vfpu_context,'\0','p');
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  iVar6 = 3;
  if (opcode != 0x3c) {
    if (opcode < 0x3d) {
      iVar1 = 3;
      if (opcode != 0x2a) {
        if (opcode != 0x3a) {
          return;
        }
        iVar1 = 3;
      }
      goto LAB_089140c8;
    }
    iVar1 = 4;
    if (opcode == 0x3e) {
      iVar6 = -1;
      goto LAB_089140c8;
    }
    if (opcode != 0x40) {
      return;
    }
    iVar6 = 2;
  }
  iVar1 = 3;
LAB_089140c8:
  iVar5 = 0;
  __pspgl_context_writereg_uncached(c,opcode,iVar1 * index * 4);
  do {
    iVar1 = 0;
    ppVar3 = (pspgl_matrix *)pGVar4;
    do {
                    /* Unresolved local var: int j@[???]
                       Unresolved local var: int i@[???] */
      if (iVar1 != iVar6) {
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???]
                       Unresolved local var: ulong val@[???] */
        __pspgl_dlist_enqueue_cmd((opcode + 1) * 0x1000000 | (uint)ppVar3->mat[0] >> 8);
      }
      iVar1 = iVar1 + 1;
      ppVar3 = (pspgl_matrix *)(ppVar3->mat + 1);
    } while (iVar1 != 4);
    iVar5 = iVar5 + 1;
    pGVar4 = ((pspgl_matrix *)pGVar4)->mat + 4;
  } while (iVar5 != 4);
  return;
}



----------------------------------------

// Function: __pspgl_context_flush_pending_state_changes @ 0891415c

void __pspgl_context_flush_pending_state_changes(pspgl_context *c,uint first,uint last)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint32_t *puVar4;
  uint uVar5;
  uint32_t *puVar6;
  
  uVar5 = first & 0xffffffe0;
  puVar6 = (c->hw).ge_reg + (uVar5 - 2);
  for (; uVar5 < (last + 0x20 & 0xffffffe0); uVar5 = uVar5 + 0x20) {
                    /* Unresolved local var: uint i@[???]
                       Unresolved local var: uint32_t word@[???]
                       Unresolved local var: uint j@[???] */
    uVar2 = (c->hw).ge_reg_touched[uVar5 >> 5];
    puVar4 = puVar6 + 2;
    (c->hw).ge_reg_touched[uVar5 >> 5] = 0;
    uVar3 = uVar5;
    while (uVar1 = uVar2 & 1, uVar2 != 0) {
      uVar2 = uVar2 >> 1;
      if ((uVar1 != 0) && (*puVar4 >> 0x18 == uVar3)) {
        __pspgl_dlist_enqueue_cmd(*puVar4);
      }
      uVar3 = uVar3 + 1;
      puVar4 = puVar4 + 1;
    }
    puVar6 = puVar6 + 0x20;
  }
  return;
}



----------------------------------------

// Function: __pspgl_context_render_setup @ 0891422c

void __pspgl_context_render_setup(pspgl_context *c,uint vtxfmt,void *vertex,void *index)

{
  bool bVar1;
  pspgl_teximg *ppVar2;
  uint uVar3;
  pspgl_matrix_stack *stk;
  int index_00;
  pspgl_texobj *tobj;
  int unaff_s4;
  uint32_t argi;
  void *unaff_retaddr;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  int in_stack_00000010;
  
                    /* Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: int clut_load@[???] */
  tobj = (c->texture).bound;
  if (tobj == (pspgl_texobj *)0x0) {
    argi = 0;
  }
  else {
    argi = 0;
    if (((c->hw).ge_reg[0x1e] & 1) != 0) {
      if (((c->hw).dirty & 1) != 0) {
                    /* Unresolved local var: pspgl_teximg * cmap@[???] */
        ppVar2 = __pspgl_texobj_cmap(tobj);
        (c->hw).dirty = (c->hw).dirty & 0xfffffffe;
        if (ppVar2 == (pspgl_teximg *)0x0) {
          argi = 0;
        }
        else {
                    /* Unresolved local var: ulong p@[???] */
          uVar3 = (int)ppVar2->image->base + ppVar2->offset;
          __pspgl_context_writereg(c,0xb0,uVar3);
          __pspgl_context_writereg(c,0xb1,uVar3 >> 8 & 0xf0000);
          __pspgl_context_writereg(c,0xc5,ppVar2->texfmt->hwformat | 0xff00);
          argi = ppVar2->width >> 3;
        }
      }
      __pspgl_context_writereg(c,0xc0,0x101);
      fVar4 = DAT_089dbce4;
                    /* Unresolved local var: pspgl_matrix_stack * tm@[???]
                       Unresolved local var: float su@[???]
                       Unresolved local var: float sv@[???]
                       Unresolved local var: float tu@[???]
                       Unresolved local var: float tv@[???] */
      fVar5 = DAT_089df684;
      if (((vtxfmt & 3) != 1) && (fVar5 = DAT_089dbce4, (vtxfmt & 3) == 2)) {
        fVar5 = DAT_089df680;
      }
      if ((tobj->flags & 8) == 0) {
        fVar6 = fVar5;
        fVar7 = 0.0;
      }
      else {
        fVar6 = -fVar5;
        fVar7 = DAT_089dbce4;
      }
      bVar1 = fVar5 == DAT_089dbce4;
      uVar3 = (c->texture_stack).flags & 0xffffffef;
      (c->texture_stack).flags = uVar3;
      if (((bVar1) && (fVar6 == fVar4)) && (fVar7 == 0.0)) {
        uVar3 = (c->modelview_stack).flags;
        goto LAB_08914400;
      }
      (c->texture_stack).flags = uVar3 | 0x10;
      fVar4 = DAT_089dbce4;
      (c->texture_stack).scale[0] = fVar5;
      (c->texture_stack).scale[1] = fVar6;
      (c->texture_stack).scale[2] = fVar4;
      (c->texture_stack).trans[1] = fVar7;
      (c->texture_stack).trans[2] = 0.0;
      (c->texture_stack).trans[0] = 0.0;
    }
  }
  uVar3 = (c->modelview_stack).flags;
LAB_08914400:
  (c->modelview_stack).flags = uVar3 & 0xffffffef;
  fVar4 = DAT_089df684;
  if (((vtxfmt & 0x180) == 0x80) || (fVar4 = DAT_089df680, (vtxfmt & 0x180) == 0x100)) {
    (c->modelview_stack).flags = uVar3 & 0xffffffef | 0x10;
    (c->modelview_stack).scale[2] = fVar4;
    (c->modelview_stack).scale[0] = fVar4;
    (c->modelview_stack).scale[1] = fVar4;
  }
  __pspgl_context_writereg(c,0x12,vtxfmt);
  if ((vtxfmt & 0x800000) == 0) {
                    /* Unresolved local var: int i@[???] */
    flush_matrix(c,0x3e,0,&c->projection_stack);
    flush_matrix(c,0x3a,0,&c->modelview_stack);
    flush_matrix(c,0x40,0,&c->texture_stack);
    flush_matrix(c,0x3c,0,&c->view_stack);
    index_00 = 0;
    stk = c->bone_stacks;
    do {
      flush_matrix(c,0x2a,index_00,stk);
      index_00 = index_00 + 1;
      stk = stk + 1;
    } while (index_00 != 8);
  }
  __pspgl_context_flush_pending_state_changes(c,0,0xff);
  if (argi != 0) {
    __pspgl_context_writereg_uncached(c,0xc4,argi);
  }
  __pspgl_context_writereg_uncached(c,0x10,(uint)vertex >> 8 & 0xf0000);
  __pspgl_context_writereg_uncached(c,1,(uint)vertex & 0xffffff);
  if ((vtxfmt & 0x1800) == 0) {
    if (index == (void *)0x0) {
      return;
    }
    __pspgl_assert_fail("index == NULL",unaff_retaddr,"__pspgl_context_render_setup",
                        "pspgl_context.c",in_stack_00000010);
    return;
  }
  if (index == (void *)0x0) {
    __pspgl_assert_fail("index != NULL",unaff_retaddr,"__pspgl_context_render_setup",
                        "pspgl_context.c",unaff_s4);
  }
  __pspgl_context_writereg_uncached(c,0x10,(uint)index >> 8 & 0xf0000);
  __pspgl_context_writereg_uncached(c,2,(uint)index & 0xffffff);
  return;
}



----------------------------------------

// Function: __pspgl_context_pin_buffers @ 0891464c

void __pspgl_context_pin_buffers(pspgl_context *c)

{
  pspgl_teximg *ppVar1;
  undefined4 *puVar2;
  pspgl_buffer *ppVar3;
  int iVar4;
  pspgl_texobj *tobj;
  
                    /* Unresolved local var: pspgl_texobj * tobj@[???] */
  __pspgl_dlist_pin_buffer(*c->draw->draw,3);
  if (((c->hw).ge_reg[0x23] & 1) == 0) {
    tobj = (c->texture).bound;
  }
  else {
    ppVar3 = c->draw->depth_buffer;
    if (ppVar3 == (pspgl_buffer *)0x0) {
      tobj = (c->texture).bound;
    }
    else {
      __pspgl_dlist_pin_buffer(ppVar3,3);
      tobj = (c->texture).bound;
    }
  }
  if ((tobj != (pspgl_texobj *)0x0) && (((c->hw).ge_reg[0x1e] & 1) != 0)) {
                    /* Unresolved local var: pspgl_teximg * cmap@[???] */
    ppVar1 = __pspgl_texobj_cmap(tobj);
    if (ppVar1 != (pspgl_teximg *)0x0) {
      __pspgl_dlist_pin_buffer(ppVar1->image,1);
    }
                    /* Unresolved local var: int i@[???] */
    iVar4 = 0;
    do {
      puVar2 = *(undefined4 **)((int)tobj->images + iVar4);
      iVar4 = iVar4 + 4;
      if ((puVar2 != (undefined4 *)0x0) &&
         (ppVar3 = (pspgl_buffer *)*puVar2, ppVar3 != (pspgl_buffer *)0x0)) {
        __pspgl_dlist_pin_buffer(ppVar3,1);
      }
    } while (iVar4 != 0x20);
  }
  return;
}



----------------------------------------

// Function: __pspgl_context_render_prim @ 08914720

void __pspgl_context_render_prim
               (pspgl_context *c,uint prim,uint count,uint vtxfmt,void *vertex,void *index)

{
  void *in_t0;
  void *in_t1;
  
  __pspgl_context_render_setup(c,vtxfmt,in_t0,in_t1);
  __pspgl_context_writereg_uncached(c,4,prim << 0x10 | count);
  __pspgl_context_pin_buffers(c);
  return;
}



----------------------------------------

// Function: now @ 08914780

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

ulonglong now(void)

{
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: ulonglong ret@[???] */
  local_c = 0;
  local_10 = 0;
  sceRtcGetCurrentTick(&local_10);
  return CONCAT44(local_c,local_10);
}



----------------------------------------

// Function: sync_list @ 089147b4

void sync_list(pspgl_dlist *list)

{
  pspgl_context *ppVar1;
  pspgl_buffer *data;
  uint uVar2;
  pspgl_buffer *ppVar3;
  int iVar4;
  ulonglong uVar5;
  
                    /* Unresolved local var: ulonglong start@[DW_OP_reg20(s4); DW_OP_piece: 4;
                       DW_OP_reg21(s5); DW_OP_piece: 4]
                       Unresolved local var: pspgl_buffer * data@[???]
                       Unresolved local var: pspgl_buffer * next@[???] */
  if (list->qid != -1) {
    iVar4 = 0;
    if ((__pspgl_curctx->stats).enabled != '\0') {
      uVar5 = now();
      iVar4 = (int)uVar5;
    }
    sceGeListSync(list->qid,0);
    ppVar1 = __pspgl_curctx;
    if ((__pspgl_curctx->stats).enabled == '\0') {
      data = list->pins;
    }
    else {
      uVar2 = (__pspgl_curctx->stats).queuewait;
      uVar5 = now();
      (ppVar1->stats).queuewait = uVar2 + ((int)uVar5 - iVar4);
      data = list->pins;
    }
    while (data != (pspgl_buffer *)0x0) {
      ppVar3 = data->pin_next;
      data->pin_prevp = (pspgl_buffer **)0x0;
      data->pin_next = (pspgl_buffer *)0x0;
      data->flags = data->flags & 0xfc;
      __pspgl_buffer_free(data);
      data = ppVar3;
    }
    list->qid = -1;
    list->pins = (pspgl_buffer *)0x0;
    list->len = 0;
  }
  return;
}



----------------------------------------

// Function: __pspgl_dlist_cancel @ 08914894

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_dlist_cancel(void)

{
  int iVar1;
  int iVar2;
  
  iVar1 = 0;
  do {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_dlist * d@[???] */
    iVar2 = iVar1 + 1;
    if (dlists[iVar1].qid != -1) {
      sceGeListDeQueue(dlists[iVar1].qid);
      sync_list(dlists + iVar1);
    }
    iVar1 = iVar2;
  } while (iVar2 != 0x10);
  return;
}



----------------------------------------

// Function: __pspgl_dlist_await_completion @ 08914908

void __pspgl_dlist_await_completion(_func_int_void_ptr *pred,void *p)

{
  int iVar1;
  uint uVar2;
  
                    /* Unresolved local var: uint i@[???] */
  uVar2 = dlist_current;
  while ((sync_list(dlists + uVar2), pred == (_func_int_void_ptr *)0x0 ||
         (iVar1 = (*pred)(p), iVar1 == 0))) {
    uVar2 = uVar2 + 1 & 0xf;
    if (uVar2 == dlist_current) {
      return;
    }
  }
  return;
}



----------------------------------------

// Function: __pspgl_dlist_pin_buffer @ 08914990

void __pspgl_dlist_pin_buffer(pspgl_buffer *data,uint flags)

{
  uint uVar1;
  pspgl_buffer *ppVar2;
  
                    /* Unresolved local var: pspgl_dlist * d@[???] */
  uVar1 = dlist_current;
  if (data->pin_prevp == (pspgl_buffer **)0x0) {
    data->refcount = data->refcount + 1;
  }
  else {
    if (data->pin_next != (pspgl_buffer *)0x0) {
      data->pin_next->pin_prevp = data->pin_prevp;
    }
    *data->pin_prevp = data->pin_next;
  }
  data->flags = (byte)flags | data->flags;
  ppVar2 = dlists[uVar1].pins;
  data->pin_prevp = &dlists[uVar1].pins;
  data->pin_next = ppVar2;
  if (ppVar2 != (pspgl_buffer *)0x0) {
    ppVar2->pin_prevp = &data->pin_next;
  }
  dlists[uVar1].pins = data;
  __pspgl_buffer_want_vidmem(data);
  return;
}



----------------------------------------

// Function: __pspgl_dlist_submit @ 08914a18

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_dlist_submit(void)

{
  uint uVar1;
  ulong *puVar2;
  ulong uVar3;
  int iVar4;
  pspgl_dlist *ppVar5;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_dlist * d@[???] */
  uVar1 = dlist_current;
  ppVar5 = dlists + dlist_current;
  if ((0x200 < ppVar5->len + 4) &&
     (__pspgl_log("d->len=%d DLIST_SIZE=%d\n",ppVar5->len,0x200), 0x200 < ppVar5->len + 4)) {
    __pspgl_assert_fail("(d->len + DLIST_EXTRA) <= DLIST_SIZE",unaff_retaddr,"dlist_finish",
                        "pspgl_dlist.c",in_stack_00000000);
  }
  uVar3 = ppVar5->len;
  puVar2 = dlists[uVar1].cmd_buf;
  iVar4 = dlists[uVar1].qid;
  puVar2[uVar3] = 0xf000000;
  puVar2[uVar3 + 1] = 0xc000000;
  puVar2[uVar3 + 2] = 0;
  puVar2[uVar3 + 3] = 0;
  ppVar5->len = uVar3 + 4;
  if (iVar4 != -1) {
    __pspgl_assert_fail("d->qid == -1",unaff_retaddr,"__pspgl_dlist_submit","pspgl_dlist.c",
                        in_stack_00000000);
  }
  if ((__pspgl_curctx->stats).enabled != '\0') {
    (__pspgl_curctx->stats).buffer_issues = (__pspgl_curctx->stats).buffer_issues + 1;
  }
  iVar4 = sceGeListEnQueue(dlists[uVar1].cmd_buf,dlists[uVar1].cmd_buf + (ppVar5->len - 1),0,0);
  dlists[uVar1].qid = iVar4;
  dlist_current = dlist_current + 1 & 0xf;
  if (dlists[dlist_current].qid != -1) {
    sync_list(dlists + dlist_current);
    return;
  }
  return;
}



----------------------------------------

// Function: __pspgl_dlist_insert_space @ 08914bd8

void * __pspgl_dlist_insert_space(ulong size)

{
  ulong *puVar1;
  ulong *puVar2;
  ulong uVar3;
  pspgl_dlist *ppVar4;
  uint uVar5;
  int unaff_s4;
  void *unaff_retaddr;
  
                    /* Unresolved local var: pspgl_dlist * d@[???]
                       Unresolved local var: ulong len@[???]
                       Unresolved local var: ulong adr@[???] */
  uVar5 = size + 3 >> 2;
  ppVar4 = dlists + dlist_current;
  if (0x1fb < uVar5 + ppVar4->len + 2) {
    __pspgl_dlist_submit();
    ppVar4 = dlists + dlist_current;
    if (ppVar4->len != 0) {
      __pspgl_assert_fail("d->len == 0",unaff_retaddr,"__pspgl_dlist_insert_space","pspgl_dlist.c",
                          unaff_s4);
    }
    if (0x1fc < uVar5) {
      __pspgl_assert_fail("size <= (DLIST_SIZE - DLIST_EXTRA)",unaff_retaddr,
                          "__pspgl_dlist_insert_space","pspgl_dlist.c",unaff_s4);
    }
  }
  uVar3 = uVar5 + ppVar4->len + 2;
  puVar2 = ppVar4->cmd_buf + uVar3;
  puVar1 = ppVar4->cmd_buf + ppVar4->len;
  ppVar4->len = uVar3;
  *puVar1 = (uint)puVar2 >> 8 & 0xf0000 | 0x10000000;
  puVar1[1] = (uint)puVar2 & 0xffffff | 0x8000000;
  return puVar1 + 2;
}



----------------------------------------

// Function: __pspgl_dlist_enqueue_cmd @ 08914d2c

void __pspgl_dlist_enqueue_cmd(ulong cmd)

{
  ulong uVar1;
  pspgl_dlist *ppVar2;
  
                    /* Unresolved local var: pspgl_dlist * d@[???] */
  ppVar2 = dlists + dlist_current;
  if (0x1fb < ppVar2->len + 1) {
    __pspgl_dlist_submit();
    ppVar2 = dlists + dlist_current;
  }
  uVar1 = ppVar2->len;
  ppVar2->cmd_buf[uVar1] = cmd;
  ppVar2->len = uVar1 + 1;
  return;
}



----------------------------------------

// Function: __pspgl_dlist_init @ 08914dc8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_dlist_init(void)

{
  ulong *puVar1;
  int iVar2;
  int iVar3;
  
  if (dlist_needinit != 0) {
    dlist_needinit = 0;
    dlist_current = 0;
    iVar2 = 0;
    do {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_dlist * d@[???] */
      iVar3 = iVar2 + 1;
      puVar1 = __pspgl_uncached(dlists[iVar2]._cmdbuf,0x800);
      dlists[iVar2].cmd_buf = puVar1;
      dlists[iVar2].qid = -1;
      dlists[iVar2].pins = (pspgl_buffer *)0x0;
      dlists[iVar2].len = 0;
      iVar2 = iVar3;
    } while (iVar3 != 0x10);
  }
  return;
}



----------------------------------------

// Function: __pspgl_matrix_load @ 08914e58

/* WARNING: Control flow encountered bad instruction data */

void __pspgl_matrix_load(pspgl_context *c,pspgl_matrix_stack *s)

{
  pspgl_matrix *ppVar1;
  undefined4 unaff_s8;
  undefined4 uVar2;
  
                    /* Unresolved local var: pspgl_matrix * m@[???] */
  uVar2 = 0x8914e94;
  ppVar1 = s->stack + s->depth;
  pspvfpu_use_matrices(c->vfpu_context,0x80,'\0');
  if ((ppVar1->flags & 4) != 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  setCopReg(2,0x8a0e910,*(undefined8 *)ppVar1->mat);
  setCopReg(2,&stack0xfffffff0,*(undefined8 *)(ppVar1->mat + 4));
  setCopReg(2,unaff_s8,*(undefined8 *)(ppVar1->mat + 8));
  setCopReg(2,uVar2,*(undefined8 *)(ppVar1->mat + 0xc));
  s->flags = s->flags | 8;
  return;
}



----------------------------------------

// Function: __pspgl_matrix_sync @ 08914ee0

void __pspgl_matrix_sync(pspgl_context *c,pspgl_matrix_stack *s)

{
  undefined8 uVar1;
  uint uVar2;
  pspgl_matrix *ppVar3;
  undefined4 unaff_s8;
  undefined4 uVar4;
  
                    /* Unresolved local var: pspgl_matrix * m@[???] */
  ppVar3 = s->stack;
  uVar2 = s->depth;
  if ((s->flags & 8) != 0) {
    uVar4 = 0x8914f18;
    pspvfpu_use_matrices(c->vfpu_context,0x80,'\0');
    uVar1 = getCopReg(2,0x8a0e910);
    *(undefined8 *)((int)ppVar3[uVar2].mat + 2) = uVar1;
    uVar1 = getCopReg(2,&stack0xfffffff0);
    *(undefined8 *)((int)ppVar3[uVar2].mat + 0x12) = uVar1;
    uVar1 = getCopReg(2,unaff_s8);
    *(undefined8 *)((int)ppVar3[uVar2].mat + 0x22) = uVar1;
    uVar1 = getCopReg(2,uVar4);
    *(undefined8 *)((int)ppVar3[uVar2].mat + 0x32) = uVar1;
  }
  return;
}



----------------------------------------

// Function: __pspgl_matrix_select @ 08914f4c

void __pspgl_matrix_select(pspgl_context *c,pspgl_matrix_stack *s)

{
  uint uVar1;
  uint uVar2;
  pspgl_matrix *ppVar3;
  pspgl_matrix_stack *s_00;
  void *unaff_retaddr;
  void *line;
  
                    /* Unresolved local var: pspgl_matrix_stack * stk@[???] */
  s_00 = c->current_matrix_stack;
  if (s_00 != s) {
    line = unaff_retaddr;
    if (s_00 != (pspgl_matrix_stack *)0x0) {
      if ((s_00->flags & 8) == 0) {
        __pspgl_assert_fail("stk->flags & MF_VFPU",unaff_retaddr,"__pspgl_matrix_select",
                            "pspgl_matrix.c",(int)unaff_retaddr);
      }
      __pspgl_matrix_sync(c,s_00);
      s_00->flags = s_00->flags & 0xfffffff7;
    }
    uVar2 = s->depth;
    ppVar3 = s->stack;
    uVar1 = s->flags;
    c->current_matrix_stack = s;
    c->current_matrix = ppVar3 + uVar2;
    if ((uVar1 & 8) != 0) {
      __pspgl_assert_fail("(s->flags & MF_VFPU) == 0",unaff_retaddr,"__pspgl_matrix_select",
                          "pspgl_matrix.c",(int)line);
    }
    __pspgl_matrix_load(c,s);
    return;
  }
  return;
}



----------------------------------------

// Function: __pspgl_vram_dump @ 08915060

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_vram_dump(void)

{
  undefined4 *puVar1;
  uint uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 *puVar8;
  undefined4 *puVar9;
  void *pvVar10;
  uint uVar11;
  pspgl_surface *ppVar12;
  undefined4 uStack_10068;
  int iStack_10064;
  undefined4 *puStack_10060;
  int iStack_1005c;
  uint uStack_10058;
  uint uStack_10054;
  uint uStack_10050;
  int iStack_1004c;
  int iStack_10048;
  uint uStack_10044;
  int iStack_10040;
  int iStack_1003c;
  uint uStack_10038;
  int iStack_10034;
  int iStack_10030;
  uint uStack_1002c;
  undefined4 auStack_10028 [16384];
  
                    /* Unresolved local var: ulong vram_start@[???]
                       Unresolved local var: ulong vram_size@[???]
                       Unresolved local var: ulong[4] header@[???]
                       Unresolved local var: uchar[65536] vram_copy@[???]
                       Unresolved local var: int fd@[???]
                       Unresolved local var: int i@[???] */
  puVar1 = (undefined4 *)sceGeEdramGetAddr();
  uVar2 = sceGeEdramGetSize();
  uVar3 = sceIoOpen("ms0:/pspgl.ge",0x302,0x1a4);
  if (__pspgl_curctx != (pspgl_context *)0x0) {
                    /* Unresolved local var: pspgl_surface * s@[???]
                       Unresolved local var: pspgl_dump_surfaces surf@[???] */
    ppVar12 = __pspgl_curctx->draw;
    uStack_10068 = 5;
    iStack_10064 = 0x40;
    puStack_10060 = (undefined4 *)0x0;
    iStack_1005c = 0;
    memset(&uStack_10058,0,0x30);
    uStack_10054 = ppVar12->alpha_mask;
    uStack_10050 = ppVar12->stencil_mask;
    uStack_10058 = ppVar12->pixfmt;
    pvVar10 = ppVar12->color_front->base;
    iStack_1004c = sceGeEdramGetAddr();
    uStack_10044 = (uint)ppVar12->pixelperline;
    iStack_1003c = 4;
    iStack_10048 = 4;
    if (ppVar12->pixfmt != 3) {
      iStack_10048 = 2;
    }
    iStack_1004c = (int)pvVar10 - iStack_1004c;
    pvVar10 = ppVar12->color_back->base;
    iStack_10048 = ppVar12->height * uStack_10044 * iStack_10048;
    iStack_10040 = sceGeEdramGetAddr();
    uStack_10038 = (uint)ppVar12->pixelperline;
    if (ppVar12->pixfmt != 3) {
      iStack_1003c = 2;
    }
    iStack_10040 = (int)pvVar10 - iStack_10040;
    iStack_1003c = ppVar12->height * uStack_10038 * iStack_1003c;
    if (ppVar12->depth_buffer != (pspgl_buffer *)0x0) {
      pvVar10 = ppVar12->depth_buffer->base;
      iStack_10034 = sceGeEdramGetAddr();
      uStack_1002c = (uint)ppVar12->pixelperline;
      iStack_10034 = (int)pvVar10 - iStack_10034;
      iStack_10030 = uStack_1002c * (uint)ppVar12->height * 2;
    }
    sceIoWrite(uVar3,&uStack_10068,0x10);
    sceIoWrite(uVar3,&uStack_10058,0x30);
  }
  iStack_10064 = uVar2 * 4 + 0x10;
  uStack_10068 = 4;
  puStack_10060 = puVar1;
  iStack_1005c = uVar2 * 4;
  sceIoWrite(uVar3,&uStack_10068,0x10);
  for (uVar11 = 0; uVar11 < (uVar2 & 0x3fffffff) >> 0xe; uVar11 = uVar11 + 1) {
    puVar9 = auStack_10028;
    puVar8 = puVar1;
    do {
      uVar4 = *puVar8;
      uVar5 = puVar8[1];
      uVar6 = puVar8[2];
      uVar7 = puVar8[3];
      puVar8 = puVar8 + 4;
      *puVar9 = uVar4;
      puVar9[1] = uVar5;
      puVar9[2] = uVar6;
      puVar9[3] = uVar7;
      puVar9 = puVar9 + 4;
    } while (puVar8 != puVar1 + 0x4000);
    sceIoWrite(uVar3,auStack_10028,0x10000);
    puVar1 = puVar1 + 0x4000;
  }
  sceIoClose(uVar3);
  return;
}



----------------------------------------

// Function: __pspgl_dlist_dump @ 089152d0

void __pspgl_dlist_dump(ulong *cmd_buf,ulong len)

{
  undefined4 uVar1;
  undefined4 local_20;
  int local_1c;
  ulong *local_18;
  
                    /* Unresolved local var: ulong[3] header@[???]
                       Unresolved local var: int fd@[???] */
  local_1c = len * 4 + 0xc;
  local_20 = 3;
  local_18 = cmd_buf;
  uVar1 = sceIoOpen("ms0:/pspgl.ge",0x302,0x1a4);
  sceIoWrite(uVar1,&local_20,0xc);
  sceIoWrite(uVar1,cmd_buf,len * 4);
  sceIoClose(uVar1);
  return;
}



----------------------------------------

// Function: pspgl_ge_writefile @ 08915358

void pspgl_ge_writefile(void *buf,ulong len)

{
  undefined4 uVar1;
  
                    /* Unresolved local var: int fd@[???] */
  uVar1 = sceIoOpen("ms0:/pspgl.ge",0x302,0x1a4);
  sceIoWrite(uVar1,buf,len);
  sceIoClose(uVar1);
  return;
}



----------------------------------------

// Function: __pspgl_ge_register_dump @ 089153b8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_ge_register_dump(void)

{
  undefined4 uVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 local_418;
  undefined4 local_414;
  undefined4 local_410 [256];
  
                    /* Unresolved local var: ulong[258] buf@[???]
                       Unresolved local var: int i@[???] */
  local_418 = 2;
  local_414 = 0x408;
  iVar2 = 0;
  puVar3 = local_410;
  do {
    uVar1 = sceGeGetCmd(iVar2);
    *puVar3 = uVar1;
    iVar2 = iVar2 + 1;
    puVar3 = puVar3 + 1;
  } while (iVar2 != 0x100);
  pspgl_ge_writefile(&local_418,0x408);
  return;
}



----------------------------------------

// Function: __pspgl_ge_matrix_dump @ 0891541c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_ge_matrix_dump(void)

{
  int iVar1;
  undefined1 *puVar2;
  undefined4 local_318;
  undefined4 local_314;
  undefined1 auStack_310 [768];
  
                    /* Unresolved local var: ulong[194] buf@[???]
                       Unresolved local var: int i@[???] */
  local_318 = 1;
  local_314 = 0x308;
  puVar2 = auStack_310;
  iVar1 = 0;
  do {
    sceGeGetMtx(iVar1,puVar2);
    iVar1 = iVar1 + 1;
    puVar2 = puVar2 + 0x40;
  } while (iVar1 != 0xc);
  pspgl_ge_writefile(&local_318,0x308);
  return;
}



----------------------------------------

// Function: __pspgl_log @ 08915480

void __pspgl_log(char *fmt,...)

{
  undefined4 in_a1;
  undefined4 in_a2;
  undefined4 in_a3;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  
                    /* Unresolved local var: va_list ap@[???] */
  local_1c = in_a1;
  local_18 = in_a2;
  local_14 = in_a3;
  vfprintf(_impure_ptr->_stderr,fmt,&local_1c);
  return;
}



----------------------------------------

// Function: __pspgl_free @ 089154cc

void __pspgl_free(void *ptr,char *function,uint line)

{
  __pspgl_log("%s(ptr %p, called from %s: %u)\n","__pspgl_free",ptr,function);
  free(ptr);
  return;
}



----------------------------------------

// Function: __pspgl_realloc @ 08915510

void * __pspgl_realloc(void *ptr,size_t size,char *function,uint line)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * new_ptr@[???] */
  pvVar1 = realloc(ptr,size);
  __pspgl_log("%s(ptr %p, size %d, called from %s: %u): %p\n","__pspgl_realloc",ptr,size);
  return pvVar1;
}



----------------------------------------

// Function: __pspgl_calloc @ 08915590

void * __pspgl_calloc(size_t count,size_t size,char *function,uint line)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * ptr@[???] */
  pvVar1 = calloc(count,size);
  __pspgl_log("%s(count %d, size %d, called from %s: %u): %p\n","__pspgl_calloc",count,size);
  return pvVar1;
}



----------------------------------------

// Function: __pspgl_assert_fail @ 08915610

void __pspgl_assert_fail(char *expr,void *retaddr,char *func,char *file,int line)

{
  __pspgl_log("ASSERTION FAILURE: %s:%d (%s, called from %p): %s\n",file);
  return;
}



----------------------------------------

// Function: __pspgl_uncached @ 08915638

void * __pspgl_uncached(void *p,size_t size)

{
  void *unaff_retaddr;
  int in_stack_00000000;
  
  if (((uint)p & 0x3f) != 0) {
    __pspgl_assert_fail("((unsigned long)p & (CACHELINE_SIZE-1)) == 0",unaff_retaddr,
                        "__pspgl_uncached","pspgl_misc.c",in_stack_00000000);
  }
  if ((size & 0x3f) != 0) {
    __pspgl_assert_fail("(size & (CACHELINE_SIZE-1)) == 0",unaff_retaddr,"__pspgl_uncached",
                        "pspgl_misc.c",in_stack_00000000);
  }
  sceKernelDcacheWritebackInvalidateRange(p,size);
  return (void *)((uint)p | 0x40000000);
}



----------------------------------------

// Function: copy_565 @ 089156e4

void copy_565(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  ushort uVar1;
  
                    /* Unresolved local var: ushort * dest@[DW_OP_reg5(a1)]
                       Unresolved local var: ushort * src@[DW_OP_reg6(a2)] */
  while (width = width - 1, width != 0xffffffff) {
    uVar1 = *(ushort *)from;
    from = (void *)((int)from + 2);
    *(ushort *)to = uVar1 << 0xb | uVar1 & 0x7e0 | uVar1 >> 0xb;
    to = (void *)((int)to + 2);
  }
  return;
}



----------------------------------------

// Function: copy_5551 @ 08915728

void copy_5551(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  ushort uVar1;
  uint uVar2;
  
                    /* Unresolved local var: ushort * dest@[DW_OP_reg8(t0)]
                       Unresolved local var: ushort * src@[DW_OP_reg6(a2)] */
  while (width = width - 1, width != 0xffffffff) {
    uVar1 = *(ushort *)from;
    uVar2 = (uint)uVar1;
    from = (void *)((int)from + 2);
    *(ushort *)to =
         (ushort)((uVar2 & 1) << 0xf) | (ushort)((uVar2 & 0x36) << 9) |
         (ushort)((int)(uVar2 & 0x7c0) >> 1) | uVar1 >> 0xb;
    to = (void *)((int)to + 2);
  }
  return;
}



----------------------------------------

// Function: copy_4444 @ 08915780

void copy_4444(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  ushort uVar1;
  uint uVar2;
  
                    /* Unresolved local var: ushort * dest@[DW_OP_reg8(t0)]
                       Unresolved local var: ushort * src@[DW_OP_reg6(a2)] */
  while (width = width - 1, width != 0xffffffff) {
    uVar1 = *(ushort *)from;
    uVar2 = (uint)uVar1;
    from = (void *)((int)from + 2);
    *(ushort *)to =
         (ushort)((uVar2 & 0xf) << 0xc) | (ushort)((uVar2 & 0xf0) << 4) |
         (ushort)((int)(uVar2 & 0xf00) >> 4) | uVar1 >> 0xc;
    to = (void *)((int)to + 2);
  }
  return;
}



----------------------------------------

// Function: copy_888_alpha @ 089157d8

void copy_888_alpha(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  undefined1 uVar1;
  
                    /* Unresolved local var: uchar * dest@[DW_OP_reg5(a1)]
                       Unresolved local var: uchar * src@[DW_OP_reg6(a2)] */
  while (width = width - 1, width != 0xffffffff) {
    *(undefined1 *)to = *(undefined1 *)from;
    *(undefined1 *)((int)to + 1) = *(undefined1 *)((int)from + 1);
    uVar1 = *(undefined1 *)((int)from + 2);
    *(undefined1 *)((int)to + 3) = 0xff;
    from = (void *)((int)from + 3);
    *(undefined1 *)((int)to + 2) = uVar1;
    to = (void *)((int)to + 4);
  }
  return;
}



----------------------------------------

// Function: copy_expand_LA @ 08915814

void copy_expand_LA(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  byte *pbVar1;
  uint uVar2;
  
                    /* Unresolved local var: uint * dest@[DW_OP_reg8(t0)]
                       Unresolved local var: uchar * src@[DW_OP_reg6(a2)] */
  while (width = width - 1, width != 0xffffffff) {
    uVar2 = (uint)*(byte *)from;
                    /* Unresolved local var: uchar l@[???]
                       Unresolved local var: uchar a@[???] */
    pbVar1 = (byte *)((int)from + 1);
    from = (void *)((int)from + 2);
    *(uint *)to = uVar2 << 8 | uVar2 << 0x10 | (uint)*pbVar1 << 0x18 | uVar2;
    to = (void *)((int)to + 4);
  }
  return;
}



----------------------------------------

// Function: make_cmap_alpha @ 0891585c

void make_cmap_alpha(uint *ptr)

{
  uint uVar1;
  int iVar2;
  
                    /* Unresolved local var: int i@[DW_OP_reg3(v1)] */
  iVar2 = 0;
  do {
    uVar1 = iVar2 << 0x18;
    iVar2 = iVar2 + 1;
    *ptr = uVar1;
    ptr = ptr + 1;
  } while (iVar2 != 0x100);
  return;
}



----------------------------------------

// Function: make_cmap_intensity @ 08915880

void make_cmap_intensity(uint *ptr)

{
  uint uVar1;
  uint uVar2;
  
                    /* Unresolved local var: int i@[DW_OP_reg5(a1)] */
  uVar2 = 0;
  do {
                    /* Unresolved local var: uint pix@[DW_OP_reg2(v0)] */
    uVar1 = uVar2 << 8 | uVar2;
    uVar2 = uVar2 + 1;
    *ptr = uVar1 << 0x10 | uVar1;
    ptr = ptr + 1;
  } while (uVar2 != 0x100);
  return;
}



----------------------------------------

// Function: make_cmap_luminance @ 089158b0

void make_cmap_luminance(uint *ptr)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: int i@[DW_OP_reg5(a1)] */
  uVar3 = 0;
  do {
                    /* Unresolved local var: uint pix@[???] */
    uVar1 = uVar3 << 0x10;
    uVar2 = uVar3 << 8 | uVar3;
    uVar3 = uVar3 + 1;
    *ptr = uVar2 | uVar1 | 0xff000000;
    ptr = ptr + 1;
  } while (uVar3 != 0x100);
  return;
}



----------------------------------------

// Function: tobj_setstate @ 089158e8

void tobj_setstate(pspgl_texobj *tobj,uint32_t reg,uint32_t setting)

{
  *(uint32_t *)((int)tobj + reg * 4 + -0x270) = reg << 0x18 | setting & 0xffffff;
  return;
}



----------------------------------------

// Function: __pspgl_texobj_unswizzle @ 0891590c

void __pspgl_texobj_unswizzle(pspgl_texobj *tobj)

{
                    /* Unresolved local var: int i@[???] */
  if ((tobj != (pspgl_texobj *)0x0) && ((tobj->flags & 4) != 0)) {
    tobj->flags = tobj->flags & 0xfffffffb;
  }
  return;
}



----------------------------------------

// Function: __pspgl_texobj_cmap @ 08915930

pspgl_teximg * __pspgl_texobj_cmap(pspgl_texobj *tobj)

{
  pspgl_teximg *ppVar1;
  
                    /* Unresolved local var: pspgl_teximg * ret@[DW_OP_reg2(v0)] */
  ppVar1 = (pspgl_teximg *)0x0;
  if (tobj != (pspgl_texobj *)0x0) {
    if (tobj->texfmt == (pspgl_texfmt *)0x0) {
      ppVar1 = tobj->cmap;
    }
    else {
      ppVar1 = tobj->texfmt->cmap;
      if (ppVar1 == (pspgl_teximg *)0x0) {
        ppVar1 = tobj->cmap;
      }
    }
  }
  return ppVar1;
}



----------------------------------------

// Function: copy_index4 @ 08915958

void copy_index4(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  memcpy(to,from,width >> 1);
  return;
}



----------------------------------------

// Function: copy @ 08915968

void copy(pspgl_texfmt *fmt,void *to,void *from,uint width)

{
  memcpy(to,from,width * fmt->pixsize);
  return;
}



----------------------------------------

// Function: __pspgl_update_texenv @ 08915980

void __pspgl_update_texenv(pspgl_texobj *tobj)

{
  uint uVar1;
  uint32_t argi;
  pspgl_texfmt *ppVar2;
  
                    /* Unresolved local var: pspgl_texfmt * fmt@[???] */
  if (tobj == (pspgl_texobj *)0x0) {
    return;
  }
  ppVar2 = tobj->texfmt;
  argi = 0x100;
  if (ppVar2 != (pspgl_texfmt *)0x0) {
    if (ppVar2->format - 0x80e4 < 4) {
      if (tobj->cmap == (pspgl_teximg *)0x0) {
        uVar1 = ppVar2->flags;
      }
      else {
        ppVar2 = tobj->cmap->texfmt;
        if (ppVar2 == (pspgl_texfmt *)0x0) goto LAB_089159f0;
        uVar1 = ppVar2->flags;
      }
    }
    else {
      uVar1 = ppVar2->flags;
    }
    if ((uVar1 & 1) == 0) {
      argi = 0;
    }
    __pspgl_context_writereg_masked(__pspgl_curctx,0xc9,argi,0x100);
  }
LAB_089159f0:
  (__pspgl_curctx->texture_stack).flags = (__pspgl_curctx->texture_stack).flags | 1;
  return;
}



----------------------------------------

// Function: __pspgl_teximg_free @ 08915a0c

void __pspgl_teximg_free(pspgl_teximg *timg)

{
  if (timg->image != (pspgl_buffer *)0x0) {
    __pspgl_buffer_free(timg->image);
  }
  free(timg);
  return;
}



----------------------------------------

// Function: __pspgl_teximg_from_buffer @ 08915a44

pspgl_teximg *
__pspgl_teximg_from_buffer
          (pspgl_buffer *buffer,uint offset,uint width,uint height,uint stride,pspgl_texfmt *texfmt)

{
  short sVar1;
  pspgl_teximg *m;
  uint in_t0;
  pspgl_texfmt *in_t1;
  
                    /* Unresolved local var: pspgl_teximg * timg@[???] */
  m = malloc(0x18);
  if (m != (pspgl_teximg *)0x0) {
    memset(m,0,0x18);
    sVar1 = buffer->refcount;
    m->offset = offset;
    m->width = width;
    buffer->refcount = sVar1 + 1;
    m->height = height;
    m->stride = in_t0;
    m->texfmt = in_t1;
    m->image = buffer;
  }
  return m;
}



----------------------------------------

// Function: __pspgl_texobj_new @ 08915af4

pspgl_texobj * __pspgl_texobj_new(GLuint id,GLenum target)

{
  pspgl_texobj *tobj;
  uint32_t reg;
  
                    /* Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: uint i@[???] */
  tobj = malloc(0xdc);
  if (tobj == (pspgl_texobj *)0x0) {
    tobj = (pspgl_texobj *)0x0;
  }
  else {
    memset(tobj,0,0xdc);
    tobj->refcount = 1;
    tobj->target = target;
    tobj->flags = 4;
    reg = 0xa0;
    do {
      tobj_setstate(tobj,reg,0);
      reg = reg + 1;
    } while (reg != 0xc9);
    tobj_setstate(tobj,0xc6,0x101);
    tobj_setstate(tobj,199,0);
  }
  return tobj;
}



----------------------------------------

// Function: init_internal_cmap @ 08915bac

void init_internal_cmap(pspgl_teximg *cmap,pspgl_texfmt *fmt,_func_void_uint_ptr *make_cmap)

{
  pspgl_buffer *data;
  uint *puVar1;
  
                    /* Unresolved local var: pspgl_buffer * b@[???]
                       Unresolved local var: void * map@[???] */
  data = __pspgl_buffer_new(0x400,0x88e4);
  if (data != (pspgl_buffer *)0x0) {
    puVar1 = __pspgl_buffer_map(data,0x88b9);
    (*make_cmap)(puVar1);
    __pspgl_buffer_unmap(data,0x88b9);
    cmap->texfmt = fmt;
    cmap->image = data;
  }
  return;
}



----------------------------------------

// Function: __pspgl_hardware_format @ 08915c2c

pspgl_texfmt * __pspgl_hardware_format(pspgl_texfmt *table,GLenum format,GLenum type)

{
  GLenum GVar1;
  pspgl_teximg *cmap;
  pspgl_texfmt *ppVar2;
  code *make_cmap;
  
  GVar1 = table->format;
  while( true ) {
    while( true ) {
      ppVar2 = table + 1;
      if (GVar1 == 0) {
        return (pspgl_texfmt *)0x0;
      }
      if (GVar1 == format) break;
      GVar1 = ppVar2->format;
      table = ppVar2;
    }
    if (table->type == type) break;
    GVar1 = ppVar2->format;
    table = ppVar2;
  }
  if (GVar1 == 0x1909) {
    if (luminance_cmap.image != (pspgl_buffer *)0x0) {
      return table;
    }
    cmap = &luminance_cmap;
    ppVar2 = __pspgl_texformats + 1;
    make_cmap = make_cmap_luminance;
  }
  else if (GVar1 == 0x1906) {
    if (alpha_cmap.image != (pspgl_buffer *)0x0) {
      return table;
    }
    cmap = &alpha_cmap;
    ppVar2 = __pspgl_texformats;
    make_cmap = make_cmap_alpha;
  }
  else {
    if (GVar1 != 0x8049) {
      return table;
    }
    if (intensity_cmap.image != (pspgl_buffer *)0x0) {
      return table;
    }
    cmap = &intensity_cmap;
    ppVar2 = __pspgl_texformats;
    make_cmap = make_cmap_intensity;
  }
  init_internal_cmap(cmap,ppVar2,make_cmap);
  return table;
}



----------------------------------------

// Function: __pspgl_teximg_new @ 08915d18

/* WARNING: Control flow encountered bad instruction data */

pspgl_teximg *
__pspgl_teximg_new(void *pixels,pixelstore *unpack,uint width,uint height,uint size,
                  GLboolean swizzled,pspgl_texfmt *texfmt)

{
  short sVar1;
  pspgl_teximg *timg;
  pspgl_buffer *ppVar2;
  void *pvVar3;
  pspgl_bufferobj *buf;
  uint in_t0;
  char in_t1;
  pspgl_texfmt *in_t2;
  uint uVar4;
  void *pvVar5;
  GLenum GVar6;
  uint uVar7;
  uint size_00;
  uint uVar8;
  uint uVar9;
  
                    /* Unresolved local var: pspgl_teximg * timg@[???]
                       Unresolved local var: uint srcsize@[???]
                       Unresolved local var: uint srcstride@[???]
                       Unresolved local var: GLenum error@[???]
                       Unresolved local var: pspgl_bufferobj * buffer@[???] */
  uVar4 = in_t2->pixsize;
  buf = unpack->pbo;
  uVar7 = unpack->row_length;
  if (unpack->row_length == 0) {
    uVar7 = width;
  }
  if (uVar4 < unpack->alignment) {
    uVar9 = unpack->alignment / uVar4;
    if (uVar4 == 0) {
      trap(7);
    }
    uVar7 = (uVar7 + uVar9) - 1 & -uVar9;
  }
  uVar8 = unpack->skip_pixels;
  uVar9 = unpack->skip_rows;
  timg = malloc(0x18);
  if (timg != (pspgl_teximg *)0x0) {
    memset(timg,0,0x18);
    size_00 = in_t0;
    if (in_t0 == 0) {
      in_t0 = uVar7 * height * in_t2->pixsize;
      size_00 = height * width * in_t2->hwsize;
    }
    timg->image = (pspgl_buffer *)0x0;
    timg->offset = 0;
    timg->width = width;
    timg->height = height;
    timg->stride = width;
    timg->texfmt = in_t2;
    pvVar5 = (void *)((int)pixels + (uVar9 * uVar7 + uVar8) * uVar4);
    if (buf == (pspgl_bufferobj *)0x0) {
      ppVar2 = timg->image;
    }
    else {
      if (buf->mapped != '\0') {
        GVar6 = 0x502;
        goto LAB_08916098;
      }
      ppVar2 = buf->data;
      if ((uint)ppVar2->size < (int)pvVar5 + in_t0) {
        GVar6 = 0x502;
        goto LAB_08916098;
      }
      if ((in_t2->flags & 2) == 0) {
        ppVar2 = timg->image;
      }
      else {
        sVar1 = ppVar2->refcount;
        timg->image = ppVar2;
        timg->offset = (uint)pvVar5;
        ppVar2->refcount = sVar1 + 1;
        timg->stride = uVar7;
        ppVar2 = timg->image;
      }
    }
    if (ppVar2 != (pspgl_buffer *)0x0) {
      return timg;
    }
    if (size_00 == 0) {
      return timg;
    }
                    /* Unresolved local var: void * src@[???] */
    ppVar2 = __pspgl_buffer_new(size_00,0x88e4);
    timg->image = ppVar2;
    if (ppVar2 != (pspgl_buffer *)0x0) {
      pvVar5 = __pspgl_bufferobj_map(buf,35000,pvVar5);
      if (pvVar5 != (void *)0x0) {
                    /* Unresolved local var: void * p@[???] */
        pvVar3 = __pspgl_buffer_map(timg->image,0x88b9);
        if (in_t2->hwformat < 8) {
          if (((in_t1 != '\0') && (0x10 < width * in_t2->hwsize)) && (7 < height)) {
                    /* Unresolved local var: uint dst_bytewidth@[???]
                       Unresolved local var: uint lg2_w@[???]
                       Unresolved local var: uint dst_chunk@[???]
                       Unresolved local var: uint pix_per_chunk@[???]
                       Unresolved local var: uint src_chunk@[???]
                       Unresolved local var: uint src_size@[???]
                       Unresolved local var: uint src_off@[???]
                       Unresolved local var: uint dst_off@[???] */
            if (in_t2->hwsize == 0) {
              trap(7);
            }
                    /* WARNING: Bad instruction - Truncating control flow here */
            halt_baddata();
          }
          if (height != 0) {
                    /* Unresolved local var: uchar * src@[???]
                       Unresolved local var: uchar * dest@[???] */
            (*in_t2->convert)(in_t2,pvVar3,pvVar5,width);
                    /* WARNING: Bad instruction - Truncating control flow here */
            halt_baddata();
          }
          ppVar2 = timg->image;
        }
        else {
          (*in_t2->convert)(in_t2,pvVar3,pvVar5,size_00);
          ppVar2 = timg->image;
        }
        __pspgl_buffer_unmap(ppVar2,0x88b9);
      }
      __pspgl_bufferobj_unmap(buf,35000);
      return timg;
    }
  }
  GVar6 = 0x505;
LAB_08916098:
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar6,"__pspgl_teximg_new");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar6;
  }
  if (timg != (pspgl_teximg *)0x0) {
    __pspgl_teximg_free(timg);
  }
  return (pspgl_teximg *)0x0;
}



----------------------------------------

// Function: __pspgl_texobj_free @ 08916108

void __pspgl_texobj_free(pspgl_texobj *tobj)

{
  uint uVar1;
  pspgl_texobj *ppVar2;
  int iVar3;
  int iVar4;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: int i@[???] */
  if (tobj->refcount == 0) {
    __pspgl_assert_fail("tobj->refcount > 0",unaff_retaddr,"__pspgl_texobj_free","pspgl_texobj.c",
                        in_stack_00000000);
  }
  uVar1 = tobj->refcount - 1;
  tobj->refcount = uVar1;
  if (uVar1 != 0) {
    return;
  }
  ppVar2 = tobj;
  iVar3 = 0;
  do {
    iVar4 = iVar3 + 4;
    if (ppVar2->images[0] != (pspgl_teximg *)0x0) {
      __pspgl_teximg_free(ppVar2->images[0]);
    }
    ppVar2 = (pspgl_texobj *)((int)tobj->ge_texreg + iVar3 + -0xc);
    iVar3 = iVar4;
  } while (iVar4 != 0x20);
  if (tobj->cmap != (pspgl_teximg *)0x0) {
    __pspgl_teximg_free(tobj->cmap);
  }
  free(tobj);
  return;
}



----------------------------------------

// Function: __pspgl_gl_sizeof @ 089161c4

uint __pspgl_gl_sizeof(GLenum type)

{
  uint uVar1;
  uint uVar2;
  
  uVar1 = 1 << (type - 0x1400 & 0x1f);
  uVar2 = 0;
  if (type - 0x1400 < 7) {
    if ((uVar1 & 3) == 0) {
      if ((uVar1 & 0xc) == 0) {
        if ((uVar1 & 0x60) == 0) {
          return 0;
        }
        uVar2 = 4;
      }
      else {
        uVar2 = 2;
      }
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



----------------------------------------

// Function: cvt_color_ub3_ub @ 08916218

void cvt_color_ub3_ub(void *to,void *from,attrib *attr)

{
                    /* Unresolved local var: uchar * src@[???]
                       Unresolved local var: ulong * dest@[???] */
  *(uint *)to = (uint)*(byte *)((int)from + 2) << 0x10 | (uint)*(byte *)from |
                (uint)*(byte *)((int)from + 1) << 8 | 0xff000000;
  return;
}



----------------------------------------

// Function: cvt_float2_float3 @ 08916244

void cvt_float2_float3(void *to,void *from,attrib *attr)

{
  undefined4 uVar1;
  
                    /* Unresolved local var: float * src@[???]
                       Unresolved local var: float * dest@[???] */
  *(undefined4 *)to = *(undefined4 *)from;
  uVar1 = *(undefined4 *)((int)from + 4);
  *(undefined4 *)((int)to + 8) = 0;
  *(undefined4 *)((int)to + 4) = uVar1;
  return;
}



----------------------------------------

// Function: cvt_short2_short3 @ 0891625c

void cvt_short2_short3(void *to,void *from,attrib *attr)

{
  undefined2 uVar1;
  
                    /* Unresolved local var: short * src@[???]
                       Unresolved local var: short * dest@[???] */
  *(undefined2 *)to = *(undefined2 *)from;
  uVar1 = *(undefined2 *)((int)from + 2);
  *(undefined2 *)((int)to + 4) = 0;
  *(undefined2 *)((int)to + 2) = uVar1;
  return;
}



----------------------------------------

// Function: cvt_byte2_byte3 @ 08916274

void cvt_byte2_byte3(void *to,void *from,attrib *attr)

{
  undefined1 uVar1;
  
                    /* Unresolved local var: uchar * src@[???]
                       Unresolved local var: uchar * dest@[???] */
  *(undefined1 *)to = *(undefined1 *)from;
  uVar1 = *(undefined1 *)((int)from + 1);
  *(undefined1 *)((int)to + 2) = 0;
  *(undefined1 *)((int)to + 1) = uVar1;
  return;
}



----------------------------------------

// Function: __pspgl_enabled_array_bits @ 0891628c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

uint __pspgl_enabled_array_bits(void)

{
  uint uVar1;
  
                    /* Unresolved local var: varray * v@[DW_OP_reg4(a0)]
                       Unresolved local var: uint ret@[DW_OP_reg5(a1)] */
  uVar1 = 8;
  if ((__pspgl_curctx->vertex_array).texcoord.enabled == 0) {
    uVar1 = 0;
  }
  if ((__pspgl_curctx->vertex_array).weight.enabled != 0) {
    uVar1 = uVar1 | 0x10;
  }
  if ((__pspgl_curctx->vertex_array).color.enabled != 0) {
    uVar1 = uVar1 | 4;
  }
  if ((__pspgl_curctx->vertex_array).normal.enabled != 0) {
    uVar1 = uVar1 | 2;
  }
  if ((__pspgl_curctx->vertex_array).vertex.enabled != 0) {
    uVar1 = uVar1 | 1;
  }
  return uVar1;
}



----------------------------------------

// Function: __pspgl_glprim2geprim @ 089162dc

long __pspgl_glprim2geprim(GLenum glprim)

{
  int iVar1;
  
  iVar1 = -1;
  if (glprim < 0xc) {
    iVar1 = (int)""[glprim];
  }
  return iVar1;
}



----------------------------------------

// Function: __pspgl_varray_convert_indices @ 08916300

pspgl_buffer *
__pspgl_varray_convert_indices
          (GLenum idxtype,void *indices,int minidx,int count,uint *buffer_offset,uint *hwformat)

{
  pspgl_buffer *ppVar1;
  uint uVar2;
  short *psVar3;
  undefined4 *puVar4;
  char *pcVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  char *pcVar9;
  undefined4 *in_t0;
  uint *in_t1;
  int unaff_s4;
  pspgl_bufferobj *buf;
  void *unaff_retaddr;
  
                    /* Unresolved local var: pspgl_bufferobj * idxbuf@[???]
                       Unresolved local var: pspgl_buffer * ret@[???]
                       Unresolved local var: void * retp@[???]
                       Unresolved local var: void * idxp@[???] */
  buf = (__pspgl_curctx->vertex_array).indexbuffer;
  *in_t0 = 0;
  if (buf != (pspgl_bufferobj *)0x0) {
    if (buf->mapped != '\0') {
      __pspgl_log("*** GL error 0x%04x in %s ***\n",0x502,"__pspgl_varray_convert_indices");
      if (__pspgl_curctx == (pspgl_context *)0x0) {
        return (pspgl_buffer *)0x0;
      }
      __pspgl_curctx->glerror = 0x502;
      return (pspgl_buffer *)0x0;
    }
    if (minidx == 0) {
      if (idxtype == 0x1401) {
        ppVar1 = buf->data;
LAB_08916384:
        if (ppVar1->mapped != '\0') {
          __pspgl_assert_fail("idxbuf->data->mapped == 0",unaff_retaddr,
                              "__pspgl_varray_convert_indices","pspgl_varray.c",unaff_s4);
        }
        if (idxtype == 0x1401) {
          uVar2 = *in_t1 | 0x800;
        }
        else {
          uVar2 = *in_t1 | 0x1000;
        }
        ppVar1 = buf->data;
        *in_t1 = uVar2;
        *in_t0 = indices;
        ppVar1->refcount = ppVar1->refcount + 1;
        return ppVar1;
      }
      if (idxtype == 0x1403) {
        ppVar1 = buf->data;
        goto LAB_08916384;
      }
    }
  }
  if ((idxtype == 0x1403) || (idxtype == 0x1405)) {
    iVar7 = 2;
  }
  else if (idxtype == 0x1401) {
    iVar7 = 1;
  }
  else {
    iVar7 = 0;
  }
  ppVar1 = __pspgl_buffer_new(iVar7 * count,0x88e0);
  if (ppVar1 == (pspgl_buffer *)0x0) {
    return (pspgl_buffer *)0x0;
  }
  psVar3 = __pspgl_buffer_map(ppVar1,0x88b9);
  puVar4 = __pspgl_bufferobj_map(buf,35000,indices);
                    /* Unresolved local var: uint hwformat@[???]
                       Unresolved local var: uint i@[???] */
  uVar2 = *in_t1;
  if (idxtype == 0x1403) {
    iVar7 = 0;
    for (iVar8 = 0; iVar8 != count; iVar8 = iVar8 + 1) {
      *(short *)((int)psVar3 + iVar7) = *(short *)((int)puVar4 + iVar7) - (short)minidx;
      iVar7 = iVar7 + 2;
    }
    uVar6 = 0x1000;
  }
  else if (idxtype == 0x1405) {
    iVar7 = 0;
    while( true ) {
      if (iVar7 == count) break;
      iVar7 = iVar7 + 1;
      *psVar3 = (short)*puVar4 - (short)minidx;
      puVar4 = puVar4 + 1;
      psVar3 = psVar3 + 1;
    }
    uVar6 = 0x1000;
  }
  else {
    if (idxtype != 0x1401) goto LAB_089164f4;
    iVar7 = 0;
    while( true ) {
      pcVar5 = (char *)((int)puVar4 + iVar7);
      pcVar9 = (char *)((int)psVar3 + iVar7);
      if (iVar7 == count) break;
      iVar7 = iVar7 + 1;
      *pcVar9 = *pcVar5 - (char)minidx;
    }
    uVar6 = 0x800;
  }
  uVar2 = uVar2 | uVar6;
LAB_089164f4:
  *in_t1 = uVar2;
  __pspgl_buffer_unmap(ppVar1,0x88b9);
  __pspgl_bufferobj_unmap(buf,35000);
  return ppVar1;
}



----------------------------------------

// Function: __pspgl_varray_bind_buffer @ 08916578

void __pspgl_varray_bind_buffer(pspgl_vertex_array *va,pspgl_bufferobj *buf)

{
  pspgl_bufferobj *bufp;
  
  if ((buf == (pspgl_bufferobj *)0x0) || (buf->mapped == '\0')) {
    if ((va->buffer != (pspgl_bufferobj *)0x0) &&
       ((__pspgl_curctx->vertex_array).locked.cached_array == va->buffer->data)) {
      __pspgl_uncache_arrays();
    }
    if (buf == (pspgl_bufferobj *)0x0) {
      bufp = va->buffer;
    }
    else {
      buf->refcount = buf->refcount + 1;
      bufp = va->buffer;
    }
    if (bufp == (pspgl_bufferobj *)0x0) {
      va->buffer = buf;
    }
    else {
      __pspgl_bufferobj_free(bufp);
      va->buffer = buf;
    }
  }
  else {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x502,"__pspgl_varray_bind_buffer");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x502;
    }
  }
  return;
}



----------------------------------------

// Function: __pspgl_vertex_is_native @ 08916634

GLboolean __pspgl_vertex_is_native(vertex_format *vfmt)

{
  GLboolean GVar1;
  bool bVar2;
  void *pvVar3;
  void *pvVar4;
  void *pvVar5;
  pspgl_vertex_array *ppVar6;
  pspgl_vertex_array *ppVar7;
  pspgl_vertex_array *ppVar8;
  int unaff_s4;
  int iVar9;
  int iVar10;
  int iVar11;
  void *unaff_retaddr;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_vertex_array * array@[???]
                       Unresolved local var: pspgl_vertex_array * next@[???]
                       Unresolved local var: int nattr@[???]
                       Unresolved local var: void * ptr@[???]
                       Unresolved local var: void * cycle@[???] */
  iVar10 = vfmt->nattrib;
  if (iVar10 == 0) {
    if (vfmt->vertex_size == 0) {
      bVar2 = true;
    }
    else {
      __pspgl_assert_fail("vfmt->vertex_size == 0",unaff_retaddr,"__pspgl_vertex_is_native",
                          "pspgl_varray.c",unaff_s4);
      bVar2 = true;
    }
  }
  else {
    ppVar8 = vfmt->attribs[0].array;
    ppVar6 = vfmt->attribs[1].array;
    iVar9 = 0;
    pvVar3 = __pspgl_bufferobj_deref(ppVar8->buffer,ppVar8->ptr);
    iVar11 = ppVar8->stride;
    pvVar5 = (void *)((int)pvVar3 + vfmt->attribs[0].size);
    while( true ) {
      ppVar7 = ppVar6;
      bVar2 = iVar10 + -1 <= iVar9;
      GVar1 = ppVar8->native;
      iVar9 = iVar9 + 1;
      if (bVar2) break;
                    /* Unresolved local var: void * nextptr@[???] */
      pvVar4 = __pspgl_bufferobj_deref(ppVar7->buffer,ppVar7->ptr);
      if (GVar1 == '\0') {
        return '\0';
      }
      if (pvVar5 != pvVar4) {
        return '\0';
      }
      pvVar5 = (void *)((int)pvVar5 + vfmt->attribs[1].size);
      ppVar6 = vfmt->attribs[2].array;
      ppVar8 = ppVar7;
      vfmt = (vertex_format *)vfmt->attribs;
    }
    if (GVar1 == '\0') {
      bVar2 = false;
    }
    else {
      bVar2 = pvVar5 == (void *)((int)pvVar3 + iVar11);
    }
  }
  return bVar2;
}



----------------------------------------

// Function: __pspgl_gen_varray @ 0891675c

int __pspgl_gen_varray(vertex_format *vfmt,int first,int count,void *to,int space)

{
  bool bVar1;
  GLboolean GVar2;
  undefined3 extraout_var;
  void *pvVar3;
  int iVar4;
  attrib *paVar5;
  uint in_t0;
  int *piVar6;
  vertex_format *pvVar7;
  int iVar8;
  int iVar9;
  pspgl_vertex_array *ppVar10;
  int iVar11;
  int local_40 [6];
  
                    /* Unresolved local var: uchar * dest@[???]
                       Unresolved local var: int nvtx@[???]
                       Unresolved local var: void *[5] ptrs@[???] */
  if (vfmt->vertex_size == 0) {
    trap(7);
  }
  iVar11 = count + in_t0 / vfmt->vertex_size;
  GVar2 = __pspgl_vertex_is_native(vfmt);
  if (CONCAT31(extraout_var,GVar2) == 0) {
    iVar9 = 0;
    pvVar7 = vfmt;
    piVar6 = local_40;
    while( true ) {
      bVar1 = vfmt->nattrib <= iVar9;
      iVar9 = iVar9 + 1;
      if (bVar1) break;
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_vertex_array * a@[???] */
      ppVar10 = pvVar7->attribs[0].array;
      pvVar3 = __pspgl_bufferobj_map(ppVar10->buffer,35000,ppVar10->ptr);
      *piVar6 = (int)((int)pvVar3 + first * ppVar10->stride);
      pvVar7 = (vertex_format *)pvVar7->attribs;
      piVar6 = piVar6 + 1;
    }
    for (iVar9 = 0; iVar9 < iVar11; iVar9 = iVar9 + 1) {
      piVar6 = local_40;
      for (iVar8 = 0; paVar5 = vfmt->attribs + iVar8, iVar8 < vfmt->nattrib; iVar8 = iVar8 + 1) {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: attrib * attr@[???]
                       Unresolved local var: pspgl_vertex_array * a@[???] */
        ppVar10 = paVar5->array;
        if (paVar5->convert == (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0) {
          memcpy((void *)((int)to + paVar5->offset),(void *)*piVar6,paVar5->size);
          iVar4 = *piVar6;
        }
        else {
          (*paVar5->convert)((void *)((int)to + paVar5->offset),(void *)*piVar6,paVar5);
          iVar4 = *piVar6;
        }
        *piVar6 = iVar4 + ppVar10->stride;
        piVar6 = piVar6 + 1;
      }
      to = (void *)((int)to + vfmt->vertex_size);
    }
    iVar9 = 0;
    pvVar7 = vfmt;
    while( true ) {
      bVar1 = vfmt->nattrib <= iVar9;
      iVar9 = iVar9 + 1;
      if (bVar1) break;
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_vertex_array * a@[???] */
      __pspgl_bufferobj_unmap((pvVar7->attribs[0].array)->buffer,35000);
      pvVar7 = (vertex_format *)pvVar7->attribs;
    }
  }
  else {
                    /* Unresolved local var: pspgl_vertex_array * va@[???]
                       Unresolved local var: void * from@[???] */
    ppVar10 = vfmt->attribs[0].array;
    pvVar3 = __pspgl_bufferobj_map(ppVar10->buffer,35000,ppVar10->ptr);
    memcpy(to,(void *)((int)pvVar3 + first * ppVar10->stride),iVar11 * vfmt->vertex_size);
    __pspgl_bufferobj_unmap(ppVar10->buffer,35000);
  }
  return iVar11;
}



----------------------------------------

// Function: __pspgl_varray_convert @ 08916940

pspgl_buffer * __pspgl_varray_convert(vertex_format *vfmt,int first,int count)

{
  pspgl_buffer *data;
  void *to;
  int iVar1;
  int unaff_s4;
  
                    /* Unresolved local var: uint size@[???]
                       Unresolved local var: pspgl_buffer * buf@[???]
                       Unresolved local var: void * bufp@[???] */
  iVar1 = count * vfmt->vertex_size;
  if (iVar1 != 0) {
    data = __pspgl_buffer_new(iVar1,0x88e0);
    if (data != (pspgl_buffer *)0x0) {
      to = __pspgl_buffer_map(data,0x88b9);
      iVar1 = __pspgl_gen_varray(vfmt,first,count,to,unaff_s4);
      if (iVar1 == count) {
        __pspgl_buffer_unmap(data,0x88b9);
        return data;
      }
      __pspgl_buffer_unmap(data,0x88b9);
      __pspgl_buffer_free(data);
    }
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x505,"__pspgl_varray_convert");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x505;
    }
  }
  return (pspgl_buffer *)0x0;
}



----------------------------------------

// Function: cvt_color_float3_ub @ 08916a40

void cvt_color_float3_ub(void *to,void *from,attrib *attr)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  
                    /* Unresolved local var: GLfloat * src@[DW_OP_reg5(a1)]
                       Unresolved local var: ulong * dest@[???]
                       Unresolved local var: ulong ret@[???] */
  fVar3 = *(float *)((int)from + 8);
  fVar1 = 0.0;
  if ((fVar3 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar3)) {
    fVar2 = *(float *)((int)from + 4);
    fVar3 = fVar1;
  }
  else {
    fVar2 = *(float *)((int)from + 4);
  }
  fVar1 = 0.0;
  if ((fVar2 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar2)) {
    fVar4 = *(float *)from;
    fVar2 = fVar1;
  }
  else {
    fVar4 = *(float *)from;
  }
  fVar1 = 0.0;
  if ((fVar4 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar4)) {
    fVar4 = fVar1;
  }
  *(uint *)to = (int)(fVar3 * DAT_089df258) << 0x10 |
                (int)(fVar4 * DAT_089df258) | (int)(fVar2 * DAT_089df258) << 8 | 0xff000000;
  return;
}



----------------------------------------

// Function: cvt_color_float4_ub @ 08916b2c

void cvt_color_float4_ub(void *to,void *from,attrib *attr)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  
                    /* Unresolved local var: GLfloat * src@[DW_OP_reg5(a1)]
                       Unresolved local var: ulong * dest@[???]
                       Unresolved local var: ulong ret@[???] */
  fVar4 = *(float *)((int)from + 0xc);
  fVar1 = 0.0;
  if ((fVar4 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar4)) {
    fVar3 = *(float *)((int)from + 8);
    fVar4 = fVar1;
  }
  else {
    fVar3 = *(float *)((int)from + 8);
  }
  fVar1 = 0.0;
  if ((fVar3 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar3)) {
    fVar2 = *(float *)((int)from + 4);
    fVar3 = fVar1;
  }
  else {
    fVar2 = *(float *)((int)from + 4);
  }
  fVar1 = 0.0;
  if ((fVar2 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar2)) {
    fVar5 = *(float *)from;
    fVar2 = fVar1;
  }
  else {
    fVar5 = *(float *)from;
  }
  fVar1 = 0.0;
  if ((fVar5 < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < fVar5)) {
    fVar5 = fVar1;
  }
  *(int *)to = (int)(fVar2 * DAT_089df258) << 8 | (int)(fVar3 * DAT_089df258) << 0x10 |
               (int)(fVar4 * DAT_089df258) << 0x18 | (int)(fVar5 * DAT_089df258);
  return;
}



----------------------------------------

// Function: __pspgl_ge_vertex_fmt @ 08916c58

void __pspgl_ge_vertex_fmt(pspgl_context *ctx,vertex_format *vfmt)

{
  int iVar1;
  code *pcVar2;
  uint uVar3;
  uint uVar4;
  GLenum GVar5;
  pspgl_vertex_array *ppVar6;
  attrib *paVar7;
  int iVar8;
  int unaff_s4;
  varray *pvVar9;
  uint uVar10;
  void *unaff_retaddr;
  
                    /* Unresolved local var: uint hwformat@[???]
                       Unresolved local var: varray * varray@[???]
                       Unresolved local var: attrib * attr@[???]
                       Unresolved local var: uint offset@[???] */
  pvVar9 = &ctx->vertex_array;
  paVar7 = vfmt->attribs;
  if ((ctx->vertex_array).vertex.enabled == 0) {
    uVar10 = 0;
    uVar4 = 0;
    goto LAB_089170fc;
  }
  if ((ctx->vertex_array).texcoord.enabled == 0) {
    uVar10 = 0;
    uVar4 = 0;
  }
  else {
    GVar5 = (ctx->vertex_array).texcoord.type;
                    /* Unresolved local var: uint hwtype@[???]
                       Unresolved local var: int ge_type@[???] */
    if (GVar5 == 0x1402) {
      uVar10 = 2;
LAB_08916cf4:
      iVar1 = (ctx->vertex_array).texcoord.size;
    }
    else {
      if (GVar5 == 0x1406) {
        uVar10 = 3;
        goto LAB_08916cf4;
      }
      if (GVar5 != 0x1400) {
        uVar10 = 0xffffffff;
        goto LAB_08916cf4;
      }
      uVar10 = 1;
      iVar1 = (ctx->vertex_array).texcoord.size;
    }
    if (2 < iVar1 - 2U) {
      __pspgl_assert_fail("varray->texcoord.size >= 2 && varray->texcoord.size <= 4",unaff_retaddr,
                          "__pspgl_ge_vertex_fmt","pspgl_varray.c",unaff_s4);
    }
    vfmt->attribs[0].array = &(ctx->vertex_array).texcoord;
    vfmt->attribs[0].convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
    if (uVar10 == 2) {
      uVar4 = 0;
LAB_08917154:
      uVar4 = uVar4 & 0xfffffffe;
      paVar7->offset = uVar4;
LAB_08916da4:
      iVar1 = 2;
    }
    else {
      uVar4 = 0;
      iVar1 = 1;
      if (uVar10 == 3) {
LAB_08917164:
        uVar4 = uVar4 & 0xfffffffc;
        paVar7->offset = uVar4;
LAB_08916dac:
        iVar1 = 4;
      }
      else if (uVar10 == 1) {
        uVar4 = 0;
        paVar7->offset = 0;
        iVar1 = 1;
      }
      else {
        if (uVar10 == 2) {
          uVar4 = 0xffffffff;
          goto LAB_08917154;
        }
        if (uVar10 == 3) {
          uVar4 = 0xffffffff;
          goto LAB_08917164;
        }
        if (uVar10 == 1) {
          uVar4 = 0xffffffff;
          paVar7->offset = 0xffffffff;
        }
        else {
          paVar7->offset = 0;
          if (uVar10 == 2) {
            uVar4 = 0;
            goto LAB_08916da4;
          }
          uVar4 = 0;
          if (uVar10 == 3) goto LAB_08916dac;
          if (uVar10 == 1) {
            iVar1 = 1;
          }
          else {
            iVar1 = 0;
          }
        }
      }
    }
    vfmt->attribs[0].size = iVar1 * 2;
    uVar4 = uVar4 + iVar1 * 2;
    paVar7 = vfmt->attribs + 1;
  }
  if ((ctx->vertex_array).weight.enabled == 0) {
    GVar5 = (ctx->vertex_array).color.enabled;
  }
  else {
                    /* Unresolved local var: uint hwtype@[???]
                       Unresolved local var: uint nweights@[???]
                       Unresolved local var: int ge_type@[???] */
    GVar5 = (ctx->vertex_array).weight.type;
    if (GVar5 == 0x1402) {
      iVar8 = (ctx->vertex_array).weight.size;
      uVar3 = (iVar8 - 1U & 7) << 0xe | 0x400;
      uVar4 = uVar4 + 1 & 0xfffffffe;
      iVar1 = 2;
LAB_089171cc:
      paVar7->array = &(ctx->vertex_array).weight;
LAB_089171f4:
      uVar10 = uVar10 | uVar3;
      paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
      paVar7->offset = uVar4;
    }
    else {
      if (GVar5 == 0x1406) {
        iVar8 = (ctx->vertex_array).weight.size;
        uVar3 = (iVar8 - 1U & 7) << 0xe | 0x600;
        uVar4 = uVar4 + 3 & 0xfffffffc;
        iVar1 = 4;
        goto LAB_089171cc;
      }
      iVar8 = (ctx->vertex_array).weight.size;
      ppVar6 = &(ctx->vertex_array).weight;
      if (GVar5 == 0x1400) {
        uVar3 = (iVar8 - 1U & 7) << 0xe | 0x200;
        iVar1 = 1;
        paVar7->array = ppVar6;
        goto LAB_089171f4;
      }
      uVar10 = uVar10 | 0xfffffe00;
      paVar7->array = ppVar6;
      paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
      paVar7->offset = 0;
      iVar1 = 0;
      uVar4 = 0;
    }
    paVar7->size = iVar1 * iVar8;
    uVar4 = uVar4 + iVar1 * iVar8;
    paVar7 = paVar7 + 1;
    GVar5 = (ctx->vertex_array).color.enabled;
  }
  if (GVar5 == 0) {
    GVar5 = (ctx->vertex_array).normal.enabled;
  }
  else {
                    /* Unresolved local var: uint type@[???]
                       Unresolved local var: uint size@[???] */
    GVar5 = (ctx->vertex_array).color.type;
    iVar1 = (ctx->vertex_array).color.size;
    if ((GVar5 != 0x1406) && (GVar5 != 0x1401)) {
      __pspgl_assert_fail("type == GL_FLOAT || type == GL_UNSIGNED_BYTE",unaff_retaddr,
                          "__pspgl_ge_vertex_fmt","pspgl_varray.c",unaff_s4);
    }
    if (1 < iVar1 - 3U) {
      __pspgl_assert_fail("size == 3 || size == 4",unaff_retaddr,"__pspgl_ge_vertex_fmt",
                          "pspgl_varray.c",unaff_s4);
    }
    paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
    if (GVar5 == 0x1406) {
      if (iVar1 == 3) {
        pcVar2 = cvt_color_float3_ub;
      }
      else {
        pcVar2 = cvt_color_float4_ub;
      }
LAB_08916eec:
      paVar7->convert = pcVar2;
    }
    else if (iVar1 == 3) {
      pcVar2 = cvt_color_ub3_ub;
      goto LAB_08916eec;
    }
    uVar4 = uVar4 + 3 & 0xfffffffc;
    paVar7->array = &(ctx->vertex_array).color;
    paVar7->size = 4;
    paVar7->offset = uVar4;
    uVar10 = uVar10 | 0x1c;
    uVar4 = uVar4 + 4;
    paVar7 = paVar7 + 1;
    GVar5 = (ctx->vertex_array).normal.enabled;
  }
  if (GVar5 == 0) {
    GVar5 = (pvVar9->vertex).enabled;
  }
  else {
                    /* Unresolved local var: uint hwtype@[???]
                       Unresolved local var: int ge_type@[???] */
    GVar5 = (ctx->vertex_array).normal.type;
    if (GVar5 == 0x1402) {
      uVar4 = uVar4 + 1 & 0xfffffffe;
      uVar10 = uVar10 | 0x40;
      iVar1 = 2;
LAB_08917240:
      paVar7->array = &(ctx->vertex_array).normal;
LAB_08917244:
      paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
      paVar7->offset = uVar4;
    }
    else {
      if (GVar5 == 0x1406) {
        uVar4 = uVar4 + 3 & 0xfffffffc;
        uVar10 = uVar10 | 0x60;
        iVar1 = 4;
        goto LAB_08917240;
      }
      ppVar6 = &(ctx->vertex_array).normal;
      if (GVar5 == 0x1400) {
        uVar10 = uVar10 | 0x20;
        iVar1 = 1;
        paVar7->array = ppVar6;
        goto LAB_08917244;
      }
      uVar10 = uVar10 | 0xffffffe0;
      paVar7->array = ppVar6;
      paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
      paVar7->offset = 0;
      iVar1 = 0;
      uVar4 = 0;
    }
    paVar7->size = iVar1 * 3;
    uVar4 = uVar4 + iVar1 * 3;
    paVar7 = paVar7 + 1;
    GVar5 = (pvVar9->vertex).enabled;
  }
  if (GVar5 != 0) {
                    /* Unresolved local var: uint hwtype@[???]
                       Unresolved local var: uint size@[???]
                       Unresolved local var: int ge_type@[???] */
    GVar5 = (ctx->vertex_array).vertex.type;
    if (GVar5 == 0x1402) {
      iVar1 = 2;
LAB_08916fc8:
      iVar8 = (ctx->vertex_array).vertex.size;
    }
    else {
      if (GVar5 == 0x1406) {
        iVar1 = 3;
        goto LAB_08916fc8;
      }
      if (GVar5 != 0x1400) {
        iVar1 = -1;
        goto LAB_08916fc8;
      }
      iVar1 = 1;
      iVar8 = (ctx->vertex_array).vertex.size;
    }
    if (2 < iVar8 - 2U) {
      __pspgl_assert_fail("size >= 2 && size <= 4",unaff_retaddr,"__pspgl_ge_vertex_fmt",
                          "pspgl_varray.c",unaff_s4);
    }
    paVar7->convert = (_func_void_void_ptr_void_ptr_attrib_ptr *)0x0;
    if (iVar8 == 2) {
      if (iVar1 == 2) {
        paVar7->convert = cvt_short2_short3;
        paVar7->array = &pvVar9->vertex;
        goto LAB_08917258;
      }
      if (iVar1 != 3) {
        if (iVar1 != 1) goto LAB_08917064;
        paVar7->convert = cvt_byte2_byte3;
        paVar7->array = &pvVar9->vertex;
        paVar7->offset = uVar4;
        goto LAB_089170b8;
      }
      paVar7->convert = cvt_float2_float3;
      paVar7->array = &pvVar9->vertex;
LAB_08917250:
      uVar4 = uVar4 + 3;
LAB_0891727c:
      uVar4 = uVar4 & 0xfffffffc;
      paVar7->offset = uVar4;
LAB_089170cc:
      iVar8 = 4;
    }
    else {
LAB_08917064:
      paVar7->array = &pvVar9->vertex;
      if (iVar1 == 2) {
LAB_08917258:
        uVar4 = uVar4 + 1;
LAB_08917268:
        uVar4 = uVar4 & 0xfffffffe;
        paVar7->offset = uVar4;
      }
      else {
        if (iVar1 == 3) goto LAB_08917250;
        if (iVar1 == 1) {
          paVar7->offset = uVar4;
LAB_089170b8:
          iVar8 = 1;
          goto LAB_089170d0;
        }
        uVar4 = uVar4 - 1;
        if (iVar1 == 2) goto LAB_08917268;
        if (iVar1 == 3) goto LAB_0891727c;
        if (iVar1 == 1) {
          paVar7->offset = uVar4;
          goto LAB_089170b8;
        }
        paVar7->offset = 0;
        if (iVar1 != 2) {
          uVar4 = 0;
          if (iVar1 != 3) {
            if (iVar1 == 1) {
              iVar8 = 1;
            }
            else {
              iVar8 = 0;
            }
            goto LAB_089170d0;
          }
          goto LAB_089170cc;
        }
        uVar4 = 0;
      }
      iVar8 = 2;
    }
LAB_089170d0:
    uVar10 = uVar10 | iVar1 << 7;
    paVar7->size = iVar8 * 3;
    uVar4 = uVar4 + iVar8 * 3;
    paVar7 = paVar7 + 1;
  }
  uVar4 = uVar4 + 3 & 0xfffffffc;
LAB_089170fc:
  vfmt->hwformat = uVar10;
  vfmt->nattrib = (int)paVar7 - (int)vfmt->attribs >> 4;
  vfmt->vertex_size = uVar4;
  uVar4 = __pspgl_enabled_array_bits();
  vfmt->arrays = uVar4;
  return;
}



----------------------------------------

// Function: __pspgl_varray_draw @ 08917288

void __pspgl_varray_draw(GLenum mode,GLint first,GLsizei count)

{
  varray *pvVar1;
  pspgl_context *c;
  GLboolean GVar2;
  uint uVar3;
  undefined3 extraout_var;
  short *psVar4;
  pspgl_buffer *data;
  GLenum GVar5;
  vertex_format *pvVar6;
  void *unaff_retaddr;
  uint local_88;
  void *in_stack_ffffff88;
  void *in_stack_ffffff8c;
  
                    /* Unresolved local var: long prim@[???]
                       Unresolved local var: vertex_format vfmt@[???]
                       Unresolved local var: vertex_format * vfmtp@[???]
                       Unresolved local var: pspgl_buffer * vbuf@[???]
                       Unresolved local var: uint vbuf_offset@[???]
                       Unresolved local var: void * buf@[???]
                       Unresolved local var: GLenum error@[???] */
  uVar3 = __pspgl_glprim2geprim(mode);
  if ((int)uVar3 < 0) {
    GVar5 = 0x500;
LAB_0891742c:
    __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar5,"__pspgl_varray_draw");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = GVar5;
    }
  }
  else {
    if (count == 0) {
      return;
    }
    GVar2 = __pspgl_cache_arrays();
    if (CONCAT31(extraout_var,GVar2) == 0) {
LAB_08917318:
      __pspgl_ge_vertex_fmt(__pspgl_curctx,(vertex_format *)&local_88);
      if (local_88 == 0) {
        return;
      }
      data = __pspgl_varray_convert((vertex_format *)&local_88,first,count);
      pvVar6 = (vertex_format *)&local_88;
      if (data == (pspgl_buffer *)0x0) {
        GVar5 = 0x505;
        goto LAB_0891742c;
      }
    }
    else {
                    /* Unresolved local var: locked_arrays * l@[???] */
      data = (__pspgl_curctx->vertex_array).locked.cached_array;
      pvVar1 = &__pspgl_curctx->vertex_array;
      first = first - (__pspgl_curctx->vertex_array).locked.cached_first;
      data->refcount = data->refcount + 1;
      pvVar6 = &(pvVar1->locked).vfmt;
      if (data == (pspgl_buffer *)0x0) goto LAB_08917318;
    }
    __pspgl_context_render_prim
              (__pspgl_curctx,uVar3,count,pvVar6->hwformat,in_stack_ffffff88,in_stack_ffffff8c);
    __pspgl_dlist_pin_buffer(data,1);
    if (mode == 2) {
                    /* Unresolved local var: GLushort * idx@[???] */
      psVar4 = __pspgl_dlist_insert_space(4);
      if (psVar4 == (short *)0x0) {
        __pspgl_assert_fail("idx != NULL",unaff_retaddr,"__pspgl_varray_draw","pspgl_varray_draw.c",
                            (int)in_stack_ffffff88);
      }
      c = __pspgl_curctx;
      uVar3 = pvVar6->hwformat;
      *psVar4 = (short)first + (short)count + -1;
      psVar4[1] = (short)first;
      __pspgl_context_render_prim(c,1,2,uVar3 | 0x1000,in_stack_ffffff88,in_stack_ffffff8c);
      __pspgl_dlist_pin_buffer(data,1);
    }
    __pspgl_buffer_free(data);
  }
  return;
}



----------------------------------------

// Function: addr_cmp @ 08917484

int addr_cmp(void *key,void *b)

{
  uint uVar1;
  
                    /* Unresolved local var: void * k@[???]
                       Unresolved local var: pspgl_buffer * * kb@[???] */
  uVar1 = 0xffffffff;
  if (*(uint *)(*(int *)b + 0x18) <= *(uint *)key) {
    uVar1 = (uint)(*(uint *)key != *(uint *)(*(int *)b + 0x18));
  }
  return uVar1;
}



----------------------------------------

// Function: __pspgl_vidmem_evict @ 089174ac

size_t __pspgl_vidmem_evict(pspgl_buffer *buf)

{
  byte bVar1;
  undefined4 *puVar2;
  pspgl_buffer *data;
  void *dst;
  size_t size;
  void *src;
  _func_int_void_ptr_void_ptr *in_stack_00000000;
  
                    /* Unresolved local var: pspgl_buffer * * chunk@[???]
                       Unresolved local var: pspgl_buffer * standin@[???]
                       Unresolved local var: void * t@[???] */
  puVar2 = bsearch(&buf->base,vidmem_map,vidmem_map_len,4,in_stack_00000000);
  if (puVar2 != (undefined4 *)0x0) {
    if ((buf->flags & 0x24) != 0) {
      return 0;
    }
    if ((buf->mapped == '\0') &&
       (data = __pspgl_buffer_new(buf->size,0x88e8), data != (pspgl_buffer *)0x0)) {
      *puVar2 = data;
      dst = data->base;
      src = buf->base;
      bVar1 = data->flags;
      size = buf->size;
      buf->base = dst;
      data->flags = bVar1 | 0x20;
      data->base = src;
      __pspgl_copy_memory(src,dst,size);
      __pspgl_dlist_pin_buffer(buf,2);
      __pspgl_dlist_pin_buffer(data,1);
      __pspgl_buffer_free(data);
      return buf->size;
    }
  }
  return 0;
}



----------------------------------------

// Function: now @ 08917590

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

ulonglong now(void)

{
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: ulonglong ret@[???] */
  local_c = 0;
  local_10 = 0;
  sceRtcGetCurrentTick(&local_10);
  return CONCAT44(local_c,local_10);
}



----------------------------------------

// Function: __pspgl_vidmem_setup_write_and_display_buffer @ 089175c4

EGLBoolean __pspgl_vidmem_setup_write_and_display_buffer(pspgl_surface *s)

{
  pspgl_context *c;
  uint uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  uint32_t argi;
  void *pvVar4;
  ulonglong uVar5;
  
                    /* Unresolved local var: ulong adr@[???] */
  uVar5 = now();
  c = __pspgl_curctx;
  s->flip_start = uVar5;
  __pspgl_context_writereg(c,0xd2,s->pixfmt);
  pvVar4 = (*s->draw)->base;
  __pspgl_context_writereg(__pspgl_curctx,0x9c,(uint)pvVar4 & 0xffffff);
  __pspgl_context_writereg
            (__pspgl_curctx,0x9d,((uint)pvVar4 & 0xff000000) >> 8 | (uint)s->pixelperline);
  if (s->depth_buffer == (pspgl_buffer *)0x0) {
    __pspgl_context_writereg(__pspgl_curctx,0x9e,0);
    argi = 0;
  }
  else {
    pvVar4 = s->depth_buffer->base;
    __pspgl_context_writereg(__pspgl_curctx,0x9e,(uint)pvVar4 & 0xffffff);
    argi = ((uint)pvVar4 & 0xff000000) >> 8 | (uint)s->pixelperline;
  }
  __pspgl_context_writereg(__pspgl_curctx,0x9f,argi);
  if ((s->flags & 1) == 0) {
    uVar2 = (undefined4)s->flip_end;
  }
  else {
    __pspgl_buffer_dlist_sync(s->color_front);
    sceDisplaySetFrameBuf(s->color_front->base,s->pixelperline,s->pixfmt,1);
    uVar1 = __pspgl_curctx->swap_interval;
    while (uVar1 != 0) {
      sceDisplayWaitVblankStart();
      uVar1 = sceDisplayGetVcount();
      uVar1 = uVar1 % __pspgl_curctx->swap_interval;
      if (__pspgl_curctx->swap_interval == 0) {
        trap(7);
      }
    }
    uVar2 = (undefined4)s->flip_end;
  }
  uVar3 = *(undefined4 *)((int)&s->flip_end + 4);
  *(undefined4 *)&s->prev_end = uVar2;
  *(undefined4 *)((int)&s->prev_end + 4) = uVar3;
  uVar5 = now();
  s->flip_end = uVar5;
  return 1;
}



----------------------------------------

// Function: __pspgl_vidmem_free @ 08917750

void __pspgl_vidmem_free(pspgl_buffer *buf)

{
  void *pvVar1;
  int iVar2;
  _func_int_void_ptr_void_ptr *unaff_s4;
  void *unaff_retaddr;
  
                    /* Unresolved local var: pspgl_buffer * * chunk@[???] */
  pvVar1 = bsearch(&buf->base,vidmem_map,vidmem_map_len,4,unaff_s4);
                    /* Unresolved local var: int i@[???] */
  if (pvVar1 != (void *)0x0) {
    iVar2 = (int)pvVar1 - (int)vidmem_map >> 2;
    vidmem_map_len = vidmem_map_len - 1;
    memmove(vidmem_map + iVar2,vidmem_map + iVar2 + 1,(vidmem_map_len - iVar2) * 4);
    if (vidmem_used <= vidmem_used - buf->size) {
      __pspgl_assert_fail("(vidmem_used - buf->size) < vidmem_used",unaff_retaddr,
                          "__pspgl_vidmem_free","pspgl_vidmem.c",(int)unaff_s4);
    }
    vidmem_used = vidmem_used - buf->size;
    return;
  }
  __pspgl_log("%s: didn\'t find chunk for buf=%p base=%p\n","__pspgl_vidmem_free",buf,buf->base);
  return;
}



----------------------------------------

// Function: __pspgl_vidmem_avail @ 08917874

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

size_t __pspgl_vidmem_avail(void)

{
  int iVar1;
  
  iVar1 = sceGeEdramGetSize();
  return iVar1 - vidmem_used;
}



----------------------------------------

// Function: vidmem_map_insert_new @ 0891789c

int vidmem_map_insert_new(ulong idx,pspgl_buffer *buf)

{
  bool bVar1;
  pspgl_buffer **pppVar2;
  
  pppVar2 = vidmem_map;
  if (vidmem_map_size < vidmem_map_len + 1) {
                    /* Unresolved local var: void * tmp@[???] */
    bVar1 = vidmem_map_size == 0;
    vidmem_map_size = vidmem_map_size << 1;
    if (bVar1) {
      vidmem_map_size = 4;
    }
    pppVar2 = realloc(vidmem_map,vidmem_map_size << 2);
    if (pppVar2 == (pspgl_buffer **)0x0) {
      return 0;
    }
  }
  vidmem_map = pppVar2;
  memmove(vidmem_map + idx + 1,vidmem_map + idx,(vidmem_map_len - idx) * 4);
  vidmem_map_len = vidmem_map_len + 1;
  vidmem_used = vidmem_used + buf->size;
  vidmem_map[idx] = buf;
  return 1;
}



----------------------------------------

// Function: __pspgl_vidmem_alloc @ 08917990

int __pspgl_vidmem_alloc(pspgl_buffer *buf)

{
  void *pvVar1;
  int iVar2;
  void *pvVar3;
  ulong idx;
  pspgl_buffer *ppVar4;
  pspgl_buffer **pppVar5;
  void *pvVar6;
  uint uVar7;
  void *pvVar8;
  
                    /* Unresolved local var: void * start@[???]
                       Unresolved local var: void * adr@[???]
                       Unresolved local var: ulong i@[???]
                       Unresolved local var: uint size@[???] */
  pvVar1 = (void *)sceGeEdramGetAddr();
  uVar7 = buf->size + 0x3fU & 0xffffffc0;
  pppVar5 = vidmem_map;
  pvVar6 = pvVar1;
  for (idx = 0; pvVar8 = (void *)((int)pvVar6 + uVar7), idx != vidmem_map_len; idx = idx + 1) {
                    /* Unresolved local var: void * new_adr@[???] */
    ppVar4 = *pppVar5;
    pvVar3 = ppVar4->base;
    pppVar5 = pppVar5 + 1;
    if (pvVar8 <= pvVar3) goto LAB_08917a2c;
    pvVar6 = (void *)((int)pvVar3 + ppVar4->size);
  }
  iVar2 = sceGeEdramGetSize();
  idx = vidmem_map_len;
  if ((void *)((int)pvVar1 + iVar2) < pvVar8) {
    return 0;
  }
LAB_08917a2c:
  buf->base = pvVar6;
  buf->size = uVar7;
  iVar2 = vidmem_map_insert_new(idx,buf);
  return iVar2;
}



----------------------------------------

// Function: __pspgl_vidmem_compact @ 08917a78

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

GLboolean __pspgl_vidmem_compact(void)

{
  bool bVar1;
  bool bVar2;
  ulong uVar3;
  undefined4 *dst0;
  int iVar4;
  pspgl_buffer *buf;
  void *src;
  undefined4 *puVar5;
  int iVar6;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_buffer * * bufs@[???]
                       Unresolved local var: int nbufs@[???]
                       Unresolved local var: GLboolean needsync@[???] */
  uVar3 = vidmem_map_len;
  dst0 = malloc(vidmem_map_len << 2);
  if (dst0 == (undefined4 *)0x0) {
    bVar2 = false;
  }
  else {
    memcpy(dst0,vidmem_map,vidmem_map_len << 2);
    iVar6 = 0;
    bVar2 = false;
    puVar5 = dst0;
    while (bVar1 = iVar6 < (int)uVar3, iVar6 = iVar6 + 1, bVar1) {
      buf = (pspgl_buffer *)*puVar5;
      puVar5 = puVar5 + 1;
      if (((buf->flags & 4) == 0) && (buf->mapped == '\0')) {
        src = buf->base;
        __pspgl_vidmem_free(buf);
        iVar4 = __pspgl_vidmem_alloc(buf);
        if (iVar4 == 0) {
                    /* Unresolved local var: pspgl_buffer * b@[???]
                       Unresolved local var: void * orig@[???] */
          __pspgl_log("%s: lost buffer %p at %p\n","__pspgl_vidmem_compact",buf,src);
          break;
        }
        if (buf->base != src) {
          bVar2 = true;
          __pspgl_copy_memory(src,buf->base,buf->size);
          __pspgl_dlist_pin_buffer(buf,3);
        }
      }
    }
    free(dst0);
    if (bVar2) {
      glFinish();
    }
  }
  return bVar2;
}



----------------------------------------

// Function: glFinish @ 08917bb4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glFinish(void)

{
  __pspgl_dlist_submit();
  __pspgl_dlist_await_completion((_func_int_void_ptr *)0x0,(void *)0x0);
  return;
}



----------------------------------------

// Function: glFrustumf @ 08917bd8

/* WARNING: Unknown calling convention */

void glFrustumf(GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat near,GLfloat far)

{
  float fVar1;
  float fVar2;
  float local_48 [6];
  undefined4 local_30;
  undefined4 local_2c;
  float local_28;
  float local_24;
  float local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  float local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: GLfloat[16] m@[???]
                       Unresolved local var: GLfloat _2n@[???]
                       Unresolved local var: GLfloat _1over_rml@[???]
                       Unresolved local var: GLfloat _1over_fmn@[???]
                       Unresolved local var: GLfloat _1over_tmb@[???] */
  fVar2 = DAT_089dbce4 / (far - near);
  fVar1 = near + near;
  local_48[0] = DAT_089dbce4 / (right - left);
  local_48[5] = DAT_089dbce4 / (top - bottom);
  local_48[1] = 0.0;
  local_1c = DAT_089dfe90;
  local_48[2] = 0.0;
  local_48[3] = 0.0;
  local_48[4] = 0.0;
  local_30 = 0;
  local_2c = 0;
  local_18 = 0;
  local_14 = 0;
  local_20 = -(far + near) * fVar2;
  local_c = 0;
  local_28 = (right + left) * local_48[0];
  local_24 = (top + bottom) * local_48[5];
  local_48[0] = fVar1 * local_48[0];
  local_48[5] = fVar1 * local_48[5];
  local_10 = -(fVar1 * far * fVar2);
  glMultMatrixf(local_48);
  return;
}



----------------------------------------

// Function: set_mipmap_regs @ 08917c90

/* WARNING: Control flow encountered bad instruction data */

void set_mipmap_regs(uint level,pspgl_teximg *img)

{
                    /* Unresolved local var: uint ptr@[???]
                       Unresolved local var: uint w_lg2@[???]
                       Unresolved local var: uint h_lg2@[???] */
  if (img != (pspgl_teximg *)0x0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  __pspgl_context_writereg(__pspgl_curctx,level + 0xa0,0);
  __pspgl_context_writereg(__pspgl_curctx,level + 0xa8,0);
  __pspgl_context_writereg(__pspgl_curctx,level + 0xb8,0);
  return;
}



----------------------------------------

// Function: __pspgl_moved_textures @ 08917d90

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_moved_textures(void)

{
  pspgl_texobj *ppVar1;
  uint level;
  uint uVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: pspgl_texobj * tobj@[???] */
  ppVar1 = (__pspgl_curctx->texture).bound;
  if (ppVar1 != (pspgl_texobj *)0x0) {
    level = 0;
    do {
      uVar2 = level + 1;
      set_mipmap_regs(level,ppVar1->images[0]);
      ppVar1 = (pspgl_texobj *)&ppVar1->target;
      level = uVar2;
    } while (uVar2 != 8);
  }
  return;
}



----------------------------------------

// Function: max_mipmap @ 08917de8

/* WARNING: Control flow encountered bad instruction data */

uint max_mipmap(uint width,uint height)

{
                    /* WARNING: Bad instruction - Truncating control flow here */
                    /* Unresolved local var: int maxlvl@[???]
                       Unresolved local var: int lw@[???]
                       Unresolved local var: int lh@[???] */
  halt_baddata();
}



----------------------------------------

// Function: __pspgl_update_mipmaps @ 08917e0c

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __pspgl_update_mipmaps(void)

{
  pspgl_context *ppVar1;
  uint stride;
  pspgl_buffer *buffer;
  pspgl_texfmt *texfmt;
  uint32_t argi;
  void *argi_00;
  GLenum GVar2;
  pspgl_teximg *ppVar3;
  pspgl_texobj *tobj;
  uint uVar4;
  pspgl_texfmt *ppVar5;
  uint uVar6;
  
                    /* Unresolved local var: pspgl_teximg * timg@[???]
                       Unresolved local var: pspgl_texfmt * texfmt@[???]
                       Unresolved local var: uint levels@[???]
                       Unresolved local var: uint level@[???]
                       Unresolved local var: pspgl_buffer * mipmaps@[???]
                       Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: GLenum saved_err@[???]
                       Unresolved local var: GLuint shademodel@[???]
                       Unresolved local var: uint mipmap_size@[???]
                       Unresolved local var: uint w@[???]
                       Unresolved local var: uint h@[???]
                       Unresolved local var: uint mipmapoff@[???]
                       Unresolved local var: uint tw@[???]
                       Unresolved local var: uint th@[???] */
  tobj = (__pspgl_curctx->texture).bound;
  if ((((tobj != (pspgl_texobj *)0x0) && ((tobj->flags & 1) != 0)) &&
      (tobj->images[0] != (pspgl_teximg *)0x0)) &&
     ((tobj->texfmt != (pspgl_texfmt *)0x0 && (tobj->texfmt->hwformat < 4)))) {
    __pspgl_texobj_unswizzle(tobj);
    GVar2 = __pspgl_curctx->glerror;
    __pspgl_curctx->glerror = 0;
    ppVar3 = tobj->images[0];
    glPushAttrib(0x46000);
    ppVar1 = __pspgl_curctx;
    if (__pspgl_curctx->glerror == 0) {
      __pspgl_curctx->glerror = GVar2;
      texfmt = (pspgl_texfmt *)(ppVar1->hw).ge_reg[0x50];
      glDisable(0xc11);
      __pspgl_context_writereg(__pspgl_curctx,0x1e,1);
      __pspgl_context_writereg(__pspgl_curctx,0x17,0);
      __pspgl_context_writereg(__pspgl_curctx,0x22,0);
      __pspgl_context_writereg(__pspgl_curctx,0x23,0);
      __pspgl_context_writereg(__pspgl_curctx,0x24,0);
      __pspgl_context_writereg(__pspgl_curctx,0x21,0);
      __pspgl_context_writereg(__pspgl_curctx,0x28,0);
      __pspgl_context_writereg(__pspgl_curctx,0xe8,0);
      __pspgl_context_writereg(__pspgl_curctx,0xe9,0);
      __pspgl_context_writereg(__pspgl_curctx,0x50,0);
      __pspgl_context_writereg(__pspgl_curctx,0xc6,0x101);
      __pspgl_context_writereg(__pspgl_curctx,199,0x101);
      __pspgl_context_writereg(__pspgl_curctx,0xc2,0);
      if ((tobj->flags & 2) == 0) {
        argi = 0x103;
      }
      else {
        argi = 0x100;
      }
      __pspgl_context_writereg(__pspgl_curctx,0xc9,argi);
      stride = max_mipmap(ppVar3->width,ppVar3->height);
      if (stride != 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      ppVar5 = tobj->texfmt;
      buffer = __pspgl_buffer_new(0,0x88e6);
      uVar6 = ppVar3->height;
      uVar4 = ppVar3->width;
      __pspgl_context_writereg(__pspgl_curctx,0xc3,ppVar5->hwformat);
      __pspgl_context_writereg(__pspgl_curctx,0xd2,ppVar5->hwformat);
      if (stride != 0) {
                    /* Unresolved local var: vertex * vertexbuf@[???]
                       Unresolved local var: uint fbptr@[???]
                       Unresolved local var: pspgl_teximg * timg@[???] */
        if (1 < uVar4) {
          uVar4 = uVar4 >> 1;
        }
        if (1 < uVar6) {
          uVar6 = uVar6 >> 1;
        }
        if (tobj->images[1] != (pspgl_teximg *)0x0) {
          __pspgl_teximg_free(tobj->images[1]);
          tobj->images[1] = (pspgl_teximg *)0x0;
        }
        ppVar3 = __pspgl_teximg_from_buffer(buffer,0,uVar4,uVar6,stride,texfmt);
        ppVar1 = __pspgl_curctx;
        argi_00 = buffer->base;
        tobj->images[1] = ppVar3;
        __pspgl_context_writereg(ppVar1,0x9c,(uint32_t)argi_00);
        __pspgl_context_writereg(__pspgl_curctx,0x9d,((uint)argi_00 & 0xff000000) >> 8 | uVar4);
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      __pspgl_buffer_free(buffer);
      glPopAttrib();
      __pspgl_context_writereg(__pspgl_curctx,0x50,(uint32_t)texfmt);
      uVar4 = 0;
      do {
        uVar6 = uVar4 + 1;
        set_mipmap_regs(uVar4,tobj->images[0]);
        tobj = (pspgl_texobj *)&tobj->target;
        uVar4 = uVar6;
      } while (uVar6 != stride + 1);
    }
  }
  return;
}



----------------------------------------

// Function: __pspgl_set_texture_image @ 089182c4

void __pspgl_set_texture_image(pspgl_texobj *tobj,uint level,pspgl_teximg *timg)

{
  pspgl_context *c;
  uint uVar1;
  pspgl_texfmt *ppVar2;
  pspgl_teximg *timg_00;
  uint32_t argi;
  pspgl_texobj *ppVar3;
  pspgl_teximg *timg_01;
  
                    /* Unresolved local var: pspgl_teximg * old_timg@[???] */
  timg_01 = tobj->images[level];
  if (timg != timg_01) {
    tobj->images[level] = (pspgl_teximg *)0x0;
    if (timg != (pspgl_teximg *)0x0) {
      if (tobj->texfmt == timg->texfmt) {
        ppVar2 = timg->texfmt;
      }
      else {
        uVar1 = 0;
        ppVar3 = tobj;
        do {
                    /* Unresolved local var: int i@[???] */
          if (((uVar1 != level) && (timg_00 = ppVar3->images[0], timg_00 != (pspgl_teximg *)0x0)) &&
             (timg_00->texfmt != timg->texfmt)) {
            __pspgl_teximg_free(timg_00);
            ppVar3->images[0] = (pspgl_teximg *)0x0;
            set_mipmap_regs(uVar1,(pspgl_teximg *)0x0);
          }
          uVar1 = uVar1 + 1;
          ppVar3 = (pspgl_texobj *)&ppVar3->target;
        } while (uVar1 != 8);
        ppVar2 = timg->texfmt;
      }
      c = __pspgl_curctx;
      argi = ppVar2->hwformat;
      tobj->texfmt = ppVar2;
      __pspgl_context_writereg(c,0xc3,argi);
    }
    tobj->images[level] = timg;
    set_mipmap_regs(level,timg);
    if (timg_01 != (pspgl_teximg *)0x0) {
      __pspgl_teximg_free(timg_01);
    }
    if ((timg != (pspgl_teximg *)0x0) && (level == 0)) {
                    /* Unresolved local var: int maxlvl@[???]
                       Unresolved local var: int swizzled@[???] */
      uVar1 = max_mipmap(timg->width,timg->height);
      __pspgl_context_writereg(__pspgl_curctx,0xc2,uVar1 << 0x10 | (tobj->flags & 7) >> 2);
    }
    __pspgl_context_writereg(__pspgl_curctx,0xcb,(__pspgl_curctx->hw).ge_reg[0xcb] + 1);
    return;
  }
  return;
}



----------------------------------------

// Function: glTexImage2D @ 08918448

void glTexImage2D(GLenum target,GLint level,GLint internalformat,GLsizei width,GLsizei height,
                 GLint border,GLenum format,GLenum type,GLvoid *texels)

{
  pspgl_texfmt *ppVar1;
  pspgl_bufferobj *ppVar2;
  pspgl_teximg *ppVar3;
  uint in_t0;
  int in_t1;
  GLenum in_t2;
  GLenum in_t3;
  GLenum GVar4;
  pspgl_texobj *tobj;
  uint unaff_s4;
  GLboolean unaff_s5;
  pspgl_texfmt *unaff_s6;
  void *local_res0;
  
                    /* Unresolved local var: GLenum error@[???]
                       Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: pspgl_teximg * timg@[???]
                       Unresolved local var: pspgl_texfmt * texfmt@[???] */
  if (target == 0xde1) {
    if ((width & width - 1U) != 0) {
      GVar4 = 0x501;
      goto LAB_0891863c;
    }
    if ((in_t0 & in_t0 - 1) != 0) {
      GVar4 = 0x501;
      goto LAB_0891863c;
    }
    if (8 < (uint)level) {
      GVar4 = 0x501;
      goto LAB_0891863c;
    }
    if (level == 8) {
      return;
    }
    if (in_t1 != 0) {
      GVar4 = 0x501;
      goto LAB_0891863c;
    }
    if (internalformat < 1) {
LAB_08918518:
      GVar4 = 0x502;
      if (in_t2 != internalformat) goto LAB_0891863c;
    }
    else {
      if (internalformat < 5) {
        internalformat = glTexImage2D::format_equiv[internalformat];
        goto LAB_08918518;
      }
      if (internalformat != 0x8049) goto LAB_08918518;
      GVar4 = 0x500;
      if (in_t2 != 0x1909) goto LAB_0891863c;
      in_t2 = 0x8049;
    }
    ppVar1 = __pspgl_hardware_format(__pspgl_texformats,in_t2,in_t3);
    if (ppVar1 != (pspgl_texfmt *)0x0) {
      GVar4 = 0x500;
      if (ppVar1->hwformat < 8) {
        tobj = (__pspgl_curctx->texture).bound;
        if (tobj == (pspgl_texobj *)0x0) {
          glBindTexture(0xde1,0);
          tobj = (__pspgl_curctx->texture).bound;
          if (tobj == (pspgl_texobj *)0x0) {
            GVar4 = 0x505;
            goto LAB_0891863c;
          }
          ppVar2 = (__pspgl_curctx->unpack).pbo;
        }
        else {
          ppVar2 = (__pspgl_curctx->unpack).pbo;
        }
        if (ppVar2 != (pspgl_bufferobj *)0x0) {
          tobj->flags = tobj->flags & 0xfffffffb;
        }
        ppVar3 = __pspgl_teximg_new(local_res0,&__pspgl_curctx->unpack,width,in_t0,unaff_s4,unaff_s5
                                    ,unaff_s6);
        if (ppVar3 == (pspgl_teximg *)0x0) {
          return;
        }
        __pspgl_set_texture_image(tobj,level,ppVar3);
        ppVar3 = __pspgl_texobj_cmap(tobj);
        if (ppVar3 != (pspgl_teximg *)0x0) {
          (__pspgl_curctx->hw).dirty = (__pspgl_curctx->hw).dirty | 1;
        }
        __pspgl_update_texenv(tobj);
        if (level != 0) {
          return;
        }
        if ((tobj->flags & 1) == 0) {
          return;
        }
        __pspgl_update_mipmaps();
        return;
      }
      goto LAB_0891863c;
    }
  }
  GVar4 = 0x500;
LAB_0891863c:
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar4,"glTexImage2D");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar4;
  }
  return;
}



----------------------------------------

// Function: __pspgl_copy_pixels @ 08918690

void __pspgl_copy_pixels(void *srcbuf,int srcstride,int srcx,int srcy,void *dstbuf,int dststride,
                        int dstx,int dsty,int width,int height,uint pixfmt)

{
  uint uVar1;
  uint in_t0;
  uint in_t1;
  uint in_t2;
  int in_t3;
  uint uVar2;
  undefined4 local_res0;
  undefined4 local_res4;
  undefined4 local_res8;
  undefined4 local_40;
  undefined4 local_30;
  
  local_30 = local_res4;
  __pspgl_context_writereg(__pspgl_curctx,0xb2,(uint32_t)srcbuf);
  __pspgl_context_writereg(__pspgl_curctx,0xb4,in_t0);
  if (srcstride < 0) {
                    /* Unresolved local var: int sdy@[???]
                       Unresolved local var: int ddy@[???] */
    if ((int)in_t1 < 0) {
      local_40 = -1;
    }
    else if (in_t1 == 0) {
      local_40 = 0;
    }
    else {
      local_40 = 1;
    }
    uVar2 = 0xffffffff;
  }
  else {
    if (-1 < (int)in_t1) {
      __pspgl_context_writereg(__pspgl_curctx,0xb3,((uint)srcbuf & 0xff000000) >> 8 | srcstride);
      __pspgl_context_writereg(__pspgl_curctx,0xb5,(in_t0 & 0xff000000) >> 8 | in_t1);
      __pspgl_context_writereg(__pspgl_curctx,0xeb,srcy << 10 | srcx);
      __pspgl_context_writereg(__pspgl_curctx,0xec,in_t3 << 10 | in_t2);
      __pspgl_context_writereg(__pspgl_curctx,0xee,(local_res4 + -1) * 0x400 | local_res0 - 1U);
      __pspgl_context_flush_pending_state_changes(__pspgl_curctx,0xb2,0xb5);
      __pspgl_context_flush_pending_state_changes(__pspgl_curctx,0xeb,0xee);
      __pspgl_context_writereg_uncached(__pspgl_curctx,0xea,(uint)(local_res8 == 3));
      return;
    }
    uVar2 = (uint)(srcstride != 0);
    local_40 = -1;
  }
  __pspgl_context_writereg(__pspgl_curctx,0xb3,((uint)srcbuf & 0xff000000) >> 8);
  __pspgl_context_writereg(__pspgl_curctx,0xb5,(in_t0 & 0xff000000) >> 8);
  __pspgl_context_writereg(__pspgl_curctx,0xee,local_res0 - 1);
  while( true ) {
    uVar1 = srcy << 10;
    local_30 = local_30 + -1;
    srcy = srcy + uVar2;
    if (local_30 == -1) break;
    __pspgl_context_writereg(__pspgl_curctx,0xeb,uVar1 | srcx);
    __pspgl_context_writereg(__pspgl_curctx,0xec,in_t3 << 10 | in_t2);
    __pspgl_context_flush_pending_state_changes(__pspgl_curctx,0xb2,0xb5);
    __pspgl_context_flush_pending_state_changes(__pspgl_curctx,0xeb,0xee);
    __pspgl_context_writereg_uncached(__pspgl_curctx,0xea,(uint)(local_res8 == 3));
    in_t3 = in_t3 + local_40;
  }
  return;
}



----------------------------------------

// Function: __pspgl_copy_memory @ 08918968

void __pspgl_copy_memory(void *src,void *dst,size_t size)

{
  uint uVar1;
  void *unaff_s0;
  uint srcstride;
  int unaff_s1;
  int unaff_s2;
  int unaff_s3;
  uint uVar2;
  int unaff_s4;
  uint uVar3;
  int unaff_s5;
  uint unaff_retaddr;
  
                    /* Unresolved local var: size_t xfersize@[???] */
  if ((((src <= dst) || (uVar1 = (int)src - (int)dst, (void *)((int)dst + size) <= src)) &&
      (uVar1 = size, src < dst)) && (dst < (void *)((int)src + size))) {
    if (src <= dst) {
      uVar1 = (int)dst - (int)src;
    }
    else {
      uVar1 = (int)src - (int)dst;
    }
  }
  uVar2 = size >> 2;
  while( true ) {
    srcstride = uVar2;
    if (uVar1 >> 2 <= uVar2) {
      srcstride = uVar1 >> 2;
    }
    if (uVar2 == 0) break;
                    /* Unresolved local var: uint w@[???]
                       Unresolved local var: uint h@[???]
                       Unresolved local var: uint chunk@[???] */
    uVar3 = 1;
    if (0x1ff < srcstride) {
      uVar3 = srcstride >> 9;
      srcstride = 0x200;
    }
    __pspgl_copy_pixels(src,srcstride,0,0,unaff_s0,unaff_s1,unaff_s2,unaff_s3,unaff_s4,unaff_s5,
                        unaff_retaddr);
    uVar2 = uVar2 - srcstride * uVar3;
    src = (void *)((int)src + srcstride * uVar3);
  }
  return;
}



----------------------------------------

// Function: glBindTexture @ 08918a74

void glBindTexture(GLenum target,GLuint id)

{
  pspgl_context *ppVar1;
  pspgl_texobj *tobj;
  pspgl_teximg *ppVar2;
  int iVar3;
  int iVar4;
  uint32_t uVar5;
  GLenum GVar6;
  uint32_t cmd;
  pspgl_texobj *tobj_00;
  hashtable *h;
  
                    /* Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: pspgl_texobj * bound@[???]
                       Unresolved local var: hashtable * hash@[???]
                       Unresolved local var: uint i@[???]
                       Unresolved local var: GLenum error@[???] */
  tobj_00 = (__pspgl_curctx->texture).bound;
  h = &__pspgl_curctx->shared->texture_objects;
  tobj = __pspgl_hash_lookup(h,id);
  if (tobj == (pspgl_texobj *)0x0) {
    tobj = __pspgl_texobj_new(id,target);
    if (tobj == (pspgl_texobj *)0x0) {
      GVar6 = 0x505;
LAB_08918c00:
      __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar6,"glBindTexture");
      if (__pspgl_curctx == (pspgl_context *)0x0) {
        return;
      }
      __pspgl_curctx->glerror = GVar6;
      return;
    }
    __pspgl_hash_insert(h,id,tobj);
  }
  else if (tobj->target == 0) {
    tobj->target = target;
  }
  else {
    GVar6 = 0x502;
    if (tobj->target != target) goto LAB_08918c00;
  }
  ppVar1 = __pspgl_curctx;
  if (tobj_00 == tobj) {
    return;
  }
  if (tobj_00 != (pspgl_texobj *)0x0) {
                    /* Unresolved local var: int i@[???] */
    iVar3 = 0;
    do {
      iVar4 = iVar3 + 4;
      *(undefined4 *)((int)tobj_00->ge_texreg + iVar3) =
           *(undefined4 *)((int)(ppVar1->hw).ge_reg + iVar3 + 0x280);
      iVar3 = iVar4;
    } while (iVar4 != 0xa4);
    __pspgl_texobj_free(tobj_00);
  }
  ppVar1 = __pspgl_curctx;
  uVar5 = tobj->ge_texreg[0];
  tobj->refcount = tobj->refcount + 1;
  (ppVar1->texture).bound = tobj;
  __pspgl_context_writereg(ppVar1,0xa0,uVar5);
  uVar5 = 0xa1;
  do {
    cmd = uVar5;
    if (uVar5 == 0xc4) {
      cmd = 0xc5;
    }
    uVar5 = cmd + 1;
    __pspgl_context_writereg(__pspgl_curctx,cmd,*(uint32_t *)((int)tobj + cmd * 4 + -0x270));
  } while (uVar5 < 0xc9);
  ppVar2 = __pspgl_texobj_cmap(tobj);
  if (ppVar2 != (pspgl_teximg *)0x0) {
    (__pspgl_curctx->hw).dirty = (__pspgl_curctx->hw).dirty | 1;
  }
  __pspgl_update_texenv(tobj);
  __pspgl_context_writereg(__pspgl_curctx,0xcb,(__pspgl_curctx->hw).ge_reg[0xcb] + 1);
  return;
}



----------------------------------------

// Function: save_regs @ 08918c4c

void save_regs(pspgl_context *c,pspgl_saved_attrib *a,uchar *regs)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uchar reg@[???] */
  while( true ) {
    bVar1 = *regs;
    uVar3 = (uint)bVar1;
    regs = regs + 1;
    bVar1 = bVar1 >> 5;
    if (uVar3 == 0) break;
    uVar2 = a->regmask[bVar1];
    a->regs[uVar3] = (c->hw).ge_reg[uVar3];
    a->regmask[bVar1] = uVar2 | 1 << (uVar3 & 0x1f);
  }
  return;
}



----------------------------------------

// Function: glPopAttrib @ 08918c98

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glPopAttrib(void)

{
  pspgl_context *c;
  uint uVar1;
  uint uVar2;
  GLfloat GVar3;
  undefined4 uVar4;
  GLint GVar5;
  GLfloat GVar6;
  GLint GVar7;
  pspgl_texobj *ppVar8;
  GLfloat GVar9;
  GLint GVar10;
  ulong uVar11;
  GLint GVar12;
  uint32_t uVar13;
  GLfloat GVar14;
  GLfloat GVar15;
  GLfloat GVar16;
  pspgl_saved_attrib *aptr;
  uint uVar17;
  uint uVar18;
  vertexblend *pvVar19;
  vertexblend *pvVar20;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_saved_attrib * a@[???]
                       Unresolved local var: uint mask@[???] */
  c = __pspgl_curctx;
  uVar2 = __pspgl_curctx->attribstackdepth;
  if (uVar2 == 0) {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x504,"glPopAttrib");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x504;
    }
    return;
  }
  aptr = __pspgl_curctx->attribstack[uVar2 - 1];
  __pspgl_curctx->attribstackdepth = uVar2 - 1;
  uVar2 = 0;
  pvVar20 = &aptr->vertexblend;
  do {
                    /* Unresolved local var: uint i@[???]
                       Unresolved local var: uint32_t word@[???]
                       Unresolved local var: uint j@[???] */
    uVar17 = aptr->regmask[uVar2 >> 5];
    uVar18 = uVar2;
    pvVar19 = pvVar20;
    while( true ) {
      uVar13 = uVar18;
      pvVar19 = pvVar19 + 4;
      uVar18 = uVar13 + 1;
      uVar1 = uVar17 & 1;
      if (uVar17 == 0) break;
      uVar17 = uVar17 >> 1;
      if (uVar1 != 0) {
        __pspgl_context_writereg(c,uVar13,*(uint32_t *)pvVar19);
      }
    }
    uVar2 = uVar2 + 0x20;
    pvVar20 = pvVar20 + 0x80;
  } while (uVar2 != 0x100);
  uVar2 = aptr->attrmask;
  if ((uVar2 & 0x4000) != 0) {
    (c->clear).color = (aptr->clear).color;
    (c->write_mask).alpha = (aptr->write_mask).alpha;
  }
  if ((uVar2 & 1) != 0) {
    GVar3 = (aptr->current).texcoord[1];
    GVar6 = (aptr->current).texcoord[2];
    GVar9 = (aptr->current).texcoord[3];
    uVar11 = (aptr->current).color;
    GVar14 = (aptr->current).normal[0];
    GVar15 = (aptr->current).normal[1];
    GVar16 = (aptr->current).normal[2];
    (c->current).texcoord[0] = (aptr->current).texcoord[0];
    (c->current).texcoord[1] = GVar3;
    (c->current).texcoord[2] = GVar6;
    (c->current).texcoord[3] = GVar9;
    (c->current).color = uVar11;
    (c->current).normal[0] = GVar14;
    (c->current).normal[1] = GVar15;
    (c->current).normal[2] = GVar16;
  }
  if ((uVar2 & 0x100) != 0) {
    (c->clear).depth = (aptr->clear).depth;
  }
  if ((uVar2 & 0x2000) != 0) {
    __pspgl_enable_state(0xb90,(GLboolean)aptr->regs[0x24]);
    __pspgl_enable_state(0xb71,(GLboolean)aptr->regs[0x23]);
    __pspgl_enable_state(0xb50,(GLboolean)aptr->regs[0x17]);
    __pspgl_enable_state(0xc11,(GLboolean)(aptr->scissor_test).enabled);
    __pspgl_enable_state(0x86a7,(aptr->vertexblend).enabled);
  }
  if ((uVar2 & 0x40) != 0) {
    __pspgl_enable_state(0xb50,(GLboolean)aptr->regs[0x17]);
    uVar4 = *(undefined4 *)(aptr->lights).spotlight;
    *(undefined4 *)(c->lights).positional = *(undefined4 *)(aptr->lights).positional;
    *(undefined4 *)(c->lights).spotlight = uVar4;
    (c->material).ambient = (aptr->material).ambient;
  }
  if ((uVar2 & 8) != 0) {
    c->polygon = aptr->polygon;
  }
  if ((uVar2 & 0x80000) != 0) {
    GVar5 = (aptr->scissor_test).x;
    GVar7 = (aptr->scissor_test).y;
    GVar10 = (aptr->scissor_test).width;
    GVar12 = (aptr->scissor_test).height;
    (c->scissor_test).enabled = (aptr->scissor_test).enabled;
    (c->scissor_test).x = GVar5;
    (c->scissor_test).y = GVar7;
    (c->scissor_test).width = GVar10;
    (c->scissor_test).height = GVar12;
  }
  if ((uVar2 & 0x400) != 0) {
    (c->write_mask).stencil = (aptr->write_mask).stencil;
    (c->clear).stencil = (aptr->clear).stencil;
  }
  if ((uVar2 & 0x40000) != 0) {
    ppVar8 = (c->texture).bound;
    if (ppVar8 == (pspgl_texobj *)0x0) {
      ppVar8 = (aptr->texture).bound;
    }
    else {
      __pspgl_texobj_free(ppVar8);
      ppVar8 = (aptr->texture).bound;
    }
    uVar13 = aptr->regs[0xcb];
    (c->texture).bound = ppVar8;
    __pspgl_context_writereg(c,0xcb,uVar13 + 1);
    (c->hw).dirty = (c->hw).dirty | 1;
  }
  if ((uVar2 & 0x1000) != 0) {
    __pspgl_matrix_select(c,aptr->current_matrix_stack);
    __pspgl_enable_state(0x86a7,(aptr->vertexblend).enabled);
  }
  if ((uVar2 & 0x800) != 0) {
    GVar5 = (aptr->viewport).y;
    GVar7 = (aptr->viewport).width;
    GVar10 = (aptr->viewport).height;
    GVar3 = (aptr->viewport).depth_offset;
    (c->viewport).x = (aptr->viewport).x;
    (c->viewport).y = GVar5;
    (c->viewport).depth_offset = GVar3;
    (c->viewport).width = GVar7;
    (c->viewport).height = GVar10;
  }
  free(aptr);
  return;
}



----------------------------------------

// Function: glPushAttrib @ 08918fc4

void glPushAttrib(GLbitfield mask)

{
  pspgl_context *c;
  pspgl_saved_attrib *a;
  GLfloat GVar1;
  undefined4 uVar2;
  GLint GVar3;
  pspgl_texobj *ppVar4;
  uint uVar5;
  GLfloat GVar6;
  GLint GVar7;
  GLfloat GVar8;
  GLint GVar9;
  ulong uVar10;
  GLint GVar11;
  GLfloat GVar12;
  GLfloat GVar13;
  GLfloat GVar14;
  GLenum GVar15;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_saved_attrib * a@[???]
                       Unresolved local var: GLenum error@[???] */
  c = __pspgl_curctx;
  if (__pspgl_curctx->attribstackdepth < 0x10) {
    a = malloc(0x494);
    if (a != (pspgl_saved_attrib *)0x0) {
      memset(a,0,0x494);
      a->attrmask = mask;
      if ((mask & 0x4000) != 0) {
        save_regs(c,a,glPushAttrib::col_regs);
        (a->clear).color = (c->clear).color;
        (a->write_mask).alpha = (c->write_mask).alpha;
      }
      if ((mask & 1) != 0) {
        GVar1 = (c->current).texcoord[1];
        GVar6 = (c->current).texcoord[2];
        GVar8 = (c->current).texcoord[3];
        uVar10 = (c->current).color;
        GVar12 = (c->current).normal[0];
        GVar13 = (c->current).normal[1];
        GVar14 = (c->current).normal[2];
        (a->current).texcoord[0] = (c->current).texcoord[0];
        (a->current).texcoord[1] = GVar1;
        (a->current).texcoord[2] = GVar6;
        (a->current).texcoord[3] = GVar8;
        (a->current).color = uVar10;
        (a->current).normal[0] = GVar12;
        (a->current).normal[1] = GVar13;
        (a->current).normal[2] = GVar14;
      }
      if ((mask & 0x100) != 0) {
        save_regs(c,a,glPushAttrib::depth_regs);
        (a->clear).depth = (c->clear).depth;
      }
      if ((mask & 0x2000) != 0) {
        save_regs(c,a,"\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&\'(");
        (a->scissor_test).enabled = (c->scissor_test).enabled;
        (a->vertexblend).enabled = (c->vertexblend).enabled;
      }
      if ((mask & 0x80) != 0) {
        save_regs(c,a,glPushAttrib::fog_regs);
      }
      if ((mask & 0x40) != 0) {
        save_regs(c,a,glPushAttrib::light_regs);
        uVar2 = *(undefined4 *)(c->lights).spotlight;
        *(undefined4 *)(a->lights).positional = *(undefined4 *)(c->lights).positional;
        *(undefined4 *)(a->lights).spotlight = uVar2;
        (a->material).ambient = (c->material).ambient;
      }
      if ((mask & 8) != 0) {
        save_regs(c,a,glPushAttrib::polygon_regs);
        a->polygon = c->polygon;
      }
      if ((mask & 0x80000) != 0) {
        save_regs(c,a,glPushAttrib::scissor_regs);
        GVar3 = (c->scissor_test).x;
        GVar7 = (c->scissor_test).y;
        GVar9 = (c->scissor_test).width;
        GVar11 = (c->scissor_test).height;
        (a->scissor_test).enabled = (c->scissor_test).enabled;
        (a->scissor_test).x = GVar3;
        (a->scissor_test).y = GVar7;
        (a->scissor_test).width = GVar9;
        (a->scissor_test).height = GVar11;
      }
      if ((mask & 0x400) != 0) {
        save_regs(c,a,glPushAttrib::stencil_regs);
        (a->write_mask).stencil = (c->write_mask).stencil;
        (a->clear).stencil = (c->clear).stencil;
      }
      if ((mask & 0x40000) != 0) {
        save_regs(c,a,glPushAttrib::texture_regs);
        ppVar4 = (c->texture).bound;
        (a->texture).bound = ppVar4;
        if (ppVar4 != (pspgl_texobj *)0x0) {
          ppVar4->refcount = ppVar4->refcount + 1;
        }
      }
      if ((mask & 0x1000) != 0) {
        a->current_matrix_stack = c->current_matrix_stack;
        (a->vertexblend).enabled = (c->vertexblend).enabled;
      }
      if ((mask & 0x800) == 0) {
        uVar5 = c->attribstackdepth;
      }
      else {
        save_regs(c,a,glPushAttrib::viewport_regs);
        GVar3 = (c->viewport).y;
        GVar7 = (c->viewport).width;
        GVar9 = (c->viewport).height;
        GVar1 = (c->viewport).depth_offset;
        (a->viewport).x = (c->viewport).x;
        (a->viewport).y = GVar3;
        (a->viewport).width = GVar7;
        (a->viewport).height = GVar9;
        (a->viewport).depth_offset = GVar1;
        uVar5 = c->attribstackdepth;
      }
      c->attribstack[uVar5] = a;
      c->attribstackdepth = uVar5 + 1;
      return;
    }
    GVar15 = 0x505;
  }
  else {
    GVar15 = 0x503;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar15,"glPushAttrib");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar15;
  }
  return;
}



----------------------------------------

// Function: __pspgl_hash_lookup @ 089192f0

void * __pspgl_hash_lookup(hashtable *h,ulong key)

{
  hashentry *phVar1;
  
                    /* Unresolved local var: hashentry * ent@[DW_OP_reg4(a0)] */
  if (key <= h->maxkey) {
    for (phVar1 = h->buckets[key & 0x1f]; phVar1 != (hashentry *)0x0; phVar1 = phVar1->next) {
      if (phVar1->key == key) {
        return phVar1->data;
      }
    }
  }
  return (void *)0x0;
}



----------------------------------------

// Function: __pspgl_hash_uniquekey @ 08919334

ulong __pspgl_hash_uniquekey(hashtable *h)

{
  void *pvVar1;
  ulong key;
  
                    /* Unresolved local var: ulong ret@[???] */
  if (h->maxkey < 0xfffffffe) {
    key = h->maxkey + 1;
  }
  else {
    key = 1;
    do {
      pvVar1 = __pspgl_hash_lookup(h,key);
      if (pvVar1 == (void *)0x0) {
        return key;
      }
      key = key + 1;
    } while (key != 0xffffffff);
  }
  return key;
}



----------------------------------------

// Function: __pspgl_hash_foreach_free @ 08919398

void __pspgl_hash_foreach_free(hashtable *h,_func_void_void_ptr *func)

{
  hashentry *phVar1;
  hashentry *aptr;
  int iVar2;
  
                    /* Unresolved local var: ulong i@[???] */
  iVar2 = 0;
  do {
    aptr = h->buckets[0];
    while (aptr != (hashentry *)0x0) {
                    /* Unresolved local var: hashentry * ent@[???]
                       Unresolved local var: hashentry * next@[???] */
      phVar1 = aptr->next;
      (*func)(aptr->data);
      free(aptr);
      aptr = phVar1;
    }
    iVar2 = iVar2 + 1;
    h->buckets[0] = (hashentry *)0x0;
    h = (hashtable *)(h->buckets + 1);
  } while (iVar2 != 0x20);
  return;
}



----------------------------------------

// Function: __pspgl_hash_remove @ 08919418

void * __pspgl_hash_remove(hashtable *h,ulong key)

{
  hashentry **pphVar1;
  hashentry *aptr;
  void *pvVar2;
  
                    /* Unresolved local var: hashentry * * entp@[???] */
  pphVar1 = h->buckets + (key & 0x1f);
  while( true ) {
    aptr = *pphVar1;
    if (aptr == (hashentry *)0x0) {
      return (void *)0x0;
    }
                    /* Unresolved local var: hashentry * ent@[???] */
    if (aptr->key == key) break;
    pphVar1 = &aptr->next;
  }
                    /* Unresolved local var: void * ret@[???] */
  pvVar2 = aptr->data;
  *pphVar1 = aptr->next;
  free(aptr);
  return pvVar2;
}



----------------------------------------

// Function: __pspgl_hash_insert @ 08919478

void __pspgl_hash_insert(hashtable *h,ulong key,void *value)

{
  hashentry *phVar1;
  uint uVar2;
  hashentry *phVar3;
  
                    /* Unresolved local var: ulong b@[???]
                       Unresolved local var: hashentry * ent@[???] */
  if (key <= h->maxkey) {
    for (phVar1 = h->buckets[key & 0x1f]; phVar1 != (hashentry *)0x0; phVar1 = phVar1->next) {
      if (phVar1->key == key) {
        phVar1->data = value;
        return;
      }
    }
  }
  phVar1 = malloc(0xc);
  if (phVar1 != (hashentry *)0x0) {
    uVar2 = h->maxkey;
    phVar3 = h->buckets[key & 0x1f];
    phVar1->data = value;
    h->buckets[key & 0x1f] = phVar1;
    phVar1->key = key;
    phVar1->next = phVar3;
    if (uVar2 < key) {
      h->maxkey = key;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_WasInit @ 0891952c

Uint32 SDL_WasInit(Uint32 flags)

{
  uint uVar1;
  
  uVar1 = 0xffff;
  if (flags != 0) {
    uVar1 = flags;
  }
  return uVar1 & SDL_initialized;
}



----------------------------------------

// Function: SDL_Linked_Version @ 08919544

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_version * SDL_Linked_Version(void)

{
  return &version;
}



----------------------------------------

// Function: SDL_QuitSubSystem @ 08919550

void SDL_QuitSubSystem(Uint32 flags)

{
  if ((flags & SDL_initialized & 0x100) != 0) {
    SDL_CDROMQuit();
    SDL_initialized = SDL_initialized & 0xfffffeff;
  }
  if ((flags & SDL_initialized & 0x200) != 0) {
    SDL_JoystickQuit();
    SDL_initialized = SDL_initialized & 0xfffffdff;
  }
  if ((flags & SDL_initialized & 1) != 0) {
    SDL_TimerQuit();
    SDL_initialized = SDL_initialized & 0xfffffffe;
  }
  if ((flags & SDL_initialized & 0x10) != 0) {
    SDL_AudioQuit();
    SDL_initialized = SDL_initialized & 0xffffffef;
  }
  if ((flags & SDL_initialized & 0x20) != 0) {
    SDL_VideoQuit();
    SDL_initialized = SDL_initialized & 0xffffffdf;
  }
  return;
}



----------------------------------------

// Function: SDL_Quit @ 08919654

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_Quit(void)

{
  SDL_QuitSubSystem(0xffff);
  SDL_UninstallParachute();
  return;
}



----------------------------------------

// Function: SDL_InitSubSystem @ 08919670

int SDL_InitSubSystem(Uint32 flags)

{
  char *pcVar1;
  int iVar2;
  
  if (((flags & 0x20) != 0) && ((SDL_initialized & 0x20) == 0)) {
    pcVar1 = getenv("SDL_VIDEODRIVER");
    iVar2 = SDL_VideoInit(pcVar1,flags & 0x1000000);
    if (iVar2 < 0) {
      return -1;
    }
    SDL_initialized = SDL_initialized | 0x20;
  }
  if (((flags & 0x10) != 0) && ((SDL_initialized & 0x10) == 0)) {
    pcVar1 = getenv("SDL_AUDIODRIVER");
    iVar2 = SDL_AudioInit(pcVar1);
    if (iVar2 < 0) {
      return -1;
    }
    SDL_initialized = SDL_initialized | 0x10;
  }
  if (ticks_started == 0) {
    SDL_StartTicks();
    ticks_started = 1;
  }
  if (((flags & 1) != 0) && ((SDL_initialized & 1) == 0)) {
    iVar2 = SDL_TimerInit();
    if (iVar2 < 0) {
      return -1;
    }
    SDL_initialized = SDL_initialized | 1;
  }
  if (((flags & 0x200) != 0) && ((SDL_initialized & 0x200) == 0)) {
    iVar2 = SDL_JoystickInit();
    if (iVar2 < 0) {
      return -1;
    }
    SDL_initialized = SDL_initialized | 0x200;
  }
  if (((flags & 0x100) != 0) && ((SDL_initialized & 0x100) == 0)) {
    iVar2 = SDL_CDROMInit();
    if (iVar2 < 0) {
      return -1;
    }
    SDL_initialized = SDL_initialized | 0x100;
    return 0;
  }
  return 0;
}



----------------------------------------

// Function: SDL_Init @ 08919804

int SDL_Init(Uint32 flags)

{
  int iVar1;
  int iVar2;
  
  SDL_ClearError();
  iVar1 = SDL_InitSubSystem(flags);
  iVar2 = -1;
  if ((-1 < iVar1) && (iVar2 = 0, (flags & 0x100000) == 0)) {
    SDL_InstallParachute();
    return 0;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_LookupString @ 0891986c

void SDL_LookupString(Uint8 *key,Uint16 *buf,int buflen)

{
  byte *pbVar1;
  
  if ((*key != 0) && (pbVar1 = key + buflen + -1, 0 < buflen + -1)) {
    *buf = (ushort)*key;
    while( true ) {
      key = key + 1;
      buf = buf + 1;
      if ((*key == 0) || (key == pbVar1)) break;
      *buf = (ushort)*key;
    }
  }
  *buf = 0;
  return;
}



----------------------------------------

// Function: SDL_ClearError @ 089198ac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_ClearError(void)

{
  SDL_error *pSVar1;
  
                    /* Unresolved local var: SDL_error * error@[???] */
  pSVar1 = SDL_GetErrBuf();
  pSVar1->error = 0;
  return;
}



----------------------------------------

// Function: SDL_GetErrorMsgUNICODE @ 089198cc

Uint16 * SDL_GetErrorMsgUNICODE(Uint16 *errstr,uint maxlen)

{
  ushort *puVar1;
  ushort uVar2;
  SDL_error *pSVar3;
  size_t sVar4;
  Uint16 *pUVar5;
  Uint16 UVar6;
  int iVar7;
  int iVar8;
  char *pcVar9;
  Uint16 *pUVar10;
  uint uVar11;
  Uint16 *buf;
  int iVar12;
  char local_2a0;
  char local_29f [127];
  Uint16 local_220;
  Uint16 local_21e;
  ushort local_21c [126];
  Uint16 local_120;
  Uint16 local_11e [127];
  
                    /* Unresolved local var: SDL_error * error@[???] */
  *errstr = 0;
  pSVar3 = SDL_GetErrBuf();
  if (pSVar3->error == 0) {
    return errstr;
  }
                    /* Unresolved local var: Uint16[128] translated@[???]
                       Unresolved local var: Uint16 * fmt@[???]
                       Unresolved local var: Uint16 * msg@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int argi@[???] */
  buf = &local_220;
  SDL_LookupString(pSVar3->key,buf,0x100);
  uVar11 = maxlen - 1;
  iVar12 = 0;
  pUVar10 = errstr;
LAB_08919960:
  do {
    UVar6 = *buf;
    if (UVar6 == 0) {
      *pUVar10 = 0;
      return errstr;
    }
    while( true ) {
      if (uVar11 == 0) goto LAB_08919994;
      if (UVar6 == 0x25) break;
      *pUVar10 = UVar6;
      buf = buf + 1;
      UVar6 = *buf;
      pUVar10 = pUVar10 + 1;
      uVar11 = uVar11 - 1;
      if (UVar6 == 0) {
LAB_08919994:
        *pUVar10 = 0;
        return errstr;
      }
    }
    uVar2 = buf[1];
    if (uVar2 == 0x66) {
                    /* Unresolved local var: char[128] tmp@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int i@[???] */
      sprintf(&local_2a0,"%f",pSVar3->args[iVar12].value_ptr,
              *(undefined4 *)((int)pSVar3->args + iVar12 * 0x80 + 4));
      sVar4 = strlen(&local_2a0);
      if ((sVar4 < uVar11) &&
         (iVar7 = (int)local_2a0, pUVar5 = pUVar10, pcVar9 = &local_2a0, iVar7 != 0)) {
        do {
          *pUVar5 = (Uint16)iVar7;
          iVar7 = (int)pcVar9[1];
          pcVar9 = pcVar9 + 1;
          pUVar5 = pUVar5 + 1;
        } while (iVar7 != 0);
                    /* Unresolved local var: char[128] tmp@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int i@[???] */
        iVar7 = (int)pcVar9 - (int)&local_2a0;
        iVar8 = iVar7 * 2;
      }
      else {
LAB_08919af8:
        iVar7 = 0;
        iVar8 = 0;
      }
LAB_08919afc:
      pUVar10 = (Uint16 *)((int)pUVar10 + iVar8);
      uVar11 = uVar11 - iVar7;
      iVar12 = iVar12 + 1;
      buf = buf + 2;
      goto LAB_08919960;
    }
    if (uVar2 < 0x67) {
      if (uVar2 == 0x53) {
        puVar1 = buf + 2;
        buf = buf + 3;
        iVar12 = iVar12 + (uint)*puVar1 + -0x30;
      }
      else {
        if (uVar2 == 100) {
                    /* Unresolved local var: char[128] tmp@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int i@[???] */
          sprintf(&local_2a0,"%d",pSVar3->args[iVar12].value_ptr);
          sVar4 = strlen(&local_2a0);
          iVar7 = (int)local_2a0;
          if ((uVar11 <= sVar4) || (pUVar5 = pUVar10, pcVar9 = &local_2a0, iVar7 == 0))
          goto LAB_08919af8;
          do {
            *pUVar5 = (Uint16)iVar7;
            iVar7 = (int)pcVar9[1];
            pcVar9 = pcVar9 + 1;
            pUVar5 = pUVar5 + 1;
          } while (iVar7 != 0);
          iVar7 = (int)pcVar9 - (int)&local_2a0;
          iVar8 = iVar7 * 2;
          goto LAB_08919afc;
        }
        if (uVar2 == 0x25) {
          *pUVar10 = 0x25;
          uVar11 = uVar11 - 1;
          pUVar10 = pUVar10 + 1;
          buf = buf + 2;
        }
        else {
LAB_089199f8:
          buf = buf + 2;
        }
      }
    }
    else {
      if (uVar2 == 0x70) {
        sprintf(&local_2a0,"%p",pSVar3->args[iVar12].value_ptr);
        sVar4 = strlen(&local_2a0);
        if ((uVar11 <= sVar4) ||
           (iVar7 = (int)local_2a0, pUVar5 = pUVar10, pcVar9 = &local_2a0, iVar7 == 0))
        goto LAB_08919af8;
        do {
          *pUVar5 = (Uint16)iVar7;
          iVar7 = (int)pcVar9[1];
          pcVar9 = pcVar9 + 1;
          pUVar5 = pUVar5 + 1;
        } while (iVar7 != 0);
        iVar7 = (int)pcVar9 - (int)&local_2a0;
        iVar8 = iVar7 * 2;
        goto LAB_08919afc;
      }
      if (uVar2 == 0x73) {
                    /* Unresolved local var: Uint16[128] buf@[???]
                       Unresolved local var: Uint16 * str@[???] */
        SDL_LookupString(pSVar3->args[0].buf + iVar12 * 0x80,&local_120,0x100);
        iVar12 = iVar12 + 1;
        pUVar5 = &local_120;
        UVar6 = local_120;
        if (local_120 == 0) goto LAB_089199f8;
        do {
          *pUVar10 = UVar6;
          UVar6 = pUVar5[1];
          uVar11 = uVar11 - 1;
          pUVar10 = pUVar10 + 1;
          if (UVar6 == 0) {
            buf = buf + 2;
            goto LAB_08919960;
          }
          pUVar5 = pUVar5 + 1;
        } while (uVar11 != 0);
        buf = buf + 2;
      }
      else {
        buf = buf + 2;
      }
    }
  } while( true );
}



----------------------------------------

// Function: SDL_GetErrorMsg @ 08919bc4

Uint8 * SDL_GetErrorMsg(Uint8 *errstr,uint maxlen)

{
  Uint16 *errstr_00;
  Uint8 *pUVar1;
  uint uVar2;
  Uint16 *pUVar3;
  
                    /* Unresolved local var: Uint16 * errstr16@[???]
                       Unresolved local var: uint i@[???] */
  errstr_00 = malloc(maxlen << 1);
  if (errstr_00 != (Uint16 *)0x0) {
    SDL_GetErrorMsgUNICODE(errstr_00,maxlen);
    uVar2 = 0;
    pUVar3 = errstr_00;
    if (maxlen != 0) {
      do {
        pUVar1 = errstr + uVar2;
        uVar2 = uVar2 + 1;
        *pUVar1 = (Uint8)*pUVar3;
        pUVar3 = pUVar3 + 1;
      } while (maxlen != uVar2);
    }
    free(errstr_00);
    return errstr;
  }
  strncpy((char *)errstr,"Out of memory",maxlen);
  errstr[maxlen - 1] = '\0';
  return errstr;
}



----------------------------------------

// Function: SDL_GetError @ 08919c88

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

char * SDL_GetError(void)

{
  Uint8 *pUVar1;
  
  pUVar1 = SDL_GetErrorMsg((Uint8 *)SDL_GetError::errmsg,0x400);
  return (char *)pUVar1;
}



----------------------------------------

// Function: SDL_SetError @ 08919c98

void SDL_SetError(char *fmt,...)

{
  SDL_error *pSVar1;
  undefined4 *puVar2;
  char cVar3;
  undefined4 in_a1;
  undefined4 uVar4;
  undefined4 in_a2;
  int iVar5;
  int iVar6;
  undefined4 in_a3;
  char *pcVar7;
  char *pcVar8;
  undefined4 *local_38;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  
  local_1c = in_a1;
  local_18 = in_a2;
  local_14 = in_a3;
                    /* Unresolved local var: va_list ap@[???]
                       Unresolved local var: SDL_error * error@[???] */
  pSVar1 = SDL_GetErrBuf();
  pSVar1->error = 1;
  strncpy((char *)pSVar1->key,fmt,0x80);
  local_38 = &local_1c;
  pSVar1->key[0x7f] = '\0';
  pSVar1->argc = 0;
  do {
    cVar3 = *fmt;
    pcVar7 = fmt;
    while( true ) {
      if (cVar3 == '\0') {
        return;
      }
      fmt = pcVar7 + 1;
      if (cVar3 != '%') break;
      cVar3 = *fmt;
      pcVar8 = pcVar7 + 2;
      if (cVar3 == 'f') {
        iVar6 = pSVar1->argc;
        puVar2 = (undefined4 *)((int)local_38 + 7U & 0xfffffff8);
        uVar4 = puVar2[1];
        iVar5 = iVar6 + 1;
        local_38 = puVar2 + 2;
        pSVar1->args[iVar6].value_ptr = (void *)*puVar2;
        *(undefined4 *)((int)pSVar1->args + iVar6 * 0x80 + 4) = uVar4;
        pSVar1->argc = iVar5;
      }
      else if (cVar3 < 'g') {
        if (cVar3 == '\0') {
          iVar5 = pSVar1->argc;
          pcVar8 = pcVar7 + 1;
        }
        else if (cVar3 == 'd') {
          iVar5 = pSVar1->argc + 1;
          pSVar1->args[pSVar1->argc].value_ptr = (void *)*local_38;
          pSVar1->argc = iVar5;
          local_38 = local_38 + 1;
        }
        else {
          iVar5 = pSVar1->argc;
        }
      }
      else if (cVar3 == 'p') {
        iVar5 = pSVar1->argc + 1;
        pSVar1->args[pSVar1->argc].value_ptr = (void *)*local_38;
        pSVar1->argc = iVar5;
        local_38 = local_38 + 1;
      }
      else if (cVar3 == 's') {
                    /* Unresolved local var: int index@[???] */
        iVar5 = pSVar1->argc * 0x80;
        strncpy((char *)(pSVar1->args[0].buf + iVar5),(char *)*local_38,0x80);
        pSVar1->args[0].buf[iVar5 + 0x7f] = '\0';
        iVar5 = pSVar1->argc + 1;
        pSVar1->argc = iVar5;
        local_38 = local_38 + 1;
      }
      else {
        iVar5 = pSVar1->argc;
      }
      if (4 < iVar5) {
        return;
      }
      cVar3 = *pcVar8;
      pcVar7 = pcVar8;
    }
  } while( true );
}



----------------------------------------

// Function: SDL_Error @ 08919e54

void SDL_Error(SDL_errorcode code)

{
  char *fmt;
  
  fmt = "Error reading from datastream";
  if ((((code != SDL_EFREAD) && (fmt = "Out of memory", code != SDL_ENOMEM)) &&
      (fmt = "Error writing to datastream", code != SDL_EFWRITE)) &&
     (fmt = "Unknown SDL error", code == SDL_EFSEEK)) {
    SDL_SetError("Error seeking in datastream");
    return;
  }
  SDL_SetError(fmt);
  return;
}



----------------------------------------

// Function: print_msg @ 08919ea8

void print_msg(char *text)

{
  return;
}



----------------------------------------

// Function: SDL_UninstallParachute @ 08919eb0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_UninstallParachute(void)

{
  _sig_func_ptr func;
  int sig;
  int *piVar1;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: _func_void_int * ohandler@[???] */
  piVar1 = SDL_fatal_signals;
  sig = 0xb;
  do {
    piVar1 = piVar1 + 1;
    func = signal(sig,(_sig_func_ptr)0x0);
    if (func != SDL_Parachute) {
      signal(sig,func);
    }
    sig = *piVar1;
  } while (sig != 0);
  return;
}



----------------------------------------

// Function: SDL_InstallParachute @ 08919f1c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_InstallParachute(void)

{
  _sig_func_ptr func;
  int sig;
  int *piVar1;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: _func_void_int * ohandler@[???] */
  piVar1 = SDL_fatal_signals;
  sig = 0xb;
  do {
    piVar1 = piVar1 + 1;
    func = signal(sig,SDL_Parachute);
    if (func != (_sig_func_ptr)0x0) {
      signal(sig,func);
    }
    sig = *piVar1;
  } while (sig != 0);
  return;
}



----------------------------------------

// Function: SDL_Parachute @ 08919f84

void SDL_Parachute(int sig)

{
  signal(sig,(_sig_func_ptr)0x0);
  SDL_Quit();
                    /* WARNING: Subroutine does not return */
  exit(-sig);
}



----------------------------------------

// Function: SDL_GetAudioStatus @ 08919fac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_audiostatus SDL_GetAudioStatus(void)

{
  SDL_audiostatus SVar1;
  
                    /* Unresolved local var: SDL_AudioDevice * audio@[???]
                       Unresolved local var: SDL_audiostatus status@[DW_OP_reg4(a0)] */
  SVar1 = SDL_AUDIO_STOPPED;
  if (((current_audio != (SDL_AudioDevice *)0x0) && (current_audio->enabled != 0)) &&
     (SVar1 = SDL_AUDIO_PAUSED, current_audio->paused == 0)) {
    SVar1 = SDL_AUDIO_PLAYING;
  }
  return SVar1;
}



----------------------------------------

// Function: SDL_PauseAudio @ 08919fe0

void SDL_PauseAudio(int pause_on)

{
                    /* Unresolved local var: SDL_AudioDevice * audio@[DW_OP_reg2(v0)] */
  if (current_audio != (SDL_AudioDevice *)0x0) {
    current_audio->paused = pause_on;
  }
  return;
}



----------------------------------------

// Function: SDL_LockAudio @ 08919ff8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_LockAudio(void)

{
                    /* Unresolved local var: SDL_AudioDevice * audio@[???] */
  if ((current_audio != (SDL_AudioDevice *)0x0) &&
     (current_audio->LockAudio != (_func_void_SDL_AudioDevice_ptr *)0x0)) {
                    /* WARNING: Could not recover jumptable at 0x0891a014. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_audio->LockAudio)(current_audio);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_UnlockAudio @ 0891a024

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_UnlockAudio(void)

{
                    /* Unresolved local var: SDL_AudioDevice * audio@[???] */
  if ((current_audio != (SDL_AudioDevice *)0x0) &&
     (current_audio->UnlockAudio != (_func_void_SDL_AudioDevice_ptr *)0x0)) {
                    /* WARNING: Could not recover jumptable at 0x0891a040. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_audio->UnlockAudio)(current_audio);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_NextAudioFormat @ 0891a050

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint16 SDL_NextAudioFormat(void)

{
  Uint16 UVar1;
  
  UVar1 = 0;
  if (format_idx != 6) {
    if (format_idx_sub != 6) {
      UVar1 = format_list[format_idx][format_idx_sub];
      format_idx_sub = format_idx_sub + 1;
    }
  }
  return UVar1;
}



----------------------------------------

// Function: SDL_FirstAudioFormat @ 0891a0a0

Uint16 SDL_FirstAudioFormat(Uint16 format)

{
  Uint16 UVar1;
  int iVar2;
  Uint16 (*paUVar3) [6];
  
  paUVar3 = format_list;
  iVar2 = 1;
  format_idx = 0;
  UVar1 = format_list[0][0];
  while ((paUVar3 = paUVar3 + 1, UVar1 != format && (format_idx = iVar2, iVar2 + 1 != 7))) {
    UVar1 = (*paUVar3)[0];
    iVar2 = iVar2 + 1;
  }
  format_idx_sub = 0;
  UVar1 = SDL_NextAudioFormat();
  return UVar1;
}



----------------------------------------

// Function: SDL_CalculateAudioSpec @ 0891a100

/* WARNING: Removing unreachable block (ram,0x0891a164) */
/* WARNING: Removing unreachable block (ram,0x0891a120) */

void SDL_CalculateAudioSpec(SDL_AudioSpec *spec)

{
  if (spec->format != 8) {
    spec->silence = '\0';
    spec->size = ((spec->format & 0xff) / 8) * (uint)spec->channels * (uint)spec->samples;
    return;
  }
  spec->silence = 0x80;
  spec->size = (uint)spec->channels * (uint)spec->samples;
  return;
}



----------------------------------------

// Function: SDL_AudioQuit @ 0891a18c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_AudioQuit(void)

{
  SDL_Thread **ppSVar1;
  SDL_AudioDevice *pSVar2;
  int iVar3;
  _func_void_SDL_AudioDevice_ptr *p_Var4;
  Uint8 *chunk;
  
                    /* Unresolved local var: SDL_AudioDevice * audio@[???] */
  pSVar2 = current_audio;
  if (current_audio == (SDL_AudioDevice *)0x0) {
    return;
  }
  ppSVar1 = &current_audio->thread;
  current_audio->enabled = 0;
  if (*ppSVar1 != (SDL_Thread *)0x0) {
    SDL_WaitThread(*ppSVar1,(int *)0x0);
  }
  if (pSVar2->mixer_lock == (SDL_mutex *)0x0) {
    chunk = pSVar2->fake_stream;
  }
  else {
    SDL_DestroyMutex(pSVar2->mixer_lock);
    chunk = pSVar2->fake_stream;
  }
  if (chunk == (Uint8 *)0x0) {
    iVar3 = (pSVar2->convert).needed;
  }
  else {
    SDL_FreeAudioMem(chunk);
    iVar3 = (pSVar2->convert).needed;
  }
  if (iVar3 == 0) {
    if (pSVar2->opened != 0) {
      p_Var4 = pSVar2->CloseAudio;
      goto LAB_0891a238;
    }
  }
  else {
    SDL_FreeAudioMem((pSVar2->convert).buf);
    if (pSVar2->opened == 0) {
      p_Var4 = pSVar2->free;
      goto LAB_0891a200;
    }
    p_Var4 = pSVar2->CloseAudio;
LAB_0891a238:
    (*p_Var4)(pSVar2);
    pSVar2->opened = 0;
  }
  p_Var4 = pSVar2->free;
LAB_0891a200:
  (*p_Var4)(pSVar2);
  current_audio = (SDL_AudioDevice *)0x0;
  return;
}



----------------------------------------

// Function: SDL_CloseAudio @ 0891a248

/* WARNING: Removing unreachable block (ram,0x08919600) */
/* WARNING: Removing unreachable block (ram,0x08919638) */
/* WARNING: Removing unreachable block (ram,0x0891961c) */
/* WARNING: Removing unreachable block (ram,0x089195b8) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_CloseAudio(void)

{
  if ((SDL_initialized & 0x10) != 0) {
    SDL_AudioQuit();
    SDL_initialized = SDL_initialized & 0xffffffef;
  }
  return;
}



----------------------------------------

// Function: SDL_OpenAudio @ 0891a250

int SDL_OpenAudio(SDL_AudioSpec *desired,SDL_AudioSpec *obtained)

{
  Uint16 UVar1;
  SDL_AudioDevice *data;
  Uint16 UVar2;
  Uint8 UVar3;
  Uint8 UVar4;
  int iVar5;
  SDL_mutex *pSVar6;
  _func_int_SDL_AudioDevice_ptr_SDL_AudioSpec_ptr *p_Var7;
  Uint8 *pUVar8;
  SDL_Thread *pSVar9;
  uint uVar10;
  uint uVar11;
  Uint16 UVar12;
  Uint32 UVar13;
  _func_void_void_ptr_Uint8_ptr_int *p_Var14;
  void *pvVar15;
  Uint16 unaff_s4;
  Uint8 unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: SDL_AudioDevice * audio@[???] */
  if (current_audio == (SDL_AudioDevice *)0x0) {
    iVar5 = SDL_InitSubSystem(0x10);
    if (iVar5 < 0) {
      return -1;
    }
    if (current_audio == (SDL_AudioDevice *)0x0) {
      return -1;
    }
    iVar5 = current_audio->opened;
  }
  else {
    iVar5 = current_audio->opened;
  }
  data = current_audio;
  if (iVar5 != 0) {
    SDL_SetError("Audio device is already opened");
    return -1;
  }
  if (desired->callback == (_func_void_void_ptr_Uint8_ptr_int *)0x0) {
    SDL_SetError("SDL_OpenAudio() passed a NULL callback");
    return -1;
  }
  if ((6 < desired->channels) || ((1 << ((int)(char)desired->channels & 0x1fU) & 0x56U) == 0)) {
    SDL_SetError("1 (mono) and 2 (stereo) channels supported");
    return -1;
  }
  pSVar6 = SDL_CreateMutex();
  data->mixer_lock = pSVar6;
  if (pSVar6 == (SDL_mutex *)0x0) {
    SDL_SetError("Couldn\'t create mixer lock");
    SDL_CloseAudio();
    return -1;
  }
  SDL_CalculateAudioSpec(desired);
  UVar12 = desired->samples;
  UVar1 = desired->padding;
  UVar13 = desired->size;
  UVar2 = desired->format;
  UVar3 = desired->channels;
  UVar4 = desired->silence;
  p_Var14 = desired->callback;
  pvVar15 = desired->userdata;
  (data->spec).freq = desired->freq;
  (data->spec).samples = UVar12;
  (data->spec).padding = UVar1;
  (data->spec).size = UVar13;
  (data->spec).format = UVar2;
  (data->spec).channels = UVar3;
  (data->spec).silence = UVar4;
  (data->spec).callback = p_Var14;
  (data->spec).userdata = pvVar15;
  p_Var7 = data->OpenAudio;
  data->paused = 1;
  (data->convert).needed = 0;
  data->enabled = 1;
  iVar5 = (*p_Var7)(data,&data->spec);
  data->opened = iVar5 + 1;
  if (iVar5 + 1 == 0) {
LAB_0891a4cc:
    SDL_CloseAudio();
    return -1;
  }
  UVar12 = (data->spec).samples;
  if (desired->samples != UVar12) {
    desired->samples = UVar12;
    SDL_CalculateAudioSpec(desired);
  }
  pUVar8 = SDL_AllocAudioMem((data->spec).size);
  data->fake_stream = pUVar8;
  if (pUVar8 == (Uint8 *)0x0) {
LAB_0891a450:
    SDL_CloseAudio();
    SDL_Error(SDL_ENOMEM);
    return -1;
  }
  if (obtained == (SDL_AudioSpec *)0x0) {
    if (desired->freq == (data->spec).freq) {
      uVar11._0_2_ = desired->format;
      uVar11._2_1_ = desired->channels;
      uVar11._3_1_ = desired->silence;
      uVar10._0_2_ = (data->spec).format;
      uVar10._2_1_ = (data->spec).channels;
      uVar10._3_1_ = (data->spec).silence;
      if ((uVar11 & 0xffffff) == (uVar10 & 0xffffff)) {
        iVar5 = data->opened;
        goto LAB_0891a39c;
      }
      UVar12 = desired->format;
    }
    else {
      UVar12 = desired->format;
    }
    iVar5 = SDL_BuildAudioCVT(&data->convert,UVar12,desired->channels,desired->freq,unaff_s4,
                              unaff_retaddr,in_stack_00000000);
    if (iVar5 < 0) goto LAB_0891a4cc;
    if ((data->convert).needed == 0) {
      iVar5 = data->opened;
      goto LAB_0891a39c;
    }
    UVar13 = desired->size;
    (data->convert).len = UVar13;
    pUVar8 = SDL_AllocAudioMem(UVar13 * (data->convert).len_mult);
    (data->convert).buf = pUVar8;
    if (pUVar8 == (Uint8 *)0x0) goto LAB_0891a450;
  }
  else {
    iVar5 = (data->spec).freq;
    UVar12 = (data->spec).format;
    UVar3 = (data->spec).channels;
    UVar4 = (data->spec).silence;
    UVar1 = (data->spec).samples;
    UVar2 = (data->spec).padding;
    UVar13 = (data->spec).size;
    p_Var14 = (data->spec).callback;
    obtained->userdata = (data->spec).userdata;
    obtained->freq = iVar5;
    obtained->format = UVar12;
    obtained->channels = UVar3;
    obtained->silence = UVar4;
    obtained->samples = UVar1;
    obtained->padding = UVar2;
    obtained->size = UVar13;
    obtained->callback = p_Var14;
  }
  iVar5 = data->opened;
LAB_0891a39c:
  if (iVar5 == 1) {
    pSVar9 = SDL_CreateThread(SDL_RunAudio,data);
    data->thread = pSVar9;
    if (pSVar9 == (SDL_Thread *)0x0) {
      SDL_CloseAudio();
      SDL_SetError("Couldn\'t create audio thread");
      return -1;
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_AudioDriverName @ 0891a52c

char * SDL_AudioDriverName(char *namebuf,int maxlen)

{
  if (current_audio != (SDL_AudioDevice *)0x0) {
    strncpy(namebuf,current_audio->name,maxlen - 1);
    namebuf[maxlen + -1] = '\0';
    return namebuf;
  }
  return (char *)0x0;
}



----------------------------------------

// Function: SDL_AudioInit @ 0891a598

int SDL_AudioInit(char *driver_name)

{
  size_t n;
  int iVar1;
  SDL_AudioDevice *pSVar2;
  char *__s;
  AudioBootStrap *pAVar3;
  AudioBootStrap **ppAVar4;
  int iVar5;
  
                    /* Unresolved local var: SDL_AudioDevice * audio@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int idx@[???] */
  if (current_audio != (SDL_AudioDevice *)0x0) {
    SDL_AudioQuit();
  }
  if (driver_name == (char *)0x0) {
    pAVar3 = &PSPAUD_bootstrap;
    ppAVar4 = bootstrap;
    pSVar2 = (SDL_AudioDevice *)0x0;
    iVar5 = 0;
    do {
      ppAVar4 = ppAVar4 + 1;
      iVar1 = (*pAVar3->available)();
      if ((iVar1 != 0) && (pSVar2 = (*pAVar3->create)(0), pSVar2 != (SDL_AudioDevice *)0x0))
      goto LAB_0891a648;
      pAVar3 = *ppAVar4;
      iVar5 = iVar5 + 1;
    } while (pAVar3 != (AudioBootStrap *)0x0);
LAB_0891a640:
    if (pSVar2 != (SDL_AudioDevice *)0x0) {
LAB_0891a648:
      current_audio = pSVar2;
      pSVar2->name = bootstrap[iVar5]->name;
      if (pSVar2->LockAudio != (_func_void_SDL_AudioDevice_ptr *)0x0) {
        return 0;
      }
      if (pSVar2->UnlockAudio == (_func_void_SDL_AudioDevice_ptr *)0x0) {
        pSVar2->UnlockAudio = SDL_UnlockAudio_Default;
        pSVar2->LockAudio = SDL_LockAudio_Default;
        return 0;
      }
      return 0;
    }
  }
  else {
    pAVar3 = &PSPAUD_bootstrap;
    ppAVar4 = bootstrap;
    iVar5 = 0;
    do {
      ppAVar4 = ppAVar4 + 1;
      __s = pAVar3->name;
      n = strlen(__s);
      iVar1 = strncmp(__s,driver_name,n);
      if (iVar1 == 0) {
        iVar1 = (*pAVar3->available)();
        if (iVar1 != 0) {
          pSVar2 = (*pAVar3->create)(0);
          goto LAB_0891a640;
        }
        pAVar3 = *ppAVar4;
      }
      else {
        pAVar3 = *ppAVar4;
      }
      iVar5 = iVar5 + 1;
    } while (pAVar3 != (AudioBootStrap *)0x0);
  }
  SDL_SetError("No available audio device");
  current_audio = (SDL_AudioDevice *)0x0;
  return 0;
}



----------------------------------------

// Function: SDL_UnlockAudio_Default @ 0891a72c

void SDL_UnlockAudio_Default(SDL_AudioDevice *audio)

{
  Uint32 UVar1;
  
  if ((audio->thread != (SDL_Thread *)0x0) && (UVar1 = SDL_ThreadID(), UVar1 == audio->threadid)) {
    return;
  }
  SDL_mutexV(audio->mixer_lock);
  return;
}



----------------------------------------

// Function: SDL_LockAudio_Default @ 0891a778

void SDL_LockAudio_Default(SDL_AudioDevice *audio)

{
  Uint32 UVar1;
  
  if ((audio->thread != (SDL_Thread *)0x0) && (UVar1 = SDL_ThreadID(), UVar1 == audio->threadid)) {
    return;
  }
  SDL_mutexP(audio->mixer_lock);
  return;
}



----------------------------------------

// Function: SDL_RunAudio @ 0891a7c4

int SDL_RunAudio(void *audiop)

{
  Uint32 UVar1;
  int iVar2;
  void *pvVar3;
  void *pvVar4;
  void *pvVar5;
  size_t n;
  uint c;
  undefined4 uVar6;
  code *pcVar7;
  
                    /* Unresolved local var: SDL_AudioDevice * audio@[???]
                       Unresolved local var: Uint8 * stream@[???]
                       Unresolved local var: int stream_len@[???]
                       Unresolved local var: void * udata@[???]
                       Unresolved local var: _func_void_void_ptr_Uint8_ptr_int * fill@[???]
                       Unresolved local var: int silence@[???] */
  if (*(code **)((int)audiop + 0xc) != (code *)0x0) {
    (**(code **)((int)audiop + 0xc))();
  }
  UVar1 = SDL_ThreadID();
  *(Uint32 *)((int)audiop + 0xb8) = UVar1;
  pcVar7 = *(code **)((int)audiop + 0x3c);
  uVar6 = *(undefined4 *)((int)audiop + 0x40);
  if (*(int *)((int)audiop + 0x48) == 0) {
    c = (uint)*(byte *)((int)audiop + 0x33);
    n = *(size_t *)((int)audiop + 0x38);
  }
  else {
    n = *(size_t *)((int)audiop + 0x5c);
    c = 0x80;
    if (*(short *)((int)audiop + 0x4c) != 8) {
      c = 0;
    }
  }
  iVar2 = *(int *)((int)audiop + 0xa0);
  pvVar5 = *(void **)((int)audiop + 0xac);
LAB_0891a830:
  if (iVar2 == 0) {
    pcVar7 = *(code **)((int)audiop + 0x1c);
LAB_0891a8bc:
    if (pcVar7 != (code *)0x0) {
      (*pcVar7)(audiop);
    }
    return 0;
  }
  pvVar3 = *(void **)((int)audiop + 0xac);
  do {
    if (pvVar5 == pvVar3) {
      if (*(int *)((int)audiop + 0x2c) == 0) {
        trap(7);
      }
      SDL_Delay((int)((uint)*(ushort *)((int)audiop + 0x34) * 1000) / *(int *)((int)audiop + 0x2c));
      iVar2 = *(int *)((int)audiop + 0x48);
    }
    else {
      (**(code **)((int)audiop + 0x10))(audiop);
      iVar2 = *(int *)((int)audiop + 0x48);
    }
    if (iVar2 == 0) {
      pvVar3 = (void *)(**(code **)((int)audiop + 0x18))(audiop);
      if (pvVar3 != (void *)0x0) goto LAB_0891a86c;
      pvVar3 = *(void **)((int)audiop + 0xac);
      memset(pvVar3,c,n);
      if (*(int *)((int)audiop + 0xa4) == 0) goto LAB_0891a924;
      iVar2 = *(int *)((int)audiop + 0x48);
LAB_0891a88c:
      if (iVar2 == 0) {
        pvVar4 = *(void **)((int)audiop + 0xac);
      }
      else {
LAB_0891a950:
        SDL_ConvertAudio((SDL_AudioCVT *)((int)audiop + 0x48));
        pvVar3 = (void *)(**(code **)((int)audiop + 0x18))(audiop);
        if (pvVar3 == (void *)0x0) {
          pvVar3 = *(void **)((int)audiop + 0xac);
        }
        memcpy(pvVar3,*(void **)((int)audiop + 0x58),*(size_t *)((int)audiop + 0x60));
        pvVar4 = *(void **)((int)audiop + 0xac);
      }
    }
    else {
      pvVar3 = *(void **)((int)audiop + 0x58);
      if (pvVar3 == (void *)0x0) {
        iVar2 = *(int *)((int)audiop + 0xa0);
        goto LAB_0891a830;
      }
LAB_0891a86c:
      memset(pvVar3,c,n);
      if (*(int *)((int)audiop + 0xa4) != 0) {
        iVar2 = *(int *)((int)audiop + 0x48);
        goto LAB_0891a88c;
      }
LAB_0891a924:
      SDL_mutexP(*(SDL_mutex **)((int)audiop + 0xb0));
      (*pcVar7)(uVar6,pvVar3,n);
      SDL_mutexV(*(SDL_mutex **)((int)audiop + 0xb0));
      if (*(int *)((int)audiop + 0x48) != 0) goto LAB_0891a950;
      pvVar4 = *(void **)((int)audiop + 0xac);
    }
    pvVar5 = pvVar3;
    if (pvVar3 == pvVar4) break;
    (**(code **)((int)audiop + 0x14))(audiop);
    if (*(int *)((int)audiop + 0xa0) == 0) {
      pcVar7 = *(code **)((int)audiop + 0x1c);
      goto LAB_0891a8bc;
    }
    pvVar3 = *(void **)((int)audiop + 0xac);
  } while( true );
  iVar2 = *(int *)((int)audiop + 0xa0);
  goto LAB_0891a830;
}



----------------------------------------

// Function: PSPAUD_Available @ 0891a9c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int PSPAUD_Available(void)

{
  return 1;
}



----------------------------------------

// Function: PSPAUD_WaitAudio @ 0891a9cc

/* DWARF original prototype: void PSPAUD_WaitAudio(SDL_AudioDevice * this) */

void __thiscall PSPAUD_WaitAudio(void *this)

{
  return;
}



----------------------------------------

// Function: PSPAUD_GetAudioBuf @ 0891a9d4

/* DWARF original prototype: Uint8 * PSPAUD_GetAudioBuf(SDL_AudioDevice * this) */

Uint8 * __thiscall PSPAUD_GetAudioBuf(void *this)

{
  return *(Uint8 **)
          (*(int *)(*(int *)((int)this + 0xbc) + 0x10) * 4 + *(int *)((int)this + 0xbc) + 8);
}



----------------------------------------

// Function: PSPAUD_CreateDevice @ 0891a9ec

SDL_AudioDevice * PSPAUD_CreateDevice(int devindex)

{
  SDL_AudioDevice *m;
  SDL_PrivateAudioData *pSVar1;
  
                    /* Unresolved local var: SDL_AudioDevice * this@[???] */
  m = malloc(200);
  if (m == (SDL_AudioDevice *)0x0) {
    SDL_Error(SDL_ENOMEM);
    m = (SDL_AudioDevice *)0x0;
  }
  else {
    memset(m,0,200);
    pSVar1 = malloc(0x14);
    m->hidden = pSVar1;
    if (pSVar1 == (SDL_PrivateAudioData *)0x0) {
      SDL_Error(SDL_ENOMEM);
      free(m);
      m = (SDL_AudioDevice *)0x0;
    }
    else {
      pSVar1->next_buffer = 0;
      pSVar1->channel = 0;
      pSVar1->rawbuf = (Uint8 *)0x0;
      pSVar1->mixbufs[0] = (Uint8 *)0x0;
      pSVar1->mixbufs[1] = (Uint8 *)0x0;
      m->OpenAudio = PSPAUD_OpenAudio;
      m->ThreadInit = PSPAUD_ThreadInit;
      m->WaitAudio = PSPAUD_WaitAudio;
      m->PlayAudio = PSPAUD_PlayAudio;
      m->GetAudioBuf = PSPAUD_GetAudioBuf;
      m->CloseAudio = PSPAUD_CloseAudio;
      m->free = PSPAUD_DeleteDevice;
    }
  }
  return m;
}



----------------------------------------

// Function: PSPAUD_DeleteDevice @ 0891aadc

void PSPAUD_DeleteDevice(SDL_AudioDevice *device)

{
  free(device->hidden);
  free(device);
  return;
}



----------------------------------------

// Function: PSPAUD_CloseAudio @ 0891ab08

/* DWARF original prototype: void PSPAUD_CloseAudio(SDL_AudioDevice * this) */

void __thiscall PSPAUD_CloseAudio(void *this)

{
  int *piVar1;
  
  piVar1 = *(int **)((int)this + 0xbc);
  if (-1 < *piVar1) {
    sceAudioChRelease(*piVar1);
    piVar1 = *(int **)((int)this + 0xbc);
    *piVar1 = -1;
  }
  if ((void *)piVar1[1] != (void *)0x0) {
    free((void *)piVar1[1]);
    *(undefined4 *)(*(int *)((int)this + 0xbc) + 4) = 0;
  }
  return;
}



----------------------------------------

// Function: PSPAUD_PlayAudio @ 0891ab68

/* WARNING: Removing unreachable block (ram,0x0891ac04) */
/* WARNING: Removing unreachable block (ram,0x0891abc4) */
/* DWARF original prototype: void PSPAUD_PlayAudio(SDL_AudioDevice * this) */

void __thiscall PSPAUD_PlayAudio(void *this)

{
  undefined4 *puVar1;
  
                    /* Unresolved local var: Uint8 * mixbuf@[???] */
  puVar1 = *(undefined4 **)((int)this + 0xbc);
  if (*(char *)((int)this + 0x32) != '\x01') {
    sceAudioOutputPannedBlocking(*puVar1,0x8000,0x8000);
    *(int *)(*(int *)((int)this + 0xbc) + 0x10) =
         (*(int *)(*(int *)((int)this + 0xbc) + 0x10) + 1) % 2;
    return;
  }
  sceAudioOutputBlocking(*puVar1,0x8000,puVar1[puVar1[4] + 2]);
  *(int *)(*(int *)((int)this + 0xbc) + 0x10) =
       (*(int *)(*(int *)((int)this + 0xbc) + 0x10) + 1) % 2;
  return;
}



----------------------------------------

// Function: PSPAUD_ThreadInit @ 0891ac20

/* DWARF original prototype: void PSPAUD_ThreadInit(SDL_AudioDevice * this) */

void __thiscall PSPAUD_ThreadInit(void *this)

{
  undefined4 uVar1;
  int iVar2;
  undefined4 local_70 [16];
  int local_30;
  
                    /* Unresolved local var: SceUID thid@[???]
                       Unresolved local var: SceKernelThreadInfo status@[???] */
  uVar1 = sceKernelGetThreadId();
  local_70[0] = 0x68;
  iVar2 = sceKernelReferThreadStatus(uVar1,local_70);
  if (iVar2 == 0) {
    sceKernelChangeThreadPriority(uVar1,local_30 + -1);
  }
  return;
}



----------------------------------------

// Function: PSPAUD_OpenAudio @ 0891ac6c

/* DWARF original prototype: int PSPAUD_OpenAudio(SDL_AudioDevice * this, SDL_AudioSpec * spec) */

int __thiscall PSPAUD_OpenAudio(void *this,SDL_AudioSpec *spec)

{
  char cVar1;
  Uint16 UVar2;
  void *pvVar3;
  Uint32 UVar4;
  int *piVar5;
  undefined4 uVar6;
  int iVar7;
  undefined4 *puVar8;
  size_t nbytes;
  
                    /* Unresolved local var: int format@[???]
                       Unresolved local var: int mixlen@[???]
                       Unresolved local var: int i@[???] */
  cVar1 = (char)spec->format;
  if (cVar1 == '\b') {
    UVar2 = spec->samples;
  }
  else {
    if (cVar1 != '\x10') {
      SDL_SetError("Unsupported audio format");
      return -1;
    }
    UVar2 = spec->samples;
  }
  spec->format = 0x8010;
  spec->freq = 0xac44;
  spec->samples = UVar2 + 0x3f & 0xffc0;
  SDL_CalculateAudioSpec(spec);
  iVar7 = *(int *)((int)this + 0xbc);
  nbytes = spec->size << 1;
  pvVar3 = memalign(0x40,nbytes);
  puVar8 = *(undefined4 **)((int)this + 0xbc);
  *(void **)(iVar7 + 4) = pvVar3;
  if (puVar8[1] == 0) {
    SDL_SetError("Couldn\'t allocate mixing buffer");
  }
  else {
    uVar6 = 0x10;
    if (spec->channels != '\x01') {
      uVar6 = 0;
    }
    uVar6 = sceAudioChReserve(0xffffffff,spec->samples,uVar6);
    piVar5 = *(int **)((int)this + 0xbc);
    *puVar8 = uVar6;
    if (-1 < *piVar5) {
      memset((void *)piVar5[1],0,nbytes);
      iVar7 = *(int *)((int)this + 0xbc);
      UVar4 = spec->size;
      *(undefined4 *)(iVar7 + 0x10) = 0;
      *(Uint32 *)(iVar7 + 0xc) = *(int *)(iVar7 + 4) + UVar4;
      *(int *)(iVar7 + 8) = *(int *)(iVar7 + 4);
      return 0;
    }
    SDL_SetError("Couldn\'t reserve hardware channel");
    free(*(void **)(*(int *)((int)this + 0xbc) + 4));
    *(undefined4 *)(*(int *)((int)this + 0xbc) + 4) = 0;
  }
  return -1;
}



----------------------------------------

// Function: SDL_GetVideoSurface @ 0891adec

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_Surface * SDL_GetVideoSurface(void)

{
  SDL_Surface *pSVar1;
  
                    /* Unresolved local var: SDL_Surface * visible@[???] */
  pSVar1 = (SDL_Surface *)0x0;
  if (current_video != (SDL_VideoDevice *)0x0) {
    pSVar1 = current_video->visible;
  }
  return pSVar1;
}



----------------------------------------

// Function: SDL_GetVideoInfo @ 0891ae08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_VideoInfo * SDL_GetVideoInfo(void)

{
  SDL_VideoInfo *pSVar1;
  
                    /* Unresolved local var: SDL_VideoInfo * info@[???] */
  pSVar1 = (SDL_VideoInfo *)0x0;
  if (current_video != (SDL_VideoDevice *)0x0) {
    pSVar1 = &current_video->info;
  }
  return pSVar1;
}



----------------------------------------

// Function: SDL_ListModes @ 0891ae24

SDL_Rect ** SDL_ListModes(SDL_PixelFormat *format,Uint32 flags)

{
  SDL_Rect **ppSVar1;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Rect * * modes@[???] */
  if (current_video->screen == (SDL_Surface *)0x0) {
    return (SDL_Rect **)0x0;
  }
  if (format == (SDL_PixelFormat *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891ae58. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    ppSVar1 = (*current_video->ListModes)(current_video,current_video->screen->format,flags);
    return ppSVar1;
  }
                    /* WARNING: Could not recover jumptable at 0x0891ae4c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  ppSVar1 = (*current_video->ListModes)(current_video,format,flags);
  return ppSVar1;
}



----------------------------------------

// Function: SDL_GL_UpdateRects @ 0891ae68

void SDL_GL_UpdateRects(int numrects,SDL_Rect *rects)

{
  ushort uVar1;
  SDL_VideoDevice *pSVar2;
  uint uVar3;
  short sVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  short sVar8;
  int iVar9;
  int iVar10;
  uint uVar11;
  SFtype SVar12;
  SFtype in_f12;
  undefined4 uVar13;
  SFtype in_f13;
  undefined4 uVar14;
  GLfloat in_f14;
  undefined4 in_f15;
  Sint16 *local_50;
  GLvoid *pGVar15;
  GLenum GVar16;
  
                    /* Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Rect update@[???]
                       Unresolved local var: SDL_Rect tmp@[???]
                       Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int i@[???] */
  pSVar2 = current_video;
  if (0 < numrects) {
    local_50 = &rects->y;
    pGVar15 = (GLvoid *)0x0;
    do {
      GVar16 = 0;
      sVar4 = *local_50;
      uVar3 = (uint)(ushort)local_50[2];
      uVar1 = local_50[1];
      do {
        uVar6 = (uint)uVar1;
        uVar11 = uVar3;
        if (0x100 < uVar3) {
          uVar11 = 0x100;
        }
        __floatsidf(uVar11);
        iVar10 = 0;
        sVar8 = ((SDL_Rect *)(local_50 + -1))->x;
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),
                 (FLO_type_conflict)CONCAT44(in_f15,in_f14));
        SVar12 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
        iVar9 = (int)sVar4;
        iVar5 = iVar9 + uVar11;
        do {
          iVar7 = (int)sVar8;
          (*pSVar2->glFlush)();
          uVar11 = uVar6;
          if (0x100 < uVar6) {
            uVar11 = 0x100;
          }
          iVar10 = iVar10 + 1;
          (*pSVar2->glTexSubImage2D)
                    (0xde1,0,0,0,iVar5,uVar3,(GLenum)pGVar15,GVar16,(GLvoid *)numrects);
          (*pSVar2->glFlush)();
          (*pSVar2->glBegin)(5);
          uVar13 = 0;
          uVar14 = 0;
          (*pSVar2->glTexCoord2f)(0.0,in_f14);
          (*pSVar2->glVertex2i)(iVar7,iVar9);
          __floatsidf(uVar11);
          __muldf3((FLO_type_conflict)CONCAT44(uVar14,uVar13),
                   (FLO_type_conflict)CONCAT44(in_f15,in_f14));
          in_f12 = __truncdfsf2((DFtype)CONCAT44(uVar14,uVar13));
          (*pSVar2->glTexCoord2f)(in_f12,in_f14);
          (*pSVar2->glVertex2i)(uVar11 + iVar7,iVar9);
          (*pSVar2->glTexCoord2f)(0.0,in_f14);
          (*pSVar2->glVertex2i)(iVar7,iVar5);
          in_f13 = SVar12;
          (*pSVar2->glTexCoord2f)(in_f12,in_f14);
          (*pSVar2->glVertex2i)(uVar11 + iVar7,iVar5);
          (*pSVar2->glEnd)();
          sVar8 = sVar8 + 0x100;
          uVar1 = local_50[1];
          uVar6 = uVar6 - 0x100 & 0xffff;
        } while (iVar10 <= (int)(uint)(uVar1 >> 8));
        GVar16 = GVar16 + 1;
        sVar4 = sVar4 + 0x100;
        uVar3 = uVar3 - 0x100 & 0xffff;
      } while ((int)GVar16 <= (int)(uint)((ushort)local_50[2] >> 8));
      pGVar15 = (GLvoid *)((int)pGVar15 + 1);
      local_50 = local_50 + 4;
    } while ((GLvoid *)numrects != pGVar15);
  }
  return;
}



----------------------------------------

// Function: SDL_GL_Lock @ 0891b160

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_GL_Lock(void)

{
  SDL_VideoDevice *pSVar1;
  uint uVar2;
  GLfloat in_a2;
  SDL_Surface *pSVar3;
  _func_void_GLenum_GLint *p_Var4;
  undefined4 unaff_s0;
  undefined4 unaff_s1;
  undefined4 unaff_s2;
  undefined4 unaff_s3;
  undefined4 unaff_retaddr;
  GLfloat GVar5;
  GLfloat GVar6;
  GLfloat GVar7;
  GLfloat GVar8;
  GLdouble in_stack_00000000;
  undefined4 in_stack_fffffffc;
  
  pSVar1 = current_video;
  lock_count = lock_count + -1;
  if (lock_count != -1) {
    return;
  }
                    /* Unresolved local var: SDL_VideoDevice * this@[???] */
  (*current_video->glPushAttrib)(0xfffff);
  (*pSVar1->glPushClientAttrib)(1);
  (*pSVar1->glEnable)(0xde1);
  (*pSVar1->glEnable)(0xbe2);
  (*pSVar1->glDisable)(0xb60);
  (*pSVar1->glDisable)(0xbc0);
  (*pSVar1->glDisable)(0xb71);
  (*pSVar1->glDisable)(0xc11);
  (*pSVar1->glDisable)(0xb90);
  (*pSVar1->glDisable)(0xb44);
  (*pSVar1->glBindTexture)(0xde1,pSVar1->texture);
  (*pSVar1->glTexEnvf)(0x2300,0x2200,in_a2);
  (*pSVar1->glTexParameteri)(0xde1,0x2801,0x2600);
  (*pSVar1->glTexParameteri)(0xde1,0x2800,0x2600);
  (*pSVar1->glTexParameteri)(0xde1,0x2802,0x2901);
  (*pSVar1->glTexParameteri)(0xde1,0x2803,0x2901);
  pSVar3 = pSVar1->screen;
  p_Var4 = pSVar1->glPixelStorei;
  uVar2 = (uint)pSVar3->format->BytesPerPixel;
  if (uVar2 == 0) {
    trap(7);
  }
  (*p_Var4)(0xcf2,pSVar3->pitch / uVar2);
  (*pSVar1->glBlendFunc)(0x302,0x303);
  GVar5 = DAT_089dbce4;
  GVar6 = DAT_089dbce4;
  GVar7 = DAT_089dbce4;
  GVar8 = DAT_089dbce4;
  (*pSVar1->glColor4f)(DAT_089dbce4,DAT_089dbce4,(GLfloat)pSVar3,(GLfloat)p_Var4);
  (*pSVar1->glViewport)(0,0,pSVar1->screen->w,pSVar1->screen->h);
  (*pSVar1->glMatrixMode)(0x1701);
  (*pSVar1->glPushMatrix)();
  (*pSVar1->glLoadIdentity)();
  pSVar3 = pSVar1->screen;
  __floatsidf(pSVar3->w);
  __floatsidf(pSVar3->h);
  (*pSVar1->glOrtho)((GLdouble)CONCAT44(GVar6,GVar5),(GLdouble)CONCAT44(GVar8,GVar7),
                     (GLdouble)CONCAT44(unaff_s1,unaff_s0),(GLdouble)CONCAT44(unaff_s3,unaff_s2),
                     (GLdouble)CONCAT44(in_stack_fffffffc,unaff_retaddr),in_stack_00000000);
  (*pSVar1->glMatrixMode)(0x1700);
  (*pSVar1->glPushMatrix)();
                    /* WARNING: Could not recover jumptable at 0x0891b3d0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*pSVar1->glLoadIdentity)();
  return;
}



----------------------------------------

// Function: SDL_GL_Unlock @ 0891b3d8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_GL_Unlock(void)

{
  SDL_VideoDevice *pSVar1;
  
  pSVar1 = current_video;
  lock_count = lock_count + 1;
  if (lock_count != 0) {
    return;
  }
                    /* Unresolved local var: SDL_VideoDevice * this@[???] */
  (*current_video->glPopMatrix)();
  (*pSVar1->glMatrixMode)(0x1701);
  (*pSVar1->glPopMatrix)();
  (*pSVar1->glPopClientAttrib)();
                    /* WARNING: Could not recover jumptable at 0x0891b44c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*pSVar1->glPopAttrib)();
  return;
}



----------------------------------------

// Function: SDL_GL_UpdateRectsLock @ 0891b454

/* DWARF original prototype: void SDL_GL_UpdateRectsLock(SDL_VideoDevice * this, int numrects,
   SDL_Rect * rects) */

void __thiscall SDL_GL_UpdateRectsLock(void *this,int numrects,SDL_Rect *rects)

{
  SDL_GL_Lock();
  SDL_GL_UpdateRects(numrects,rects);
  SDL_GL_Unlock();
  return;
}



----------------------------------------

// Function: SDL_WM_GetCaption @ 0891b490

void SDL_WM_GetCaption(char **title,char **icon)

{
  SDL_VideoDevice *pSVar1;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[DW_OP_reg3(v1)] */
  pSVar1 = current_video;
  if (current_video != (SDL_VideoDevice *)0x0) {
    if (title != (char **)0x0) {
      *title = current_video->wm_title;
    }
    if (icon != (char **)0x0) {
      *icon = pSVar1->wm_icon;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_WM_GrabInputRaw @ 0891b4c8

SDL_GrabMode SDL_WM_GrabInputRaw(SDL_GrabMode mode)

{
  SDL_VideoDevice *pSVar1;
  SDL_GrabMode SVar2;
  _func_SDL_GrabMode_SDL_VideoDevice_ptr_SDL_GrabMode *p_Var3;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  pSVar1 = current_video;
  p_Var3 = current_video->GrabInput;
  if (p_Var3 == (_func_SDL_GrabMode_SDL_VideoDevice_ptr_SDL_GrabMode *)0x0) {
    return current_video->input_grab;
  }
  SVar2 = current_video->input_grab;
  if (mode == SDL_GRAB_OFF) {
    if (SVar2 == SDL_GRAB_OFF) {
      return SDL_GRAB_OFF;
    }
    mode = (*p_Var3)(current_video,SDL_GRAB_OFF);
    SVar2 = pSVar1->input_grab;
  }
  else if (SVar2 == SDL_GRAB_OFF) {
    mode = (*p_Var3)(current_video,mode);
    SVar2 = pSVar1->input_grab;
  }
  if (mode != SVar2) {
    pSVar1->input_grab = mode;
    if (pSVar1->CheckMouseMode != (_func_void_SDL_VideoDevice_ptr *)0x0) {
      (*pSVar1->CheckMouseMode)(pSVar1);
    }
  }
  if (mode < SDL_GRAB_FULLSCREEN) {
    return mode;
  }
  return mode + ~SDL_GRAB_ON;
}



----------------------------------------

// Function: SDL_WM_GrabInput @ 0891b5a0

SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode)

{
  SDL_GrabMode SVar1;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???] */
  SVar1 = SDL_GRAB_OFF;
  if (current_video != (SDL_VideoDevice *)0x0) {
    if (mode != SDL_GRAB_QUERY) {
      if (SDL_GRAB_ON < mode) {
        mode = mode + ~SDL_GRAB_ON;
      }
      if ((current_video->screen != (SDL_Surface *)0x0) && ((int)current_video->screen->flags < 0))
      {
        SVar1 = SDL_WM_GrabInputRaw(mode + SDL_GRAB_FULLSCREEN);
        return SVar1;
      }
      SVar1 = SDL_WM_GrabInputRaw(mode);
      return SVar1;
    }
    SVar1 = current_video->input_grab;
    if (SDL_GRAB_ON < SVar1) {
      SVar1 = SVar1 + ~SDL_GRAB_ON;
    }
  }
  return SVar1;
}



----------------------------------------

// Function: SDL_WM_GrabInputOff @ 0891b604

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_GrabMode SDL_WM_GrabInputOff(void)

{
  SDL_GrabMode SVar1;
  
                    /* Unresolved local var: SDL_GrabMode mode@[???] */
  SVar1 = SDL_WM_GrabInput(SDL_GRAB_QUERY);
  SDL_WM_GrabInputRaw(SDL_GRAB_OFF);
  return SVar1;
}



----------------------------------------

// Function: SDL_WM_IconifyWindow @ 0891b638

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_WM_IconifyWindow(void)

{
  int iVar1;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: int retval@[???] */
  if (current_video->IconifyWindow != (_func_int_SDL_VideoDevice_ptr *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891b64c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    iVar1 = (*current_video->IconifyWindow)(current_video);
    return iVar1;
  }
  return 0;
}



----------------------------------------

// Function: SDL_WM_ToggleFullScreen @ 0891b65c

int SDL_WM_ToggleFullScreen(SDL_Surface *surface)

{
  SDL_VideoDevice *pSVar1;
  SDL_Surface *pSVar2;
  int iVar3;
  _func_int_SDL_VideoDevice_ptr_int *p_Var4;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: int toggled@[???] */
  pSVar1 = current_video;
  pSVar2 = current_video->visible;
  if (((pSVar2 != (SDL_Surface *)0x0) && (pSVar2 == surface)) &&
     (p_Var4 = current_video->ToggleFullScreen, p_Var4 != (_func_int_SDL_VideoDevice_ptr_int *)0x0))
  {
    if ((int)pSVar2->flags < 0) {
      iVar3 = (*p_Var4)(current_video,0);
      if (iVar3 != 0) {
        pSVar2 = current_video->visible;
        current_video->screen->flags = current_video->screen->flags & 0x7fffffff;
        pSVar2->flags = pSVar2->flags & 0x7fffffff;
        goto LAB_0891b6f8;
      }
    }
    else {
      iVar3 = (*p_Var4)(current_video,1);
      if (iVar3 != 0) {
        pSVar2 = current_video->visible;
        current_video->screen->flags = current_video->screen->flags | 0x80000000;
        pSVar2->flags = pSVar2->flags | 0x80000000;
LAB_0891b6f8:
        SDL_WM_GrabInput(pSVar1->input_grab);
        return iVar3;
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_GetWMInfo @ 0891b75c

int SDL_GetWMInfo(SDL_SysWMinfo *info)

{
  int iVar1;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  if ((current_video != (SDL_VideoDevice *)0x0) &&
     (current_video->GetWMInfo != (_func_int_SDL_VideoDevice_ptr_SDL_SysWMinfo_ptr *)0x0)) {
                    /* WARNING: Could not recover jumptable at 0x0891b77c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    iVar1 = (*current_video->GetWMInfo)(current_video,info);
    return iVar1;
  }
  return 0;
}



----------------------------------------

// Function: SDL_VideoModeOK @ 0891b78c

/* WARNING: Removing unreachable block (ram,0x0891b7ec) */

int SDL_VideoModeOK(int width,int height,int bpp,Uint32 flags)

{
  ushort uVar1;
  SDL_Rect **ppSVar2;
  int iVar3;
  SDL_Rect *pSVar4;
  Uint8 *pUVar5;
  int iVar6;
  SDL_PixelFormat local_50;
  
                    /* Unresolved local var: int table@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int supported@[???]
                       Unresolved local var: SDL_PixelFormat format@[???]
                       Unresolved local var: SDL_Rect * * sizes@[???] */
  if (((bpp - 8U < 0x19) && (0 < width)) && (0 < height)) {
    iVar6 = 0;
    local_50.palette = (SDL_Palette *)0x0;
    local_50.BitsPerPixel = '\0';
    local_50.BytesPerPixel = '\0';
    local_50.Rloss = '\0';
    local_50.Gloss = '\0';
    local_50.Bloss = '\0';
    local_50.Aloss = '\0';
    local_50.Rshift = '\0';
    local_50.Gshift = '\0';
    local_50.Bshift = '\0';
    local_50.Ashift = '\0';
    local_50._14_2_ = 0;
    local_50.Rmask = 0;
    local_50.Gmask = 0;
    local_50.Bmask = 0;
    local_50.Amask = 0;
    local_50.colorkey = 0;
    local_50.alpha = '\0';
    local_50._37_3_ = 0;
    iVar3 = (bpp + 7) / 8 + -1;
    pUVar5 = SDL_closest_depths[iVar3];
    *pUVar5 = (Uint8)bpp;
    SDL_closest_depths[iVar3][7] = '\0';
    for (; *pUVar5 != '\0'; pUVar5 = pUVar5 + 1) {
      local_50.BitsPerPixel = *pUVar5;
      ppSVar2 = SDL_ListModes(&local_50,flags);
      if (ppSVar2 != (SDL_Rect **)0x0) {
        if (ppSVar2 == (SDL_Rect **)0xffffffff) {
LAB_0891b924:
          return (uint)SDL_closest_depths[iVar3][iVar6];
        }
        pSVar4 = *ppSVar2;
        if (current_video->handles_any_size == 0) {
          if (pSVar4 != (SDL_Rect *)0x0) {
            uVar1 = pSVar4->w;
            while( true ) {
              if (width == (uint)uVar1) {
                if (height == (uint)pSVar4->h) goto LAB_0891b924;
                pSVar4 = ppSVar2[1];
              }
              else {
                pSVar4 = ppSVar2[1];
              }
              ppSVar2 = ppSVar2 + 1;
              if (pSVar4 == (SDL_Rect *)0x0) break;
              uVar1 = pSVar4->w;
            }
          }
        }
        else {
          while (pSVar4 != (SDL_Rect *)0x0) {
            if ((int)(uint)pSVar4->w < width) {
              pSVar4 = ppSVar2[1];
            }
            else {
              if (height <= (int)(uint)pSVar4->h) goto LAB_0891b924;
              pSVar4 = ppSVar2[1];
            }
            ppSVar2 = ppSVar2 + 1;
          }
        }
      }
      iVar6 = iVar6 + 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_WM_SetIcon @ 0891b960

/* WARNING: Removing unreachable block (ram,0x0891bccc) */
/* WARNING: Removing unreachable block (ram,0x0891bbcc) */
/* WARNING: Removing unreachable block (ram,0x0891bae4) */
/* WARNING: Removing unreachable block (ram,0x0891ba08) */
/* WARNING: Removing unreachable block (ram,0x0891bc14) */
/* WARNING: Removing unreachable block (ram,0x0891bc24) */
/* WARNING: Removing unreachable block (ram,0x0891bd14) */
/* WARNING: Removing unreachable block (ram,0x0891bad4) */
/* WARNING: Removing unreachable block (ram,0x0891bd24) */

void SDL_WM_SetIcon(SDL_Surface *icon,Uint8 *mask)

{
  Uint8 UVar1;
  byte bVar2;
  ushort uVar3;
  SDL_VideoDevice *pSVar4;
  Uint8 *m;
  _func_void_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8_ptr *p_Var5;
  uint uVar6;
  byte *pbVar7;
  uint *puVar8;
  ushort *puVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  uint uVar13;
  SDL_PixelFormat *pSVar14;
  int iVar15;
  void *pvVar16;
  size_t nbytes;
  int iVar17;
  int iVar18;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  pSVar4 = current_video;
  if ((icon == (SDL_Surface *)0x0) ||
     (current_video->SetIcon == (_func_void_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8_ptr *)0x0)) {
    return;
  }
  if (mask != (Uint8 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891b9c0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_video->SetIcon)(current_video,icon,mask);
    return;
  }
                    /* Unresolved local var: int mask_len@[???]
                       Unresolved local var: int flags@[???] */
  nbytes = ((icon->w + 7) * icon->h) / 8;
  m = malloc(nbytes);
  if (m == (Uint8 *)0x0) {
    return;
  }
  memset(m,-1,nbytes);
  uVar6 = -((int)(icon->flags << 0x13) >> 0x1f);
  if ((icon->flags & 0x10000) == 0) {
    if (uVar6 == 0) {
      p_Var5 = pSVar4->SetIcon;
      goto LAB_0891bb3c;
    }
    pSVar14 = icon->format;
  }
  else {
    uVar6 = uVar6 | 2;
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: Uint32 colorkey@[???] */
    pSVar14 = icon->format;
  }
  UVar1 = pSVar14->BytesPerPixel;
  uVar13 = pSVar14->colorkey;
  if (UVar1 == '\x02') {
    iVar12 = icon->h;
    if (0 < iVar12) {
      iVar15 = icon->w;
      pvVar16 = icon->pixels;
      uVar3 = icon->pitch;
      iVar11 = 0;
      do {
        if (0 < iVar15) {
          iVar10 = 0;
          puVar9 = (ushort *)((int)pvVar16 + ((int)((uint)uVar3 * iVar11) / 2) * 2);
          do {
            if ((((uVar6 & 1) != 0) && (uVar13 == *puVar9)) ||
               (((uVar6 & 2) != 0 && (((uint)*puVar9 & pSVar14->Amask) == 0)))) {
              m[((iVar15 + 7) / 8) * iVar11 + iVar10 / 8] =
                   ~(byte)(1 << (7U - iVar10 % 8 & 0x1f)) &
                   m[((iVar15 + 7) / 8) * iVar11 + iVar10 / 8];
            }
            iVar10 = iVar10 + 1;
            puVar9 = puVar9 + 1;
          } while (iVar10 < iVar15);
        }
        iVar11 = iVar11 + 1;
      } while (iVar11 < iVar12);
      p_Var5 = pSVar4->SetIcon;
      goto LAB_0891bb3c;
    }
  }
  else if (UVar1 == '\x04') {
                    /* Unresolved local var: Uint32 * pixels@[???] */
    iVar12 = icon->h;
    if (0 < iVar12) {
      iVar15 = icon->w;
      pvVar16 = icon->pixels;
      uVar3 = icon->pitch;
                    /* Unresolved local var: Uint16 * pixels@[???] */
      iVar11 = 0;
      do {
        if (0 < iVar15) {
          iVar10 = 0;
          puVar8 = (uint *)((int)pvVar16 + ((int)((uint)uVar3 * iVar11) / 4) * 4);
          do {
            if ((((uVar6 & 1) != 0) && (uVar13 == *puVar8)) ||
               (((uVar6 & 2) != 0 && ((*puVar8 & pSVar14->Amask) == 0)))) {
              m[((iVar15 + 7) / 8) * iVar11 + iVar10 / 8] =
                   ~(byte)(1 << (7U - iVar10 % 8 & 0x1f)) &
                   m[((iVar15 + 7) / 8) * iVar11 + iVar10 / 8];
            }
            iVar10 = iVar10 + 1;
            puVar8 = puVar8 + 1;
          } while (iVar10 < iVar15);
        }
        iVar11 = iVar11 + 1;
      } while (iVar11 < iVar12);
      p_Var5 = pSVar4->SetIcon;
      goto LAB_0891bb3c;
    }
  }
  else {
    if (UVar1 != '\x01') {
      p_Var5 = pSVar4->SetIcon;
      goto LAB_0891bb3c;
    }
                    /* Unresolved local var: Uint8 * pixels@[???] */
    iVar15 = icon->h;
    iVar12 = 0;
    if (0 < iVar15) {
      iVar11 = icon->w;
      pvVar16 = icon->pixels;
      uVar3 = icon->pitch;
      do {
        if (0 < iVar11) {
          iVar10 = 0;
          pbVar7 = (byte *)((int)pvVar16 + (uint)uVar3 * iVar12);
          do {
            bVar2 = *pbVar7;
            while (pbVar7 = pbVar7 + 1, uVar13 == bVar2) {
              iVar17 = iVar10 / 8;
              iVar18 = iVar10 % 8;
              iVar10 = iVar10 + 1;
              m[((iVar11 + 7) / 8) * iVar12 + iVar17] =
                   ~(byte)(1 << (7U - iVar18 & 0x1f)) & m[((iVar11 + 7) / 8) * iVar12 + iVar17];
              if (iVar11 <= iVar10) goto LAB_0891bb2c;
              bVar2 = *pbVar7;
            }
            iVar10 = iVar10 + 1;
          } while (iVar10 < iVar11);
        }
LAB_0891bb2c:
        iVar12 = iVar12 + 1;
      } while (iVar12 < iVar15);
    }
  }
  p_Var5 = pSVar4->SetIcon;
LAB_0891bb3c:
  (*p_Var5)(pSVar4,icon,m);
  free(m);
  return;
}



----------------------------------------

// Function: SDL_WM_SetCaption @ 0891bd80

void SDL_WM_SetCaption(char *title,char *icon)

{
  SDL_VideoDevice *pSVar1;
  size_t sVar2;
  char *pcVar3;
  _func_void_SDL_VideoDevice_ptr_char_ptr_char_ptr *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  pSVar1 = current_video;
  if (current_video != (SDL_VideoDevice *)0x0) {
    if (title != (char *)0x0) {
      if (current_video->wm_title != (char *)0x0) {
        free(current_video->wm_title);
      }
      sVar2 = strlen(title);
      pcVar3 = malloc(sVar2 + 1);
      pSVar1->wm_title = pcVar3;
      if (pcVar3 != (char *)0x0) {
        strcpy(pcVar3,title);
      }
    }
    if (icon != (char *)0x0) {
      if (pSVar1->wm_icon != (char *)0x0) {
        free(pSVar1->wm_icon);
      }
      sVar2 = strlen(icon);
      pcVar3 = malloc(sVar2 + 1);
      pSVar1->wm_icon = pcVar3;
      if (pcVar3 != (char *)0x0) {
        strcpy(pcVar3,icon);
      }
    }
    if (title == (char *)0x0) {
      if (icon == (char *)0x0) {
        return;
      }
      UNRECOVERED_JUMPTABLE = pSVar1->SetCaption;
    }
    else {
      UNRECOVERED_JUMPTABLE = pSVar1->SetCaption;
    }
    if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_VideoDevice_ptr_char_ptr_char_ptr *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891be54. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*UNRECOVERED_JUMPTABLE)(pSVar1,pSVar1->wm_title,pSVar1->wm_icon);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_GL_SwapBuffers @ 0891be7c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_GL_SwapBuffers(void)

{
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  if ((current_video->screen->flags & 2) != 0) {
                    /* WARNING: Could not recover jumptable at 0x0891bea0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_video->GL_SwapBuffers)(current_video);
    return;
  }
  SDL_SetError("OpenGL video mode has not been set");
  return;
}



----------------------------------------

// Function: SDL_GL_GetAttribute @ 0891beb0

int SDL_GL_GetAttribute(SDL_GLattr attr,int *value)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???]
                       Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  if (current_video->GL_GetAttribute != (_func_int_SDL_VideoDevice_ptr_SDL_GLattr_int_ptr *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891bedc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    iVar1 = (*current_video->GL_GetAttribute)(current_video,attr,value);
    return iVar1;
  }
  *value = 0;
  SDL_SetError("GL_GetAttribute not supported");
  return -1;
}



----------------------------------------

// Function: SDL_GL_SetAttribute @ 0891bf04

int SDL_GL_SetAttribute(SDL_GLattr attr,int value)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???]
                       Unresolved local var: SDL_VideoDevice * video@[???] */
  switch(attr) {
  case SDL_GL_RED_SIZE:
    iVar1 = 0;
    (current_video->gl_config).red_size = value;
    break;
  case SDL_GL_GREEN_SIZE:
    iVar1 = 0;
    (current_video->gl_config).green_size = value;
    break;
  case SDL_GL_BLUE_SIZE:
    iVar1 = 0;
    (current_video->gl_config).blue_size = value;
    break;
  case SDL_GL_ALPHA_SIZE:
    iVar1 = 0;
    (current_video->gl_config).alpha_size = value;
    break;
  case SDL_GL_BUFFER_SIZE:
    iVar1 = 0;
    (current_video->gl_config).buffer_size = value;
    break;
  case SDL_GL_DOUBLEBUFFER:
    iVar1 = 0;
    (current_video->gl_config).double_buffer = value;
    break;
  case SDL_GL_DEPTH_SIZE:
    iVar1 = 0;
    (current_video->gl_config).depth_size = value;
    break;
  case SDL_GL_STENCIL_SIZE:
    iVar1 = 0;
    (current_video->gl_config).stencil_size = value;
    break;
  case SDL_GL_ACCUM_RED_SIZE:
    iVar1 = 0;
    (current_video->gl_config).accum_red_size = value;
    break;
  case SDL_GL_ACCUM_GREEN_SIZE:
    iVar1 = 0;
    (current_video->gl_config).accum_green_size = value;
    break;
  case SDL_GL_ACCUM_BLUE_SIZE:
    iVar1 = 0;
    (current_video->gl_config).accum_blue_size = value;
    break;
  case SDL_GL_ACCUM_ALPHA_SIZE:
    iVar1 = 0;
    (current_video->gl_config).accum_alpha_size = value;
    break;
  case SDL_GL_STEREO:
    iVar1 = 0;
    (current_video->gl_config).stereo = value;
    break;
  case SDL_GL_MULTISAMPLEBUFFERS:
    iVar1 = 0;
    (current_video->gl_config).multisamplebuffers = value;
    break;
  case SDL_GL_MULTISAMPLESAMPLES:
    iVar1 = 0;
    (current_video->gl_config).multisamplesamples = value;
    break;
  default:
    SDL_SetError("Unknown OpenGL attribute");
    iVar1 = -1;
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_GL_GetProcAddress @ 0891c008

void * SDL_GL_GetProcAddress(char *proc)

{
  void *pvVar1;
  char *fmt;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: void * func@[???] */
  fmt = "No dynamic GL support in video driver";
  if ((current_video->GL_GetProcAddress != (_func_void_ptr_SDL_VideoDevice_ptr_char_ptr *)0x0) &&
     (fmt = "No GL driver has been loaded", (current_video->gl_config).driver_loaded != 0)) {
                    /* WARNING: Could not recover jumptable at 0x0891c044. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    pvVar1 = (*current_video->GL_GetProcAddress)(current_video,proc);
    return pvVar1;
  }
  SDL_SetError(fmt);
  return (void *)0x0;
}



----------------------------------------

// Function: SDL_GL_LoadLibrary @ 0891c064

int SDL_GL_LoadLibrary(char *path)

{
  int iVar1;
  char *fmt;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: int retval@[???] */
  fmt = "Video subsystem has not been initialized";
  if (current_video != (SDL_VideoDevice *)0x0) {
    if (current_video->GL_LoadLibrary != (_func_int_SDL_VideoDevice_ptr_char_ptr *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0891c094. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      iVar1 = (*current_video->GL_LoadLibrary)(current_video,path);
      return iVar1;
    }
    fmt = "No dynamic GL support in video driver";
  }
  SDL_SetError(fmt);
  return -1;
}



----------------------------------------

// Function: SDL_VideoQuit @ 0891c0bc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_VideoQuit(void)

{
  SDL_VideoDevice *pSVar1;
  _func_void_SDL_VideoDevice_ptr *p_Var2;
  SDL_Palette *pSVar3;
  SDL_Surface *pSVar4;
  Uint16 *aptr;
  char *pcVar5;
  
                    /* Unresolved local var: SDL_Surface * ready_to_go@[???] */
  pSVar1 = current_video;
  if (current_video != (SDL_VideoDevice *)0x0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    SDL_StopEventLoop();
    if (current_video->visible != (SDL_Surface *)0x0) {
      current_video->visible = (SDL_Surface *)0x0;
    }
    SDL_CursorQuit();
    SDL_WM_GrabInputOff();
    (*pSVar1->VideoQuit)(pSVar1);
    pSVar4 = current_video->shadow;
    current_video->shadow = (SDL_Surface *)0x0;
    SDL_FreeSurface(pSVar4);
    pSVar4 = current_video->screen;
    if (pSVar4 == (SDL_Surface *)0x0) {
      pSVar3 = pSVar1->physpal;
    }
    else {
      current_video->screen = (SDL_Surface *)0x0;
      SDL_FreeSurface(pSVar4);
      pSVar3 = pSVar1->physpal;
    }
    current_video->visible = (SDL_Surface *)0x0;
    if (pSVar3 != (SDL_Palette *)0x0) {
      free(pSVar3->colors);
      free(pSVar1->physpal);
      pSVar1->physpal = (SDL_Palette *)0x0;
    }
    if (pSVar1->gammacols == (SDL_Color *)0x0) {
      aptr = pSVar1->gamma;
    }
    else {
      free(pSVar1->gammacols);
      pSVar1->gammacols = (SDL_Color *)0x0;
      aptr = pSVar1->gamma;
    }
    if (aptr == (Uint16 *)0x0) {
      pcVar5 = pSVar1->wm_title;
    }
    else {
      free(aptr);
      pSVar1->gamma = (Uint16 *)0x0;
      pcVar5 = pSVar1->wm_title;
    }
    if (pcVar5 == (char *)0x0) {
      pcVar5 = pSVar1->wm_icon;
    }
    else {
      free(pcVar5);
      pSVar1->wm_title = (char *)0x0;
      pcVar5 = pSVar1->wm_icon;
    }
    if (pcVar5 == (char *)0x0) {
      p_Var2 = pSVar1->free;
    }
    else {
      free(pcVar5);
      pSVar1->wm_icon = (char *)0x0;
      p_Var2 = pSVar1->free;
    }
    (*p_Var2)(pSVar1);
    current_video = (SDL_VideoDevice *)0x0;
  }
  return;
}



----------------------------------------

// Function: SDL_UpdateRects @ 0891c1dc

void SDL_UpdateRects(SDL_Surface *screen,int numrects,SDL_Rect *rects)

{
  SDL_VideoDevice *pSVar1;
  SDL_Color *pSVar2;
  SDL_Rect *pSVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  SDL_Palette *pSVar7;
  SDL_Color *pSVar8;
  _func_void_SDL_VideoDevice_ptr_int_SDL_Rect_ptr *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  pSVar1 = current_video;
  if (current_video->shadow != screen) {
    if (screen != current_video->screen) {
      return;
    }
    goto LAB_0891c2d8;
  }
  pSVar7 = screen->format->palette;
  if (pSVar7 == (SDL_Palette *)0x0) {
    pSVar8 = (SDL_Color *)0x0;
  }
  else {
    pSVar8 = (SDL_Color *)0x0;
    if ((current_video->screen->flags & 0x20000000) == 0) {
      pSVar2 = current_video->gammacols;
      pSVar8 = pSVar7->colors;
      if (pSVar2 == (SDL_Color *)0x0) {
        if (current_video->physpal == (SDL_Palette *)0x0) goto LAB_0891c3cc;
        pSVar2 = current_video->physpal->colors;
      }
      pSVar7->colors = pSVar2;
    }
  }
LAB_0891c3cc:
  if ((SDL_cursorstate & 0x11U) == 0x11) {
                    /* Unresolved local var: SDL_Palette * pal@[???]
                       Unresolved local var: SDL_Color * saved_colors@[???] */
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexP(SDL_cursorlock);
    }
    SDL_DrawCursor(current_video->shadow);
    if (0 < numrects) {
      iVar4 = 0;
      pSVar3 = rects;
      do {
        iVar4 = iVar4 + 1;
        SDL_LowerBlit(current_video->shadow,pSVar3,current_video->screen,pSVar3);
        pSVar3 = pSVar3 + 1;
      } while (numrects != iVar4);
    }
    SDL_EraseCursor(current_video->shadow);
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexV(SDL_cursorlock);
    }
  }
  else if (0 < numrects) {
    iVar4 = 0;
    pSVar3 = rects;
    do {
      iVar4 = iVar4 + 1;
      SDL_LowerBlit(current_video->shadow,pSVar3,current_video->screen,pSVar3);
      pSVar3 = pSVar3 + 1;
    } while (numrects != iVar4);
  }
  if (pSVar8 != (SDL_Color *)0x0) {
    pSVar7->colors = pSVar8;
  }
  screen = current_video->screen;
LAB_0891c2d8:
  if (screen->offset == 0) {
    UNRECOVERED_JUMPTABLE = pSVar1->UpdateRects;
  }
  else {
    if (0 < numrects) {
      iVar5 = pSVar1->offset_x;
      iVar6 = pSVar1->offset_y;
      iVar4 = 0;
      pSVar3 = rects;
      do {
        iVar4 = iVar4 + 1;
        pSVar3->x = (short)iVar5 + pSVar3->x;
        pSVar3->y = (short)iVar6 + pSVar3->y;
        pSVar3 = pSVar3 + 1;
      } while (numrects != iVar4);
      (*pSVar1->UpdateRects)(pSVar1,numrects,rects);
      iVar6 = pSVar1->offset_y;
      iVar5 = pSVar1->offset_x;
      iVar4 = 0;
      do {
        iVar4 = iVar4 + 1;
        rects->x = rects->x - (short)iVar5;
        rects->y = rects->y - (short)iVar6;
        rects = rects + 1;
      } while (numrects != iVar4);
      return;
    }
    UNRECOVERED_JUMPTABLE = pSVar1->UpdateRects;
  }
                    /* WARNING: Could not recover jumptable at 0x0891c454. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(pSVar1,numrects,rects);
  return;
}



----------------------------------------

// Function: SDL_UpdateRect @ 0891c478

void SDL_UpdateRect(SDL_Surface *screen,Sint32 x,Sint32 y,Uint32 w,Uint32 h)

{
  Uint32 UVar1;
  int in_t0;
  SDL_Rect local_10;
  
  if (screen != (SDL_Surface *)0x0) {
                    /* Unresolved local var: SDL_Rect rect@[???] */
    if (w == 0) {
      UVar1 = screen->w;
      w = UVar1;
    }
    else {
      UVar1 = screen->w;
    }
    if (in_t0 == 0) {
      in_t0 = screen->h;
    }
    if (((int)(w + x) <= (int)UVar1) && (in_t0 + y <= screen->h)) {
      local_10.x = (Sint16)x;
      local_10.y = (Sint16)y;
      local_10.w = (Uint16)w;
      local_10.h = (Uint16)in_t0;
      SDL_UpdateRects(screen,1,&local_10);
    }
  }
  return;
}



----------------------------------------

// Function: SDL_SetPalette @ 0891c4ec

int SDL_SetPalette(SDL_Surface *screen,int which,SDL_Color *colors,int firstcolor,int ncolors)

{
  bool bVar1;
  SDL_PixelFormat *pSVar2;
  SDL_Palette *pSVar3;
  SDL_Color *pSVar4;
  Uint16 *pUVar5;
  int in_t0;
  SDL_VideoDevice *pSVar6;
  SDL_Palette *pSVar7;
  int iVar8;
  size_t nbytes;
  SDL_Color aSStackY_430 [4];
  Uint32 in_stack_fffffbe0;
  uint local_30;
  
                    /* Unresolved local var: SDL_Palette * pal@[???]
                       Unresolved local var: int gotall@[???]
                       Unresolved local var: int palsize@[???] */
  if (current_video == (SDL_VideoDevice *)0x0) {
    return 0;
  }
  if (current_video->visible == screen) {
    if ((screen->flags & 0x20000000) == 0) {
      which = which | 3;
      goto LAB_0891c544;
    }
    pSVar2 = screen->format;
  }
  else {
    which = which & 0xfffffffd;
LAB_0891c544:
    pSVar2 = screen->format;
  }
  pSVar7 = pSVar2->palette;
  if (pSVar7 == (SDL_Palette *)0x0) {
    return 0;
  }
  iVar8 = (1 << (pSVar2->BitsPerPixel & 0x1f)) - firstcolor;
  bVar1 = in_t0 <= iVar8;
  if (!bVar1) {
    in_t0 = iVar8;
  }
  local_30 = (uint)bVar1;
  if ((which & 1U) != 0) {
                    /* Unresolved local var: SDL_Palette * pal@[???]
                       Unresolved local var: SDL_Palette * vidpal@[???] */
    if (colors != pSVar7->colors + firstcolor) {
      memcpy(pSVar7->colors + firstcolor,colors,in_t0 << 2);
    }
    pSVar3 = current_video->screen->format->palette;
    if ((screen == current_video->shadow) && (pSVar3 != (SDL_Palette *)0x0)) {
      memcpy(pSVar3->colors + firstcolor,colors,in_t0 << 2);
    }
    SDL_FormatChanged(screen);
  }
  if ((which & 2U) == 0) {
    return local_30;
  }
                    /* Unresolved local var: SDL_VideoDevice * video@[???] */
  if (current_video == (SDL_VideoDevice *)0x0) {
    return local_30;
  }
  if (current_video->physpal == (SDL_Palette *)0x0) {
    pSVar6 = current_video;
    if ((which & 1U) == 0) {
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: SDL_Palette * pp@[???] */
      pSVar3 = malloc(8);
      if (pSVar3 == (SDL_Palette *)0x0) {
        return 0;
      }
      iVar8 = pSVar7->ncolors;
      nbytes = iVar8 << 2;
      current_video->physpal = pSVar3;
      pSVar3->ncolors = iVar8;
      pSVar4 = malloc(nbytes);
      pSVar3->colors = pSVar4;
      if (pSVar4 == (SDL_Color *)0x0) {
        return 0;
      }
      memcpy(pSVar4,pSVar7->colors,nbytes);
      pSVar6 = current_video;
      if (current_video->physpal != (SDL_Palette *)0x0) {
        pSVar4 = current_video->physpal->colors;
        goto LAB_0891c5dc;
      }
    }
  }
  else {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: int gotall@[???] */
    pSVar4 = current_video->physpal->colors;
LAB_0891c5dc:
    pSVar6 = current_video;
    memcpy(pSVar4 + firstcolor,colors,in_t0 << 2);
  }
  if (screen == current_video->shadow) {
    if ((current_video->screen->flags & 0x20000000) != 0) {
                    /* Unresolved local var: SDL_Color[256] gcolors@[???] */
      pUVar5 = pSVar6->gamma;
      goto LAB_0891c668;
    }
    if (current_video->screen == screen->map->dst) {
      SDL_InvalidateMap(screen->map);
      pUVar5 = pSVar6->gamma;
    }
    else {
      pUVar5 = pSVar6->gamma;
    }
    if (pUVar5 != (Uint16 *)0x0) {
      if (pSVar6->gammacols == (SDL_Color *)0x0) {
                    /* Unresolved local var: SDL_Palette * pp@[???] */
        pSVar7 = pSVar6->physpal;
        if (pSVar7 == (SDL_Palette *)0x0) {
          pSVar7 = screen->format->palette;
        }
        pSVar4 = malloc(pSVar7->ncolors << 2);
        pSVar6->gammacols = pSVar4;
        SDL_ApplyGamma(pSVar6->gamma,pSVar7->colors,pSVar4,pSVar7->ncolors);
      }
      else {
        SDL_ApplyGamma(pUVar5,colors,pSVar6->gammacols + firstcolor,in_t0);
      }
    }
    SDL_UpdateRect(screen,0,0,0,in_stack_fffffbe0);
  }
  if (screen != current_video->screen) {
    return local_30;
  }
  pUVar5 = pSVar6->gamma;
LAB_0891c668:
  if (pUVar5 != (Uint16 *)0x0) {
    SDL_ApplyGamma(pUVar5,colors,aSStackY_430,in_t0);
    colors = aSStackY_430;
  }
  iVar8 = (*pSVar6->SetColors)(pSVar6,firstcolor,in_t0,colors);
  SDL_CursorPaletteChanged();
  if (iVar8 != 0) {
    return local_30;
  }
  return 0;
}



----------------------------------------

// Function: SDL_SetColors @ 0891c824

int SDL_SetColors(SDL_Surface *screen,SDL_Color *colors,int firstcolor,int ncolors)

{
  int iVar1;
  int in_stack_00000010;
  
  iVar1 = SDL_SetPalette(screen,3,colors,firstcolor,in_stack_00000010);
  return iVar1;
}



----------------------------------------

// Function: SDL_Flip @ 0891c83c

int SDL_Flip(SDL_Surface *screen)

{
  SDL_VideoDevice *pSVar1;
  int iVar2;
  SDL_Color *pSVar3;
  SDL_Surface *src;
  Uint32 unaff_s2;
  SDL_Palette *pSVar4;
  SDL_Color *pSVar5;
  SDL_Rect local_20;
  
  pSVar1 = current_video;
                    /* Unresolved local var: SDL_VideoDevice * video@[???] */
  src = current_video->shadow;
  if (src != screen) goto LAB_0891c86c;
                    /* Unresolved local var: SDL_Rect rect@[???]
                       Unresolved local var: SDL_Palette * pal@[???]
                       Unresolved local var: SDL_Color * saved_colors@[???] */
  pSVar4 = screen->format->palette;
  if (pSVar4 == (SDL_Palette *)0x0) {
    pSVar5 = (SDL_Color *)0x0;
  }
  else {
    pSVar5 = (SDL_Color *)0x0;
    if ((current_video->screen->flags & 0x20000000) == 0) {
      pSVar3 = current_video->gammacols;
      pSVar5 = pSVar4->colors;
      if (pSVar3 == (SDL_Color *)0x0) {
        if (current_video->physpal == (SDL_Palette *)0x0) goto LAB_0891c918;
        pSVar3 = current_video->physpal->colors;
      }
      pSVar4->colors = pSVar3;
    }
  }
LAB_0891c918:
  local_20.h = (Uint16)src->h;
  local_20.w = (Uint16)src->w;
  local_20.x = 0;
  local_20.y = 0;
  if ((SDL_cursorstate & 0x11U) == 0x11) {
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexP(SDL_cursorlock);
    }
    SDL_DrawCursor(current_video->shadow);
    SDL_LowerBlit(current_video->shadow,&local_20,current_video->screen,&local_20);
    SDL_EraseCursor(current_video->shadow);
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexV(SDL_cursorlock);
    }
  }
  else {
    SDL_LowerBlit(src,&local_20,pSVar1->screen,&local_20);
  }
  if (pSVar5 != (SDL_Color *)0x0) {
    pSVar4->colors = pSVar5;
  }
  screen = current_video->screen;
LAB_0891c86c:
  if ((screen->flags & 0x40000000) == 0) {
    SDL_UpdateRect(screen,0,0,0,unaff_s2);
    return 0;
  }
                    /* Unresolved local var: SDL_VideoDevice * this@[???] */
  iVar2 = (*pSVar1->FlipHWSurface)(current_video,current_video->screen);
  return iVar2;
}



----------------------------------------

// Function: SDL_DisplayFormat @ 0891c9e8

SDL_Surface * SDL_DisplayFormat(SDL_Surface *surface)

{
  SDL_Surface *pSVar1;
  uint uVar2;
  
                    /* Unresolved local var: Uint32 flags@[???] */
  pSVar1 = current_video->visible;
  if (pSVar1 != (SDL_Surface *)0x0) {
    uVar2 = 0;
    if ((pSVar1->flags & 1) != 0) {
      uVar2 = (&current_video->info)->blit_hw;
    }
    pSVar1 = SDL_ConvertSurface(surface,pSVar1->format,uVar2 | surface->flags & 0x13000);
    return pSVar1;
  }
  SDL_SetError("No video mode has been set");
  return (SDL_Surface *)0x0;
}



----------------------------------------

// Function: SDL_DisplayFormatAlpha @ 0891ca64

SDL_Surface * SDL_DisplayFormatAlpha(SDL_Surface *surface)

{
  byte bVar1;
  SDL_Surface *pSVar2;
  SDL_PixelFormat *pSVar3;
  Uint32 Rmask;
  Uint32 Bmask;
  Uint32 in_stack_00000000;
  
                    /* Unresolved local var: SDL_PixelFormat * vf@[???]
                       Unresolved local var: SDL_PixelFormat * format@[???]
                       Unresolved local var: SDL_Surface * converted@[???]
                       Unresolved local var: Uint32 flags@[???]
                       Unresolved local var: Uint32 amask@[???]
                       Unresolved local var: Uint32 rmask@[???]
                       Unresolved local var: Uint32 gmask@[???]
                       Unresolved local var: Uint32 bmask@[???] */
  if (current_video->visible == (SDL_Surface *)0x0) {
    SDL_SetError("No video mode has been set");
    return (SDL_Surface *)0x0;
  }
  pSVar3 = current_video->visible->format;
  bVar1 = pSVar3->BytesPerPixel;
  if (bVar1 == 2) {
    Rmask = 0xff0000;
    if (pSVar3->Rmask != 0x1f) goto LAB_0891caac;
    if (pSVar3->Bmask != 0xf800) {
      if (pSVar3->Bmask == 0x7c00) {
        Rmask = 0xff;
        Bmask = 0xff0000;
      }
      else {
        Bmask = 0xff;
      }
      goto LAB_0891cab4;
    }
  }
  else {
    if ((bVar1 < 2) || (Rmask = 0xff0000, 4 < bVar1)) {
LAB_0891caac:
      Rmask = 0xff0000;
      Bmask = 0xff;
      goto LAB_0891cab4;
    }
    Bmask = 0xff;
    if ((pSVar3->Rmask != 0xff) || (pSVar3->Bmask != 0xff0000)) goto LAB_0891cab4;
  }
  Rmask = 0xff;
  Bmask = 0xff0000;
LAB_0891cab4:
  pSVar3 = SDL_AllocFormat(0x20,Rmask,0xff00,Bmask,in_stack_00000000);
  pSVar2 = SDL_ConvertSurface(surface,pSVar3,
                              current_video->visible->flags & 1 | surface->flags & 0x12000);
  SDL_FreeFormat(pSVar3);
  return pSVar2;
}



----------------------------------------

// Function: SDL_SetVideoMode @ 0891cb98

/* WARNING: Removing unreachable block (ram,0x0891d0b8) */
/* WARNING: Removing unreachable block (ram,0x0891d494) */
/* WARNING: Removing unreachable block (ram,0x0891d0e4) */

SDL_Surface * SDL_SetVideoMode(int width,int height,int bpp,Uint32 flags)

{
  byte bVar1;
  ushort uVar2;
  bool bVar3;
  SDL_VideoDevice *pSVar4;
  SDL_VideoDevice *pSVar5;
  SDL_VideoDevice *pSVar6;
  uint uVar7;
  SDL_Palette *pSVar8;
  SDL_GrabMode mode;
  _func_SDL_Surface_ptr_SDL_VideoDevice_ptr_SDL_Surface_ptr_int_int_int_Uint32 *p_Var9;
  SDL_Surface *surface;
  int iVar10;
  SDL_Palette *pSVar11;
  Uint32 color;
  _func_void_GLenum *p_Var12;
  _func_void_GLenum_GLuint *p_Var13;
  _func_void_GLenum_GLenum *p_Var14;
  _func_void_GLfloat_GLfloat_GLfloat_GLfloat *p_Var15;
  _func_void_GLenum_GLint_GLenum_GLint_GLint_GLsizei_GLint *p_Var16;
  _func_void *p_Var17;
  _func_void_GLsizei_GLuint_ptr *p_Var18;
  _func_GLubyte_ptr_GLenum *p_Var19;
  _func_void_GLdouble_GLdouble_GLdouble_GLdouble_GLdouble_GLdouble *p_Var20;
  _func_void_GLenum_GLint *p_Var21;
  _func_void_GLbitfield *p_Var22;
  _func_void_GLfloat_GLfloat *p_Var23;
  _func_void_GLenum_GLenum_GLfloat *p_Var24;
  _func_void_GLenum_GLint_GLint_GLsizei_GLsizei_GLint_GLenum_GLenum_GLvoid_ptr *p_Var25;
  _func_void_GLenum_GLenum_GLint *p_Var26;
  _func_void_GLenum_GLint_GLint_GLint_GLsizei_GLsizei_GLenum_GLenum_GLvoid_ptr *p_Var27;
  _func_void_GLint_GLint *p_Var28;
  _func_void_GLint_GLint_GLsizei_GLsizei *p_Var29;
  SDL_Rect **ppSVar30;
  GLubyte *pGVar31;
  char *pcVar32;
  SItype SVar33;
  SDL_Rect *pSVar34;
  SDL_Surface *pSVar35;
  SDL_Color *aptr;
  SDL_Rect **ppSVar36;
  uint uVar37;
  GLint GVar38;
  int iVar39;
  int iVar40;
  SDL_PixelFormat *pSVar41;
  uint uVar42;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  int iVar43;
  SDL_Palette *local_60;
  undefined4 local_5c;
  Uint32 in_stack_ffffffa8;
  Uint32 in_stack_ffffffac;
  Uint32 in_stack_ffffffb0;
  Uint32 in_stack_ffffffb4;
  GLvoid *in_stack_ffffffb8;
  uint local_30;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Surface * prev_mode@[???]
                       Unresolved local var: SDL_Surface * mode@[???]
                       Unresolved local var: int video_w@[???]
                       Unresolved local var: int video_h@[???]
                       Unresolved local var: int video_bpp@[???]
                       Unresolved local var: int is_opengl@[???]
                       Unresolved local var: SDL_GrabMode saved_grab@[???] */
  if ((current_video == (SDL_VideoDevice *)0x0) && (iVar10 = SDL_Init(0x100020), iVar10 < 0)) {
    return (SDL_Surface *)0x0;
  }
  pSVar4 = current_video;
  local_30 = bpp;
  if (bpp == 0) {
    flags = flags | 0x10000000;
    local_30 = (uint)current_video->screen->format->BitsPerPixel;
  }
                    /* Unresolved local var: int table@[???]
                       Unresolved local var: int b@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int supported@[???]
                       Unresolved local var: int native_bpp@[???]
                       Unresolved local var: SDL_PixelFormat format@[???]
                       Unresolved local var: SDL_Rect * * sizes@[???] */
  if (0x18 < local_30 - 8) {
    SDL_SetError("Invalid bits per pixel (range is {8...32})");
    return (SDL_Surface *)0x0;
  }
  if ((width < 1) || (height < 1)) {
    SDL_SetError("Invalid width or height");
    return (SDL_Surface *)0x0;
  }
  uVar7 = SDL_VideoModeOK(width,height,local_30,flags);
  pSVar5 = current_video;
  uVar37 = width;
  uVar42 = height;
  if ((local_30 != uVar7) && ((int)uVar7 < 1)) {
    local_60 = (SDL_Palette *)0x0;
    local_5c._0_1_ = '\0';
    local_5c._1_1_ = '\0';
    local_5c._2_1_ = '\0';
    local_5c._3_1_ = '\0';
    in_stack_ffffffa8 = 0;
    in_stack_ffffffac = 0;
    in_stack_ffffffb0 = 0;
    in_stack_ffffffb4 = 0;
    in_stack_ffffffb8 = (GLvoid *)0x0;
    iVar43 = 0;
    iVar10 = (int)(local_30 + 7) / 8 + -1;
    SDL_closest_depths[iVar10][0] = (Uint8)local_30;
    SDL_closest_depths[iVar10][7] = pSVar5->screen->format->BitsPerPixel;
    do {
      if (SDL_closest_depths[iVar10][iVar43] == '\0') {
        SDL_SetError("No video mode large enough for %dx%d",width,height);
        return (SDL_Surface *)0x0;
      }
      local_5c._0_1_ = SDL_closest_depths[iVar10][iVar43];
      ppSVar30 = SDL_ListModes((SDL_PixelFormat *)&local_60,flags);
                    /* Unresolved local var: int best@[???] */
      if ((ppSVar30 != (SDL_Rect **)0x0) && (pSVar34 = *ppSVar30, pSVar34 != (SDL_Rect *)0x0)) {
        iVar39 = 0;
        bVar3 = false;
        iVar40 = 0;
        ppSVar36 = ppSVar30;
        do {
          if ((int)(uint)pSVar34->w < width) {
            pSVar34 = ppSVar36[1];
          }
          else if ((int)(uint)pSVar34->h < height) {
            pSVar34 = ppSVar36[1];
          }
          else {
            if (((uint)pSVar34->w <= (uint)ppSVar30[iVar40]->w) ||
               ((uint)pSVar34->h <= (uint)ppSVar30[iVar40]->h)) {
              bVar3 = true;
              iVar40 = iVar39;
            }
            pSVar34 = ppSVar36[1];
          }
          iVar39 = iVar39 + 1;
          ppSVar36 = ppSVar36 + 1;
        } while (pSVar34 != (SDL_Rect *)0x0);
        if (bVar3) {
          uVar7 = (uint)SDL_closest_depths[iVar10][iVar43];
          uVar37 = (uint)ppSVar30[iVar40]->w;
          uVar42 = (uint)ppSVar30[iVar40]->h;
          break;
        }
      }
      iVar43 = iVar43 + 1;
    } while( true );
  }
  if (8 < (int)uVar7) {
    flags = flags & 0xdfffffff;
  }
  if ((flags & 0x40000000) != 0) {
    flags = flags | 1;
  }
  iVar10 = flags << 0x1e;
  if (iVar10 < 0) {
    flags = flags & 0xbffffffe;
  }
  SDL_ResetKeyboard();
  SDL_ResetMouse();
  pSVar5 = current_video;
  if (current_video->visible != (SDL_Surface *)0x0) {
    current_video->visible = (SDL_Surface *)0x0;
  }
  pSVar35 = pSVar5->shadow;
  if (pSVar35 == (SDL_Surface *)0x0) {
    pSVar8 = pSVar4->physpal;
  }
  else {
                    /* Unresolved local var: SDL_Surface * ready_to_go@[???] */
    pSVar5->shadow = (SDL_Surface *)0x0;
    SDL_FreeSurface(pSVar35);
    pSVar8 = pSVar4->physpal;
  }
  if (pSVar8 == (SDL_Palette *)0x0) {
    aptr = pSVar4->gammacols;
  }
  else {
    free(pSVar8->colors);
    free(pSVar4->physpal);
    pSVar4->physpal = (SDL_Palette *)0x0;
    aptr = pSVar4->gammacols;
  }
  if (aptr != (SDL_Color *)0x0) {
    free(aptr);
    pSVar4->gammacols = (SDL_Color *)0x0;
  }
  mode = SDL_WM_GrabInputOff();
  pSVar35 = current_video->screen;
  if (SDL_cursorlock != (SDL_mutex *)0x0) {
    SDL_mutexP(SDL_cursorlock);
  }
  p_Var9 = pSVar4->SetVideoMode;
  current_video->screen = (SDL_Surface *)0x0;
  surface = (*p_Var9)(pSVar4,pSVar35,uVar37,uVar42,in_stack_ffffffa8,in_stack_ffffffac);
  if (surface == (SDL_Surface *)0x0) {
LAB_0891d170:
    current_video->screen = pSVar35;
  }
  else {
    SDL_PrivateResize(surface->w,surface->h);
    if (iVar10 < 0) {
      if ((surface->flags & 2) == 0) {
        SDL_SetError("OpenGL not available");
        surface = (SDL_Surface *)0x0;
        goto LAB_0891d170;
      }
      current_video->screen = surface;
    }
    else {
      iVar10 = surface->w;
      current_video->screen = surface;
      if ((iVar10 < width) || (surface->h < height)) {
        SDL_SetError("Video mode smaller than requested");
        return (SDL_Surface *)0x0;
      }
      pSVar41 = surface->format;
      if (pSVar41->palette == (SDL_Palette *)0x0) {
        pSVar4->offset_x = 0;
      }
      else {
                    /* Unresolved local var: SDL_PixelFormat * vf@[???] */
        SDL_DitherColors(pSVar41->palette->colors,(uint)pSVar41->BitsPerPixel);
        (*pSVar4->SetColors)(pSVar4,0,pSVar41->palette->ncolors,pSVar41->palette->colors);
        pSVar4->offset_x = 0;
      }
      pSVar4->offset_y = 0;
      surface->offset = 0;
      SDL_SetClipRect(surface,(SDL_Rect *)0x0);
      color = SDL_MapRGB(surface->format,'\0','\0','\0');
                    /* Unresolved local var: Uint32 black@[???] */
      SDL_FillRect(surface,(SDL_Rect *)0x0,color);
      if ((surface->flags & 0x40000001) == 0x40000001) {
        SDL_Flip(surface);
        SDL_FillRect(surface,(SDL_Rect *)0x0,color);
      }
      SDL_Flip(surface);
      iVar10 = (surface->w - width) / 2;
      uVar2 = surface->pitch;
      pSVar41 = surface->format;
      pSVar4->offset_x = iVar10;
      iVar43 = (surface->h - height) / 2;
      pSVar4->offset_y = iVar43;
      bVar1 = pSVar41->BytesPerPixel;
      surface->w = width;
      surface->h = height;
      surface->offset = iVar43 * (uint)uVar2 + (uint)bVar1 * iVar10;
      SDL_SetClipRect(surface,(SDL_Rect *)0x0);
    }
  }
  SDL_ResetCursor();
  if (SDL_cursorlock != (SDL_mutex *)0x0) {
    SDL_mutexV(SDL_cursorlock);
  }
  if (surface == (SDL_Surface *)0x0) {
    return (SDL_Surface *)0x0;
  }
  if ((pSVar4->info).wm_available == 0) {
    surface->flags = surface->flags | 0x20;
  }
  SDL_SetCursor((SDL_Cursor *)0x0);
  if (pSVar4->UpdateMouse != (_func_void_SDL_VideoDevice_ptr *)0x0) {
    (*pSVar4->UpdateMouse)(pSVar4);
  }
  SDL_WM_GrabInput(mode);
  SDL_GetRelativeMouseState((int *)0x0,(int *)0x0);
  if ((flags & 10) != 0) {
    p_Var12 = SDL_GL_GetProcAddress("glBegin");
    pSVar4->glBegin = p_Var12;
    if (p_Var12 == (_func_void_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glBegin");
      return (SDL_Surface *)0x0;
    }
    p_Var13 = SDL_GL_GetProcAddress("glBindTexture");
    pSVar4->glBindTexture = p_Var13;
    if (p_Var13 == (_func_void_GLenum_GLuint *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glBindTexture");
      return (SDL_Surface *)0x0;
    }
    p_Var14 = SDL_GL_GetProcAddress("glBlendFunc");
    pSVar4->glBlendFunc = p_Var14;
    if (p_Var14 == (_func_void_GLenum_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glBlendFunc");
      return (SDL_Surface *)0x0;
    }
    p_Var15 = SDL_GL_GetProcAddress("glColor4f");
    pSVar4->glColor4f = p_Var15;
    if (p_Var15 == (_func_void_GLfloat_GLfloat_GLfloat_GLfloat *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glColor4f");
      return (SDL_Surface *)0x0;
    }
    p_Var16 = SDL_GL_GetProcAddress("glCopyTexImage1D");
    pSVar4->glCopyTexImage1D = p_Var16;
    if (p_Var16 == (_func_void_GLenum_GLint_GLenum_GLint_GLint_GLsizei_GLint *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glCopyTexImage1D");
      return (SDL_Surface *)0x0;
    }
    p_Var12 = SDL_GL_GetProcAddress("glDisable");
    pSVar4->glDisable = p_Var12;
    if (p_Var12 == (_func_void_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glDisable");
      return (SDL_Surface *)0x0;
    }
    p_Var12 = SDL_GL_GetProcAddress("glEnable");
    pSVar4->glEnable = p_Var12;
    if (p_Var12 == (_func_void_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glEnable");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glEnd");
    pSVar4->glEnd = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glEnd");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glFlush");
    pSVar4->glFlush = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glFlush");
      return (SDL_Surface *)0x0;
    }
    p_Var18 = SDL_GL_GetProcAddress("glGenTextures");
    pSVar4->glGenTextures = p_Var18;
    if (p_Var18 == (_func_void_GLsizei_GLuint_ptr *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glGenTextures");
      return (SDL_Surface *)0x0;
    }
    p_Var19 = SDL_GL_GetProcAddress("glGetString");
    pSVar4->glGetString = p_Var19;
    if (p_Var19 == (_func_GLubyte_ptr_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glGetString");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glLoadIdentity");
    pSVar4->glLoadIdentity = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glLoadIdentity");
      return (SDL_Surface *)0x0;
    }
    p_Var12 = SDL_GL_GetProcAddress("glMatrixMode");
    pSVar4->glMatrixMode = p_Var12;
    if (p_Var12 == (_func_void_GLenum *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glMatrixMode");
      return (SDL_Surface *)0x0;
    }
    p_Var20 = SDL_GL_GetProcAddress("glOrtho");
    pSVar4->glOrtho = p_Var20;
    if (p_Var20 == (_func_void_GLdouble_GLdouble_GLdouble_GLdouble_GLdouble_GLdouble *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glOrtho");
      return (SDL_Surface *)0x0;
    }
    p_Var21 = SDL_GL_GetProcAddress("glPixelStorei");
    pSVar4->glPixelStorei = p_Var21;
    if (p_Var21 == (_func_void_GLenum_GLint *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPixelStorei");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glPopAttrib");
    pSVar4->glPopAttrib = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPopAttrib");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glPopClientAttrib");
    pSVar4->glPopClientAttrib = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPopClientAttrib");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glPopMatrix");
    pSVar4->glPopMatrix = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPopMatrix");
      return (SDL_Surface *)0x0;
    }
    p_Var22 = SDL_GL_GetProcAddress("glPushAttrib");
    pSVar4->glPushAttrib = p_Var22;
    if (p_Var22 == (_func_void_GLbitfield *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPushAttrib");
      return (SDL_Surface *)0x0;
    }
    p_Var22 = SDL_GL_GetProcAddress("glPushClientAttrib");
    pSVar4->glPushClientAttrib = p_Var22;
    if (p_Var22 == (_func_void_GLbitfield *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPushClientAttrib");
      return (SDL_Surface *)0x0;
    }
    p_Var17 = SDL_GL_GetProcAddress("glPushMatrix");
    pSVar4->glPushMatrix = p_Var17;
    if (p_Var17 == (_func_void *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glPushMatrix");
      return (SDL_Surface *)0x0;
    }
    p_Var23 = SDL_GL_GetProcAddress("glTexCoord2f");
    pSVar4->glTexCoord2f = p_Var23;
    if (p_Var23 == (_func_void_GLfloat_GLfloat *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glTexCoord2f");
      return (SDL_Surface *)0x0;
    }
    p_Var24 = SDL_GL_GetProcAddress("glTexEnvf");
    pSVar4->glTexEnvf = p_Var24;
    if (p_Var24 == (_func_void_GLenum_GLenum_GLfloat *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glTexEnvf");
      return (SDL_Surface *)0x0;
    }
    p_Var25 = SDL_GL_GetProcAddress("glTexImage2D");
    pSVar4->glTexImage2D = p_Var25;
    if (p_Var25 ==
        (_func_void_GLenum_GLint_GLint_GLsizei_GLsizei_GLint_GLenum_GLenum_GLvoid_ptr *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glTexImage2D");
      return (SDL_Surface *)0x0;
    }
    p_Var26 = SDL_GL_GetProcAddress("glTexParameteri");
    pSVar4->glTexParameteri = p_Var26;
    if (p_Var26 == (_func_void_GLenum_GLenum_GLint *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glTexParameteri");
      return (SDL_Surface *)0x0;
    }
    p_Var27 = SDL_GL_GetProcAddress("glTexSubImage2D");
    pSVar4->glTexSubImage2D = p_Var27;
    if (p_Var27 ==
        (_func_void_GLenum_GLint_GLint_GLint_GLsizei_GLsizei_GLenum_GLenum_GLvoid_ptr *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glTexSubImage2D");
      return (SDL_Surface *)0x0;
    }
    p_Var28 = SDL_GL_GetProcAddress("glVertex2i");
    pSVar4->glVertex2i = p_Var28;
    if (p_Var28 == (_func_void_GLint_GLint *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glVertex2i");
      return (SDL_Surface *)0x0;
    }
    p_Var29 = SDL_GL_GetProcAddress("glViewport");
    pSVar4->glViewport = p_Var29;
    if (p_Var29 == (_func_void_GLint_GLint_GLsizei_GLsizei *)0x0) {
      SDL_SetError("Couldn\'t load GL function: %s\n","glViewport");
      return (SDL_Surface *)0x0;
    }
  }
  if ((((pSVar4->screen->flags & 2) != 0) &&
      (pSVar4->GL_MakeCurrent != (_func_int_SDL_VideoDevice_ptr *)0x0)) &&
     (iVar10 = (*pSVar4->GL_MakeCurrent)(pSVar4), iVar10 < 0)) {
    return (SDL_Surface *)0x0;
  }
  if ((flags & 10) == 10) {
    if (local_30 == 0x10) {
      pGVar31 = (*pSVar4->glGetString)(0x1f03);
      pcVar32 = strstr((char *)pGVar31,"GL_EXT_packed_pixels");
      if (pcVar32 == (char *)0x0) {
        pGVar31 = (*pSVar4->glGetString)(0x1f02);
        atof((char *)pGVar31);
        SVar33 = __gedf2(in_f12_13,in_f14_15);
        if (SVar33 < 0) goto LAB_0891d67c;
      }
      pSVar5 = current_video;
      pSVar4->is_32bit = 0;
      pSVar35 = SDL_CreateRGBSurface
                          (flags,width,height,0x10,in_stack_ffffffa8,in_stack_ffffffac,
                           in_stack_ffffffb0,in_stack_ffffffb4);
      pSVar5->screen = pSVar35;
    }
    else {
LAB_0891d67c:
      pSVar5 = current_video;
      pSVar4->is_32bit = 1;
      pSVar35 = SDL_CreateRGBSurface
                          (flags,width,height,0x20,in_stack_ffffffa8,in_stack_ffffffac,
                           in_stack_ffffffb0,in_stack_ffffffb4);
      pSVar5->screen = pSVar35;
    }
    if (current_video->screen == (SDL_Surface *)0x0) {
      return (SDL_Surface *)0x0;
    }
    current_video->screen->flags = surface->flags | 10;
    SDL_FreeSurface(surface);
    pSVar35 = current_video->screen;
    memset(pSVar35->pixels,0xff,(uint)pSVar35->pitch * pSVar35->h);
    (*pSVar4->glGenTextures)(1,&pSVar4->texture);
    (*pSVar4->glBindTexture)(0xde1,pSVar4->texture);
    if (pSVar4->is_32bit == 0) {
      GVar38 = 0x1907;
    }
    else {
      GVar38 = 0x1908;
    }
    (*pSVar4->glTexImage2D)
              (0xde1,0,GVar38,0x100,in_stack_ffffffa8,in_stack_ffffffac,in_stack_ffffffb0,
               in_stack_ffffffb4,in_stack_ffffffb8);
    pSVar4->UpdateRects = SDL_GL_UpdateRectsLock;
  }
  pSVar5 = current_video;
  pSVar35 = current_video->screen;
  uVar37 = pSVar35->flags;
  if ((uVar37 & 2) != 0) {
    current_video->visible = pSVar35;
    goto LAB_0891cf40;
  }
  if (((((flags & 0x10000000) != 0) || (local_30 == pSVar35->format->BitsPerPixel)) &&
      (((flags & 0x20000000) == 0 || ((uVar37 & 0x20000000) != 0)))) &&
     (((flags & 1) != 0 || ((uVar37 & 1) == 0)))) {
    if ((flags & 0x40000000) == 0) {
      current_video->visible = pSVar35;
      goto LAB_0891cf40;
    }
    if ((uVar37 & 1) == 0) {
      current_video->visible = pSVar35;
      goto LAB_0891cf40;
    }
    if ((uVar37 & 0x40000000) != 0) {
      current_video->visible = pSVar35;
      goto LAB_0891cf40;
    }
  }
  pSVar35 = SDL_CreateRGBSurface
                      (0,pSVar35->w,pSVar35->h,local_30,in_stack_ffffffa8,in_stack_ffffffac,
                       in_stack_ffffffb0,in_stack_ffffffb4);
  pSVar6 = current_video;
  pSVar5->shadow = pSVar35;
  pSVar35 = pSVar6->shadow;
  if (pSVar35 != (SDL_Surface *)0x0) {
    pSVar8 = pSVar35->format->palette;
    if (pSVar8 != (SDL_Palette *)0x0) {
      pSVar41 = pSVar6->screen->format;
      pSVar35->flags = pSVar35->flags | 0x20000000;
      if (local_30 == pSVar41->BitsPerPixel) {
        pSVar11 = pSVar41->palette;
        memcpy(pSVar8->colors,pSVar11->colors,pSVar11->ncolors << 2);
      }
      else {
        SDL_DitherColors(pSVar8->colors,local_30);
      }
    }
    pSVar5 = current_video;
    if ((current_video->screen->flags & 0x10) != 0) {
      current_video->shadow->flags = current_video->shadow->flags | 0x10;
    }
    if ((pSVar5->screen->flags & 0x20) != 0) {
      pSVar5->shadow->flags = pSVar5->shadow->flags | 0x20;
    }
    if ((int)pSVar5->screen->flags < 0) {
      pSVar5->shadow->flags = pSVar5->shadow->flags | 0x80000000;
    }
    if ((pSVar5->screen->flags & 0x40000000) != 0) {
      pSVar5->shadow->flags = pSVar5->shadow->flags | 0x40000000;
    }
    if (pSVar5->shadow != (SDL_Surface *)0x0) {
      pSVar5->visible = pSVar5->shadow;
LAB_0891cf40:
      pSVar35 = current_video->visible;
      (pSVar4->info).vfmt = current_video->screen->format;
      return pSVar35;
    }
  }
  SDL_SetError("Couldn\'t create shadow surface");
  return (SDL_Surface *)0x0;
}



----------------------------------------

// Function: SDL_VideoDriverName @ 0891daac

char * SDL_VideoDriverName(char *namebuf,int maxlen)

{
  if (current_video != (SDL_VideoDevice *)0x0) {
    strncpy(namebuf,current_video->name,maxlen - 1);
    namebuf[maxlen + -1] = '\0';
    return namebuf;
  }
  return (char *)0x0;
}



----------------------------------------

// Function: SDL_VideoInit @ 0891db18

int SDL_VideoInit(char *driver_name,Uint32 flags)

{
  SDL_VideoDevice *pSVar1;
  SDL_VideoDevice *pSVar2;
  size_t n;
  int iVar3;
  SDL_VideoDevice *pSVar4;
  SDL_Surface *pSVar5;
  SDL_PixelFormat *pSVar6;
  char *__s;
  VideoBootStrap *pVVar7;
  VideoBootStrap **ppVVar8;
  int iVar9;
  SDL_Palette *local_48;
  uint local_44;
  undefined4 local_40;
  undefined4 local_3c;
  Uint32 Rmask;
  Uint32 Gmask;
  Uint32 Bmask;
  Uint32 Amask;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: int index@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: SDL_PixelFormat vformat@[???]
                       Unresolved local var: Uint32 video_flags@[???] */
  if (current_video != (SDL_VideoDevice *)0x0) {
    SDL_VideoQuit();
  }
  if (driver_name == (char *)0x0) {
    pVVar7 = &PSP_bootstrap;
    ppVVar8 = bootstrap;
    pSVar4 = (SDL_VideoDevice *)0x0;
    iVar9 = 0;
    do {
      ppVVar8 = ppVVar8 + 1;
      iVar3 = (*pVVar7->available)();
      if ((iVar3 != 0) && (pSVar4 = (*pVVar7->create)(0), pSVar4 != (SDL_VideoDevice *)0x0))
      goto LAB_0891dbd0;
      pVVar7 = *ppVVar8;
      iVar9 = iVar9 + 1;
    } while (pVVar7 != (VideoBootStrap *)0x0);
LAB_0891dbc8:
    if (pSVar4 != (SDL_VideoDevice *)0x0) {
LAB_0891dbd0:
      current_video = pSVar4;
      pSVar4->name = bootstrap[iVar9]->name;
      *(undefined4 *)&pSVar4->info = 0;
      (pSVar4->gl_config).blue_size = 5;
      (pSVar4->gl_config).depth_size = 0x10;
      (pSVar4->gl_config).red_size = 5;
      (pSVar4->gl_config).green_size = 5;
      (pSVar4->gl_config).double_buffer = 1;
      (pSVar4->info).vfmt = (SDL_PixelFormat *)0x0;
      pSVar4->screen = (SDL_Surface *)0x0;
      pSVar4->shadow = (SDL_Surface *)0x0;
      pSVar4->visible = (SDL_Surface *)0x0;
      pSVar4->physpal = (SDL_Palette *)0x0;
      pSVar4->gammacols = (SDL_Color *)0x0;
      pSVar4->gamma = (Uint16 *)0x0;
      pSVar4->wm_title = (char *)0x0;
      pSVar4->wm_icon = (char *)0x0;
      pSVar4->offset_x = 0;
      pSVar4->offset_y = 0;
      (pSVar4->info).video_mem = 0;
      pSVar4->displayformatalphapixel = (SDL_PixelFormat *)0x0;
      (pSVar4->gl_config).driver_loaded = 0;
      (pSVar4->gl_config).dll_handle = (void *)0x0;
      (pSVar4->gl_config).alpha_size = 0;
      (pSVar4->gl_config).buffer_size = 0;
      (pSVar4->gl_config).stencil_size = 0;
      (pSVar4->gl_config).accum_red_size = 0;
      (pSVar4->gl_config).accum_green_size = 0;
      (pSVar4->gl_config).accum_blue_size = 0;
      (pSVar4->gl_config).accum_alpha_size = 0;
      (pSVar4->gl_config).stereo = 0;
      (pSVar4->gl_config).multisamplebuffers = 0;
      (pSVar4->gl_config).multisamplesamples = 0;
      local_48 = (SDL_Palette *)0x0;
      local_44 = 0;
      local_40._0_1_ = '\0';
      local_40._1_1_ = '\0';
      local_40._2_1_ = '\0';
      local_40._3_1_ = '\0';
      local_3c._0_1_ = '\0';
      local_3c._1_1_ = '\0';
      local_3c._2_2_ = 0;
      Rmask = 0;
      Gmask = 0;
      Bmask = 0;
      Amask = 0;
      iVar9 = (*pSVar4->VideoInit)(pSVar4,(SDL_PixelFormat *)&local_48);
      pSVar1 = current_video;
      if (-1 < iVar9) {
        pSVar5 = SDL_CreateRGBSurface(0,0,0,local_44 & 0xff,Rmask,Gmask,Bmask,Amask);
        pSVar2 = current_video;
        pSVar1->screen = pSVar5;
        pSVar5 = pSVar2->screen;
        if (pSVar5 != (SDL_Surface *)0x0) {
          pSVar6 = pSVar5->format;
          pSVar2->visible = (SDL_Surface *)0x0;
          (pSVar4->info).vfmt = pSVar6;
          iVar9 = SDL_StartEventLoop(flags);
          if (-1 < iVar9) {
            SDL_CursorInit(flags & 0x1000000);
            return 0;
          }
        }
      }
      SDL_VideoQuit();
      return -1;
    }
  }
  else {
    pVVar7 = &PSP_bootstrap;
    ppVVar8 = bootstrap;
    iVar9 = 0;
    do {
      ppVVar8 = ppVVar8 + 1;
      __s = pVVar7->name;
      n = strlen(__s);
      iVar3 = strncmp(__s,driver_name,n);
      if (iVar3 == 0) {
        iVar3 = (*pVVar7->available)();
        if (iVar3 != 0) {
          pSVar4 = (*pVVar7->create)(0);
          goto LAB_0891dbc8;
        }
        pVVar7 = *ppVVar8;
      }
      else {
        pVVar7 = *ppVVar8;
      }
      iVar9 = iVar9 + 1;
    } while (pVVar7 != (VideoBootStrap *)0x0);
  }
  SDL_SetError("No available video device");
  return -1;
}



----------------------------------------

// Function: SDL_DitherColors @ 0891dde8

void SDL_DitherColors(SDL_Color *colors,int bpp)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  
                    /* Unresolved local var: int i@[DW_OP_reg9(t1)] */
  if (bpp == 8) {
    uVar4 = 0;
    do {
                    /* Unresolved local var: int r@[???]
                       Unresolved local var: int g@[???]
                       Unresolved local var: int b@[???] */
      uVar2 = uVar4 & 0xe0;
      iVar1 = (uVar4 & 0x1c) << 3;
      uVar3 = uVar4 & 3 | (uVar4 & 3) << 2;
      uVar4 = uVar4 + 1;
      colors->r = (byte)((int)uVar2 >> 6) | (byte)uVar2 | (byte)((int)uVar2 >> 3);
      colors->g = (byte)(iVar1 >> 6) | (byte)iVar1 | (byte)(iVar1 >> 3);
      colors->b = (byte)uVar3 | (byte)(uVar3 << 4);
      colors = colors + 1;
    } while (uVar4 != 0x100);
  }
  return;
}



----------------------------------------

// Function: SDL_CalculatePitch @ 0891de5c

/* WARNING: Removing unreachable block (ram,0x0891decc) */
/* WARNING: Removing unreachable block (ram,0x0891dea8) */

Uint16 SDL_CalculatePitch(SDL_Surface *surface)

{
  Uint8 UVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: Uint16 pitch@[???] */
  UVar1 = surface->format->BitsPerPixel;
  uVar2 = (uint)surface->format->BytesPerPixel * surface->w;
  uVar3 = uVar2 & 0xffff;
  if (UVar1 == '\x01') {
    return (short)((uVar3 + 7) / 8) + 3U & 0xfffc;
  }
  if (UVar1 != '\x04') {
    return (short)uVar2 + 3U & 0xfffc;
  }
  return (short)((uVar3 + 1) / 2) + 3U & 0xfffc;
}



----------------------------------------

// Function: SDL_FindColor @ 0891dee4

Uint8 SDL_FindColor(SDL_Palette *pal,Uint8 r,Uint8 g,Uint8 b)

{
  byte bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  SDL_Color *pSVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  
                    /* Unresolved local var: uint smallest@[???]
                       Unresolved local var: uint distance@[???]
                       Unresolved local var: int rd@[???]
                       Unresolved local var: int gd@[???]
                       Unresolved local var: int bd@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 pixel@[???] */
  if (pal->ncolors < 1) {
    return '\0';
  }
  pSVar5 = pal->colors;
  uVar7 = 0xffffffff;
  uVar6 = 0;
  uVar8 = 0;
  bVar1 = pSVar5->r;
  while( true ) {
    iVar3 = (uint)pSVar5->g - (uint)g;
    iVar4 = (uint)pSVar5->b - (uint)b;
    uVar2 = ((uint)bVar1 - (uint)r) * ((uint)bVar1 - (uint)r) + iVar3 * iVar3 + iVar4 * iVar4;
    pSVar5 = pSVar5 + 1;
    if ((uVar2 < uVar7) && (uVar8 = uVar6 & 0xff, uVar7 = uVar2, uVar2 == 0)) break;
    uVar6 = uVar6 + 1;
    if (pal->ncolors == uVar6) {
      return (Uint8)uVar8;
    }
    bVar1 = pSVar5->r;
  }
  return (Uint8)uVar6;
}



----------------------------------------

// Function: SDL_MapRGB @ 0891df7c

Uint32 SDL_MapRGB(SDL_PixelFormat *format,Uint8 r,Uint8 g,Uint8 b)

{
  Uint8 UVar1;
  undefined3 extraout_var;
  
  if (format->palette != (SDL_Palette *)0x0) {
    UVar1 = SDL_FindColor(format->palette,r,g,b);
    return CONCAT31(extraout_var,UVar1);
  }
  return ((int)(uint)r >> (format->Rloss & 0x1f)) << (format->Rshift & 0x1f) |
         ((int)(uint)g >> (format->Gloss & 0x1f)) << (format->Gshift & 0x1f) |
         ((int)(uint)b >> (format->Bloss & 0x1f)) << (format->Bshift & 0x1f) | format->Amask;
}



----------------------------------------

// Function: SDL_MapRGBA @ 0891e00c

Uint32 SDL_MapRGBA(SDL_PixelFormat *format,Uint8 r,Uint8 g,Uint8 b,Uint8 a)

{
  Uint8 UVar1;
  undefined3 extraout_var;
  uint in_t0;
  
  if (format->palette != (SDL_Palette *)0x0) {
    UVar1 = SDL_FindColor(format->palette,r,g,b);
    return CONCAT31(extraout_var,UVar1);
  }
  return ((int)(uint)r >> (format->Rloss & 0x1f)) << (format->Rshift & 0x1f) |
         ((int)(uint)g >> (format->Gloss & 0x1f)) << (format->Gshift & 0x1f) |
         ((int)(uint)b >> (format->Bloss & 0x1f)) << (format->Bshift & 0x1f) |
         ((int)(in_t0 & 0xff) >> (format->Aloss & 0x1f)) << (format->Ashift & 0x1f) & format->Amask;
}



----------------------------------------

// Function: SDL_GetRGBA @ 0891e0b4

void SDL_GetRGBA(Uint32 pixel,SDL_PixelFormat *fmt,Uint8 *r,Uint8 *g,Uint8 *b,Uint8 *a)

{
  uint uVar1;
  Uint8 *in_t0;
  char *in_t1;
  
                    /* Unresolved local var: uint v@[???] */
  if (fmt->palette == (SDL_Palette *)0x0) {
    uVar1 = (pixel & fmt->Rmask) >> (fmt->Rshift & 0x1f);
    *r = (char)(uVar1 << (fmt->Rloss & 0x1f)) + (char)(uVar1 >> ((uint)fmt->Rloss * -2 + 8 & 0x1f));
    uVar1 = (pixel & fmt->Gmask) >> (fmt->Gshift & 0x1f);
    *g = (char)(uVar1 << (fmt->Gloss & 0x1f)) + (char)(uVar1 >> ((uint)fmt->Gloss * -2 + 8 & 0x1f));
    uVar1 = (pixel & fmt->Bmask) >> (fmt->Bshift & 0x1f);
    *in_t0 = (char)(uVar1 << (fmt->Bloss & 0x1f)) +
             (char)(uVar1 >> ((uint)fmt->Bloss * -2 + 8 & 0x1f));
    if (fmt->Amask != 0) {
      uVar1 = (pixel & fmt->Amask) >> (fmt->Ashift & 0x1f);
      *in_t1 = (char)(uVar1 << (fmt->Aloss & 0x1f)) +
               (char)(uVar1 >> ((uint)fmt->Aloss * -2 + 8 & 0x1f));
      return;
    }
  }
  else {
    *r = fmt->palette->colors[pixel].r;
    *g = fmt->palette->colors[pixel].g;
    *in_t0 = fmt->palette->colors[pixel].b;
  }
  *in_t1 = -1;
  return;
}



----------------------------------------

// Function: SDL_GetRGB @ 0891e1c8

void SDL_GetRGB(Uint32 pixel,SDL_PixelFormat *fmt,Uint8 *r,Uint8 *g,Uint8 *b)

{
  uint uVar1;
  Uint8 *in_t0;
  
                    /* Unresolved local var: uint v@[???] */
  if (fmt->palette != (SDL_Palette *)0x0) {
    *r = fmt->palette->colors[pixel].r;
    *g = fmt->palette->colors[pixel].g;
    *in_t0 = fmt->palette->colors[pixel].b;
    return;
  }
  uVar1 = (pixel & fmt->Rmask) >> (fmt->Rshift & 0x1f);
  *r = (char)(uVar1 << (fmt->Rloss & 0x1f)) + (char)(uVar1 >> ((uint)fmt->Rloss * -2 + 8 & 0x1f));
  uVar1 = (pixel & fmt->Gmask) >> (fmt->Gshift & 0x1f);
  *g = (char)(uVar1 << (fmt->Gloss & 0x1f)) + (char)(uVar1 >> ((uint)fmt->Gloss * -2 + 8 & 0x1f));
  uVar1 = (pixel & fmt->Bmask) >> (fmt->Bshift & 0x1f);
  *in_t0 = (char)(uVar1 << (fmt->Bloss & 0x1f)) +
           (char)(uVar1 >> ((uint)fmt->Bloss * -2 + 8 & 0x1f));
  return;
}



----------------------------------------

// Function: SDL_ApplyGamma @ 0891e2a4

void SDL_ApplyGamma(Uint16 *gamma,SDL_Color *colors,SDL_Color *output,int ncolors)

{
  byte bVar1;
  byte bVar2;
  int iVar3;
  
                    /* Unresolved local var: int i@[DW_OP_reg10(t2)] */
  if (0 < ncolors) {
    iVar3 = 0;
    do {
      bVar1 = colors->g;
      bVar2 = colors->b;
      output->r = (Uint8)(gamma[colors->r] >> 8);
      output->g = (Uint8)(gamma[bVar1 + 0x100] >> 8);
      iVar3 = iVar3 + 1;
      colors = colors + 1;
      output->b = (Uint8)(gamma[bVar2 + 0x200] >> 8);
      output = output + 1;
    } while (ncolors != iVar3);
  }
  return;
}



----------------------------------------

// Function: SDL_InvalidateMap @ 0891e314

void SDL_InvalidateMap(SDL_BlitMap *map)

{
  if (map != (SDL_BlitMap *)0x0) {
    map->format_version = 0xffffffff;
    map->dst = (SDL_Surface *)0x0;
    if (map->table != (Uint8 *)0x0) {
      free(map->table);
      map->table = (Uint8 *)0x0;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_FreeBlitMap @ 0891e35c

void SDL_FreeBlitMap(SDL_BlitMap *map)

{
  if (map != (SDL_BlitMap *)0x0) {
    SDL_InvalidateMap(map);
    if (map->sw_data != (private_swaccel *)0x0) {
      free(map->sw_data);
    }
    free(map);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_FormatChanged @ 0891e3b0

void SDL_FormatChanged(SDL_Surface *surface)

{
  SDL_FormatChanged::format_version = SDL_FormatChanged::format_version + 1;
  if (SDL_FormatChanged::format_version < 0) {
    SDL_FormatChanged::format_version = 1;
  }
  surface->format_version = SDL_FormatChanged::format_version;
  SDL_InvalidateMap(surface->map);
  return;
}



----------------------------------------

// Function: SDL_FreeFormat @ 0891e3dc

void SDL_FreeFormat(SDL_PixelFormat *format)

{
  SDL_Palette *aptr;
  
  if (format == (SDL_PixelFormat *)0x0) {
    return;
  }
  aptr = format->palette;
  if (aptr != (SDL_Palette *)0x0) {
    if (aptr->colors != (SDL_Color *)0x0) {
      free(aptr->colors);
      aptr = format->palette;
    }
    free(aptr);
  }
  free(format);
  return;
}



----------------------------------------

// Function: Map1to1 @ 0891e440

Uint8 * Map1to1(SDL_Palette *src,SDL_Palette *dst,int *identical)

{
  Uint8 UVar1;
  Uint8 *pUVar2;
  SDL_Color *pSVar3;
  int iVar4;
  int iVar5;
  Uint8 *pUVar6;
  
                    /* Unresolved local var: Uint8 * map@[???]
                       Unresolved local var: int i@[???] */
  if (identical != (int *)0x0) {
    if (dst->ncolors < src->ncolors) {
      *identical = 0;
    }
    else {
      iVar4 = memcmp(src->colors,dst->colors,src->ncolors << 2);
      if (iVar4 == 0) {
        *identical = 1;
        return (Uint8 *)0x0;
      }
      *identical = 0;
    }
  }
  pUVar2 = malloc(src->ncolors);
  if (pUVar2 == (Uint8 *)0x0) {
    SDL_Error(SDL_ENOMEM);
    pUVar2 = (Uint8 *)0x0;
  }
  else if (0 < src->ncolors) {
    iVar4 = 0;
    do {
      pSVar3 = src->colors + iVar4;
      UVar1 = SDL_FindColor(dst,pSVar3->r,pSVar3->g,pSVar3->b);
      iVar5 = src->ncolors;
      pUVar6 = pUVar2 + iVar4;
      iVar4 = iVar4 + 1;
      *pUVar6 = UVar1;
    } while (iVar4 < iVar5);
  }
  return pUVar2;
}



----------------------------------------

// Function: SDL_AllocBlitMap @ 0891e534

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_BlitMap * SDL_AllocBlitMap(void)

{
  SDL_BlitMap *map;
  private_swaccel *ppVar1;
  
                    /* Unresolved local var: SDL_BlitMap * map@[???] */
  map = malloc(0x20);
  if (map != (SDL_BlitMap *)0x0) {
    map->dst = (SDL_Surface *)0x0;
    map->identity = 0;
    map->table = (Uint8 *)0x0;
    map->hw_blit = (SDL_blit)0x0;
    map->sw_blit = (SDL_blit)0x0;
    map->hw_data = (private_hwaccel *)0x0;
    map->sw_data = (private_swaccel *)0x0;
    map->format_version = 0;
    ppVar1 = malloc(8);
    map->sw_data = ppVar1;
    if (ppVar1 != (private_swaccel *)0x0) {
      ppVar1->aux_data = (void *)0x0;
      ppVar1->blit = (SDL_loblit)0x0;
      return map;
    }
    SDL_FreeBlitMap(map);
  }
  SDL_Error(SDL_ENOMEM);
  return (SDL_BlitMap *)0x0;
}



----------------------------------------

// Function: SDL_MapSurface @ 0891e5b8

int SDL_MapSurface(SDL_Surface *src,SDL_Surface *dst)

{
  Uint8 UVar1;
  uint uVar2;
  int iVar3;
  uint *puVar4;
  Uint8 *pUVar5;
  uint *puVar6;
  int iVar7;
  int iVar8;
  SDL_PixelFormat *pSVar9;
  SDL_PixelFormat *pSVar10;
  SDL_Palette *pSVar11;
  SDL_BlitMap *map;
  uint uVar12;
  SDL_Palette local_430;
  SDL_Color aSStack_428 [256];
  
                    /* Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???]
                       Unresolved local var: SDL_BlitMap * map@[???] */
  map = src->map;
  if ((src->flags & 0x4000) == 0) {
    SDL_InvalidateMap(map);
    pSVar9 = src->format;
    map->identity = 0;
    pSVar10 = dst->format;
    if (pSVar9->BytesPerPixel == '\x01') goto LAB_0891e69c;
LAB_0891e618:
    if (pSVar10->BytesPerPixel == '\x01') {
      pSVar11 = pSVar10->palette;
                    /* Unresolved local var: SDL_Palette dithered@[???]
                       Unresolved local var: SDL_Color[256] colors@[???] */
      memset(aSStack_428,0,0x400);
      local_430.ncolors = 0x100;
      SDL_DitherColors(aSStack_428,8);
      local_430.colors = aSStack_428;
      pUVar5 = Map1to1(&local_430,pSVar11,&map->identity);
      map->table = pUVar5;
      if (map->identity == 0) {
        if (pUVar5 == (Uint8 *)0x0) {
          return -1;
        }
        map->identity = 0;
      }
      else {
        map->identity = 0;
      }
    }
    else if (pSVar9->BitsPerPixel == pSVar10->BitsPerPixel) {
      if (pSVar9->Rmask != pSVar10->Rmask) {
        uVar2 = dst->format_version;
        goto LAB_0891e638;
      }
      if (pSVar9->Amask != pSVar10->Amask) {
        uVar2 = dst->format_version;
        goto LAB_0891e638;
      }
      map->identity = 1;
    }
  }
  else {
    SDL_UnRLESurface(src,1);
    SDL_InvalidateMap(map);
    pSVar9 = src->format;
    map->identity = 0;
    pSVar10 = dst->format;
    if (pSVar9->BytesPerPixel != '\x01') goto LAB_0891e618;
LAB_0891e69c:
    uVar2 = (uint)pSVar10->BytesPerPixel;
    if (uVar2 == 1) {
      if ((src->flags & 1) == 0) {
        pSVar11 = pSVar9->palette;
LAB_0891e8e8:
        pUVar5 = Map1to1(pSVar11,pSVar10->palette,&map->identity);
        map->table = pUVar5;
        if (map->identity != 0) goto LAB_0891e904;
        if (pUVar5 == (Uint8 *)0x0) {
          return -1;
        }
        UVar1 = pSVar9->BitsPerPixel;
      }
      else {
        if ((dst->flags & 1) == 0) {
          pSVar11 = pSVar9->palette;
          goto LAB_0891e8e8;
        }
        map->identity = 1;
LAB_0891e904:
        UVar1 = pSVar9->BitsPerPixel;
      }
      if (UVar1 == pSVar10->BitsPerPixel) {
        uVar2 = dst->format_version;
        goto LAB_0891e638;
      }
      map->identity = 0;
    }
    else {
      pSVar11 = pSVar9->palette;
                    /* Unresolved local var: Uint8 * map@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int bpp@[???]
                       Unresolved local var: uint alpha@[???] */
      uVar12 = 4;
      if (uVar2 != 3) {
        uVar12 = uVar2;
      }
      puVar4 = malloc(uVar12 * pSVar11->ncolors);
      if (puVar4 == (uint *)0x0) {
        SDL_Error(SDL_ENOMEM);
        map->table = (Uint8 *)0x0;
        return -1;
      }
      iVar3 = pSVar11->ncolors;
      uVar2 = 0xff;
      if (pSVar10->Amask == 0) {
        uVar2 = 0;
      }
      if (0 < iVar3) {
        iVar7 = 0;
        iVar8 = 0;
        puVar6 = puVar4;
        do {
          while (UVar1 = pSVar10->BytesPerPixel, UVar1 != '\x03') {
            if (UVar1 == '\x04') {
                    /* Unresolved local var: Uint32 pixel@[???] */
              pUVar5 = &pSVar11->colors->r + iVar8;
              *puVar6 = ((int)(uint)*pUVar5 >> (pSVar10->Rloss & 0x1f)) << (pSVar10->Rshift & 0x1f)
                        | ((int)(uint)pUVar5[1] >> (pSVar10->Gloss & 0x1f)) <<
                          (pSVar10->Gshift & 0x1f) |
                        ((int)(uint)pUVar5[2] >> (pSVar10->Bloss & 0x1f)) <<
                        (pSVar10->Bshift & 0x1f) |
                        (uVar2 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
            }
            else if (UVar1 == '\x02') {
                    /* Unresolved local var: Uint16 pixel@[???] */
              pUVar5 = &pSVar11->colors->r + iVar8;
              *(ushort *)puVar6 =
                   (ushort)(((int)(uint)*pUVar5 >> (pSVar10->Rloss & 0x1f)) <<
                           (pSVar10->Rshift & 0x1f)) |
                   (ushort)(((int)(uint)pUVar5[1] >> (pSVar10->Gloss & 0x1f)) <<
                           (pSVar10->Gshift & 0x1f)) |
                   (ushort)(((int)(uint)pUVar5[2] >> (pSVar10->Bloss & 0x1f)) <<
                           (pSVar10->Bshift & 0x1f)) |
                   (ushort)((uVar2 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
            }
            iVar7 = iVar7 + 1;
            iVar8 = iVar8 + 4;
            puVar6 = (uint *)((int)puVar6 + uVar12);
            if (iVar7 == iVar3) goto LAB_0891e77c;
          }
          iVar7 = iVar7 + 1;
          pUVar5 = &pSVar11->colors->r + iVar8;
          *(Uint8 *)((uint)(pSVar10->Rshift >> 3) + (int)puVar6) = *pUVar5;
          iVar8 = iVar8 + 4;
          *(Uint8 *)((uint)(pSVar10->Gshift >> 3) + (int)puVar6) = pUVar5[1];
          *(Uint8 *)((uint)(pSVar10->Bshift >> 3) + (int)puVar6) = pUVar5[2];
          puVar6 = (uint *)((int)puVar6 + uVar12);
        } while (iVar7 != iVar3);
      }
LAB_0891e77c:
      map->table = (Uint8 *)puVar4;
    }
  }
  uVar2 = dst->format_version;
LAB_0891e638:
  map->dst = dst;
  map->format_version = uVar2;
  iVar3 = SDL_CalculateBlit(src);
  return iVar3;
}



----------------------------------------

// Function: SDL_AllocFormat @ 0891e950

/* WARNING: Removing unreachable block (ram,0x0891e9a8) */
/* WARNING: Removing unreachable block (ram,0x0891ed28) */

SDL_PixelFormat * SDL_AllocFormat(int bpp,Uint32 Rmask,Uint32 Gmask,Uint32 Bmask,Uint32 Amask)

{
  byte bVar1;
  Uint8 UVar2;
  SDL_PixelFormat *format;
  SDL_Palette *pSVar3;
  SDL_Color *pSVar4;
  uint uVar5;
  uint uVar6;
  Uint32 UVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  uint uVar11;
  uint in_t0;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  uint uVar16;
  
                    /* Unresolved local var: SDL_PixelFormat * format@[???]
                       Unresolved local var: Uint32 mask@[???] */
  format = malloc(0x28);
  if (format == (SDL_PixelFormat *)0x0) goto LAB_0891eebc;
  format->BitsPerPixel = '\0';
  format->BytesPerPixel = '\0';
  format->Rloss = '\0';
  format->Gloss = '\0';
  *(undefined4 *)&format->alpha = 0;
  format->alpha = 0xff;
  format->palette = (SDL_Palette *)0x0;
  format->Bloss = '\0';
  format->Aloss = '\0';
  format->Rshift = '\0';
  format->Gshift = '\0';
  format->Bshift = '\0';
  format->Ashift = '\0';
  *(undefined2 *)&format->field_0xe = 0;
  format->Rmask = 0;
  format->Gmask = 0;
  format->Bmask = 0;
  format->Amask = 0;
  format->colorkey = 0;
  format->BitsPerPixel = (Uint8)bpp;
  format->BytesPerPixel = (Uint8)((bpp + 7) / 8);
  if (Rmask == 0) {
    if (Bmask != 0) {
      format->Rloss = '\b';
LAB_0891edb4:
      format->palette = (SDL_Palette *)0x0;
      format->Rshift = '\0';
      goto LAB_0891ea40;
    }
    if (Gmask != 0) {
      format->Rloss = '\b';
      goto LAB_0891edb4;
    }
    if (8 < bpp) {
      bpp = bpp + 0x18;
      uVar14 = bpp / 3;
      format->Bshift = '\0';
      uVar6 = 8 - (uVar14 & 0xff);
      uVar16 = (-(bpp % 3 & 0xffU) - uVar14) + 8;
      format->Rshift = (Uint8)uVar14 * '\x02' + (char)(bpp % 3);
      format->Gshift = (Uint8)uVar14;
      format->Gloss = (Uint8)uVar16;
      format->Rloss = (Uint8)uVar6;
      format->Bloss = (Uint8)uVar6;
      format->Rmask = (0xff >> (uVar6 & 0x1f)) << (format->Rshift & 0x1f);
      format->Gmask = (0xff >> (uVar16 & 0x1f)) << (format->Gshift & 0x1f);
      format->Bmask = 0xff >> (uVar6 & 0x1f);
      goto LAB_0891eb4c;
    }
    format->Aloss = '\b';
    format->Rloss = '\b';
    format->Gloss = '\b';
    format->Bloss = '\b';
    format->Rshift = '\0';
    format->Gshift = '\0';
    format->Bshift = '\0';
    format->Ashift = '\0';
    format->Rmask = 0;
    format->Gmask = 0;
    format->Bmask = 0;
    format->Amask = 0;
  }
  else {
    format->Rloss = '\b';
    format->palette = (SDL_Palette *)0x0;
    format->Rshift = '\0';
    uVar6 = Rmask;
    if ((Rmask & 1) == 0) {
      UVar2 = '\0';
      do {
        uVar6 = uVar6 >> 1;
        UVar2 = UVar2 + '\x01';
      } while ((uVar6 & 1) == 0);
      format->Rshift = UVar2;
    }
    UVar2 = format->Rloss;
    do {
      uVar6 = uVar6 >> 1;
      UVar2 = UVar2 + 0xff;
    } while ((uVar6 & 1) != 0);
    format->Rloss = UVar2;
LAB_0891ea40:
    format->Gloss = '\b';
    format->Gshift = '\0';
    if (Gmask != 0) {
      UVar7 = Gmask;
      if ((Gmask & 1) == 0) {
        UVar2 = '\0';
        do {
          UVar7 = UVar7 >> 1;
          UVar2 = UVar2 + '\x01';
        } while ((UVar7 & 1) == 0);
        format->Gshift = UVar2;
      }
      UVar2 = format->Gloss;
      do {
        UVar7 = UVar7 >> 1;
        UVar2 = UVar2 + 0xff;
      } while ((UVar7 & 1) != 0);
      format->Gloss = UVar2;
    }
    format->Bloss = '\b';
    format->Bshift = '\0';
    if (Bmask != 0) {
      UVar7 = Bmask;
      if ((Bmask & 1) == 0) {
        UVar2 = '\0';
        do {
          UVar7 = UVar7 >> 1;
          UVar2 = UVar2 + '\x01';
        } while ((UVar7 & 1) == 0);
        format->Bshift = UVar2;
      }
      UVar2 = format->Bloss;
      do {
        UVar7 = UVar7 >> 1;
        UVar2 = UVar2 + 0xff;
      } while ((UVar7 & 1) != 0);
      format->Bloss = UVar2;
    }
    format->Aloss = '\b';
    format->Ashift = '\0';
    if (in_t0 != 0) {
      uVar6 = in_t0;
      if ((in_t0 & 1) == 0) {
        UVar2 = '\0';
        do {
          uVar6 = uVar6 >> 1;
          UVar2 = UVar2 + '\x01';
        } while ((uVar6 & 1) == 0);
        format->Ashift = UVar2;
      }
      UVar2 = format->Aloss;
      do {
        uVar6 = uVar6 >> 1;
        UVar2 = UVar2 + 0xff;
      } while ((uVar6 & 1) != 0);
      format->Aloss = UVar2;
    }
    format->Amask = in_t0;
    format->Rmask = Rmask;
    format->Gmask = Gmask;
    format->Bmask = Bmask;
LAB_0891eb4c:
    if (8 < bpp) {
      return format;
    }
  }
                    /* Unresolved local var: int ncolors@[???] */
  pSVar3 = malloc(8);
  format->palette = pSVar3;
  if (pSVar3 != (SDL_Palette *)0x0) {
    uVar6 = 1 << (bpp & 0x1fU);
    pSVar3->ncolors = uVar6;
    pSVar4 = malloc(uVar6 << 2);
    pSVar3->colors = pSVar4;
    pSVar3 = format->palette;
    pSVar4 = pSVar3->colors;
    if (pSVar4 != (SDL_Color *)0x0) {
      if (Rmask == 0) {
        uVar16 = 0;
        if (Bmask != 0) {
          uVar14 = 0;
          goto LAB_0891edfc;
        }
        if (Gmask == 0) {
          if (uVar6 == 2) {
            pSVar4->r = 0xff;
            format->palette->colors->g = 0xff;
            format->palette->colors->b = 0xff;
            format->palette->colors[1].r = '\0';
            format->palette->colors[1].g = '\0';
            format->palette->colors[1].b = '\0';
            return format;
          }
          memset(pSVar4,0,pSVar3->ncolors << 2);
          return format;
        }
        uVar16 = 0;
        uVar14 = 0;
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int Rm@[???]
                       Unresolved local var: int Gm@[???]
                       Unresolved local var: int Bm@[???]
                       Unresolved local var: int Rw@[???]
                       Unresolved local var: int Gw@[???]
                       Unresolved local var: int Bw@[???] */
        bVar1 = format->Gloss;
LAB_0891ebb8:
        uVar10 = (uint)bVar1;
        uVar12 = 8 - uVar10;
        if (uVar10 == 0) {
          uVar15 = 0;
        }
        else {
          iVar8 = uVar10 - uVar12;
          uVar15 = 0;
          iVar9 = 0;
          do {
            iVar8 = iVar8 + -uVar12;
            uVar15 = uVar15 | 1 << (iVar9 + uVar10 & 0x1f);
            iVar9 = iVar9 + -uVar12;
          } while (0 < (int)(iVar8 + uVar12));
        }
        if (Bmask == 0) {
LAB_0891ebfc:
          uVar13 = 0;
          uVar10 = 0;
          goto LAB_0891ec04;
        }
        bVar1 = format->Bloss;
      }
      else {
        uVar10 = (uint)format->Rloss;
        uVar14 = 8 - uVar10;
        if (uVar10 == 0) {
          uVar16 = 0;
        }
        else {
          iVar8 = uVar10 - uVar14;
          uVar16 = 0;
          iVar9 = 0;
          do {
            iVar8 = iVar8 + -uVar14;
            uVar16 = uVar16 | 1 << (iVar9 + uVar10 & 0x1f);
            iVar9 = iVar9 + -uVar14;
          } while (0 < (int)(iVar8 + uVar14));
        }
LAB_0891edfc:
        if (Gmask != 0) {
          bVar1 = format->Gloss;
          goto LAB_0891ebb8;
        }
        uVar15 = 0;
        uVar12 = 0;
        if (Bmask == 0) goto LAB_0891ebfc;
        bVar1 = format->Bloss;
      }
      uVar11 = (uint)bVar1;
      uVar10 = 8 - uVar11;
      if (uVar11 == 0) {
        uVar13 = 0;
      }
      else {
        iVar8 = uVar11 - uVar10;
        uVar13 = 0;
        iVar9 = 0;
        do {
          iVar8 = iVar8 + -uVar10;
          uVar13 = uVar13 | 1 << (iVar9 + uVar11 & 0x1f);
          iVar9 = iVar9 + -uVar10;
        } while (0 < (int)(iVar8 + uVar10));
      }
LAB_0891ec04:
      if ((int)uVar6 < 1) {
        return format;
      }
      uVar11 = 0;
      while( true ) {
                    /* Unresolved local var: int r@[???]
                       Unresolved local var: int g@[???]
                       Unresolved local var: int b@[???] */
        uVar5 = (Rmask & uVar11) >> (format->Rshift & 0x1f);
        pSVar3->colors[uVar11].r =
             (byte)(uVar5 << (format->Rloss & 0x1f)) |
             (byte)((int)(uVar5 * uVar16) >> (uVar14 & 0x1f));
        uVar5 = (Gmask & uVar11) >> (format->Gshift & 0x1f);
        format->palette->colors[uVar11].g =
             (byte)(uVar5 << (format->Gloss & 0x1f)) |
             (byte)((int)(uVar15 * uVar5) >> (uVar12 & 0x1f));
        uVar5 = (Bmask & uVar11) >> (format->Bshift & 0x1f);
        format->palette->colors[uVar11].b =
             (byte)(uVar5 << (format->Bloss & 0x1f)) |
             (byte)((int)(uVar13 * uVar5) >> (uVar10 & 0x1f));
        format->palette->colors[uVar11].unused = '\0';
        if (uVar6 == uVar11 + 1) break;
        pSVar3 = format->palette;
        uVar11 = uVar11 + 1;
      }
      return format;
    }
  }
  SDL_FreeFormat(format);
LAB_0891eebc:
  SDL_Error(SDL_ENOMEM);
  return (SDL_PixelFormat *)0x0;
}



----------------------------------------

// Function: SDL_ReallocFormat @ 0891ef34

SDL_PixelFormat *
SDL_ReallocFormat(SDL_Surface *surface,int bpp,Uint32 Rmask,Uint32 Gmask,Uint32 Bmask,Uint32 Amask)

{
  SDL_PixelFormat *pSVar1;
  Uint32 in_t0;
  Uint32 unaff_s4;
  
  if (surface->format != (SDL_PixelFormat *)0x0) {
    SDL_FreeFormat(surface->format);
    SDL_FormatChanged(surface);
  }
  pSVar1 = SDL_AllocFormat(bpp,Rmask,Gmask,in_t0,unaff_s4);
  surface->format = pSVar1;
  return pSVar1;
}



----------------------------------------

// Function: SDL_GetClipRect @ 0891efc8

void SDL_GetClipRect(SDL_Surface *surface,SDL_Rect *rect)

{
  Sint16 SVar1;
  Uint16 UVar2;
  Uint16 UVar3;
  
  if ((surface != (SDL_Surface *)0x0) && (rect != (SDL_Rect *)0x0)) {
    SVar1 = (surface->clip_rect).y;
    UVar2 = (surface->clip_rect).w;
    UVar3 = (surface->clip_rect).h;
    rect->x = (surface->clip_rect).x;
    rect->y = SVar1;
    rect->w = UVar2;
    rect->h = UVar3;
  }
  return;
}



----------------------------------------

// Function: SDL_LockSurface @ 0891eff8

int SDL_LockSurface(SDL_Surface *surface)

{
  int iVar1;
  uint uVar2;
  Uint32 UVar3;
  
  UVar3 = surface->locked;
  if (UVar3 == 0) {
    uVar2 = surface->flags;
    if ((uVar2 & 5) != 0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
      iVar1 = (*current_video->LockHWSurface)(current_video,surface);
      if (iVar1 < 0) {
        return -1;
      }
      uVar2 = surface->flags;
    }
    if ((uVar2 & 0x4000) != 0) {
      SDL_UnRLESurface(surface,1);
      surface->flags = surface->flags | 0x4000;
    }
    UVar3 = surface->locked;
    surface->pixels = (void *)((int)surface->pixels + surface->offset);
  }
  surface->locked = UVar3 + 1;
  return 0;
}



----------------------------------------

// Function: SDL_UnlockSurface @ 0891f0a4

void SDL_UnlockSurface(SDL_Surface *surface)

{
  Uint32 UVar1;
  uint uVar2;
  
  UVar1 = surface->locked - 1;
  if ((surface->locked != 0) && (surface->locked = UVar1, UVar1 == 0)) {
    uVar2 = surface->flags;
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    surface->pixels = (void *)((int)surface->pixels - surface->offset);
    if ((uVar2 & 5) != 0) {
                    /* WARNING: Could not recover jumptable at 0x0891f104. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*current_video->UnlockHWSurface)(current_video,surface);
      return;
    }
    if ((uVar2 & 0x4000) != 0) {
      surface->flags = uVar2 & 0xffffbfff;
      SDL_RLESurface(surface);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_FreeSurface @ 0891f10c

void SDL_FreeSurface(SDL_Surface *surface)

{
  int iVar1;
  private_hwdata *ppVar2;
  SDL_PixelFormat *format;
  SDL_BlitMap *map;
  
  if (surface != (SDL_Surface *)0x0) {
    if (current_video == (SDL_VideoDevice *)0x0) {
      iVar1 = surface->refcount;
    }
    else {
      if (surface == current_video->shadow) {
        return;
      }
      if (surface == current_video->screen) {
        return;
      }
      iVar1 = surface->refcount;
    }
    surface->refcount = iVar1 + -1;
    if (iVar1 + -1 < 1) {
      while (surface->locked != 0) {
        SDL_UnlockSurface(surface);
      }
      if ((surface->flags & 0x4000) == 0) {
        format = surface->format;
      }
      else {
        SDL_UnRLESurface(surface,0);
        format = surface->format;
      }
      if (format == (SDL_PixelFormat *)0x0) {
        map = surface->map;
      }
      else {
        SDL_FreeFormat(format);
        surface->format = (SDL_PixelFormat *)0x0;
        map = surface->map;
      }
      if (map == (SDL_BlitMap *)0x0) {
        ppVar2 = surface->hwdata;
      }
      else {
        SDL_FreeBlitMap(map);
        surface->map = (SDL_BlitMap *)0x0;
        ppVar2 = surface->hwdata;
      }
      if (ppVar2 != (private_hwdata *)0x0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
        (*current_video->FreeHWSurface)(current_video,surface);
      }
      if ((surface->pixels != (void *)0x0) && ((surface->flags & 0x1000000) == 0)) {
        free(surface->pixels);
      }
      free(surface);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_SetAlphaChannel @ 0891f230

int SDL_SetAlphaChannel(SDL_Surface *surface,Uint8 value)

{
  Uint8 *pUVar1;
  Uint32 UVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int row@[???]
                       Unresolved local var: int col@[???]
                       Unresolved local var: int offset@[???]
                       Unresolved local var: Uint8 * buf@[???] */
  UVar2 = surface->format->Amask;
  if (UVar2 == 0xff000000) {
    iVar6 = 3;
  }
  else {
    iVar6 = 0;
    if (UVar2 != 0xff) {
      SDL_SetError("Unsupported surface alpha mask format");
      return -1;
    }
  }
  if ((surface->offset == 0) && ((surface->flags & 0x4005) == 0)) {
    iVar3 = surface->h;
  }
  else {
    iVar3 = SDL_LockSurface(surface);
    if (iVar3 < 0) {
      return -1;
    }
    iVar3 = surface->h;
  }
  while (iVar3 = iVar3 + -1, iVar3 != -1) {
    iVar5 = surface->w;
    if (iVar5 != 0) {
      pUVar1 = (Uint8 *)((int)surface->pixels + iVar6 + iVar3 * (uint)surface->pitch);
      iVar4 = 1;
      while( true ) {
        *pUVar1 = value;
        pUVar1 = pUVar1 + 4;
        if (iVar5 == iVar4) break;
        iVar4 = iVar4 + 1;
      }
    }
  }
  if ((surface->offset != 0) || ((surface->flags & 0x4005) != 0)) {
    SDL_UnlockSurface(surface);
  }
  return 0;
}



----------------------------------------

// Function: SDL_FillRect @ 0891f34c

int SDL_FillRect(SDL_Surface *dst,SDL_Rect *dstrect,Uint32 color)

{
  undefined1 *puVar1;
  byte bVar2;
  short sVar3;
  short sVar4;
  ushort uVar5;
  ushort uVar6;
  SDL_VideoDevice *pSVar7;
  Uint16 UVar8;
  int iVar9;
  uint uVar10;
  uint *puVar11;
  Uint16 UVar12;
  uint uVar13;
  uint *puVar14;
  undefined2 uVar15;
  short sVar16;
  uint uVar17;
  uint uVar18;
  short sVar19;
  uint uVar20;
  uint *puVar21;
  SDL_Rect local_28;
  undefined4 local_20;
  
  pSVar7 = current_video;
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: Uint8 * row@[???] */
  bVar2 = dst->format->BitsPerPixel;
  local_20 = color;
  if (bVar2 < 8) {
    if (bVar2 == 1) {
      SDL_SetError("1-bpp rect fill not yet implemented");
      return -1;
    }
    if (bVar2 != 4) {
      SDL_SetError("Fill rect on unsupported surface format");
      return -1;
    }
    SDL_SetError("4-bpp rect fill not yet implemented");
    return -1;
  }
  if (dstrect == (SDL_Rect *)0x0) {
    dstrect = &dst->clip_rect;
  }
  else {
                    /* Unresolved local var: int Amin@[???]
                       Unresolved local var: int Amax@[???]
                       Unresolved local var: int Bmin@[???]
                       Unresolved local var: int Bmax@[???] */
    sVar3 = (dst->clip_rect).x;
    sVar4 = (dst->clip_rect).y;
    sVar19 = dstrect->x + sVar3;
    sVar16 = dstrect->y + sVar4;
    UVar12 = (dstrect->x + dstrect->w + sVar3 + (dst->clip_rect).w) - sVar19;
    UVar8 = (dstrect->y + dstrect->h + sVar4 + (dst->clip_rect).h) - sVar16;
    dstrect->w = UVar12;
    dstrect->x = sVar19;
    dstrect->y = sVar16;
    dstrect->h = UVar8;
    if ((UVar12 == 0) || (UVar8 == 0)) {
      return 0;
    }
  }
  if (((dst->flags & 1) != 0) && ((&pSVar7->info)->blit_fill != 0)) {
                    /* Unresolved local var: SDL_Rect hw_rect@[???] */
    if (dst == pSVar7->screen) {
      puVar1 = (undefined1 *)((int)&dstrect->y + 1);
      uVar10 = (uint)puVar1 & 3;
      uVar18 = (uint)dstrect & 3;
      uVar10 = (*(int *)(puVar1 + -uVar10) << (3 - uVar10) * 8 |
               (uint)pSVar7->screen & 0xffffffffU >> (uVar10 + 1) * 8) & -1 << (4 - uVar18) * 8 |
               *(uint *)((int)dstrect - uVar18) >> uVar18 * 8;
      local_28.w = dstrect->w;
      local_28.h = dstrect->h;
      local_28.x = (Sint16)uVar10;
      local_28.y = (Sint16)(uVar10 >> 0x10);
      local_28.y = (short)pSVar7->offset_y + local_28.y;
      local_28.x = (short)pSVar7->offset_x + local_28.x;
      dstrect = &local_28;
    }
    iVar9 = (*pSVar7->FillHWRect)(pSVar7,dst,dstrect,color);
    return iVar9;
  }
  iVar9 = SDL_LockSurface(dst);
  if (iVar9 != 0) {
    return -1;
  }
  uVar10 = (uint)dst->format->BytesPerPixel;
  uVar18 = (uint)dst->pitch;
  puVar21 = (uint *)((int)dstrect->x * uVar10 + (int)dstrect->y * uVar18 + (int)dst->pixels);
  if (dst->format->palette == (SDL_Palette *)0x0) {
    if (local_20 != 0) {
      if (uVar10 == 3) {
        uVar5 = dstrect->h;
        uVar10 = 0;
        if (uVar5 != 0) {
                    /* Unresolved local var: Uint8 * pixels@[???] */
          uVar6 = dstrect->w;
          while( true ) {
            if (uVar6 != 0) {
              uVar18 = 0;
              puVar14 = puVar21;
              do {
                uVar18 = uVar18 + 1;
                *(undefined1 *)puVar14 = (undefined1)local_20;
                *(undefined1 *)((int)puVar14 + 1) = local_20._1_1_;
                *(undefined1 *)((int)puVar14 + 2) = local_20._2_1_;
                puVar14 = (uint *)((int)puVar14 + 3);
              } while (uVar18 != uVar6);
              uVar18 = (uint)dst->pitch;
            }
            uVar10 = uVar10 + 1;
            puVar21 = (uint *)((int)puVar21 + uVar18);
            if (uVar10 == uVar5) break;
            uVar6 = dstrect->w;
          }
        }
      }
      else if (uVar10 == 4) {
        uVar5 = dstrect->h;
        if (uVar5 != 0) {
                    /* Unresolved local var: uint _count@[???]
                       Unresolved local var: uint _n@[???]
                       Unresolved local var: Uint32 * _p@[???]
                       Unresolved local var: Uint32 _val@[???] */
          uVar6 = dstrect->w;
          uVar17 = 0;
          uVar13 = uVar6 & 3;
          uVar20 = uVar6 + 3 >> 2;
          uVar10 = uVar20;
          puVar14 = puVar21;
          if (uVar13 == 1) goto LAB_0891f8a4;
LAB_0891f870:
          if ((uVar6 & 3) != 0) {
            if (uVar13 == 2) {
              *puVar14 = local_20;
              puVar21 = puVar14 + 1;
              uVar10 = uVar20;
              goto LAB_0891f8a4;
            }
            if (uVar13 != 3) goto LAB_0891f888;
            *puVar14 = local_20;
            uVar10 = uVar20;
            puVar21 = puVar14;
            goto LAB_0891f8c4;
          }
          *puVar14 = local_20;
          puVar21 = puVar14 + 1;
          uVar10 = uVar20;
          do {
            *puVar21 = local_20;
LAB_0891f8c4:
            puVar21[1] = local_20;
            puVar21 = puVar21 + 2;
LAB_0891f8a4:
            while( true ) {
              uVar10 = uVar10 - 1;
              *puVar21 = local_20;
              if (uVar10 != 0) break;
LAB_0891f888:
              uVar17 = uVar17 + 1;
              puVar21 = (uint *)((int)puVar14 + uVar18);
              if (uVar5 == uVar17) goto LAB_0891f668;
              uVar10 = uVar20;
              puVar14 = puVar21;
              if (uVar13 != 1) goto LAB_0891f870;
            }
            puVar21[1] = local_20;
            puVar21 = puVar21 + 2;
          } while( true );
        }
      }
      else if (uVar10 == 2) {
        uVar5 = dstrect->h;
        uVar10 = 0;
        if (uVar5 != 0) {
                    /* Unresolved local var: Uint16 * pixels@[???]
                       Unresolved local var: Uint16 c@[???]
                       Unresolved local var: Uint32 cc@[???]
                       Unresolved local var: int n@[???] */
          uVar18 = (uint)dstrect->w;
          uVar15 = (undefined2)local_20;
          puVar14 = puVar21;
          if (((uint)puVar21 & 3) == 0) goto LAB_0891f720;
          *(undefined2 *)puVar21 = uVar15;
          do {
            uVar18 = uVar18 - 1;
            puVar21 = (uint *)((int)puVar14 + 2);
LAB_0891f720:
            do {
              uVar20 = (int)uVar18 >> 1;
              if (uVar20 != 0) {
                    /* Unresolved local var: uint _count@[???]
                       Unresolved local var: uint _n@[???]
                       Unresolved local var: Uint32 * _p@[???]
                       Unresolved local var: Uint32 _val@[???] */
                uVar13 = uVar20 & 3;
                uVar17 = local_20 & 0xffff | local_20 << 0x10;
                uVar20 = uVar20 + 3 >> 2;
                puVar11 = puVar21;
                if (uVar13 == 1) goto LAB_0891f7b8;
                if (uVar13 == 0) {
                  *puVar21 = uVar17;
                  while( true ) {
                    puVar11[1] = uVar17;
                    puVar11 = puVar11 + 1;
LAB_0891f7ac:
                    puVar11[1] = uVar17;
                    puVar11 = puVar11 + 1;
LAB_0891f7b4:
                    puVar11 = puVar11 + 1;
LAB_0891f7b8:
                    uVar20 = uVar20 - 1;
                    *puVar11 = uVar17;
                    if (uVar20 == 0) break;
                    puVar11 = puVar11 + 1;
                    *puVar11 = uVar17;
                  }
                }
                else {
                  if (uVar13 == 2) {
                    *puVar21 = uVar17;
                    goto LAB_0891f7b4;
                  }
                  if (uVar13 == 3) {
                    *puVar21 = uVar17;
                    goto LAB_0891f7ac;
                  }
                }
              }
              uVar10 = uVar10 + 1;
              if ((uVar18 & 1) != 0) {
                *(undefined2 *)((int)puVar21 + uVar18 * 2 + -2) = uVar15;
              }
              if (uVar10 == uVar5) goto LAB_0891f668;
              puVar21 = (uint *)((int)puVar14 + (uint)dst->pitch);
              uVar18 = (uint)dstrect->w;
              puVar14 = puVar21;
            } while (((uint)puVar21 & 3) == 0);
            *(undefined2 *)puVar21 = uVar15;
          } while( true );
        }
      }
      goto LAB_0891f668;
    }
    uVar10 = uVar10 * dstrect->w;
LAB_0891f580:
    if (((uint)puVar21 & 3) == 0) {
      if ((uVar10 & 3) == 0) {
        if ((dst->pitch & 3) == 0) {
                    /* Unresolved local var: int n@[???] */
          uVar5 = dstrect->h;
          if (uVar5 != 0) {
            uVar13 = (int)uVar10 >> 2 & 3;
            uVar20 = ((int)uVar10 >> 2) + 3U >> 2;
            uVar17 = 0;
                    /* Unresolved local var: uint _count@[???]
                       Unresolved local var: uint _n@[???]
                       Unresolved local var: Uint32 * _p@[???]
                       Unresolved local var: Uint32 _val@[???] */
            uVar10 = uVar20;
            puVar14 = puVar21;
            if (uVar13 == 1) goto LAB_0891f608;
LAB_0891f5d8:
            if (uVar13 != 0) {
              if (uVar13 == 2) {
                *puVar14 = 0;
                puVar21 = puVar14 + 1;
                uVar10 = uVar20;
                goto LAB_0891f608;
              }
              if (uVar13 != 3) goto LAB_0891f5f0;
              *puVar14 = 0;
              uVar10 = uVar20;
              puVar21 = puVar14;
              goto LAB_0891f628;
            }
            *puVar14 = 0;
            puVar21 = puVar14 + 1;
            uVar10 = uVar20;
            do {
              *puVar21 = 0;
LAB_0891f628:
              puVar21[1] = 0;
              puVar21 = puVar21 + 2;
LAB_0891f608:
              while( true ) {
                uVar10 = uVar10 - 1;
                *puVar21 = 0;
                if (uVar10 != 0) break;
LAB_0891f5f0:
                uVar17 = uVar17 + 1;
                puVar21 = (uint *)((int)puVar14 + uVar18);
                if (uVar5 == uVar17) goto LAB_0891f668;
                uVar10 = uVar20;
                puVar14 = puVar21;
                if (uVar13 != 1) goto LAB_0891f5d8;
              }
              puVar21[1] = 0;
              puVar21 = puVar21 + 2;
            } while( true );
          }
          goto LAB_0891f668;
        }
        uVar18 = (uint)dstrect->h;
      }
      else {
        uVar18 = (uint)dstrect->h;
      }
    }
    else {
      uVar18 = (uint)dstrect->h;
    }
  }
  else {
    uVar10 = uVar10 * dstrect->w;
    if (local_20 == 0) goto LAB_0891f580;
    uVar18 = (uint)dstrect->h;
  }
  uVar20 = 0;
  if (uVar18 != 0) {
    do {
      memset(puVar21,local_20,uVar10);
      uVar20 = uVar20 + 1;
      puVar21 = (uint *)((int)puVar21 + (uint)dst->pitch);
    } while (uVar18 != uVar20);
  }
LAB_0891f668:
  SDL_UnlockSurface(dst);
  return 0;
}



----------------------------------------

// Function: SDL_LowerBlit @ 0891f90c

int SDL_LowerBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  undefined1 *puVar1;
  uint uVar2;
  undefined2 uVar3;
  uint uVar4;
  SDL_blit p_Var5;
  int iVar6;
  undefined2 uVar7;
  SDL_BlitMap *pSVar8;
  SDL_Rect local_28;
  SDL_Rect local_20;
  
                    /* Unresolved local var: SDL_blit do_blit@[???]
                       Unresolved local var: SDL_Rect hw_srcrect@[???]
                       Unresolved local var: SDL_Rect hw_dstrect@[???] */
  pSVar8 = src->map;
  if ((pSVar8->dst == dst) && (dst->format_version == pSVar8->format_version)) {
    uVar4 = src->flags;
  }
  else {
    iVar6 = SDL_MapSurface(src,dst);
    if (iVar6 < 0) {
      return -1;
    }
    pSVar8 = src->map;
    uVar4 = src->flags;
  }
  if ((uVar4 & 0x100) == 0) {
    p_Var5 = pSVar8->sw_blit;
  }
  else {
    if (src == current_video->screen) {
      puVar1 = (undefined1 *)((int)&srcrect->y + 1);
      uVar4 = (uint)puVar1 & 3;
      uVar2 = (uint)srcrect & 3;
      uVar4 = (*(int *)(puVar1 + -uVar4) << (3 - uVar4) * 8 |
              0xffffffffU >> (uVar4 + 1) * 8 & 0x8a10000) & -1 << (4 - uVar2) * 8 |
              *(uint *)((int)srcrect - uVar2) >> uVar2 * 8;
      local_28.w = srcrect->w;
      local_28.h = srcrect->h;
      local_28.x = (Sint16)uVar4;
      local_28.y = (Sint16)(uVar4 >> 0x10);
      local_28.y = (short)current_video->offset_y + local_28.y;
      local_28.x = (short)current_video->offset_x + local_28.x;
      srcrect = &local_28;
    }
    if (dst == current_video->screen) {
      uVar3 = dstrect->x;
      uVar7 = dstrect->y;
      local_20.w = dstrect->w;
      local_20.h = dstrect->h;
      p_Var5 = pSVar8->hw_blit;
      dstrect = &local_20;
      local_20.y = (short)current_video->offset_y + uVar7;
      local_20.x = (short)current_video->offset_x + uVar3;
    }
    else {
      p_Var5 = pSVar8->hw_blit;
    }
  }
  iVar6 = (*p_Var5)(src,srcrect,dst,dstrect);
  return iVar6;
}



----------------------------------------

// Function: SDL_UpperBlit @ 0891fa4c

int SDL_UpperBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  ushort uVar1;
  short sVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  short sVar7;
  int iVar8;
  short sVar9;
  int iVar10;
  SDL_Rect local_18;
  SDL_Rect local_10;
  
                    /* Unresolved local var: SDL_Rect fulldst@[???]
                       Unresolved local var: int srcx@[???]
                       Unresolved local var: int srcy@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???] */
  if ((src == (SDL_Surface *)0x0) || (dst == (SDL_Surface *)0x0)) {
    SDL_SetError("SDL_UpperBlit: passed a NULL surface");
    return -1;
  }
  if ((src->locked == 0) && (dst->locked == 0)) {
    if (dstrect == (SDL_Rect *)0x0) {
      local_18.y = 0;
      local_18.x = 0;
      dstrect = &local_18;
    }
    if (srcrect == (SDL_Rect *)0x0) {
      iVar6 = src->w;
      iVar10 = 0;
      iVar8 = 0;
      uVar4 = src->h;
    }
    else {
                    /* Unresolved local var: int maxw@[???]
                       Unresolved local var: int maxh@[???] */
      iVar10 = (int)srcrect->x;
      uVar3 = (uint)srcrect->w;
      if (iVar10 < 0) {
        uVar3 = uVar3 + iVar10;
        iVar10 = 0;
        dstrect->x = dstrect->x - srcrect->x;
      }
      iVar8 = (int)srcrect->y;
      uVar4 = (uint)srcrect->h;
      iVar6 = uVar3 + (src->w - iVar10);
      if (iVar8 < 0) {
        uVar4 = uVar4 + iVar8;
        iVar8 = 0;
        dstrect->y = dstrect->y - srcrect->y;
      }
      uVar3 = src->h - iVar8;
      if ((int)uVar3 < (int)uVar4) {
        uVar4 = uVar3;
      }
    }
    sVar7 = (short)iVar8;
    sVar9 = (short)iVar10;
                    /* Unresolved local var: SDL_Rect * clip@[???]
                       Unresolved local var: int dx@[???]
                       Unresolved local var: int dy@[???] */
    iVar10 = (int)dstrect->x;
    iVar5 = (int)(dst->clip_rect).x;
    iVar8 = iVar5 - iVar10;
    if (0 < iVar8) {
      sVar2 = dstrect->x + (short)iVar8;
      dstrect->x = sVar2;
      iVar5 = (int)(dst->clip_rect).x;
      iVar10 = (int)sVar2;
      sVar9 = sVar9 + (short)iVar8;
      iVar6 = iVar6 - iVar8;
    }
    iVar10 = ((iVar6 + iVar10) - iVar5) - (uint)(dst->clip_rect).w;
    if (0 < iVar10) {
      iVar6 = iVar6 - iVar10;
    }
    iVar10 = (int)dstrect->y;
    iVar5 = (int)(dst->clip_rect).y;
    iVar8 = iVar5 - iVar10;
    if (iVar8 < 1) {
      uVar1 = (dst->clip_rect).h;
    }
    else {
      sVar2 = dstrect->y + (short)iVar8;
      dstrect->y = sVar2;
      iVar5 = (int)(dst->clip_rect).y;
      iVar10 = (int)sVar2;
      sVar7 = sVar7 + (short)iVar8;
      uVar4 = uVar4 - iVar8;
      uVar1 = (dst->clip_rect).h;
    }
    iVar10 = ((uVar4 + iVar10) - iVar5) - (uint)uVar1;
    if (0 < iVar10) {
      uVar4 = uVar4 - iVar10;
    }
    if (iVar6 < 1) {
      dstrect->w = 0;
    }
    else {
      if (0 < (int)uVar4) {
                    /* Unresolved local var: SDL_Rect sr@[???] */
        dstrect->w = (Uint16)iVar6;
        dstrect->h = (Uint16)uVar4;
        local_10.x = sVar9;
        local_10.y = sVar7;
        local_10.w = (Uint16)iVar6;
        local_10.h = (Uint16)uVar4;
        iVar10 = SDL_LowerBlit(src,&local_10,dst,dstrect);
        return iVar10;
      }
      dstrect->w = 0;
    }
    dstrect->h = 0;
    return 0;
  }
  SDL_SetError("Surfaces must not be locked during blit");
  return -1;
}



----------------------------------------

// Function: SDL_SetAlpha @ 0891fc24

int SDL_SetAlpha(SDL_Surface *surface,Uint32 flag,Uint8 value)

{
  byte bVar1;
  SDL_VideoDevice *pSVar2;
  _func_int_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8 *p_Var3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  SDL_PixelFormat *pSVar7;
  uint uVar8;
  
                    /* Unresolved local var: Uint32 oldflags@[???]
                       Unresolved local var: Uint32 oldalpha@[???] */
  uVar5 = surface->flags;
  pSVar7 = surface->format;
  bVar1 = pSVar7->alpha;
  if ((flag & 0x10000) == 0) {
    uVar8 = 0;
LAB_0891fc6c:
    if (uVar8 == (uVar5 & 0x12000)) {
LAB_0891fd14:
      if (uVar8 == 0) {
        return 0;
      }
      if ((uint)bVar1 == (uint)value) {
        return 0;
      }
    }
  }
  else {
    uVar8 = 0x12000;
    if ((flag & 0x6000) != 0) goto LAB_0891fc6c;
    uVar8 = 0x10000;
    if ((uVar5 & 0x12000) == 0x10000) goto LAB_0891fd14;
  }
  uVar6 = uVar5;
  if (((uVar8 & 0x2000) == 0) && ((uVar5 & 0x4000) != 0)) {
    SDL_UnRLESurface(surface,1);
    pSVar7 = surface->format;
    uVar6 = surface->flags;
  }
  if (uVar8 == 0) {
    surface->flags = uVar6 & 0xfffeffff;
    pSVar7->alpha = 0xff;
    uVar6 = surface->flags;
    goto LAB_0891fcac;
  }
  surface->flags = uVar6 | 0x10000;
  pSVar2 = current_video;
  pSVar7->alpha = value;
  uVar6 = surface->flags;
  if ((uVar6 & 0x100) != 0) {
    p_Var3 = pSVar2->SetHWAlpha;
    if (p_Var3 != (_func_int_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8 *)0x0) {
      iVar4 = (*p_Var3)(pSVar2,surface,value);
      uVar6 = surface->flags;
      if (-1 < iVar4) goto LAB_0891fd90;
    }
    uVar6 = uVar6 & 0xfffffeff;
    surface->flags = uVar6;
  }
LAB_0891fd90:
  if ((uVar8 & 0x2000) == 0) {
    uVar6 = uVar6 & 0xffffdfff;
    surface->flags = uVar6;
  }
  else {
    uVar6 = uVar6 | 0x2000;
    surface->flags = uVar6;
  }
LAB_0891fcac:
  if ((((uVar6 & 0x100) != 0) || (uVar5 != uVar6)) || (((bVar1 + 1 ^ value + 1) & 0x100) != 0)) {
    SDL_InvalidateMap(surface->map);
  }
  return 0;
}



----------------------------------------

// Function: SDL_SetColorKey @ 0891fddc

int SDL_SetColorKey(SDL_Surface *surface,Uint32 flag,Uint32 key)

{
  SDL_PixelFormat *pSVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  
  if ((flag & 0x1000) == 0) {
    uVar3 = surface->flags;
    uVar4 = 0;
    if ((uVar3 & 0x3000) == 0) {
      pSVar1 = surface->format;
      goto LAB_0891fe84;
    }
LAB_0891fe18:
    if ((uVar3 & 0x4000) == 0) goto LAB_0891fe20;
LAB_0891fe9c:
    SDL_UnRLESurface(surface,1);
    uVar3 = surface->flags;
    if (uVar4 == 0) {
LAB_0891fe28:
      surface->flags = uVar3 & 0xffffcfff;
      surface->format->colorkey = 0;
      goto LAB_0891fe3c;
    }
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    pSVar1 = surface->format;
  }
  else {
    uVar3 = surface->flags;
    uVar4 = 0x3000;
    if ((flag & 0x6000) == 0) {
      uVar4 = 0x1000;
    }
    if (uVar4 != (uVar3 & 0x3000)) goto LAB_0891fe18;
    pSVar1 = surface->format;
LAB_0891fe84:
    if (key == pSVar1->colorkey) {
      return 0;
    }
    if ((uVar3 & 0x4000) != 0) goto LAB_0891fe9c;
LAB_0891fe20:
    if (uVar4 == 0) goto LAB_0891fe28;
    pSVar1 = surface->format;
  }
  surface->flags = uVar3 | 0x1000;
  pSVar1->colorkey = key;
  uVar3 = surface->flags;
  if ((uVar3 & 0x100) != 0) {
    if (current_video->SetHWColorKey != (_func_int_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint32 *)0x0)
    {
      iVar2 = (*current_video->SetHWColorKey)(current_video,surface,key);
      uVar3 = surface->flags;
      if (-1 < iVar2) goto LAB_0891feec;
    }
    uVar3 = uVar3 & 0xfffffeff;
    surface->flags = uVar3;
  }
LAB_0891feec:
  if ((uVar4 & 0x2000) == 0) {
    surface->flags = uVar3 & 0xffffdfff;
  }
  else {
    surface->flags = uVar3 | 0x2000;
  }
LAB_0891fe3c:
  SDL_InvalidateMap(surface->map);
  return 0;
}



----------------------------------------

// Function: SDL_SetClipRect @ 0891ff20

SDL_bool SDL_SetClipRect(SDL_Surface *surface,SDL_Rect *rect)

{
  Sint16 SVar1;
  Sint16 SVar2;
  Uint16 UVar3;
  Uint16 UVar4;
  SDL_bool SVar5;
  
                    /* Unresolved local var: SDL_Rect full_rect@[???] */
  SVar5 = SDL_FALSE;
  if (surface != (SDL_Surface *)0x0) {
                    /* Unresolved local var: int Amin@[???]
                       Unresolved local var: int Amax@[???]
                       Unresolved local var: int Bmin@[???]
                       Unresolved local var: int Bmax@[???] */
    UVar3 = (Uint16)surface->w;
    UVar4 = (Uint16)surface->h;
    if (rect == (SDL_Rect *)0x0) {
      (surface->clip_rect).h = UVar4;
      (surface->clip_rect).w = UVar3;
      (surface->clip_rect).x = 0;
      (surface->clip_rect).y = 0;
      return SDL_TRUE;
    }
    SVar1 = rect->x;
    SVar2 = rect->y;
    UVar3 = rect->w + UVar3;
    UVar4 = rect->h + UVar4;
    (surface->clip_rect).w = UVar3;
    SVar5 = SDL_FALSE;
    (surface->clip_rect).x = SVar1;
    (surface->clip_rect).y = SVar2;
    (surface->clip_rect).h = UVar4;
    if (UVar3 != 0) {
      SVar5 = (SDL_bool)(UVar4 != 0);
    }
  }
  return SVar5;
}



----------------------------------------

// Function: SDL_CreateRGBSurface @ 0891ffc4

SDL_Surface *
SDL_CreateRGBSurface
          (Uint32 flags,int width,int height,int depth,Uint32 Rmask,Uint32 Gmask,Uint32 Bmask,
          Uint32 Amask)

{
  SDL_VideoDevice *pSVar1;
  Uint16 UVar2;
  SDL_Surface *surface;
  SDL_PixelFormat *pSVar3;
  void *m;
  SDL_BlitMap *pSVar4;
  int iVar5;
  Uint32 in_t0;
  Uint32 in_t1;
  Uint32 in_t2;
  Uint32 in_t3;
  Uint32 unaff_s0;
  SDL_Surface *pSVar6;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Surface * screen@[???]
                       Unresolved local var: SDL_Surface * surface@[???] */
  pSVar1 = current_video;
  if ((0x3fff < width) || (0xffff < height)) {
    SDL_SetError("Width or height is too large");
    return (SDL_Surface *)0x0;
  }
  pSVar6 = (SDL_Surface *)0x0;
  if (((current_video == (SDL_VideoDevice *)0x0) ||
      (pSVar6 = current_video->visible, pSVar6 == (SDL_Surface *)0x0)) || ((pSVar6->flags & 1) == 0)
     ) {
    flags = 0;
  }
  else {
    if ((flags & 0x11000) != 0) {
      flags = flags | 1;
    }
    if (((flags & 0x1000) != 0) && ((&current_video->info)->blit_hw_CC == 0)) {
      flags = flags & 0xfffffffe;
    }
    if (((flags & 0x10000) != 0) && ((&current_video->info)->blit_hw_A == 0)) {
      flags = 0;
    }
  }
  surface = malloc(0x3c);
  if (surface == (SDL_Surface *)0x0) {
LAB_0892029c:
    SDL_Error(SDL_ENOMEM);
  }
  else {
    surface->flags = 0;
    if ((flags & 1) != 0) {
      if (in_t3 == 0) {
        pSVar3 = pSVar6->format;
      }
      else {
        pSVar3 = pSVar1->displayformatalphapixel;
        if (pSVar3 != (SDL_PixelFormat *)0x0) {
          in_t3 = pSVar3->Amask;
          depth = (int)pSVar3->BitsPerPixel;
          in_t0 = pSVar3->Rmask;
          in_t1 = pSVar3->Gmask;
          in_t2 = pSVar3->Bmask;
          goto LAB_089200a4;
        }
        pSVar3 = pSVar6->format;
      }
      in_t3 = pSVar3->Amask;
      depth = (int)pSVar3->BitsPerPixel;
      in_t0 = pSVar3->Rmask;
      in_t1 = pSVar3->Gmask;
      in_t2 = pSVar3->Bmask;
    }
LAB_089200a4:
    pSVar3 = SDL_AllocFormat(depth,in_t0,in_t1,in_t2,unaff_s0);
    surface->format = pSVar3;
    if (pSVar3 == (SDL_PixelFormat *)0x0) {
      free(surface);
      return (SDL_Surface *)0x0;
    }
    if (in_t3 != 0) {
      surface->flags = surface->flags | 0x10000;
    }
    surface->w = width;
    surface->h = height;
    UVar2 = SDL_CalculatePitch(surface);
    surface->pitch = UVar2;
    surface->pixels = (void *)0x0;
    surface->offset = 0;
    surface->hwdata = (private_hwdata *)0x0;
    surface->locked = 0;
    surface->map = (SDL_BlitMap *)0x0;
    surface->unused1 = 0;
    SDL_SetClipRect(surface,(SDL_Rect *)0x0);
    SDL_FormatChanged(surface);
    if ((flags & 1) == 0) {
      iVar5 = surface->w;
LAB_08920130:
      if ((iVar5 != 0) && (surface->h != 0)) {
        m = malloc(surface->h * (uint)surface->pitch);
        surface->pixels = m;
        if (m == (void *)0x0) {
          SDL_FreeSurface(surface);
          goto LAB_0892029c;
        }
        memset(m,0,(uint)surface->pitch * surface->h);
      }
    }
    else {
      iVar5 = (*pSVar1->AllocHWSurface)(pSVar1,surface);
      if (iVar5 < 0) {
        iVar5 = surface->w;
        goto LAB_08920130;
      }
    }
    pSVar4 = SDL_AllocBlitMap();
    surface->map = pSVar4;
    if (pSVar4 != (SDL_BlitMap *)0x0) {
      surface->refcount = 1;
      return surface;
    }
    SDL_FreeSurface(surface);
  }
  return (SDL_Surface *)0x0;
}



----------------------------------------

// Function: SDL_ConvertSurface @ 089202cc

SDL_Surface * SDL_ConvertSurface(SDL_Surface *surface,SDL_PixelFormat *format,Uint32 flags)

{
  SDL_Palette *pSVar1;
  SDL_Surface *dst;
  SDL_Palette *pSVar2;
  SDL_VideoInfo *pSVar3;
  SDL_PixelFormat *pSVar4;
  Uint32 key;
  SDL_Color *pSVar5;
  int iVar6;
  int iVar7;
  Uint32 UVar8;
  Uint8 *unaff_s0;
  uint uVar9;
  Uint32 unaff_s1;
  Uint32 unaff_s2;
  Uint32 unaff_s3;
  uint uVar10;
  Uint8 value;
  Uint8 local_38;
  Uint8 local_37;
  Uint8 local_36;
  SDL_Rect local_34;
  
                    /* Unresolved local var: SDL_Surface * convert@[???]
                       Unresolved local var: Uint32 colorkey@[???]
                       Unresolved local var: Uint8 alpha@[???]
                       Unresolved local var: Uint32 surface_flags@[???]
                       Unresolved local var: SDL_Rect bounds@[???] */
  pSVar1 = format->palette;
  if (pSVar1 == (SDL_Palette *)0x0) {
LAB_089203c0:
    UVar8 = format->Amask;
  }
  else {
                    /* Unresolved local var: int i@[???] */
    iVar7 = pSVar1->ncolors;
    if (iVar7 < 1) {
      if (iVar7 == 0) {
LAB_08920378:
        SDL_SetError("Empty destination palette");
        return (SDL_Surface *)0x0;
      }
      goto LAB_089203c0;
    }
    pSVar5 = pSVar1->colors;
    if (pSVar5->r == '\0') {
      if (pSVar5->g == '\0') {
        if (pSVar5->b == '\0') {
          for (iVar6 = 1; iVar7 != iVar6; iVar6 = iVar6 + 1) {
            if ((pSVar5[1].r != '\0') || (pSVar5[1].g != '\0')) goto LAB_089203c0;
            if (pSVar5[1].b != '\0') {
              UVar8 = format->Amask;
              goto LAB_089203c4;
            }
            pSVar5 = pSVar5 + 1;
          }
          goto LAB_08920378;
        }
        goto LAB_089203c0;
      }
      UVar8 = format->Amask;
    }
    else {
      UVar8 = format->Amask;
    }
  }
LAB_089203c4:
  if (UVar8 == 0) {
LAB_089203cc:
    iVar7 = surface->w;
  }
  else if ((flags & 1) == 0) {
    iVar7 = surface->w;
  }
  else {
                    /* Unresolved local var: SDL_VideoInfo * vi@[???] */
    pSVar3 = SDL_GetVideoInfo();
    if ((pSVar3 == (SDL_VideoInfo *)0x0) || (pSVar3->blit_hw_A == 0)) {
      flags = flags & 0xfffffffe;
      goto LAB_089203cc;
    }
    iVar7 = surface->w;
  }
  dst = SDL_CreateRGBSurface
                  (flags,iVar7,surface->h,(uint)format->BitsPerPixel,(Uint32)unaff_s0,unaff_s1,
                   unaff_s2,unaff_s3);
  if (dst == (SDL_Surface *)0x0) {
    return (SDL_Surface *)0x0;
  }
  pSVar1 = format->palette;
  if (pSVar1 == (SDL_Palette *)0x0) {
    uVar10 = surface->flags;
  }
  else {
    pSVar2 = dst->format->palette;
    if (pSVar2 == (SDL_Palette *)0x0) {
      uVar10 = surface->flags;
    }
    else {
      memcpy(pSVar2->colors,pSVar1->colors,pSVar1->ncolors << 2);
      dst->format->palette->ncolors = format->palette->ncolors;
      uVar10 = surface->flags;
    }
  }
  uVar9 = uVar10 & 0x1000;
  if (uVar9 == 0) {
LAB_08920448:
    UVar8 = 0;
  }
  else {
    if ((flags & 0x1000) == 0) {
      if (format->Amask != 0) {
        uVar10 = uVar10 & 0xffffefff;
        uVar9 = 0;
        goto LAB_08920448;
      }
      pSVar4 = surface->format;
    }
    else {
      pSVar4 = surface->format;
    }
    UVar8 = pSVar4->colorkey;
    SDL_SetColorKey(surface,0,0);
  }
  if ((uVar10 & 0x10000) != 0) {
    if (format->Amask == 0) {
      value = surface->format->alpha;
      SDL_SetAlpha(surface,0,'\0');
      local_34.w = (Uint16)surface->w;
      goto LAB_08920460;
    }
    surface->flags = surface->flags & 0xfffeffff;
  }
  value = '\0';
  local_34.w = (Uint16)surface->w;
LAB_08920460:
  local_34.h = (Uint16)surface->h;
  local_34.x = 0;
  local_34.y = 0;
  SDL_LowerBlit(surface,&local_34,dst,&local_34);
  SDL_SetClipRect(dst,&surface->clip_rect);
  if (uVar9 != 0) {
                    /* Unresolved local var: Uint32 cflags@[???]
                       Unresolved local var: Uint8 keyR@[???]
                       Unresolved local var: Uint8 keyG@[???]
                       Unresolved local var: Uint8 keyB@[???] */
    SDL_GetRGB(UVar8,surface->format,&local_38,&local_37,unaff_s0);
    key = SDL_MapRGB(dst->format,local_38,local_37,local_36);
    SDL_SetColorKey(dst,uVar10 & 0x3000 | flags & 0x2000,key);
    SDL_SetColorKey(surface,uVar10 & 0x3000,UVar8);
  }
  if ((uVar10 & 0x10000) != 0) {
                    /* Unresolved local var: Uint32 aflags@[???] */
    SDL_SetAlpha(dst,uVar10 & 0x12000 | flags & 0x2000,value);
    if (format->Amask != 0) {
      surface->flags = surface->flags | 0x10000;
      return dst;
    }
    SDL_SetAlpha(surface,uVar10 & 0x12000,value);
  }
  return dst;
}



----------------------------------------

// Function: SDL_CreateRGBSurfaceFrom @ 08920644

SDL_Surface *
SDL_CreateRGBSurfaceFrom
          (void *pixels,int width,int height,int depth,int pitch,Uint32 Rmask,Uint32 Gmask,
          Uint32 Bmask,Uint32 Amask)

{
  SDL_Surface *surface;
  Uint16 in_t0;
  Uint32 unaff_s4;
  Uint32 unaff_retaddr;
  Uint32 in_stack_00000000;
  Uint32 in_stack_00000004;
  
                    /* Unresolved local var: SDL_Surface * surface@[???] */
  surface = SDL_CreateRGBSurface
                      (0,0,0,depth,unaff_s4,unaff_retaddr,in_stack_00000000,in_stack_00000004);
  if (surface != (SDL_Surface *)0x0) {
    surface->pixels = pixels;
    surface->w = width;
    surface->flags = surface->flags | 0x1000000;
    surface->h = height;
    surface->pitch = in_t0;
    SDL_SetClipRect(surface,(SDL_Rect *)0x0);
  }
  return surface;
}



----------------------------------------

// Function: SDL_MouseInit @ 089206e8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_MouseInit(void)

{
  SDL_MouseY = -1;
  SDL_DeltaX = 0;
  SDL_MouseX = -1;
  SDL_ButtonState = '\0';
  SDL_DeltaY = 0;
  return 0;
}



----------------------------------------

// Function: SDL_GetMouseState @ 0892071c

Uint8 SDL_GetMouseState(int *x,int *y)

{
  if (x != (int *)0x0) {
    *x = (int)SDL_MouseX;
  }
  if (y != (int *)0x0) {
    *y = (int)SDL_MouseY;
  }
  return SDL_ButtonState;
}



----------------------------------------

// Function: SDL_GetRelativeMouseState @ 0892075c

Uint8 SDL_GetRelativeMouseState(int *x,int *y)

{
  int iVar1;
  
  if (x != (int *)0x0) {
    *x = (int)SDL_DeltaX;
  }
  if (y == (int *)0x0) {
    SDL_DeltaY = 0;
    SDL_DeltaX = 0;
    return SDL_ButtonState;
  }
  iVar1 = (int)SDL_DeltaY;
  SDL_DeltaY = 0;
  *y = iVar1;
  SDL_DeltaX = 0;
  return SDL_ButtonState;
}



----------------------------------------

// Function: ClipOffset @ 089207b0

void ClipOffset(Sint16 *x,Sint16 *y)

{
  uint uVar1;
  SDL_Surface *pSVar2;
  SDL_PixelFormat *pSVar3;
  int iVar4;
  
  pSVar2 = current_video->screen;
  iVar4 = pSVar2->offset;
  if (iVar4 != 0) {
    pSVar3 = pSVar2->format;
    if (pSVar2->pitch == 0) {
      trap(7);
    }
    *y = *y - (short)(iVar4 / (int)(uint)pSVar2->pitch);
    uVar1 = (uint)pSVar3->BytesPerPixel;
    if (pSVar2->pitch == 0) {
      trap(7);
    }
    if (uVar1 == 0) {
      trap(7);
    }
    *x = *x - (short)((iVar4 % (int)(uint)pSVar2->pitch) / (int)uVar1);
  }
  return;
}



----------------------------------------

// Function: SDL_PrivateMouseButton @ 0892082c

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateMouseButton(Uint8 state,Uint8 button,Sint16 x,Sint16 y)

{
  bool bVar1;
  short sVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  SDL_Event local_30;
  Sint16 local_18 [2];
  Sint16 local_14 [2];
  
                    /* Unresolved local var: SDL_Event event@[???]
                       Unresolved local var: int posted@[???]
                       Unresolved local var: int move_mouse@[???]
                       Unresolved local var: Uint8 buttonstate@[???] */
  local_30.type = '\0';
  local_30.active.gain = '\0';
  local_30.active.state = '\0';
  local_30.button.state = '\0';
  local_30.resize.w = 0;
  local_30.key.keysym.sym = SDLK_FIRST;
  local_30.key.keysym.mod = KMOD_NONE;
  local_30._16_4_ = 0;
  local_14[0] = y;
  if ((x == 0) && (y == 0)) {
    local_18[0] = SDL_MouseX;
    bVar1 = false;
    iVar3 = 0;
    goto LAB_089208e4;
  }
  local_18[0] = x;
  ClipOffset(local_18,local_14);
  iVar5 = (int)local_18[0];
  if (iVar5 < 0) {
    iVar5 = 0;
    local_18[0] = 0;
LAB_089208a4:
    if (local_14[0] < 0) goto LAB_0892095c;
LAB_089208b0:
    iVar3 = (int)local_14[0];
    iVar4 = current_video->screen->h;
    sVar2 = (short)iVar4 + -1;
    if (iVar3 < iVar4) {
      bVar1 = true;
      if (iVar5 != 0) goto LAB_089208e4;
    }
    else {
      iVar3 = (int)sVar2;
      local_14[0] = sVar2;
      if (iVar5 != 0) {
        bVar1 = true;
        goto LAB_089208e4;
      }
    }
  }
  else {
    iVar3 = current_video->screen->w;
    if (iVar5 < iVar3) goto LAB_089208a4;
    local_18[0] = (short)iVar3 + -1;
    iVar5 = (int)local_18[0];
    if (-1 < local_14[0]) goto LAB_089208b0;
LAB_0892095c:
    iVar3 = 0;
    local_14[0] = 0;
    if (iVar5 != 0) {
      bVar1 = true;
      goto LAB_089208e4;
    }
  }
  bVar1 = true;
  local_18[0] = SDL_MouseX;
LAB_089208e4:
  if (iVar3 == 0) {
    local_14[0] = SDL_MouseY;
  }
  if (state == '\0') {
    local_30.type = '\x06';
    SDL_ButtonState = ~(byte)(1 << (button - 1 & 0x1f)) & SDL_ButtonState;
  }
  else {
    if (state != '\x01') {
      return 0;
    }
    SDL_ButtonState = (byte)(1 << (button - 1 & 0x1f)) | SDL_ButtonState;
    local_30.type = '\x05';
  }
  if (bVar1) {
    SDL_MouseX = local_18[0];
    SDL_MouseY = local_14[0];
    SDL_MoveCursor((int)local_18[0],(int)local_14[0]);
  }
  else {
  }
  if (SDL_ProcessEvents[local_30.type] == '\x01') {
    local_30.active.state = button;
    local_30.button.state = state;
    local_30.jball.yrel = local_14[0];
    local_30.jaxis.value = local_18[0];
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar3 = (*SDL_EventOK)(&local_30), iVar3 != 0)) {
      SDL_PushEvent(&local_30);
      return 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_ResetMouse @ 08920a58

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_ResetMouse(void)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: Uint8 i@[???] */
  uVar1 = (uint)SDL_ButtonState;
  iVar2 = 0;
  do {
    while (iVar3 = iVar2 + 1, ((int)uVar1 >> (iVar2 - 1U & 0x1f) & 1U) == 0) {
      uVar1 = (uint)SDL_ButtonState;
      iVar2 = iVar3;
      if (iVar3 == 8) {
        return;
      }
    }
    SDL_PrivateMouseButton('\0',(Uint8)iVar2,0,0);
    uVar1 = (uint)SDL_ButtonState;
    iVar2 = iVar3;
  } while (iVar3 != 8);
  return;
}



----------------------------------------

// Function: SDL_PrivateMouseMotion @ 08920ad8

/* WARNING: Type propagation algorithm not settling */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateMouseMotion(Uint8 buttonstate,int relative,Sint16 x,Sint16 y)

{
  int iVar1;
  int iVar2;
  short sVar3;
  short sVar4;
  SDL_Event local_40;
  short local_28 [2];
  short local_24 [2];
  
                    /* Unresolved local var: int posted@[???]
                       Unresolved local var: Uint16 X@[???]
                       Unresolved local var: Uint16 Y@[???]
                       Unresolved local var: Sint16 Xrel@[???]
                       Unresolved local var: Sint16 Yrel@[???] */
  if (current_video->screen == (SDL_Surface *)0x0) {
    return 0;
  }
  if (buttonstate == '\0') {
    buttonstate = SDL_ButtonState;
  }
  if (relative == 0) {
    local_28[0] = x;
    local_24[0] = y;
    ClipOffset(local_28,local_24);
  }
  else {
    local_28[0] = x + SDL_MouseX;
    local_24[0] = y + SDL_MouseY;
  }
  if (local_28[0] < 0) {
    sVar4 = 0;
    iVar1 = 0;
  }
  else {
    iVar1 = current_video->screen->w;
    sVar4 = local_28[0];
    if (iVar1 <= local_28[0]) {
      sVar4 = (short)iVar1 + -1;
    }
    iVar1 = (int)sVar4;
  }
  if (local_24[0] < 0) {
    iVar2 = 0;
    sVar3 = 0;
  }
  else {
    iVar2 = current_video->screen->h;
    if (local_24[0] < iVar2) {
      iVar2 = (int)local_24[0];
      sVar3 = local_24[0];
    }
    else {
      sVar3 = (short)iVar2 + -1;
      iVar2 = (int)sVar3;
    }
  }
  if (((relative == 0) && (-1 < SDL_MouseX)) && (-1 < SDL_MouseY)) {
    y = sVar3 - SDL_MouseY;
    x = sVar4 - SDL_MouseX;
  }
  SDL_DeltaX = x + SDL_DeltaX;
  SDL_DeltaY = y + SDL_DeltaY;
  SDL_MouseX = sVar4;
  SDL_MouseY = sVar3;
  SDL_ButtonState = buttonstate;
  SDL_MoveCursor(iVar1,iVar2);
  if (SDL_ProcessEvents[4] == '\x01') {
    local_40.active.state = buttonstate;
    local_40._0_2_ = 4;
                    /* Unresolved local var: SDL_Event event@[???] */
    local_40.button.state = 0;
    local_40.jball.yrel = sVar3;
    local_40.jaxis.value = sVar4;
    local_40.motion.yrel = y;
    local_40.motion.xrel = x;
    local_40.key.keysym.mod = KMOD_NONE;
    local_40._16_4_ = 0;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar1 = (*SDL_EventOK)(&local_40), iVar1 != 0)) {
      SDL_PushEvent(&local_40);
      return 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_PrivateResize @ 08920d34

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateResize(int w,int h)

{
  int iVar1;
  SDL_Surface *pSVar2;
  SDL_Event local_2a8;
  SDL_Event aSStack_294 [32];
  
                    /* Unresolved local var: int posted@[???]
                       Unresolved local var: SDL_Event[32] events@[???] */
  if ((((w != 0) && (h != 0)) && ((w != last_resize.w || (h != last_resize.h)))) &&
     (pSVar2 = current_video->screen, last_resize.w = w, last_resize.h = h,
     pSVar2 != (SDL_Surface *)0x0)) {
    if (w == pSVar2->w) {
      if (h == pSVar2->h) {
        return 0;
      }
      SDL_PeepEvents(aSStack_294,0x20,SDL_GETEVENT,0x10000);
    }
    else {
      SDL_PeepEvents(aSStack_294,0x20,SDL_GETEVENT,0x10000);
    }
    if ((SDL_ProcessEvents[0x10] == '\x01') &&
       ((local_2a8.type = '\x10', local_2a8.resize.w = w, local_2a8.resize.h = h,
        SDL_EventOK == (SDL_EventFilter)0x0 || (iVar1 = (*SDL_EventOK)(&local_2a8), iVar1 != 0)))) {
      SDL_PushEvent(&local_2a8);
      return 1;
    }
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_EventThreadID @ 08920e54

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint32 SDL_EventThreadID(void)

{
  return event_thread;
}



----------------------------------------

// Function: SDL_GetEventFilter @ 08920e60

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

SDL_EventFilter SDL_GetEventFilter(void)

{
  return SDL_EventOK;
}



----------------------------------------

// Function: SDL_PumpEvents @ 08920e6c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_PumpEvents(void)

{
  if (SDL_EventThread == (SDL_Thread *)0x0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    if (current_video != (SDL_VideoDevice *)0x0) {
      (*current_video->PumpEvents)(current_video);
    }
    SDL_CheckKeyRepeat();
    if ((SDL_numjoysticks != '\0') && ((SDL_eventstate & 0xf80) != 0)) {
      SDL_JoystickUpdate();
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_PeepEvents @ 08920ed8

/* WARNING: Removing unreachable block (ram,0x08921214) */
/* WARNING: Removing unreachable block (ram,0x08921064) */
/* WARNING: Removing unreachable block (ram,0x08920fb0) */
/* WARNING: Removing unreachable block (ram,0x089210dc) */
/* WARNING: Removing unreachable block (ram,0x0892116c) */
/* WARNING: Removing unreachable block (ram,0x089211b4) */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PeepEvents(SDL_Event *events,int numevents,SDL_eventaction action,Uint32 mask)

{
  bool bVar1;
  SDL_version SVar2;
  undefined1 uVar3;
  undefined *puVar4;
  int iVar5;
  SDL_Event *pSVar6;
  SDL_SysWMmsg *pSVar7;
  void *pvVar8;
  int iVar9;
  undefined4 uVar10;
  int iVar11;
  SDL_JoyHatEvent SVar12;
  undefined4 uVar13;
  undefined4 uVar14;
  undefined4 uVar15;
  int iVar16;
  int iVar17;
  SDL_Event *pSVar18;
  int iVar19;
  SDL_Event SStack_40;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int used@[???] */
  pSVar18 = &SStack_40;
  if (SDL_EventQ.active == 0) {
    return -1;
  }
  iVar5 = SDL_mutexP(SDL_EventQ.lock);
  if (iVar5 != 0) {
    SDL_SetError("Couldn\'t lock event queue");
    return -1;
  }
  if (action == SDL_ADDEVENT) {
    if (0 < numevents) {
      iVar16 = 0;
      iVar5 = 0;
      do {
                    /* Unresolved local var: int tail@[???]
                       Unresolved local var: int added@[???] */
        iVar19 = (SDL_EventQ.tail + 1) % 0x80;
        iVar17 = 0;
        if (iVar19 != SDL_EventQ.head) {
          iVar9 = SDL_EventQ.tail * 0x14;
          SVar12 = events->jhat;
          iVar17 = (events->resize).h;
          pvVar8 = (events->user).data2;
          uVar10 = *(undefined4 *)&(events->key).keysym.unicode;
          *(int *)((int)SDL_EventQ.event + iVar9 + 4) = (events->resize).w;
          *(SDL_JoyHatEvent *)(SDL_EventQ.event + SDL_EventQ.tail) = SVar12;
          *(int *)((int)SDL_EventQ.event + iVar9 + 8) = iVar17;
          *(void **)((int)SDL_EventQ.event + iVar9 + 0xc) = pvVar8;
          *(undefined4 *)((int)SDL_EventQ.event + iVar9 + 0x10) = uVar10;
          iVar17 = 1;
          SDL_EventQ.tail = iVar19;
          if (events->type == '\r') {
                    /* Unresolved local var: int next@[???] */
            pSVar7 = (events->syswm).msg;
            SVar2 = pSVar7->version;
            uVar3 = pSVar7->field_0x3;
            SDL_EventQ.wmmsg[SDL_EventQ.wmmsg_next].data = pSVar7->data;
            SDL_EventQ.wmmsg[SDL_EventQ.wmmsg_next].version = SVar2;
            SDL_EventQ.wmmsg[SDL_EventQ.wmmsg_next].field_0x3 = uVar3;
            *(int *)((int)SDL_EventQ.event + iVar9 + 4) = SDL_EventQ.wmmsg_next * 8 + 0x8a0fc64;
            SDL_EventQ.wmmsg_next = (SDL_EventQ.wmmsg_next + 1) % 0x80;
          }
        }
        iVar16 = iVar16 + 1;
        iVar5 = iVar5 + iVar17;
        events = events + 1;
      } while (numevents != iVar16);
      goto LAB_08921014;
    }
  }
  else {
                    /* Unresolved local var: SDL_Event tmpevent@[???]
                       Unresolved local var: int spot@[???] */
    if (events == (SDL_Event *)0x0) {
      numevents = 1;
      action = SDL_PEEKEVENT;
    }
    else {
      iVar5 = 0;
      pSVar18 = events;
      if (numevents < 1) goto LAB_08921014;
    }
    if (SDL_EventQ.tail != SDL_EventQ.head) {
      iVar16 = SDL_EventQ.head;
      iVar17 = 0;
      do {
        puVar4 = PTR_SDL_EventQ_089e0740;
        iVar19 = iVar16 * 0x14;
        iVar5 = iVar17;
        if ((1 << (SDL_EventQ.event[iVar16].type & 0x1f) & mask) == 0) {
LAB_089210d4:
          iVar16 = (iVar16 + 1) % 0x80;
        }
        else {
          SVar12 = *(SDL_JoyHatEvent *)(SDL_EventQ.event + iVar16);
          iVar9 = *(int *)((int)SDL_EventQ.event + iVar19 + 4);
          iVar11 = *(int *)((int)SDL_EventQ.event + iVar19 + 8);
          pvVar8 = *(void **)((int)SDL_EventQ.event + iVar19 + 0xc);
          iVar5 = iVar17 + 1;
          pSVar6 = pSVar18 + iVar17;
          *(undefined4 *)&(pSVar6->key).keysym.unicode =
               *(undefined4 *)((int)SDL_EventQ.event + iVar19 + 0x10);
          pSVar6->jhat = SVar12;
          (pSVar6->resize).w = iVar9;
          (pSVar6->resize).h = iVar11;
          (pSVar6->user).data2 = pvVar8;
          if (action != SDL_GETEVENT) goto LAB_089210d4;
          if (SDL_EventQ.head == iVar16) {
            iVar16 = (iVar16 + 1) % 0x80;
            SDL_EventQ.head = iVar16;
          }
          else {
            bVar1 = (iVar16 + 1) % 0x80 != SDL_EventQ.tail;
            iVar17 = SDL_EventQ.tail + -1;
            SDL_EventQ.tail = iVar16;
            if (bVar1) {
                    /* Unresolved local var: int here@[???]
                       Unresolved local var: int next@[???] */
              SDL_EventQ.tail = iVar17;
              iVar19 = iVar16;
              if (iVar17 < 0) {
                SDL_EventQ.tail = 0x7f;
                iVar17 = SDL_EventQ.tail;
              }
              while (iVar17 != iVar19) {
                iVar9 = (iVar19 + 1) % 0x80;
                uVar10 = *(undefined4 *)(puVar4 + iVar9 * 0x14 + 0x10);
                uVar13 = *(undefined4 *)(puVar4 + iVar9 * 0x14 + 0x14);
                uVar14 = *(undefined4 *)(puVar4 + iVar9 * 0x14 + 0x18);
                uVar15 = *(undefined4 *)(puVar4 + iVar9 * 0x14 + 0x1c);
                *(undefined4 *)(puVar4 + iVar19 * 0x14 + 0x20) =
                     *(undefined4 *)(puVar4 + iVar9 * 0x14 + 0x20);
                *(undefined4 *)(puVar4 + iVar19 * 0x14 + 0x10) = uVar10;
                *(undefined4 *)(puVar4 + iVar19 * 0x14 + 0x14) = uVar13;
                *(undefined4 *)(puVar4 + iVar19 * 0x14 + 0x18) = uVar14;
                *(undefined4 *)(puVar4 + iVar19 * 0x14 + 0x1c) = uVar15;
                iVar19 = iVar9;
              }
            }
          }
        }
      } while ((iVar5 < numevents) && (iVar17 = iVar5, iVar16 != SDL_EventQ.tail));
      goto LAB_08921014;
    }
  }
  iVar5 = 0;
LAB_08921014:
  SDL_mutexV(SDL_EventQ.lock);
  return iVar5;
}



----------------------------------------

// Function: SDL_PushEvent @ 08921254

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PushEvent(SDL_Event *event)

{
  int iVar1;
  int iVar2;
  
  iVar1 = SDL_PeepEvents(event,1,SDL_ADDEVENT,0);
  iVar2 = -1;
  if (0 < iVar1) {
    iVar2 = 0;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_PrivateSysWMEvent @ 08921284

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateSysWMEvent(SDL_SysWMmsg *message)

{
  int iVar1;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???] */
  if (SDL_ProcessEvents[0xd] == '\x01') {
    local_20.key.keysym.sym = SDLK_FIRST;
    local_20.key.keysym.mod = KMOD_NONE;
    local_20.type = '\r';
    local_20.active.gain = '\0';
    local_20.active.state = '\0';
    local_20.button.state = '\0';
    local_20._16_4_ = 0;
    local_20.syswm.msg = message;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)) {
      SDL_PushEvent(&local_20);
      return 1;
    }
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_WaitEvent @ 08921304

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_WaitEvent(SDL_Event *event)

{
  int iVar1;
  
  while( true ) {
    while( true ) {
      SDL_PumpEvents();
      iVar1 = SDL_PeepEvents(event,1,SDL_GETEVENT,0xffffffff);
      if (iVar1 != 0) break;
      SDL_Delay(10);
    }
    if (iVar1 == 1) break;
    if (iVar1 == -1) {
      return 0;
    }
  }
  return 1;
}



----------------------------------------

// Function: SDL_PollEvent @ 08921394

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PollEvent(SDL_Event *event)

{
  int iVar1;
  
  SDL_PumpEvents();
  iVar1 = SDL_PeepEvents(event,1,SDL_GETEVENT,0xffffffff);
  return (uint)(0 < iVar1);
}



----------------------------------------

// Function: SDL_EventState @ 089213d0

/* WARNING: Enum "SDLKey": Some values do not have unique names */

Uint8 SDL_EventState(Uint8 type,int state)

{
  uint uVar1;
  uint uVar2;
  int iVar3;
  uint uVar4;
  Uint8 *pUVar5;
  Uint8 UVar6;
  SDL_Event SStack_20;
  
                    /* Unresolved local var: SDL_Event bitbucket@[???]
                       Unresolved local var: Uint8 current_state@[???] */
  uVar4 = (uint)type;
  if (uVar4 != 0xff) {
    UVar6 = SDL_ProcessEvents[uVar4];
    if ((uint)state < 2) {
      SDL_ProcessEvents[uVar4] = (Uint8)state;
      if (state == 1) {
        SDL_eventstate = 1 << (uVar4 & 0x1f) | SDL_eventstate;
      }
      else {
        SDL_eventstate = ~(1 << (uVar4 & 0x1f)) & SDL_eventstate;
      }
      do {
        iVar3 = SDL_PollEvent(&SStack_20);
      } while (0 < iVar3);
    }
    return UVar6;
  }
  pUVar5 = SDL_ProcessEvents;
  UVar6 = '\0';
  uVar4 = 0;
  do {
    while( true ) {
      uVar1 = uVar4 & 0x1f;
      uVar2 = uVar4 & 0x1f;
      if (*pUVar5 != '\0') {
        UVar6 = '\x01';
      }
      *pUVar5 = (Uint8)state;
      if (state != 1) break;
      uVar4 = uVar4 + 1;
      SDL_eventstate = SDL_eventstate | state << uVar2;
      pUVar5 = pUVar5 + 1;
      if (uVar4 == 0x20) goto LAB_089214b4;
    }
    uVar4 = uVar4 + 1;
    SDL_eventstate = SDL_eventstate & ~(1 << uVar1);
    pUVar5 = pUVar5 + 1;
  } while (uVar4 != 0x20);
LAB_089214b4:
  do {
    iVar3 = SDL_PollEvent(&SStack_20);
  } while (0 < iVar3);
  return UVar6;
}



----------------------------------------

// Function: SDL_SetEventFilter @ 089214ec

/* WARNING: Enum "SDLKey": Some values do not have unique names */

void SDL_SetEventFilter(SDL_EventFilter filter)

{
  int iVar1;
  SDL_Event SStack_20;
  
                    /* Unresolved local var: SDL_Event bitbucket@[???] */
  SDL_EventOK = filter;
  do {
    iVar1 = SDL_PollEvent(&SStack_20);
  } while (0 < iVar1);
  return;
}



----------------------------------------

// Function: SDL_Unlock_EventThread @ 08921514

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_Unlock_EventThread(void)

{
  Uint32 UVar1;
  
  if ((SDL_EventThread != (SDL_Thread *)0x0) && (UVar1 = SDL_ThreadID(), UVar1 != event_thread)) {
    SDL_mutexV(SDL_EventLock.lock);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_Lock_EventThread @ 08921560

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_Lock_EventThread(void)

{
  Uint32 UVar1;
  
  if ((SDL_EventThread != (SDL_Thread *)0x0) && (UVar1 = SDL_ThreadID(), UVar1 != event_thread)) {
    SDL_mutexP(SDL_EventLock.lock);
    while (SDL_EventLock.safe == 0) {
      SDL_Delay(1);
    }
  }
  return;
}



----------------------------------------

// Function: SDL_GobbleEvents @ 089215d0

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_GobbleEvents(void *unused)

{
  event_thread = SDL_ThreadID();
  while (SDL_EventQ.active != 0) {
    while( true ) {
      if (current_video != (SDL_VideoDevice *)0x0) {
        (*current_video->PumpEvents)(current_video);
      }
      SDL_CheckKeyRepeat();
      if ((SDL_numjoysticks != '\0') && ((SDL_eventstate & 0xf80) != 0)) {
        SDL_JoystickUpdate();
      }
      SDL_EventLock.safe = 1;
      if (SDL_timer_running == 0) break;
      SDL_ThreadedTimerCheck();
      SDL_Delay(1);
      SDL_mutexP(SDL_EventLock.lock);
      SDL_EventLock.safe = 0;
      SDL_mutexV(SDL_EventLock.lock);
      if (SDL_EventQ.active == 0) goto LAB_089216e0;
    }
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    SDL_Delay(1);
    SDL_mutexP(SDL_EventLock.lock);
    SDL_EventLock.safe = 0;
    SDL_mutexV(SDL_EventLock.lock);
  }
LAB_089216e0:
  SDL_SetTimerThreaded(0);
  event_thread = 0;
  return 0;
}



----------------------------------------

// Function: SDL_StopEventLoop @ 08921730

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

void SDL_StopEventLoop(void)

{
  SDL_EventQ.active = 0;
  if (SDL_EventThread != (SDL_Thread *)0x0) {
    SDL_WaitThread(SDL_EventThread,(int *)0x0);
    SDL_EventThread = (SDL_Thread *)0x0;
    SDL_DestroyMutex(SDL_EventLock.lock);
  }
  SDL_DestroyMutex(SDL_EventQ.lock);
  SDL_EventQ.wmmsg_next = 0;
  SDL_EventQ.head = 0;
  SDL_EventQ.tail = 0;
  return;
}



----------------------------------------

// Function: SDL_StartEventLoop @ 089217a8

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_StartEventLoop(Uint32 flags)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: int retcode@[???] */
  SDL_EventThread = (SDL_Thread *)0x0;
  SDL_EventQ.lock = (SDL_mutex *)0x0;
  SDL_StopEventLoop();
  SDL_EventOK = (SDL_EventFilter)0x0;
  memset(SDL_ProcessEvents,1,0x20);
  SDL_ProcessEvents[0xd] = '\0';
  SDL_eventstate = 0xffffdfff;
  iVar1 = SDL_AppActiveInit();
  iVar2 = SDL_KeyboardInit();
  iVar3 = SDL_MouseInit();
  iVar4 = SDL_QuitInit();
  if (iVar1 + iVar2 + iVar3 + iVar4 < 0) {
    return -1;
  }
  SDL_EventLock.safe = 0;
  SDL_EventThread = (SDL_Thread *)0x0;
  SDL_EventLock.lock = (SDL_mutex *)0x0;
  SDL_EventQ.lock = SDL_CreateMutex();
  if (SDL_EventQ.lock != (SDL_mutex *)0x0) {
    SDL_EventQ.active = 1;
    if ((flags & 0x1000000) == 0) {
      SDL_EventQ.active = 1;
      event_thread = 0;
      return 0;
    }
    SDL_EventLock.lock = SDL_CreateMutex();
    if (SDL_EventLock.lock != (SDL_mutex *)0x0) {
      SDL_EventLock.safe = 0;
      SDL_SetTimerThreaded(2);
      SDL_EventThread = SDL_CreateThread(SDL_GobbleEvents,(void *)0x0);
      if (SDL_EventThread != (SDL_Thread *)0x0) {
        return 0;
      }
    }
  }
  SDL_StopEventLoop();
  return -1;
}



----------------------------------------

// Function: SDL_EnableUNICODE @ 08921920

int SDL_EnableUNICODE(int enable)

{
  int iVar1;
  
                    /* Unresolved local var: int old_mode@[???] */
  iVar1 = SDL_TranslateUNICODE;
  if (-1 < enable) {
    SDL_TranslateUNICODE = enable;
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_GetKeyState @ 08921938

Uint8 * SDL_GetKeyState(int *numkeys)

{
  if (numkeys != (int *)0x0) {
    *numkeys = 0x143;
  }
  return SDL_KeyState;
}



----------------------------------------

// Function: SDL_GetModState @ 08921954

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDLMod SDL_GetModState(void)

{
  return SDL_ModState;
}



----------------------------------------

// Function: SDL_SetModState @ 08921960

void SDL_SetModState(SDLMod modstate)

{
  SDL_ModState = modstate;
  return;
}



----------------------------------------

// Function: SDL_GetKeyName @ 0892196c

/* WARNING: Enum "SDLKey": Some values do not have unique names */

char * SDL_GetKeyName(SDLKey key)

{
                    /* Unresolved local var: char * keyname@[???] */
  if ((key < SDLK_LAST) && (keynames[key] != (char *)0x0)) {
    return keynames[key];
  }
  return "unknown key";
}



----------------------------------------

// Function: SDL_EnableKeyRepeat @ 089219a4

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_EnableKeyRepeat(int delay,int interval)

{
  if ((-1 < delay) && (-1 < interval)) {
    SDL_KeyRepeat.delay = delay;
    SDL_KeyRepeat.interval = interval;
    SDL_KeyRepeat.timestamp = 0;
    SDL_KeyRepeat.firsttime = 0;
    return 0;
  }
  SDL_SetError("keyboard repeat value less than zero");
  return -1;
}



----------------------------------------

// Function: SDL_KeyboardInit @ 08921a00

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_KeyboardInit(void)

{
  SDL_VideoDevice *pSVar1;
  char **ppcVar2;
  Uint8 *pUVar3;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: Uint16 i@[???] */
  pSVar1 = current_video;
  SDL_EnableUNICODE(0);
  SDL_ModState = KMOD_NONE;
  ppcVar2 = keynames;
  keynames[0] = (char *)0x0;
  while (ppcVar2 = ppcVar2 + 1, ppcVar2 != (char **)&SDL_numjoysticks) {
    *ppcVar2 = (char *)0x0;
  }
  pUVar3 = SDL_KeyState;
  SDL_KeyState[0] = '\0';
  while (pUVar3 = pUVar3 + 1, pUVar3 != (Uint8 *)0x8a101b7) {
    *pUVar3 = '\0';
  }
  (*pSVar1->InitOSKeymap)(pSVar1);
  SDL_EnableKeyRepeat(0,0);
  keynames[8] = "backspace";
  keynames[9] = "tab";
  keynames[0xc] = "clear";
  keynames[0xd] = "return";
  keynames[0x13] = "pause";
  keynames[0x1b] = "escape";
  keynames[0x20] = "space";
  keynames[0x21] = "!";
  keynames[0x22] = "\"";
  keynames[0x23] = "#";
  keynames[0x24] = "$";
  keynames[0x26] = "&";
  keynames[0x27] = "\'";
  keynames[0x28] = "(";
  keynames[0x29] = ")";
  keynames[0x2a] = "*";
  keynames[0x2b] = "+";
  keynames[0x2c] = ",";
  keynames[0x2d] = "-";
  keynames[0x2e] = ".";
  keynames[0x2f] = "/";
  keynames[0x30] = "0";
  keynames[0x31] = "1";
  keynames[0x32] = "2";
  keynames[0x33] = "3";
  keynames[0x34] = "4";
  keynames[0x35] = "5";
  keynames[0x36] = "6";
  keynames[0x37] = "7";
  keynames[0x38] = "8";
  keynames[0x39] = "9";
  keynames[0x3a] = ":";
  keynames[0x3b] = ";";
  keynames[0x3c] = "<";
  keynames[0x3d] = "=";
  keynames[0x3e] = ">";
  keynames[0x3f] = "?";
  keynames[0x40] = "@";
  keynames[0x5b] = "[";
  keynames[0x5c] = "\\";
  keynames[0x5d] = "]";
  keynames[0x5e] = "^";
  keynames[0x5f] = "_";
  keynames[0x60] = "`";
  keynames[0x61] = "a";
  keynames[0x62] = "b";
  keynames[99] = "c";
  keynames[100] = "d";
  keynames[0x65] = "e";
  keynames[0x66] = "f";
  keynames[0x67] = "g";
  keynames[0x68] = "h";
  keynames[0x69] = "i";
  keynames[0x6a] = "j";
  keynames[0x6b] = "k";
  keynames[0x6c] = "l";
  keynames[0x6d] = "m";
  keynames[0x6e] = "n";
  keynames[0x6f] = "o";
  keynames[0x70] = "p";
  keynames[0x71] = "q";
  keynames[0x72] = "r";
  keynames[0x73] = "s";
  keynames[0x74] = "t";
  keynames[0x75] = "u";
  keynames[0x76] = "v";
  keynames[0x77] = "w";
  keynames[0x78] = "x";
  keynames[0x79] = "y";
  keynames[0x7a] = "z";
  keynames[0x7f] = "delete";
  keynames[0xa0] = "world 0";
  keynames[0xa1] = "world 1";
  keynames[0xa2] = "world 2";
  keynames[0xa3] = "world 3";
  keynames[0xa4] = "world 4";
  keynames[0xa5] = "world 5";
  keynames[0xa6] = "world 6";
  keynames[0xa7] = "world 7";
  keynames[0xa8] = "world 8";
  keynames[0xa9] = "world 9";
  keynames[0xaa] = "world 10";
  keynames[0xab] = "world 11";
  keynames[0xac] = "world 12";
  keynames[0xad] = "world 13";
  keynames[0xae] = "world 14";
  keynames[0xaf] = "world 15";
  keynames[0xb0] = "world 16";
  keynames[0xb1] = "world 17";
  keynames[0xb2] = "world 18";
  keynames[0xb3] = "world 19";
  keynames[0xb4] = "world 20";
  keynames[0xb5] = "world 21";
  keynames[0xb6] = "world 22";
  keynames[0xb7] = "world 23";
  keynames[0xb8] = "world 24";
  keynames[0xb9] = "world 25";
  keynames[0xba] = "world 26";
  keynames[0xbb] = "world 27";
  keynames[0xbc] = "world 28";
  keynames[0xbd] = "world 29";
  keynames[0xbe] = "world 30";
  keynames[0xbf] = "world 31";
  keynames[0xc0] = "world 32";
  keynames[0xc1] = "world 33";
  keynames[0xc2] = "world 34";
  keynames[0xc3] = "world 35";
  keynames[0xc4] = "world 36";
  keynames[0xc5] = "world 37";
  keynames[0xc6] = "world 38";
  keynames[199] = "world 39";
  keynames[200] = "world 40";
  keynames[0xc9] = "world 41";
  keynames[0xca] = "world 42";
  keynames[0xcb] = "world 43";
  keynames[0xcc] = "world 44";
  keynames[0xcd] = "world 45";
  keynames[0xce] = "world 46";
  keynames[0xcf] = "world 47";
  keynames[0xd0] = "world 48";
  keynames[0xd1] = "world 49";
  keynames[0xd2] = "world 50";
  keynames[0xd3] = "world 51";
  keynames[0xd4] = "world 52";
  keynames[0xd5] = "world 53";
  keynames[0xd6] = "world 54";
  keynames[0xd7] = "world 55";
  keynames[0xd8] = "world 56";
  keynames[0xd9] = "world 57";
  keynames[0xda] = "world 58";
  keynames[0xdb] = "world 59";
  keynames[0xdc] = "world 60";
  keynames[0xdd] = "world 61";
  keynames[0xde] = "world 62";
  keynames[0xdf] = "world 63";
  keynames[0xe0] = "world 64";
  keynames[0xe1] = "world 65";
  keynames[0xe2] = "world 66";
  keynames[0xe3] = "world 67";
  keynames[0xe4] = "world 68";
  keynames[0xe5] = "world 69";
  keynames[0xe6] = "world 70";
  keynames[0xe7] = "world 71";
  keynames[0xe8] = "world 72";
  keynames[0xe9] = "world 73";
  keynames[0xea] = "world 74";
  keynames[0xeb] = "world 75";
  keynames[0xec] = "world 76";
  keynames[0xed] = "world 77";
  keynames[0xee] = "world 78";
  keynames[0xef] = "world 79";
  keynames[0xf0] = "world 80";
  keynames[0xf1] = "world 81";
  keynames[0xf2] = "world 82";
  keynames[0xf3] = "world 83";
  keynames[0xf4] = "world 84";
  keynames[0xf5] = "world 85";
  keynames[0xf6] = "world 86";
  keynames[0xf7] = "world 87";
  keynames[0xf8] = "world 88";
  keynames[0xf9] = "world 89";
  keynames[0xfa] = "world 90";
  keynames[0xfb] = "world 91";
  keynames[0xfc] = "world 92";
  keynames[0xfd] = "world 93";
  keynames[0xfe] = "world 94";
  keynames[0xff] = "world 95";
  keynames[0x100] = "[0]";
  keynames[0x101] = "[1]";
  keynames[0x102] = "[2]";
  keynames[0x103] = "[3]";
  keynames[0x104] = "[4]";
  keynames[0x105] = "[5]";
  keynames[0x106] = "[6]";
  keynames[0x107] = "[7]";
  keynames[0x108] = "[8]";
  keynames[0x109] = "[9]";
  keynames[0x10a] = "[.]";
  keynames[0x10b] = "[/]";
  keynames[0x10c] = "[*]";
  keynames[0x10d] = "[-]";
  keynames[0x10e] = "[+]";
  keynames[0x10f] = "enter";
  keynames[0x110] = "equals";
  keynames[0x111] = "up";
  keynames[0x113] = "right";
  keynames[0x114] = "left";
  keynames[0x112] = "down";
  keynames[0x115] = "insert";
  keynames[0x116] = "home";
  keynames[0x117] = "end";
  keynames[0x118] = "page up";
  keynames[0x119] = "page down";
  keynames[0x11a] = "f1";
  keynames[0x11b] = "f2";
  keynames[0x11c] = "f3";
  keynames[0x11d] = "f4";
  keynames[0x11e] = "f5";
  keynames[0x11f] = "f6";
  keynames[0x120] = "f7";
  keynames[0x121] = "f8";
  keynames[0x122] = "f9";
  keynames[0x123] = "f10";
  keynames[0x124] = "f11";
  keynames[0x142] = "undo";
  keynames[0x125] = "f12";
  keynames[0x126] = "f13";
  keynames[0x127] = "f14";
  keynames[0x128] = "f15";
  keynames[300] = "numlock";
  keynames[0x12d] = "caps lock";
  keynames[0x12e] = "scroll lock";
  keynames[0x12f] = "right shift";
  keynames[0x130] = "left shift";
  keynames[0x131] = "right ctrl";
  keynames[0x132] = "left ctrl";
  keynames[0x133] = "right alt";
  keynames[0x134] = "left alt";
  keynames[0x135] = "right meta";
  keynames[0x136] = "left meta";
  keynames[0x137] = "left super";
  keynames[0x138] = "right super";
  keynames[0x139] = "alt gr";
  keynames[0x13a] = "compose";
  keynames[0x13b] = "help";
  keynames[0x13c] = "print screen";
  keynames[0x13d] = "sys req";
  keynames[0x13e] = "break";
  keynames[0x13f] = "menu";
  keynames[0x141] = "euro";
  keynames[0x140] = "power";
  return 0;
}



----------------------------------------

// Function: SDL_CheckKeyRepeat @ 08922570

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

void SDL_CheckKeyRepeat(void)

{
  Uint32 UVar1;
  int iVar2;
  
  if (SDL_KeyRepeat.timestamp != 0) {
                    /* Unresolved local var: Uint32 now@[???]
                       Unresolved local var: Uint32 interval@[???] */
    UVar1 = SDL_GetTicks();
    if (SDL_KeyRepeat.firsttime == 0) {
      if (((uint)SDL_KeyRepeat.interval < UVar1 - SDL_KeyRepeat.timestamp) &&
         ((SDL_KeyRepeat.timestamp = UVar1, SDL_EventOK == (SDL_EventFilter)0x0 ||
          (iVar2 = (*SDL_EventOK)((SDL_Event *)0x8a1f764), iVar2 != 0)))) {
        SDL_PushEvent(&SDL_KeyRepeat.evt);
        return;
      }
    }
    else if ((uint)SDL_KeyRepeat.delay < UVar1 - SDL_KeyRepeat.timestamp) {
      SDL_KeyRepeat.timestamp = UVar1;
      SDL_KeyRepeat.firsttime = 0;
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_PrivateKeyboard @ 08922640

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateKeyboard(Uint8 state,SDL_keysym *keysym)

{
  byte bVar1;
  bool bVar2;
  int iVar3;
  SDLMod SVar4;
  uint uVar5;
  uint uVar6;
  SDLKey SVar7;
  SDL_Event local_20;
  
                    /* Unresolved local var: SDL_Event event@[???]
                       Unresolved local var: int posted@[???]
                       Unresolved local var: int repeatable@[???]
                       Unresolved local var: Uint16 modstate@[???] */
  uVar5 = (uint)state;
  SVar4 = SDL_ModState & 0xffff;
  if (uVar5 == 1) {
    SVar7 = keysym->sym;
    keysym->mod = SVar4;
    switch(SVar7) {
    case SDLK_NUMLOCK:
      SVar4 = SVar4 ^ KMOD_NUM;
      uVar6 = -((int)(SVar4 << 0x13) >> 0x1f);
      bVar2 = false;
      keysym->mod = SVar4;
      uVar5 = 0;
      if (uVar6 == 0) goto LAB_08922698;
      goto LAB_08922758;
    case SDLK_CAPSLOCK:
      SVar4 = SVar4 ^ KMOD_CAPS;
      uVar6 = -((int)(SVar4 << 0x12) >> 0x1f);
      bVar2 = false;
      keysym->mod = SVar4;
      uVar5 = 0;
      if (uVar6 != 0) goto LAB_08922758;
      goto LAB_08922698;
    default:
      bVar2 = true;
      goto joined_r0x08922690;
    case SDLK_RSHIFT:
      SVar4 = SVar4 | KMOD_RSHIFT;
      break;
    case SDLK_LSHIFT:
      SVar4 = SVar4 | KMOD_LSHIFT;
      break;
    case SDLK_RCTRL:
      SVar4 = SVar4 | KMOD_RCTRL;
      break;
    case SDLK_LCTRL:
      SVar4 = SVar4 | KMOD_LCTRL;
      break;
    case SDLK_RALT:
      SVar4 = SVar4 | KMOD_RALT;
      break;
    case SDLK_LALT:
      SVar4 = SVar4 | KMOD_LALT;
      break;
    case SDLK_RMETA:
      SVar4 = SVar4 | KMOD_RMETA;
      break;
    case SDLK_LMETA:
      SVar4 = SVar4 | KMOD_LMETA;
      break;
    case SDLK_MODE:
      SVar4 = SVar4 | KMOD_MODE;
    }
    bVar2 = false;
LAB_08922798:
    local_20.type = '\x02';
    local_20.active.gain = '\0';
    local_20.active.state = '\0';
    local_20.button.state = '\0';
  }
  else {
    SVar7 = keysym->sym;
    switch(SVar7) {
    case SDLK_NUMLOCK:
    case SDLK_CAPSLOCK:
      goto switchD_08922784_caseD_12c;
    default:
      keysym->mod = SVar4;
      break;
    case SDLK_RSHIFT:
      SVar4 = SDL_ModState & 0xfffd;
      keysym->mod = SVar4;
      break;
    case SDLK_LSHIFT:
      SVar4 = SDL_ModState & 0xfffe;
      keysym->mod = SVar4;
      break;
    case SDLK_RCTRL:
      SVar4 = SDL_ModState & 0xff7f;
      keysym->mod = SVar4;
      break;
    case SDLK_LCTRL:
      SVar4 = SDL_ModState & 0xffbf;
      keysym->mod = SVar4;
      break;
    case SDLK_RALT:
      SVar4 = SDL_ModState & 0xfdff;
      keysym->mod = SVar4;
      break;
    case SDLK_LALT:
      SVar4 = SDL_ModState & 0xfeff;
      keysym->mod = SVar4;
      break;
    case SDLK_RMETA:
      SVar4 = SDL_ModState & 0xf7ff;
      keysym->mod = SVar4;
      break;
    case SDLK_LMETA:
      SVar4 = SDL_ModState & 0xfbff;
      keysym->mod = SVar4;
      break;
    case SDLK_MODE:
      SVar4 = SDL_ModState & 0xbfff;
      keysym->mod = SVar4;
    }
    bVar2 = false;
joined_r0x08922690:
    uVar6 = uVar5;
    if (state != '\0') {
LAB_08922758:
      uVar5 = 1;
      if (uVar6 != 1) {
        return 0;
      }
      goto LAB_08922798;
    }
LAB_08922698:
    local_20.type = '\x03';
    local_20.active.gain = '\0';
    local_20.active.state = '\0';
    local_20.button.state = '\0';
    if ((SDL_KeyRepeat.timestamp != 0) && (SDL_KeyRepeat.evt.key.keysym.sym == SVar7)) {
      SDL_KeyRepeat.timestamp = 0;
    }
  }
  if (SDL_KeyState[SVar7] != uVar5) {
    bVar1 = SDL_ProcessEvents[(int)local_20.jhat];
    SDL_ModState = SVar4;
    SDL_KeyState[SVar7] = (byte)uVar5;
    if (bVar1 == 1) {
      local_20._16_4_ = *(undefined4 *)&keysym->unicode;
      local_20.resize.w = *(undefined4 *)keysym;
      local_20.key.keysym.sym = keysym->sym;
      local_20.key.keysym.mod = keysym->mod;
      local_20.active.state = (byte)uVar5;
      local_20.button.state = 0;
      if ((bVar2) && (SDL_KeyRepeat.delay != 0)) {
        SDL_KeyRepeat.evt.jhat = local_20.jhat;
        SDL_KeyRepeat.firsttime = (uint)bVar1;
        SDL_KeyRepeat.evt.resize.w = local_20.resize.w;
        SDL_KeyRepeat.evt.key.keysym.sym = local_20.key.keysym.sym;
        SDL_KeyRepeat.evt.key.keysym.mod = local_20.key.keysym.mod;
        SDL_KeyRepeat.evt._16_4_ = local_20._16_4_;
        SDL_KeyRepeat.timestamp = SDL_GetTicks();
      }
      if ((SDL_EventOK != (SDL_EventFilter)0x0) && (iVar3 = (*SDL_EventOK)(&local_20), iVar3 == 0))
      {
        return 0;
      }
      SDL_PushEvent(&local_20);
      return 1;
    }
  }
switchD_08922784_caseD_12c:
  return 0;
}



----------------------------------------

// Function: SDL_ResetKeyboard @ 08922944

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

void SDL_ResetKeyboard(void)

{
  int iVar1;
  SDLKey SVar2;
  SDL_keysym local_28;
  
                    /* Unresolved local var: SDL_keysym keysym@[???]
                       Unresolved local var: SDLKey key@[???] */
  SVar2 = SDLK_FIRST;
  iVar1 = 0;
  local_28.scancode = '\0';
  local_28._1_3_ = 0;
  local_28.mod = KMOD_NONE;
  local_28.unicode = 0;
  local_28._14_2_ = 0;
  do {
    while (iVar1 = iVar1 + 1, SDL_KeyState[SVar2] == '\x01') {
      local_28.sym = SVar2;
      SDL_PrivateKeyboard('\0',&local_28);
      SVar2 = SVar2 + 1;
      if (iVar1 == 0x143) {
        SDL_KeyRepeat.timestamp = 0;
        return;
      }
    }
    SVar2 = SVar2 + 1;
  } while (iVar1 != 0x143);
  SDL_KeyRepeat.timestamp = 0;
  return;
}



----------------------------------------

// Function: SDL_NumJoysticks @ 089229e4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_NumJoysticks(void)

{
  return (uint)SDL_numjoysticks;
}



----------------------------------------

// Function: SDL_JoystickOpened @ 089229f0

int SDL_JoystickOpened(int device_index)

{
  SDL_Joystick *pSVar1;
  SDL_Joystick **ppSVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int opened@[???] */
  if (*SDL_joysticks != (SDL_Joystick *)0x0) {
    if ((uint)(*SDL_joysticks)->index == (device_index & 0xffU)) {
      return 1;
    }
    pSVar1 = SDL_joysticks[1];
    ppSVar2 = SDL_joysticks;
    while (pSVar1 != (SDL_Joystick *)0x0) {
      if ((uint)pSVar1->index == (device_index & 0xffU)) {
        return 1;
      }
      pSVar1 = ppSVar2[2];
      ppSVar2 = ppSVar2 + 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: SDL_JoystickEventState @ 08922a40

int SDL_JoystickEventState(int state)

{
  Uint8 UVar1;
  undefined3 extraout_var;
  Uint8 *pUVar2;
  
                    /* Unresolved local var: int i@[???] */
  if (state == -1) {
    pUVar2 = "\a\b\t\n\v";
    UVar1 = SDL_JoystickEventState::event_list[0];
    while( true ) {
      pUVar2 = pUVar2 + 1;
      UVar1 = SDL_EventState(UVar1,-1);
      state = 1;
      if (CONCAT31(extraout_var,UVar1) == 1) break;
      if (pUVar2 == "") {
        return CONCAT31(extraout_var,UVar1);
      }
      UVar1 = *pUVar2;
    }
  }
  else {
    pUVar2 = "\a\b\t\n\v";
    UVar1 = SDL_JoystickEventState::event_list[0];
    while( true ) {
      pUVar2 = pUVar2 + 1;
      SDL_EventState(UVar1,state);
      if (pUVar2 == "") break;
      UVar1 = *pUVar2;
    }
  }
  return state;
}



----------------------------------------

// Function: SDL_JoystickUpdate @ 08922b00

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_JoystickUpdate(void)

{
  undefined4 *puVar1;
  SDL_Joystick *joystick;
  int iVar2;
  
  iVar2 = 4;
                    /* Unresolved local var: int i@[???] */
  joystick = *SDL_joysticks;
  while (joystick != (SDL_Joystick *)0x0) {
    SDL_SYS_JoystickUpdate(joystick);
    puVar1 = (undefined4 *)((int)SDL_joysticks + iVar2);
    iVar2 = iVar2 + 4;
    joystick = (SDL_Joystick *)*puVar1;
  }
  return;
}



----------------------------------------

// Function: SDL_PrivateJoystickButton @ 08922b54

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateJoystickButton(SDL_Joystick *joystick,Uint8 button,Uint8 state)

{
  int iVar1;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???]
                       Unresolved local var: SDL_Event event@[???] */
  if (state == '\0') {
    local_20.type = 0xb;
  }
  else {
    if (state != '\x01') {
      return 0;
    }
    local_20.type = 10;
  }
  joystick->buttons[button] = state;
  if ((SDL_ProcessEvents[local_20.type] == '\x01') &&
     ((local_20.active.gain = joystick->index, local_20.active.state = button,
      local_20.button.state = state, SDL_EventOK == (SDL_EventFilter)0x0 ||
      (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)))) {
    SDL_PushEvent(&local_20);
    return 1;
  }
  return 0;
}



----------------------------------------

// Function: SDL_PrivateJoystickBall @ 08922c0c

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateJoystickBall(SDL_Joystick *joystick,Uint8 ball,Sint16 xrel,Sint16 yrel)

{
  int iVar1;
  balldelta *pbVar2;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???] */
  pbVar2 = joystick->balls + ball;
  pbVar2->dy = pbVar2->dy + (int)yrel;
  pbVar2->dx = pbVar2->dx + (int)xrel;
  if (SDL_ProcessEvents[8] == '\x01') {
    local_20.active.gain = joystick->index;
    local_20.type = '\b';
    local_20.active.state = ball;
    local_20.jaxis.value = xrel;
    local_20.jball.yrel = yrel;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)) {
      SDL_PushEvent(&local_20);
      return 1;
    }
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_PrivateJoystickHat @ 08922cbc

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateJoystickHat(SDL_Joystick *joystick,Uint8 hat,Uint8 value)

{
  int iVar1;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???] */
  joystick->hats[hat] = value;
  if (SDL_ProcessEvents[9] == '\x01') {
    local_20.active.gain = joystick->index;
    local_20.type = '\t';
    local_20.active.state = hat;
    local_20.button.state = value;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)) {
      SDL_PushEvent(&local_20);
      return 1;
    }
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_PrivateJoystickAxis @ 08922d4c

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateJoystickAxis(SDL_Joystick *joystick,Uint8 axis,Sint16 value)

{
  int iVar1;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???] */
  joystick->axes[axis] = value;
  if (SDL_ProcessEvents[7] == '\x01') {
    local_20.active.gain = joystick->index;
    local_20.type = '\a';
    local_20.active.state = axis;
    local_20.jaxis.value = value;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)) {
      SDL_PushEvent(&local_20);
      return 1;
    }
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_JoystickQuit @ 08922de0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_JoystickQuit(void)

{
  SDL_Lock_EventThread();
  SDL_numjoysticks = '\0';
  SDL_Unlock_EventThread();
  SDL_SYS_JoystickQuit();
  if (SDL_joysticks != (SDL_Joystick **)0x0) {
    free(SDL_joysticks);
    SDL_joysticks = (SDL_Joystick **)0x0;
  }
  return;
}



----------------------------------------

// Function: ValidJoystick @ 08922e30

int ValidJoystick(SDL_Joystick **joystick)

{
  bool bVar1;
  int iVar2;
  
                    /* Unresolved local var: int valid@[???] */
  iVar2 = 1;
  if ((*joystick == (SDL_Joystick *)0x0) &&
     (bVar1 = default_joystick == (SDL_Joystick *)0x0, *joystick = default_joystick, bVar1)) {
    SDL_SetError("Joystick hasn\'t been opened yet");
    iVar2 = 0;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_JoystickClose @ 08922e80

void SDL_JoystickClose(SDL_Joystick *joystick)

{
  int iVar1;
  Uint8 *pUVar2;
  balldelta *aptr;
  SDL_Joystick **ppSVar3;
  int iVar4;
  SDL_Joystick *local_10 [2];
  
                    /* Unresolved local var: int i@[???] */
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  if ((iVar1 == 0) ||
     (iVar1 = local_10[0]->ref_count + -1, local_10[0]->ref_count = iVar1, 0 < iVar1)) {
    return;
  }
  SDL_Lock_EventThread();
  if (local_10[0] == default_joystick) {
    default_joystick = (SDL_Joystick *)0x0;
  }
  SDL_SYS_JoystickClose(local_10[0]);
  if (*SDL_joysticks != (SDL_Joystick *)0x0) {
    ppSVar3 = SDL_joysticks;
    if (local_10[0] == *SDL_joysticks) {
      iVar4 = 0;
      iVar1 = 0;
    }
    else {
      iVar4 = 0;
      do {
        ppSVar3 = ppSVar3 + 1;
        iVar4 = iVar4 + 1;
        iVar1 = iVar4 * 4;
        if (*ppSVar3 == (SDL_Joystick *)0x0) goto LAB_08922f24;
      } while (*ppSVar3 != local_10[0]);
    }
    memcpy(ppSVar3,(void *)((int)SDL_joysticks + iVar1 + 4),((uint)SDL_numjoysticks - iVar4) * 4);
  }
LAB_08922f24:
  SDL_Unlock_EventThread();
  if (local_10[0]->axes == (Sint16 *)0x0) {
    pUVar2 = local_10[0]->hats;
  }
  else {
    free(local_10[0]->axes);
    pUVar2 = local_10[0]->hats;
  }
  if (pUVar2 == (Uint8 *)0x0) {
    aptr = local_10[0]->balls;
  }
  else {
    free(pUVar2);
    aptr = local_10[0]->balls;
  }
  if (aptr == (balldelta *)0x0) {
    pUVar2 = local_10[0]->buttons;
  }
  else {
    free(aptr);
    pUVar2 = local_10[0]->buttons;
  }
  if (pUVar2 != (Uint8 *)0x0) {
    free(pUVar2);
  }
  free(local_10[0]);
  return;
}



----------------------------------------

// Function: SDL_JoystickGetButton @ 08922fd4

Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick,int button)

{
  int iVar1;
  Uint8 UVar2;
  SDL_Joystick *local_10 [2];
  
                    /* Unresolved local var: Uint8 state@[???] */
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  UVar2 = '\0';
  if (iVar1 != 0) {
    if (local_10[0]->nbuttons <= button) {
      SDL_SetError("Joystick only has %d buttons",local_10[0]->nbuttons);
      return '\0';
    }
    UVar2 = local_10[0]->buttons[button];
  }
  return UVar2;
}



----------------------------------------

// Function: SDL_JoystickGetBall @ 08923054

int SDL_JoystickGetBall(SDL_Joystick *joystick,int ball,int *dx,int *dy)

{
  int iVar1;
  balldelta *pbVar2;
  SDL_Joystick *local_18 [2];
  
                    /* Unresolved local var: int retval@[???] */
  local_18[0] = joystick;
  iVar1 = ValidJoystick(local_18);
  if (iVar1 != 0) {
    if (ball < local_18[0]->nballs) {
      if (dx != (int *)0x0) {
        *dx = local_18[0]->balls[ball].dx;
      }
      pbVar2 = local_18[0]->balls;
      if (dy != (int *)0x0) {
        *dy = pbVar2[ball].dy;
        pbVar2 = local_18[0]->balls;
      }
      pbVar2[ball].dy = 0;
      pbVar2[ball].dx = 0;
      return 0;
    }
    SDL_SetError("Joystick only has %d balls");
  }
  return -1;
}



----------------------------------------

// Function: SDL_JoystickGetHat @ 08923120

Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick,int hat)

{
  int iVar1;
  Uint8 UVar2;
  SDL_Joystick *local_10 [2];
  
                    /* Unresolved local var: Uint8 state@[???] */
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  UVar2 = '\0';
  if (iVar1 != 0) {
    if (local_10[0]->nhats <= hat) {
      SDL_SetError("Joystick only has %d hats",local_10[0]->nhats);
      return '\0';
    }
    UVar2 = local_10[0]->hats[hat];
  }
  return UVar2;
}



----------------------------------------

// Function: SDL_JoystickGetAxis @ 089231a0

Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick,int axis)

{
  int iVar1;
  Sint16 SVar2;
  SDL_Joystick *local_10 [2];
  
                    /* Unresolved local var: Sint16 state@[???] */
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  SVar2 = 0;
  if (iVar1 != 0) {
    if (local_10[0]->naxes <= axis) {
      SDL_SetError("Joystick only has %d axes",local_10[0]->naxes);
      return 0;
    }
    SVar2 = local_10[0]->axes[axis];
  }
  return SVar2;
}



----------------------------------------

// Function: SDL_JoystickNumButtons @ 08923224

int SDL_JoystickNumButtons(SDL_Joystick *joystick)

{
  int iVar1;
  int iVar2;
  SDL_Joystick *local_10 [2];
  
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = local_10[0]->nbuttons;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_JoystickNumBalls @ 08923258

int SDL_JoystickNumBalls(SDL_Joystick *joystick)

{
  int iVar1;
  int iVar2;
  SDL_Joystick *local_10 [2];
  
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = local_10[0]->nballs;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_JoystickNumHats @ 0892328c

int SDL_JoystickNumHats(SDL_Joystick *joystick)

{
  int iVar1;
  int iVar2;
  SDL_Joystick *local_10 [2];
  
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = local_10[0]->nhats;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_JoystickNumAxes @ 089232c0

int SDL_JoystickNumAxes(SDL_Joystick *joystick)

{
  int iVar1;
  int iVar2;
  SDL_Joystick *local_10 [2];
  
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = local_10[0]->naxes;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_JoystickIndex @ 089232f4

int SDL_JoystickIndex(SDL_Joystick *joystick)

{
  int iVar1;
  uint uVar2;
  SDL_Joystick *local_10 [2];
  
  local_10[0] = joystick;
  iVar1 = ValidJoystick(local_10);
  uVar2 = 0xffffffff;
  if (iVar1 != 0) {
    uVar2 = (uint)local_10[0]->index;
  }
  return uVar2;
}



----------------------------------------

// Function: SDL_JoystickOpen @ 08923328

SDL_Joystick * SDL_JoystickOpen(int device_index)

{
  SDL_Joystick **ppSVar1;
  byte bVar2;
  int iVar3;
  Uint8 *pUVar4;
  SDL_Joystick *pSVar5;
  SDL_Joystick **ppSVar6;
  size_t sVar7;
  Sint16 *pSVar8;
  balldelta *pbVar9;
  SDL_Joystick *pSVar10;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: SDL_Joystick * joystick@[???] */
  if ((device_index < 0) || ((int)(uint)SDL_numjoysticks <= device_index)) {
    SDL_SetError("There are %d joysticks available",(uint)SDL_numjoysticks);
    return (SDL_Joystick *)0x0;
  }
  pSVar10 = *SDL_joysticks;
  if (pSVar10 != (SDL_Joystick *)0x0) {
    bVar2 = pSVar10->index;
    ppSVar6 = SDL_joysticks;
    while( true ) {
      if (device_index == (uint)bVar2) {
        pSVar10->ref_count = pSVar10->ref_count + 1;
        return pSVar10;
      }
      pSVar10 = ppSVar6[1];
      ppSVar6 = ppSVar6 + 1;
      if (pSVar10 == (SDL_Joystick *)0x0) break;
      bVar2 = pSVar10->index;
    }
  }
  pSVar10 = malloc(0x30);
  if (pSVar10 == (SDL_Joystick *)0x0) {
    return (SDL_Joystick *)0x0;
  }
  *(undefined4 *)pSVar10 = 0;
  pSVar10->name = (char *)0x0;
  pSVar10->index = (Uint8)device_index;
  pSVar10->naxes = 0;
  pSVar10->axes = (Sint16 *)0x0;
  pSVar10->nhats = 0;
  pSVar10->hats = (Uint8 *)0x0;
  pSVar10->nballs = 0;
  pSVar10->balls = (balldelta *)0x0;
  pSVar10->nbuttons = 0;
  pSVar10->buttons = (Uint8 *)0x0;
  pSVar10->hwdata = (joystick_hwdata *)0x0;
  pSVar10->ref_count = 0;
  iVar3 = SDL_SYS_JoystickOpen(pSVar10);
  if (iVar3 < 0) {
    free(pSVar10);
    return (SDL_Joystick *)0x0;
  }
  if (pSVar10->naxes < 1) {
    sVar7 = pSVar10->nhats;
  }
  else {
    pSVar8 = malloc(pSVar10->naxes << 1);
    pSVar10->axes = pSVar8;
    sVar7 = pSVar10->nhats;
  }
  if ((int)sVar7 < 1) {
    iVar3 = pSVar10->nballs;
  }
  else {
    pUVar4 = malloc(sVar7);
    pSVar10->hats = pUVar4;
    iVar3 = pSVar10->nballs;
  }
  if (iVar3 < 1) {
    sVar7 = pSVar10->nbuttons;
  }
  else {
    pbVar9 = malloc(iVar3 << 3);
    pSVar10->balls = pbVar9;
    sVar7 = pSVar10->nbuttons;
  }
  if ((int)sVar7 < 1) {
    iVar3 = pSVar10->naxes;
  }
  else {
    pUVar4 = malloc(sVar7);
    pSVar10->buttons = pUVar4;
    iVar3 = pSVar10->naxes;
  }
  if (iVar3 < 1) {
    iVar3 = pSVar10->nhats;
LAB_089234b4:
    if (iVar3 < 1) {
      iVar3 = pSVar10->nballs;
    }
    else {
      if (pSVar10->hats == (Uint8 *)0x0) goto LAB_089235a8;
      iVar3 = pSVar10->nballs;
    }
    if (iVar3 < 1) {
      iVar3 = pSVar10->nbuttons;
    }
    else {
      if (pSVar10->balls == (balldelta *)0x0) goto LAB_089235a8;
      iVar3 = pSVar10->nbuttons;
    }
    if (iVar3 < 1) {
      pSVar8 = pSVar10->axes;
      goto LAB_089234fc;
    }
    if (pSVar10->buttons == (Uint8 *)0x0) goto LAB_089235a8;
  }
  else {
    if (pSVar10->axes != (Sint16 *)0x0) {
      iVar3 = pSVar10->nhats;
      goto LAB_089234b4;
    }
LAB_089235a8:
    SDL_Error(SDL_ENOMEM);
    SDL_JoystickClose(pSVar10);
    pSVar10 = (SDL_Joystick *)0x0;
  }
  pSVar8 = pSVar10->axes;
LAB_089234fc:
  if (pSVar8 != (Sint16 *)0x0) {
    memset(pSVar8,0,pSVar10->naxes << 1);
  }
  if (pSVar10->hats == (Uint8 *)0x0) {
    pbVar9 = pSVar10->balls;
  }
  else {
    memset(pSVar10->hats,0,pSVar10->nhats);
    pbVar9 = pSVar10->balls;
  }
  if (pbVar9 != (balldelta *)0x0) {
    memset(pbVar9,0,pSVar10->nballs << 3);
  }
  if (pSVar10->buttons == (Uint8 *)0x0) {
    iVar3 = pSVar10->ref_count;
  }
  else {
    memset(pSVar10->buttons,0,pSVar10->nbuttons);
    iVar3 = pSVar10->ref_count;
  }
  pSVar10->ref_count = iVar3 + 1;
  SDL_Lock_EventThread();
  pSVar5 = *SDL_joysticks;
  ppSVar6 = SDL_joysticks;
  while (pSVar5 != (SDL_Joystick *)0x0) {
    ppSVar1 = ppSVar6 + 1;
    ppSVar6 = ppSVar6 + 1;
    pSVar5 = *ppSVar1;
  }
  *ppSVar6 = pSVar10;
  SDL_Unlock_EventThread();
  return pSVar10;
}



----------------------------------------

// Function: SDL_JoystickName @ 089235d0

char * SDL_JoystickName(int device_index)

{
  char *pcVar1;
  
  if ((-1 < device_index) && (device_index < (int)(uint)SDL_numjoysticks)) {
    pcVar1 = SDL_SYS_JoystickName(device_index);
    return pcVar1;
  }
  SDL_SetError("There are %d joysticks available",(uint)SDL_numjoysticks);
  return (char *)0x0;
}



----------------------------------------

// Function: SDL_JoystickInit @ 08923620

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_JoystickInit(void)

{
  int iVar1;
  size_t nbytes;
  
                    /* Unresolved local var: int arraylen@[???]
                       Unresolved local var: int status@[???] */
  SDL_numjoysticks = '\0';
  iVar1 = SDL_SYS_JoystickInit();
  nbytes = iVar1 * 4 + 4;
  if (-1 < iVar1) {
    SDL_joysticks = malloc(nbytes);
    if (SDL_joysticks == (SDL_Joystick **)0x0) {
      default_joystick = (SDL_Joystick *)0x0;
      SDL_numjoysticks = '\0';
      return 0;
    }
    memset(SDL_joysticks,0,nbytes);
    SDL_numjoysticks = (Uint8)iVar1;
    iVar1 = 0;
  }
  default_joystick = (SDL_Joystick *)0x0;
  return iVar1;
}



----------------------------------------

// Function: SDL_CDROMQuit @ 089236d4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_CDROMQuit(void)

{
  SDL_SYS_CDQuit();
  SDL_cdinitted = 0;
  return;
}



----------------------------------------

// Function: CheckInit @ 089236f8

int CheckInit(int check_cdrom,SDL_CD **cdrom)

{
  bool bVar1;
  int iVar2;
  
                    /* Unresolved local var: int okay@[???] */
  iVar2 = SDL_cdinitted;
  if (((check_cdrom != 0) && (*cdrom == (SDL_CD *)0x0)) &&
     (bVar1 = default_cdrom == (SDL_CD *)0x0, *cdrom = default_cdrom, bVar1)) {
    iVar2 = 0;
    SDL_SetError("CD-ROM not opened");
  }
  if (SDL_cdinitted == 0) {
    SDL_SetError("CD-ROM subsystem not initialized");
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_CDClose @ 08923774

void SDL_CDClose(SDL_CD *cdrom)

{
  int iVar1;
  SDL_CD *local_10 [2];
  
  local_10[0] = cdrom;
  iVar1 = CheckInit(1,local_10);
  if (iVar1 != 0) {
    (*SDL_CDcaps.Close)(local_10[0]);
    free(local_10[0]);
    default_cdrom = (SDL_CD *)0x0;
  }
  return;
}



----------------------------------------

// Function: SDL_CDEject @ 089237c0

int SDL_CDEject(SDL_CD *cdrom)

{
  int iVar1;
  int iVar2;
  SDL_CD *local_10 [2];
  
  local_10[0] = cdrom;
  iVar1 = CheckInit(1,local_10);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = (*SDL_CDcaps.Eject)(local_10[0]);
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_CDStop @ 08923804

int SDL_CDStop(SDL_CD *cdrom)

{
  int iVar1;
  CDstatus CVar2;
  int iVar3;
  SDL_CD *local_10 [2];
  
                    /* Unresolved local var: CDstatus status@[???]
                       Unresolved local var: int retval@[???] */
  local_10[0] = cdrom;
  iVar1 = CheckInit(1,local_10);
  iVar3 = -1;
  if (iVar1 != 0) {
    CVar2 = (*SDL_CDcaps.Status)(local_10[0],(int *)0x0);
    iVar3 = 0;
    if ((uint)(CVar2 + ~CD_STOPPED) < 2) {
      (*SDL_CDcaps.Stop)(local_10[0]);
      return 0;
    }
  }
  return iVar3;
}



----------------------------------------

// Function: SDL_CDResume @ 08923888

int SDL_CDResume(SDL_CD *cdrom)

{
  int iVar1;
  CDstatus CVar2;
  int iVar3;
  SDL_CD *local_10 [2];
  
                    /* Unresolved local var: CDstatus status@[???]
                       Unresolved local var: int retval@[???] */
  local_10[0] = cdrom;
  iVar1 = CheckInit(1,local_10);
  iVar3 = -1;
  if (iVar1 != 0) {
    CVar2 = (*SDL_CDcaps.Status)(local_10[0],(int *)0x0);
    iVar3 = 0;
    if (CVar2 == CD_PAUSED) {
      (*SDL_CDcaps.Resume)(local_10[0]);
      return 0;
    }
  }
  return iVar3;
}



----------------------------------------

// Function: SDL_CDPause @ 08923908

int SDL_CDPause(SDL_CD *cdrom)

{
  int iVar1;
  CDstatus CVar2;
  int iVar3;
  SDL_CD *local_10 [2];
  
                    /* Unresolved local var: CDstatus status@[???]
                       Unresolved local var: int retval@[???] */
  local_10[0] = cdrom;
  iVar1 = CheckInit(1,local_10);
  iVar3 = -1;
  if (iVar1 != 0) {
    CVar2 = (*SDL_CDcaps.Status)(local_10[0],(int *)0x0);
    iVar3 = 0;
    if (CVar2 == CD_PLAYING) {
      iVar1 = (*SDL_CDcaps.Pause)(local_10[0]);
      return iVar1;
    }
  }
  return iVar3;
}



----------------------------------------

// Function: SDL_CDPlay @ 08923988

int SDL_CDPlay(SDL_CD *cdrom,int sframe,int length)

{
  int iVar1;
  int iVar2;
  SDL_CD *local_18 [2];
  
  local_18[0] = cdrom;
  iVar1 = CheckInit(1,local_18);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = (*SDL_CDcaps.Play)(local_18[0],sframe,length);
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_CDPlayTracks @ 089239ec

int SDL_CDPlayTracks(SDL_CD *cdrom,int strack,int sframe,int ntracks,int nframes)

{
  Uint8 UVar1;
  int iVar2;
  Uint8 *pUVar3;
  int iVar4;
  int in_t0;
  SDL_CD *local_20 [2];
  
                    /* Unresolved local var: int etrack@[???]
                       Unresolved local var: int eframe@[???]
                       Unresolved local var: int start@[???]
                       Unresolved local var: int length@[???] */
  local_20[0] = cdrom;
  iVar2 = CheckInit(1,local_20);
  if (iVar2 == 0) {
    return -1;
  }
  if ((strack < 0) || (iVar2 = local_20[0]->numtracks, iVar2 <= strack)) {
    SDL_SetError("Invalid starting track");
    return -1;
  }
  iVar4 = strack + ntracks;
  if (ntracks == 0) {
    if (in_t0 == 0) {
      in_t0 = 0;
      iVar4 = iVar2;
      goto LAB_08923a5c;
    }
LAB_08923bf0:
    in_t0 = sframe + in_t0;
    iVar4 = strack;
  }
  else if (strack == iVar4) goto LAB_08923bf0;
  if (iVar2 < iVar4) {
    SDL_SetError("Invalid play length");
    return -1;
  }
LAB_08923a5c:
  if ((strack <= iVar4) && (local_20[0]->track[strack].type == '\x04')) {
    pUVar3 = &local_20[0]->track[strack + 1].type;
    do {
      strack = strack + 1;
      if (iVar4 < strack) break;
      UVar1 = *pUVar3;
      pUVar3 = pUVar3 + 0xc;
    } while (UVar1 == '\x04');
  }
  if (sframe < (int)local_20[0]->track[strack].length) {
    if ((strack < iVar4) && (local_20[0]->track[iVar4 + -1].type == '\x04')) {
      pUVar3 = &local_20[0]->track[iVar4 + -2].type;
      do {
        iVar4 = iVar4 + -1;
        if (iVar4 <= strack) break;
        UVar1 = *pUVar3;
        pUVar3 = pUVar3 + -0xc;
      } while (UVar1 == '\x04');
    }
    if ((int)local_20[0]->track[iVar4].length < in_t0) {
      SDL_SetError("Invalid ending frame for track %d");
      iVar2 = -1;
    }
    else {
      iVar2 = sframe + local_20[0]->track[strack].offset;
      iVar4 = ((in_t0 + local_20[0]->track[iVar4].offset) - iVar2) + -10;
      if (-1 < iVar4) {
        iVar2 = (*SDL_CDcaps.Play)(local_20[0],iVar2,iVar4);
        return iVar2;
      }
      iVar2 = 0;
    }
  }
  else {
    SDL_SetError("Invalid starting frame for track %d",strack);
    iVar2 = -1;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_CDStatus @ 08923c28

CDstatus SDL_CDStatus(SDL_CD *cdrom)

{
  SDL_CDtrack *pSVar1;
  _func_CDstatus_SDL_CD_ptr_int_ptr *p_Var2;
  int iVar3;
  int iVar4;
  CDstatus CVar5;
  SDL_CD *pSVar6;
  uint local_20 [2];
  SDL_CD *local_18 [2];
  
                    /* Unresolved local var: CDstatus status@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 position@[???] */
  local_18[0] = cdrom;
  iVar4 = CheckInit(1,local_18);
  p_Var2 = SDL_CDcaps.Status;
  if (iVar4 != 0) {
    local_18[0]->numtracks = 0;
    local_18[0]->cur_track = 0;
    local_18[0]->cur_frame = 0;
    CVar5 = (*p_Var2)(local_18[0],(int *)local_20);
    local_18[0]->status = CVar5;
    if (CVar5 < CD_STOPPED) {
      return CVar5;
    }
    iVar4 = (*SDL_CDcaps.GetTOC)(local_18[0]);
    if (-1 < iVar4) {
      if (1 < (uint)(CVar5 + ~CD_STOPPED)) {
        return CVar5;
      }
      iVar4 = 0;
      if (local_18[0]->track[1].offset <= local_20[0]) {
        pSVar6 = local_18[0];
        iVar3 = 2;
        do {
          iVar4 = iVar3;
          pSVar1 = pSVar6->track;
          pSVar6 = (SDL_CD *)&pSVar6->cur_track;
          iVar3 = iVar4 + 1;
        } while (pSVar1[2].offset <= local_20[0]);
        iVar4 = iVar4 + -1;
      }
      local_18[0]->cur_track = iVar4;
      local_18[0]->cur_frame = local_20[0] - local_18[0]->track[iVar4].offset;
      return CVar5;
    }
  }
  return CD_ERROR;
}



----------------------------------------

// Function: SDL_CDName @ 08923d48

char * SDL_CDName(int drive)

{
  int iVar1;
  char *pcVar2;
  
  iVar1 = CheckInit(0,(SDL_CD **)0x0);
  pcVar2 = (char *)0x0;
  if (iVar1 != 0) {
    if (drive < SDL_numcds) {
      pcVar2 = "";
      if (SDL_CDcaps.Name != (_func_char_ptr_int *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08923da4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
        pcVar2 = (*SDL_CDcaps.Name)(drive);
        return pcVar2;
      }
    }
    else {
      SDL_SetError("Invalid CD-ROM drive index");
      pcVar2 = (char *)0x0;
    }
  }
  return pcVar2;
}



----------------------------------------

// Function: SDL_CDNumDrives @ 08923dcc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_CDNumDrives(void)

{
  int iVar1;
  int iVar2;
  
  iVar1 = CheckInit(0,(SDL_CD **)0x0);
  iVar2 = -1;
  if (iVar1 != 0) {
    iVar2 = SDL_numcds;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_CDOpen @ 08923e00

SDL_CD * SDL_CDOpen(int drive)

{
  SDL_CD *pSVar1;
  int iVar2;
  SDL_CD *m;
  
                    /* Unresolved local var: SDL_CD * cdrom@[???] */
  iVar2 = CheckInit(0,(SDL_CD **)0x0);
  m = (SDL_CD *)0x0;
  pSVar1 = default_cdrom;
  if (iVar2 != 0) {
    if (drive < SDL_numcds) {
      m = malloc(0x4c4);
      if (m == (SDL_CD *)0x0) {
        SDL_Error(SDL_ENOMEM);
        m = (SDL_CD *)0x0;
        pSVar1 = default_cdrom;
      }
      else {
        memset(m,0,0x4c4);
        iVar2 = (*SDL_CDcaps.Open)(drive);
        m->id = iVar2;
        pSVar1 = m;
        if (iVar2 < 0) {
          free(m);
          m = (SDL_CD *)0x0;
          pSVar1 = default_cdrom;
        }
      }
    }
    else {
      SDL_SetError("Invalid CD-ROM drive index");
      m = (SDL_CD *)0x0;
      pSVar1 = default_cdrom;
    }
  }
  default_cdrom = pSVar1;
  return m;
}



----------------------------------------

// Function: SDL_CDROMInit @ 08923ed0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_CDROMInit(void)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???] */
  SDL_numcds = 0;
  iVar1 = SDL_SYS_CDInit();
  if (iVar1 == 0) {
    SDL_cdinitted = 1;
  }
  default_cdrom = (SDL_CD *)0x0;
  return iVar1;
}



----------------------------------------

// Function: SDL_SYS_CDInit @ 08923f08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_SYS_CDInit(void)

{
  return 0;
}



----------------------------------------

// Function: SDL_SYS_CDQuit @ 08923f10

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SYS_CDQuit(void)

{
  return;
}



----------------------------------------

// Function: SDL_SYS_SetupThread @ 08923f18

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SYS_SetupThread(void)

{
  return;
}



----------------------------------------

// Function: SDL_SYS_KillThread @ 08923f20

void SDL_SYS_KillThread(SDL_Thread *thread)

{
  return;
}



----------------------------------------

// Function: SDL_SYS_WaitThread @ 08923f28

void SDL_SYS_WaitThread(SDL_Thread *thread)

{
  sceKernelWaitThreadEnd(thread->handle,0);
  sceKernelDeleteThread(thread->handle);
  return;
}



----------------------------------------

// Function: SDL_ThreadID @ 08923f58

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint32 SDL_ThreadID(void)

{
  Uint32 in_v0;
  
  return in_v0;
}



----------------------------------------

// Function: SDL_SYS_CreateThread @ 08923f60

int SDL_SYS_CreateThread(SDL_Thread *thread,void *args)

{
  undefined4 uVar1;
  int iVar2;
  undefined4 local_78 [16];
  undefined4 local_38;
  void *local_10 [2];
  
                    /* Unresolved local var: SceKernelThreadInfo status@[???]
                       Unresolved local var: int priority@[???] */
  local_78[0] = 0x68;
  local_10[0] = args;
  uVar1 = sceKernelGetThreadId();
  iVar2 = sceKernelReferThreadStatus(uVar1,local_78);
  uVar1 = 0x20;
  if (iVar2 == 0) {
    uVar1 = local_38;
  }
  iVar2 = sceKernelCreateThread("SDL thread",ThreadEntry,uVar1,0x8000);
  thread->handle = iVar2;
  if (iVar2 < 0) {
    SDL_SetError("sceKernelCreateThread() failed",4,local_10);
    iVar2 = -1;
  }
  else {
    sceKernelStartThread(iVar2);
    iVar2 = 0;
  }
  return iVar2;
}



----------------------------------------

// Function: ThreadEntry @ 08923ffc

int ThreadEntry(SceSize args,void *argp)

{
  SDL_RunThread(*(void **)argp);
  return 0;
}



----------------------------------------

// Function: SDL_GetThreadID @ 08924020

Uint32 SDL_GetThreadID(SDL_Thread *thread)

{
  Uint32 UVar1;
  
                    /* Unresolved local var: Uint32 id@[???] */
  if (thread != (SDL_Thread *)0x0) {
    return thread->threadid;
  }
  UVar1 = SDL_ThreadID();
  return UVar1;
}



----------------------------------------

// Function: SDL_GetErrBuf @ 08924038

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_error * SDL_GetErrBuf(void)

{
  Uint32 UVar1;
  SDL_Thread **ppSVar2;
  SDL_Thread *pSVar3;
  int iVar4;
  SDL_error *pSVar5;
  
                    /* Unresolved local var: SDL_error * errbuf@[???] */
  if (SDL_Threads == (SDL_Thread **)0x0) {
    return &SDL_global_error;
  }
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 this_thread@[???] */
  UVar1 = SDL_ThreadID();
  SDL_mutexP(thread_lock);
  if (0 < SDL_numthreads) {
    pSVar3 = *SDL_Threads;
    if (UVar1 == pSVar3->threadid) {
LAB_089240dc:
      pSVar5 = &pSVar3->errbuf;
      goto LAB_089240b8;
    }
    ppSVar2 = SDL_Threads;
    for (iVar4 = 1; iVar4 != SDL_numthreads; iVar4 = iVar4 + 1) {
      pSVar3 = ppSVar2[1];
      ppSVar2 = ppSVar2 + 1;
      if (UVar1 == pSVar3->threadid) goto LAB_089240dc;
    }
  }
  pSVar5 = &SDL_global_error;
LAB_089240b8:
  SDL_mutexV(thread_lock);
  return pSVar5;
}



----------------------------------------

// Function: SDL_DelThread @ 08924104

void SDL_DelThread(SDL_Thread *thread)

{
  SDL_Thread **ppSVar1;
  SDL_Thread **ppSVar2;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: int i@[???] */
  if (thread_lock == (SDL_mutex *)0x0) {
    return;
  }
  SDL_mutexP(thread_lock);
  if (0 < SDL_numthreads) {
    if (thread == *SDL_Threads) {
      iVar4 = 0;
    }
    else {
      iVar4 = 0;
      ppSVar2 = SDL_Threads;
      do {
        iVar4 = iVar4 + 1;
        if (SDL_numthreads == iVar4) goto LAB_0892416c;
        ppSVar1 = ppSVar2 + 1;
        ppSVar2 = ppSVar2 + 1;
      } while (*ppSVar1 != thread);
    }
    iVar3 = SDL_numthreads + -1;
    SDL_numthreads = iVar3;
    if (iVar3 < 1) {
      SDL_maxthreads = 0;
      free(SDL_Threads);
      SDL_Threads = (SDL_Thread **)0x0;
    }
    else if (iVar4 < iVar3) {
      ppSVar2 = SDL_Threads + iVar4;
      do {
        iVar4 = iVar4 + 1;
        *ppSVar2 = ppSVar2[1];
        ppSVar2 = ppSVar2 + 1;
      } while (iVar4 < iVar3);
      SDL_mutexV(thread_lock);
      return;
    }
  }
LAB_0892416c:
  SDL_mutexV(thread_lock);
  return;
}



----------------------------------------

// Function: SDL_WaitThread @ 08924208

void SDL_WaitThread(SDL_Thread *thread,int *status)

{
  if (thread != (SDL_Thread *)0x0) {
    SDL_SYS_WaitThread(thread);
    if (status != (int *)0x0) {
      *status = thread->status;
    }
    SDL_DelThread(thread);
    free(thread);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_KillThread @ 08924270

void SDL_KillThread(SDL_Thread *thread)

{
  if (thread != (SDL_Thread *)0x0) {
    SDL_SYS_KillThread(thread);
    SDL_WaitThread(thread,(int *)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RunThread @ 089242b4

void SDL_RunThread(void *data)

{
  Uint32 UVar1;
  SDL_sem *sem;
  int iVar2;
  Uint32 *pUVar3;
  undefined4 uVar4;
  code *pcVar5;
  
                    /* Unresolved local var: thread_args * args@[???]
                       Unresolved local var: _func_int_void_ptr * userfunc@[???]
                       Unresolved local var: void * userdata@[???]
                       Unresolved local var: int * statusloc@[???] */
  SDL_SYS_SetupThread();
  pUVar3 = *(Uint32 **)((int)data + 8);
  UVar1 = SDL_ThreadID();
  uVar4 = *(undefined4 *)((int)data + 4);
  sem = *(SDL_sem **)((int)data + 0xc);
  pcVar5 = *(code **)data;
  iVar2 = *(int *)((int)data + 8);
  *pUVar3 = UVar1;
  SDL_SemPost(sem);
  uVar4 = (*pcVar5)(uVar4);
  *(undefined4 *)(iVar2 + 8) = uVar4;
  return;
}



----------------------------------------

// Function: SDL_ThreadsQuit @ 08924324

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_ThreadsQuit(void)

{
  SDL_mutex *mutex;
  
                    /* Unresolved local var: SDL_mutex * mutex@[???] */
  mutex = thread_lock;
  thread_lock = (SDL_mutex *)0x0;
  if (mutex != (SDL_mutex *)0x0) {
    SDL_DestroyMutex(mutex);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ThreadsInit @ 08924348

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_ThreadsInit(void)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???] */
  _creating_thread_lock = 1;
  thread_lock = SDL_CreateMutex();
  _creating_thread_lock = 0;
  iVar1 = -1;
  if (thread_lock != (SDL_mutex *)0x0) {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_CreateThread @ 0892438c

SDL_Thread * SDL_CreateThread(_func_int_void_ptr *fn,void *data)

{
  SDL_Thread *thread;
  undefined4 *aptr;
  SDL_sem *pSVar1;
  int iVar2;
  SDL_Thread **ppSVar3;
  
                    /* Unresolved local var: SDL_Thread * thread@[???]
                       Unresolved local var: thread_args * args@[???]
                       Unresolved local var: int ret@[???] */
  thread = malloc(800);
  if (thread == (SDL_Thread *)0x0) {
    SDL_Error(SDL_ENOMEM);
    return (SDL_Thread *)0x0;
  }
  memset(thread,0,800);
  thread->status = -1;
  aptr = malloc(0x10);
  if (aptr == (undefined4 *)0x0) {
    SDL_Error(SDL_ENOMEM);
    free(thread);
    return (SDL_Thread *)0x0;
  }
  *aptr = fn;
  aptr[1] = data;
  aptr[2] = thread;
  pSVar1 = SDL_CreateSemaphore(0);
  aptr[3] = pSVar1;
  if (pSVar1 == (SDL_sem *)0x0) {
    free(thread);
    free(aptr);
    return (SDL_Thread *)0x0;
  }
                    /* Unresolved local var: SDL_Thread * * threads@[???] */
  if (thread_lock == (SDL_mutex *)0x0) {
    iVar2 = SDL_ThreadsInit();
    if (iVar2 < 0) goto LAB_08924464;
    SDL_mutexP(thread_lock);
    ppSVar3 = SDL_Threads;
    if (SDL_numthreads == SDL_maxthreads) goto LAB_08924508;
LAB_08924440:
    SDL_Threads = ppSVar3;
    ppSVar3 = SDL_Threads + SDL_numthreads;
    SDL_numthreads = SDL_numthreads + 1;
    *ppSVar3 = thread;
  }
  else {
    SDL_mutexP(thread_lock);
    ppSVar3 = SDL_Threads;
    if (SDL_numthreads != SDL_maxthreads) goto LAB_08924440;
LAB_08924508:
    ppSVar3 = malloc(SDL_numthreads * 4 + 0x80);
    if (ppSVar3 != (SDL_Thread **)0x0) {
      memcpy(ppSVar3,SDL_Threads,SDL_numthreads << 2);
      SDL_maxthreads = SDL_maxthreads + 0x20;
      if (SDL_Threads != (SDL_Thread **)0x0) {
        free(SDL_Threads);
      }
      goto LAB_08924440;
    }
    SDL_Error(SDL_ENOMEM);
  }
  SDL_mutexV(thread_lock);
LAB_08924464:
  iVar2 = SDL_SYS_CreateThread(thread,aptr);
  if (iVar2 < 0) {
    SDL_DelThread(thread);
    free(thread);
    thread = (SDL_Thread *)0x0;
  }
  else {
    SDL_SemWait((SDL_sem *)aptr[3]);
  }
  SDL_DestroySemaphore((SDL_sem *)aptr[3]);
  free(aptr);
  return thread;
}



----------------------------------------

// Function: SDL_mutexV @ 089245a4

int SDL_mutexV(SDL_mutex *mutex)

{
  Uint32 UVar1;
  char *fmt;
  
  fmt = "Passed a NULL mutex";
  if (mutex != (SDL_mutex *)0x0) {
    UVar1 = SDL_ThreadID();
    fmt = "mutex not owned by this thread";
    if (UVar1 == mutex->owner) {
      if (mutex->recursive != 0) {
        mutex->recursive = mutex->recursive + -1;
        return 0;
      }
      mutex->owner = 0;
      SDL_SemPost(mutex->sem);
      return 0;
    }
  }
  SDL_SetError(fmt);
  return -1;
}



----------------------------------------

// Function: SDL_mutexP @ 08924634

int SDL_mutexP(SDL_mutex *mutex)

{
  Uint32 UVar1;
  int iVar2;
  
                    /* Unresolved local var: Uint32 this_thread@[???] */
  if (mutex == (SDL_mutex *)0x0) {
    SDL_SetError("Passed a NULL mutex");
    iVar2 = -1;
  }
  else {
    UVar1 = SDL_ThreadID();
    if (UVar1 == mutex->owner) {
      mutex->recursive = mutex->recursive + 1;
      return 0;
    }
    SDL_SemWait(mutex->sem);
    mutex->owner = UVar1;
    mutex->recursive = 0;
    iVar2 = 0;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_DestroyMutex @ 089246cc

void SDL_DestroyMutex(SDL_mutex *mutex)

{
  if (mutex != (SDL_mutex *)0x0) {
    if (mutex->sem != (SDL_sem *)0x0) {
      SDL_DestroySemaphore(mutex->sem);
    }
    free(mutex);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_CreateMutex @ 08924718

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_mutex * SDL_CreateMutex(void)

{
  SDL_mutex *aptr;
  SDL_sem *pSVar1;
  
                    /* Unresolved local var: SDL_mutex * mutex@[???] */
  aptr = malloc(0xc);
  if (aptr == (SDL_mutex *)0x0) {
    SDL_Error(SDL_ENOMEM);
    return (SDL_mutex *)0x0;
  }
  pSVar1 = SDL_CreateSemaphore(1);
  aptr->sem = pSVar1;
  aptr->recursive = 0;
  aptr->owner = 0;
  if (pSVar1 == (SDL_sem *)0x0) {
    free(aptr);
    aptr = (SDL_mutex *)0x0;
  }
  return aptr;
}



----------------------------------------

// Function: callback_wrapper @ 08924794

Uint32 callback_wrapper(Uint32 ms,void *param)

{
  Uint32 UVar1;
  
                    /* Unresolved local var: SDL_TimerCallback func@[???] */
                    /* WARNING: Could not recover jumptable at 0x08924798. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*param)();
  return UVar1;
}



----------------------------------------

// Function: SDL_RemoveTimer @ 089247a0

SDL_bool SDL_RemoveTimer(SDL_TimerID id)

{
  SDL_TimerID p_Var1;
  SDL_TimerID p_Var2;
  SDL_TimerID p_Var3;
  
                    /* Unresolved local var: SDL_TimerID t@[???]
                       Unresolved local var: SDL_TimerID prev@[???]
                       Unresolved local var: SDL_bool removed@[???] */
  SDL_mutexP(SDL_timer_mutex);
  if (SDL_timers != (SDL_TimerID)0x0) {
    p_Var1 = SDL_timers->next;
    p_Var3 = SDL_timers;
    if (SDL_timers == id) {
LAB_0892481c:
      SDL_timers = p_Var1;
      free(id);
      SDL_timer_running = SDL_timer_running + -1;
      list_changed = SDL_TRUE;
      SDL_mutexV(SDL_timer_mutex);
      return SDL_TRUE;
    }
    while (p_Var2 = p_Var1, p_Var2 != (SDL_TimerID)0x0) {
      if (id == p_Var2) {
        p_Var3->next = id->next;
        p_Var1 = SDL_timers;
        goto LAB_0892481c;
      }
      p_Var3 = p_Var2;
      p_Var1 = p_Var2->next;
    }
  }
  SDL_mutexV(SDL_timer_mutex);
  return SDL_FALSE;
}



----------------------------------------

// Function: SDL_AddTimerInternal @ 08924868

/* WARNING: Removing unreachable block (ram,0x089248ac) */

SDL_TimerID SDL_AddTimerInternal(Uint32 interval,SDL_NewTimerCallback callback,void *param)

{
  SDL_TimerID p_Var1;
  Uint32 UVar2;
  
                    /* Unresolved local var: SDL_TimerID t@[???] */
  p_Var1 = malloc(0x14);
  if (p_Var1 != (SDL_TimerID)0x0) {
    p_Var1->cb = callback;
    p_Var1->param = param;
    p_Var1->interval = ((interval + 9) / 10) * 10;
    UVar2 = SDL_GetTicks();
    SDL_timer_running = SDL_timer_running + 1;
    p_Var1->next = SDL_timers;
    list_changed = SDL_TRUE;
    SDL_timers = p_Var1;
    p_Var1->last_alarm = UVar2;
  }
  return p_Var1;
}



----------------------------------------

// Function: SDL_SetTimer @ 0892491c

int SDL_SetTimer(Uint32 ms,SDL_TimerCallback callback)

{
  _SDL_TimerID *p_Var1;
  SDL_TimerID p_Var2;
  int iVar3;
  
                    /* Unresolved local var: int retval@[???] */
  if (SDL_timer_threaded != 0) {
    SDL_mutexP(SDL_timer_mutex);
  }
  if (SDL_timer_running != 0) {
    if (SDL_timer_threaded == 0) {
      SDL_SYS_StopTimer();
      SDL_timer_running = 0;
    }
    else {
      if (SDL_timers != (SDL_TimerID)0x0) {
                    /* Unresolved local var: SDL_TimerID freeme@[???] */
        p_Var1 = SDL_timers->next;
        while (p_Var2 = SDL_timers, SDL_timers = p_Var1, free(p_Var2),
              SDL_timers != (SDL_TimerID)0x0) {
          p_Var1 = SDL_timers->next;
        }
      }
      list_changed = SDL_TRUE;
      SDL_timer_running = 0;
    }
  }
  if (ms == 0) {
    iVar3 = 0;
  }
  else if (SDL_timer_threaded == 0) {
    SDL_timer_running = 1;
    SDL_alarm_interval = ms;
    SDL_alarm_callback = callback;
    iVar3 = SDL_SYS_StartTimer();
  }
  else {
    p_Var2 = SDL_AddTimerInternal(ms,callback_wrapper,callback);
    iVar3 = -1;
    if (p_Var2 != (SDL_TimerID)0x0) {
      iVar3 = 0;
    }
  }
  if (SDL_timer_threaded != 0) {
    SDL_mutexV(SDL_timer_mutex);
  }
  return iVar3;
}



----------------------------------------

// Function: SDL_ThreadedTimerCheck @ 08924a50

/* WARNING: Removing unreachable block (ram,0x08924b54) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_ThreadedTimerCheck(void)

{
  Uint32 UVar1;
  uint uVar2;
  uint uVar3;
  Uint32 UVar4;
  void *pvVar5;
  SDL_NewTimerCallback p_Var6;
  SDL_TimerID aptr;
  _SDL_TimerID *p_Var7;
  SDL_TimerID p_Var8;
  SDL_TimerID p_Var9;
  
                    /* Unresolved local var: Uint32 now@[???]
                       Unresolved local var: Uint32 ms@[???]
                       Unresolved local var: SDL_TimerID t@[???]
                       Unresolved local var: SDL_TimerID prev@[???]
                       Unresolved local var: SDL_TimerID next@[???]
                       Unresolved local var: SDL_bool removed@[???] */
  SDL_mutexP(SDL_timer_mutex);
  list_changed = SDL_FALSE;
  UVar1 = SDL_GetTicks();
  if (SDL_timers != (SDL_TimerID)0x0) {
    aptr = SDL_timers;
    p_Var8 = (SDL_TimerID)0x0;
    do {
      uVar3 = aptr->interval;
      uVar2 = UVar1 - aptr->last_alarm;
      p_Var7 = aptr->next;
      p_Var9 = aptr;
      if ((int)(uVar3 - 10) < (int)uVar2) {
                    /* Unresolved local var: _SDL_TimerID timer@[???] */
        if (uVar2 < uVar3) {
          aptr->last_alarm = uVar3 + aptr->last_alarm;
        }
        else {
          aptr->last_alarm = UVar1;
        }
        UVar4 = aptr->interval;
        p_Var6 = aptr->cb;
        pvVar5 = aptr->param;
        SDL_mutexV(SDL_timer_mutex);
        UVar4 = (*p_Var6)(UVar4,pvVar5);
        SDL_mutexP(SDL_timer_mutex);
        if (list_changed != SDL_FALSE) break;
        if (UVar4 != aptr->interval) {
          if (UVar4 == 0) {
            p_Var9 = p_Var7;
            if (p_Var8 != (SDL_TimerID)0x0) {
              p_Var8->next = p_Var7;
              p_Var9 = SDL_timers;
            }
            SDL_timers = p_Var9;
            free(aptr);
            SDL_timer_running = SDL_timer_running + -1;
            p_Var9 = p_Var8;
          }
          else {
            aptr->interval = ((UVar4 + 9) / 10) * 10;
          }
        }
      }
      aptr = p_Var7;
      p_Var8 = p_Var9;
    } while (p_Var7 != (_SDL_TimerID *)0x0);
  }
  SDL_mutexV(SDL_timer_mutex);
  return;
}



----------------------------------------

// Function: SDL_AddTimer @ 08924bd8

SDL_TimerID SDL_AddTimer(Uint32 interval,SDL_NewTimerCallback callback,void *param)

{
  SDL_TimerID p_Var1;
  char *fmt;
  
                    /* Unresolved local var: SDL_TimerID t@[???] */
  if (SDL_timer_mutex == (SDL_mutex *)0x0) {
    fmt = "This platform doesn\'t support multiple timers";
    if (SDL_timer_started != 0) goto LAB_08924c9c;
    SDL_SetError("You must call SDL_Init(SDL_INIT_TIMER) first");
    p_Var1 = (SDL_TimerID)0x0;
  }
  else {
    if (SDL_timer_threaded == 0) {
      fmt = "Multiple timers require threaded events!";
LAB_08924c9c:
      SDL_SetError(fmt);
      return (SDL_TimerID)0x0;
    }
    SDL_mutexP(SDL_timer_mutex);
    p_Var1 = SDL_AddTimerInternal(interval,callback,param);
    SDL_mutexV(SDL_timer_mutex);
  }
  return p_Var1;
}



----------------------------------------

// Function: SDL_SetTimerThreaded @ 08924cc8

int SDL_SetTimerThreaded(int value)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???] */
  if (SDL_timer_started == 0) {
    iVar1 = 0;
    SDL_timer_threaded = value;
  }
  else {
    SDL_SetError("Timer already initialized");
    iVar1 = -1;
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_TimerQuit @ 08924d10

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_TimerQuit(void)

{
  SDL_SetTimer(0,(SDL_TimerCallback)0x0);
  if (SDL_timer_threaded < 2) {
    SDL_SYS_TimerQuit();
  }
  if (SDL_timer_threaded != 0) {
    SDL_DestroyMutex(SDL_timer_mutex);
  }
  SDL_timer_started = 0;
  SDL_timer_threaded = 0;
  return;
}



----------------------------------------

// Function: SDL_TimerInit @ 08924d7c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_TimerInit(void)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???] */
  iVar1 = 0;
  if (SDL_timer_started != 0) {
    SDL_TimerQuit();
  }
  if ((SDL_timer_threaded != 0) || (iVar1 = SDL_SYS_TimerInit(), SDL_timer_threaded != 0)) {
    SDL_timer_mutex = SDL_CreateMutex();
  }
  if (iVar1 == 0) {
    SDL_timer_started = 1;
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_SYS_StopTimer @ 08924e1c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SYS_StopTimer(void)

{
  return;
}



----------------------------------------

// Function: SDL_SYS_StartTimer @ 08924e24

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_SYS_StartTimer(void)

{
  SDL_SetError("Internal logic error: PSP uses threaded timer");
  return -1;
}



----------------------------------------

// Function: SDL_SYS_TimerQuit @ 08924e48

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SYS_TimerQuit(void)

{
  timer_alive = 0;
  if (timer != (SDL_Thread *)0x0) {
    SDL_WaitThread(timer,(int *)0x0);
    timer = (SDL_Thread *)0x0;
  }
  return;
}



----------------------------------------

// Function: SDL_SYS_TimerInit @ 08924e8c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_SYS_TimerInit(void)

{
  int iVar1;
  
  timer_alive = 1;
  timer = SDL_CreateThread(RunTimer,(void *)0x0);
  if (timer != (SDL_Thread *)0x0) {
    iVar1 = SDL_SetTimerThreaded(1);
    return iVar1;
  }
  return -1;
}



----------------------------------------

// Function: SDL_Delay @ 08924edc

void SDL_Delay(Uint32 ms)

{
  Uint32 UVar1;
  
                    /* Unresolved local var: Uint32 max_delay@[???] */
  UVar1 = 0x418937;
  if (ms < 0x418938) {
    UVar1 = ms;
  }
  sceKernelDelayThreadCB(UVar1 * 1000);
  return;
}



----------------------------------------

// Function: RunTimer @ 08924f00

int RunTimer(void *unused)

{
  do {
    if (timer_alive == 0) {
      return 0;
    }
    while (SDL_timer_running == 0) {
      SDL_Delay(10);
      if (timer_alive == 0) {
        return 0;
      }
    }
    SDL_ThreadedTimerCheck();
    SDL_Delay(10);
  } while( true );
}



----------------------------------------

// Function: SDL_GetTicks @ 08924f78

/* WARNING: Removing unreachable block (ram,0x08924fb0) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint32 SDL_GetTicks(void)

{
  int local_10;
  int local_c;
  
                    /* Unresolved local var: timeval now@[???]
                       Unresolved local var: Uint32 ticks@[???] */
  gettimeofday((timeval *)&local_10,(timezone *)0x0);
  return (local_10 - start.tv_sec) * 1000 + (local_c - start.tv_usec) / 1000;
}



----------------------------------------

// Function: SDL_StartTicks @ 08924fd8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_StartTicks(void)

{
  gettimeofday((timeval *)&start,(timezone *)0x0);
  return;
}



----------------------------------------

// Function: SDL_FreeRW @ 08924fe8

void SDL_FreeRW(SDL_RWops *area)

{
  _free_r(_impure_ptr,area);
  return;
}



----------------------------------------

// Function: mem_close @ 08924ff0

int mem_close(SDL_RWops *context)

{
  if (context != (SDL_RWops *)0x0) {
    free(context);
  }
  return 0;
}



----------------------------------------

// Function: SDL_AllocRW @ 08925014

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_RWops * SDL_AllocRW(void)

{
  SDL_RWops *pSVar1;
  
                    /* Unresolved local var: SDL_RWops * area@[???] */
  pSVar1 = malloc(0x20);
  if (pSVar1 != (SDL_RWops *)0x0) {
    return pSVar1;
  }
  SDL_Error(SDL_ENOMEM);
  return (SDL_RWops *)0x0;
}



----------------------------------------

// Function: SDL_RWFromConstMem @ 08925064

SDL_RWops * SDL_RWFromConstMem(void *mem,int size)

{
  SDL_RWops *pSVar1;
  
                    /* Unresolved local var: SDL_RWops * rwops@[???] */
  pSVar1 = SDL_AllocRW();
  if (pSVar1 != (SDL_RWops *)0x0) {
    (pSVar1->hidden).mem.stop = (Uint8 *)((int)mem + size);
    pSVar1->seek = mem_seek;
    pSVar1->read = mem_read;
    pSVar1->write = mem_writeconst;
    pSVar1->close = mem_close;
    (pSVar1->hidden).mem.base = mem;
    (pSVar1->hidden).stdio.fp = mem;
  }
  return pSVar1;
}



----------------------------------------

// Function: SDL_RWFromMem @ 089250d8

SDL_RWops * SDL_RWFromMem(void *mem,int size)

{
  SDL_RWops *pSVar1;
  
                    /* Unresolved local var: SDL_RWops * rwops@[???] */
  pSVar1 = SDL_AllocRW();
  if (pSVar1 != (SDL_RWops *)0x0) {
    (pSVar1->hidden).mem.stop = (Uint8 *)((int)mem + size);
    pSVar1->seek = mem_seek;
    pSVar1->read = mem_read;
    pSVar1->write = mem_write;
    pSVar1->close = mem_close;
    (pSVar1->hidden).mem.base = mem;
    (pSVar1->hidden).stdio.fp = mem;
  }
  return pSVar1;
}



----------------------------------------

// Function: SDL_RWFromFP @ 0892514c

SDL_RWops * SDL_RWFromFP(FILE *fp,int autoclose)

{
  SDL_RWops *pSVar1;
  
                    /* Unresolved local var: SDL_RWops * rwops@[???] */
  pSVar1 = SDL_AllocRW();
  if (pSVar1 != (SDL_RWops *)0x0) {
    pSVar1->seek = stdio_seek;
    pSVar1->read = stdio_read;
    (pSVar1->hidden).stdio.autoclose = autoclose;
    pSVar1->write = stdio_write;
    pSVar1->close = stdio_close;
    (pSVar1->hidden).stdio.fp = fp;
  }
  return pSVar1;
}



----------------------------------------

// Function: mem_writeconst @ 089251b8

int mem_writeconst(SDL_RWops *context,void *ptr,int size,int num)

{
  SDL_SetError("Can\'t write to read-only memory");
  return -1;
}



----------------------------------------

// Function: mem_seek @ 089251dc

int mem_seek(SDL_RWops *context,int offset,int whence)

{
  FILE *pFVar1;
  FILE *pFVar2;
  FILE *pFVar3;
  FILE *pFVar4;
  
                    /* Unresolved local var: Uint8 * newpos@[???] */
  if (whence == 1) {
    pFVar3 = (FILE *)(context->hidden).mem.base;
    pFVar4 = (FILE *)(context->hidden).mem.stop;
    pFVar2 = (FILE *)(((context->hidden).stdio.fp)->_ubuf + offset + -0x40);
  }
  else if (whence == 2) {
    pFVar4 = (FILE *)(context->hidden).mem.stop;
    pFVar3 = (FILE *)(context->hidden).mem.base;
    pFVar2 = (FILE *)(pFVar4->_ubuf + offset + -0x40);
  }
  else {
    if (whence != 0) {
      SDL_SetError("Unknown value for \'whence\'");
      return -1;
    }
    pFVar3 = (FILE *)(context->hidden).mem.base;
    pFVar4 = (FILE *)(context->hidden).mem.stop;
    pFVar2 = (FILE *)(pFVar3->_ubuf + offset + -0x40);
  }
  pFVar1 = pFVar3;
  if (pFVar3 <= pFVar2) {
    pFVar1 = pFVar2;
  }
  if (pFVar4 <= pFVar1) {
    pFVar1 = pFVar4;
  }
  (context->hidden).stdio.fp = pFVar1;
  return (int)pFVar1 - (int)pFVar3;
}



----------------------------------------

// Function: mem_write @ 08925274

int mem_write(SDL_RWops *context,void *ptr,int size,int num)

{
  FILE *dst0;
  Uint8 *pUVar1;
  size_t len0;
  
  len0 = num * size;
  dst0 = (context->hidden).stdio.fp;
  pUVar1 = (context->hidden).mem.stop;
  if (pUVar1 < dst0->_ubuf + (len0 - 0x40)) {
    num = ((int)pUVar1 - (int)dst0) / size;
    if (size == 0) {
      trap(7);
    }
    len0 = size * num;
  }
  memcpy(dst0,ptr,len0);
  (context->hidden).stdio.fp = (FILE *)(((context->hidden).stdio.fp)->_ubuf + (len0 - 0x40));
  return num;
}



----------------------------------------

// Function: mem_read @ 08925300

int mem_read(SDL_RWops *context,void *ptr,int size,int maxnum)

{
  FILE *src0;
  Uint8 *len0;
  
                    /* Unresolved local var: int total_bytes@[???]
                       Unresolved local var: int mem_available@[???] */
  if ((0 < maxnum) && (0 < size)) {
    if (maxnum == 0) {
      trap(7);
    }
    if (size == (maxnum * size) / maxnum) {
      src0 = (context->hidden).stdio.fp;
      len0 = (context->hidden).mem.stop + (maxnum * size - (int)src0);
      memcpy(ptr,src0,(size_t)len0);
      if (size == 0) {
        trap(7);
      }
      (context->hidden).stdio.fp =
           (FILE *)(len0 + (int)(((context->hidden).stdio.fp)->_ubuf + -0x40));
      return (int)len0 / size;
    }
  }
  return 0;
}



----------------------------------------

// Function: stdio_close @ 089253b4

int stdio_close(SDL_RWops *context)

{
  if (context != (SDL_RWops *)0x0) {
    if ((context->hidden).stdio.autoclose != 0) {
      fclose((context->hidden).stdio.fp);
    }
    free(context);
  }
  return 0;
}



----------------------------------------

// Function: stdio_write @ 08925400

int stdio_write(SDL_RWops *context,void *ptr,int size,int num)

{
  size_t sVar1;
  
                    /* Unresolved local var: size_t nwrote@[???] */
  sVar1 = fwrite(ptr,size,num,(context->hidden).stdio.fp);
  if ((sVar1 == 0) && ((((context->hidden).stdio.fp)->_flags & 0x40U) != 0)) {
    SDL_Error(SDL_EFWRITE);
    return 0;
  }
  return sVar1;
}



----------------------------------------

// Function: stdio_read @ 0892547c

int stdio_read(SDL_RWops *context,void *ptr,int size,int maxnum)

{
  size_t sVar1;
  
                    /* Unresolved local var: size_t nread@[???] */
  sVar1 = fread(ptr,size,maxnum,(context->hidden).stdio.fp);
  if ((sVar1 == 0) && ((((context->hidden).stdio.fp)->_flags & 0x40U) != 0)) {
    SDL_Error(SDL_EFREAD);
    return 0;
  }
  return sVar1;
}



----------------------------------------

// Function: stdio_seek @ 089254f8

int stdio_seek(SDL_RWops *context,int offset,int whence)

{
  int iVar1;
  long lVar2;
  
  iVar1 = fseek((context->hidden).stdio.fp,offset,whence);
  if (iVar1 == 0) {
    lVar2 = ftell((context->hidden).stdio.fp);
    return lVar2;
  }
  SDL_Error(SDL_EFSEEK);
  return -1;
}



----------------------------------------

// Function: SDL_RWFromFile @ 08925548

SDL_RWops * SDL_RWFromFile(char *file,char *mode)

{
  FILE *fp;
  SDL_RWops *pSVar1;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: SDL_RWops * rwops@[???] */
  fp = fopen(file,mode);
  if (fp != (FILE *)0x0) {
    pSVar1 = SDL_RWFromFP(fp,1);
    return pSVar1;
  }
  SDL_SetError("Couldn\'t open %s",file);
  return (SDL_RWops *)0x0;
}



----------------------------------------

// Function: SDL_ConvertMono @ 0892559c

/* WARNING: Removing unreachable block (ram,0x0892571c) */
/* WARNING: Removing unreachable block (ram,0x089257a4) */
/* WARNING: Removing unreachable block (ram,0x0892583c) */
/* WARNING: Removing unreachable block (ram,0x08925694) */
/* WARNING: Removing unreachable block (ram,0x0892562c) */
/* WARNING: Removing unreachable block (ram,0x089258ac) */
/* WARNING: Removing unreachable block (ram,0x089255e0) */

void SDL_ConvertMono(SDL_AudioCVT *cvt,Uint16 format)

{
  ushort uVar1;
  int iVar2;
  uint uVar3;
  Uint8 *pUVar4;
  byte *pbVar5;
  byte *pbVar6;
  ushort *puVar7;
  short *psVar8;
  Uint8 *pUVar9;
  ushort *puVar10;
  short *psVar11;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar12;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Sint32 sample@[???] */
  uVar1 = format & 0x8018;
  if (uVar1 == 0x10) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    puVar7 = (ushort *)cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar2 = cvt->len_cvt;
      iVar12 = iVar2 / 4;
      puVar10 = puVar7;
      if (iVar12 == 0) goto LAB_089255d4;
      do {
        uVar3 = (uint)*puVar7 + (uint)puVar7[1];
        if (uVar3 < 0x10000) {
          *(char *)((int)puVar10 + 1) = (char)(uVar3 >> 8);
          *(char *)puVar10 = (char)uVar3;
        }
        else {
          *(undefined1 *)puVar10 = 0xff;
          *(undefined1 *)((int)puVar10 + 1) = 0xff;
        }
        iVar12 = iVar12 + -1;
        puVar7 = puVar7 + 2;
        puVar10 = puVar10 + 1;
      } while (iVar12 != 0);
    }
    else {
      iVar2 = cvt->len_cvt;
      iVar12 = iVar2 / 4;
      puVar10 = puVar7;
      if (iVar12 == 0) goto LAB_089255d4;
      do {
        uVar3 = (uint)CONCAT11((char)*puVar7,*(undefined1 *)((int)puVar7 + 1)) +
                (uint)CONCAT11((char)puVar7[1],*(undefined1 *)((int)puVar7 + 3));
        if (uVar3 < 0x10000) {
          *(char *)puVar10 = (char)(uVar3 >> 8);
          *(char *)((int)puVar10 + 1) = (char)uVar3;
        }
        else {
          *(undefined1 *)puVar10 = 0xff;
          *(undefined1 *)((int)puVar10 + 1) = 0xff;
        }
        iVar12 = iVar12 + -1;
        puVar7 = puVar7 + 2;
        puVar10 = puVar10 + 1;
      } while (iVar12 != 0);
    }
  }
  else if (uVar1 < 0x11) {
    if (uVar1 != 8) {
      iVar2 = cvt->len_cvt;
      goto LAB_089255d4;
    }
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    iVar2 = cvt->len_cvt;
    iVar12 = iVar2 / 2;
    pbVar5 = cvt->buf;
    pbVar6 = pbVar5;
    if (iVar12 == 0) goto LAB_089255d4;
    do {
      if ((uint)*pbVar5 + (uint)pbVar5[1] < 0x100) {
        *pbVar6 = (byte)((uint)*pbVar5 + (uint)pbVar5[1]);
      }
      else {
        *pbVar6 = 0xff;
      }
      iVar12 = iVar12 + -1;
      pbVar5 = pbVar5 + 2;
      pbVar6 = pbVar6 + 1;
    } while (iVar12 != 0);
  }
  else if (uVar1 == 0x8008) {
                    /* Unresolved local var: Sint8 * src@[???]
                       Unresolved local var: Sint8 * dst@[???] */
    iVar2 = cvt->len_cvt;
    iVar12 = iVar2 / 2;
    pUVar4 = cvt->buf;
    pUVar9 = pUVar4;
    if (iVar12 == 0) goto LAB_089255d4;
    do {
      iVar2 = (int)(char)*pUVar4 + (int)(char)pUVar4[1];
      if (iVar2 < 0x80) {
        if (iVar2 < -0x80) {
          *pUVar9 = 0x80;
        }
        else {
          *pUVar9 = (Uint8)iVar2;
        }
      }
      else {
        *pUVar9 = '\x7f';
      }
      iVar12 = iVar12 + -1;
      pUVar4 = pUVar4 + 2;
      pUVar9 = pUVar9 + 1;
    } while (iVar12 != 0);
  }
  else if (uVar1 == 0x8010) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    psVar8 = (short *)cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar2 = cvt->len_cvt;
      iVar12 = iVar2 / 4;
      psVar11 = psVar8;
      if (iVar12 == 0) goto LAB_089255d4;
      do {
        iVar2 = (int)*psVar8 + (int)psVar8[1];
        if (iVar2 < 0x8000) {
          if (iVar2 < -0x8000) {
            *(undefined1 *)((int)psVar11 + 1) = 0x80;
            *(undefined1 *)psVar11 = 0;
          }
          else {
            *(char *)((int)psVar11 + 1) = (char)((uint)iVar2 >> 8);
            *(char *)psVar11 = (char)iVar2;
          }
        }
        else {
          *(undefined1 *)((int)psVar11 + 1) = 0x7f;
          *(undefined1 *)psVar11 = 0xff;
        }
        iVar12 = iVar12 + -1;
        psVar8 = psVar8 + 2;
        psVar11 = psVar11 + 1;
      } while (iVar12 != 0);
    }
    else {
      iVar2 = cvt->len_cvt;
      iVar12 = iVar2 / 4;
      psVar11 = psVar8;
      if (iVar12 == 0) goto LAB_089255d4;
      do {
        iVar2 = (int)CONCAT11((char)*psVar8,*(undefined1 *)((int)psVar8 + 1)) +
                (int)CONCAT11((char)psVar8[1],*(undefined1 *)((int)psVar8 + 3));
        if (iVar2 < 0x8000) {
          if (iVar2 < -0x8000) {
            *(undefined1 *)psVar11 = 0x80;
            *(undefined1 *)((int)psVar11 + 1) = 0;
          }
          else {
            *(char *)psVar11 = (char)((uint)iVar2 >> 8);
            *(char *)((int)psVar11 + 1) = (char)iVar2;
          }
        }
        else {
          *(undefined1 *)psVar11 = 0x7f;
          *(undefined1 *)((int)psVar11 + 1) = 0xff;
        }
        iVar12 = iVar12 + -1;
        psVar8 = psVar8 + 2;
        psVar11 = psVar11 + 1;
      } while (iVar12 != 0);
    }
  }
  iVar2 = cvt->len_cvt;
LAB_089255d4:
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0892560c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ConvertStrip @ 0892594c

/* WARNING: Removing unreachable block (ram,0x08925aac) */
/* WARNING: Removing unreachable block (ram,0x08925b24) */
/* WARNING: Removing unreachable block (ram,0x08925b9c) */
/* WARNING: Removing unreachable block (ram,0x08925a34) */
/* WARNING: Removing unreachable block (ram,0x089259dc) */
/* WARNING: Removing unreachable block (ram,0x08925be8) */
/* WARNING: Removing unreachable block (ram,0x08925990) */

void SDL_ConvertStrip(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 UVar1;
  Uint8 UVar2;
  Uint8 UVar3;
  undefined2 uVar4;
  undefined2 uVar5;
  ushort uVar6;
  int iVar7;
  Uint8 *pUVar8;
  Uint8 *pUVar9;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar10;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Sint32 lsample@[???]
                       Unresolved local var: Sint32 rsample@[???] */
  uVar6 = format & 0x8018;
  if (uVar6 == 0x10) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    pUVar8 = cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 0xc;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          uVar4 = *(undefined2 *)pUVar8;
          uVar5 = *(undefined2 *)(pUVar8 + 2);
          iVar10 = iVar10 + -1;
          pUVar9[1] = (Uint8)((ushort)uVar4 >> 8);
          pUVar9[3] = (Uint8)((ushort)uVar5 >> 8);
          *pUVar9 = (Uint8)uVar4;
          pUVar9[2] = (Uint8)uVar5;
          pUVar8 = pUVar8 + 0xc;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 0xc;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          UVar1 = pUVar8[2];
          UVar2 = pUVar8[1];
          UVar3 = pUVar8[3];
          iVar10 = iVar10 + -1;
          *pUVar9 = *pUVar8;
          pUVar9[2] = UVar1;
          pUVar9[1] = UVar2;
          pUVar9[3] = UVar3;
          pUVar8 = pUVar8 + 0xc;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
  }
  else if (uVar6 < 0x11) {
    if (uVar6 == 8) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 6;
      pUVar9 = cvt->buf;
      pUVar8 = pUVar9;
      if (iVar10 != 0) {
        do {
          UVar1 = *pUVar8;
          iVar10 = iVar10 + -1;
          pUVar9[1] = pUVar8[1];
          *pUVar9 = UVar1;
          pUVar9 = pUVar9 + 2;
          pUVar8 = pUVar8 + 6;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
    }
  }
  else if (uVar6 == 0x8008) {
                    /* Unresolved local var: Sint8 * src@[???]
                       Unresolved local var: Sint8 * dst@[???] */
    iVar7 = cvt->len_cvt;
    iVar10 = iVar7 / 6;
    pUVar9 = cvt->buf;
    pUVar8 = pUVar9;
    if (iVar10 != 0) {
      do {
        UVar1 = *pUVar9;
        iVar10 = iVar10 + -1;
        pUVar8[1] = pUVar9[1];
        *pUVar8 = UVar1;
        pUVar9 = pUVar9 + 6;
        pUVar8 = pUVar8 + 2;
      } while (iVar10 != 0);
      iVar7 = cvt->len_cvt;
    }
  }
  else if (uVar6 == 0x8010) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    pUVar8 = cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 0xc;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          uVar4 = *(undefined2 *)pUVar8;
          uVar5 = *(undefined2 *)(pUVar8 + 2);
          iVar10 = iVar10 + -1;
          pUVar9[1] = (Uint8)((ushort)uVar4 >> 8);
          pUVar9[3] = (Uint8)((ushort)uVar5 >> 8);
          *pUVar9 = (Uint8)uVar4;
          pUVar9[2] = (Uint8)uVar5;
          pUVar8 = pUVar8 + 0xc;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 0xc;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          UVar1 = pUVar8[2];
          UVar2 = pUVar8[1];
          UVar3 = pUVar8[3];
          iVar10 = iVar10 + -1;
          *pUVar9 = *pUVar8;
          pUVar9[2] = UVar1;
          pUVar9[1] = UVar2;
          pUVar9[3] = UVar3;
          pUVar8 = pUVar8 + 0xc;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
  }
  else {
    iVar7 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar7 / 3;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089259bc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ConvertStrip_2 @ 08925c50

/* WARNING: Removing unreachable block (ram,0x08925db0) */
/* WARNING: Removing unreachable block (ram,0x08925e28) */
/* WARNING: Removing unreachable block (ram,0x08925ea0) */
/* WARNING: Removing unreachable block (ram,0x08925d38) */
/* WARNING: Removing unreachable block (ram,0x08925ce0) */
/* WARNING: Removing unreachable block (ram,0x08925eec) */
/* WARNING: Removing unreachable block (ram,0x08925c94) */

void SDL_ConvertStrip_2(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 UVar1;
  Uint8 UVar2;
  Uint8 UVar3;
  undefined2 uVar4;
  undefined2 uVar5;
  ushort uVar6;
  int iVar7;
  Uint8 *pUVar8;
  Uint8 *pUVar9;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar10;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Sint32 lsample@[???]
                       Unresolved local var: Sint32 rsample@[???] */
  uVar6 = format & 0x8018;
  if (uVar6 == 0x10) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    pUVar8 = cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 8;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          uVar4 = *(undefined2 *)pUVar8;
          uVar5 = *(undefined2 *)(pUVar8 + 2);
          iVar10 = iVar10 + -1;
          pUVar9[1] = (Uint8)((ushort)uVar4 >> 8);
          pUVar9[3] = (Uint8)((ushort)uVar5 >> 8);
          *pUVar9 = (Uint8)uVar4;
          pUVar9[2] = (Uint8)uVar5;
          pUVar8 = pUVar8 + 8;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 8;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          UVar1 = pUVar8[2];
          UVar2 = pUVar8[1];
          UVar3 = pUVar8[3];
          iVar10 = iVar10 + -1;
          *pUVar9 = *pUVar8;
          pUVar9[2] = UVar1;
          pUVar9[1] = UVar2;
          pUVar9[3] = UVar3;
          pUVar8 = pUVar8 + 8;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
  }
  else if (uVar6 < 0x11) {
    if (uVar6 == 8) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 4;
      pUVar9 = cvt->buf;
      pUVar8 = pUVar9;
      if (iVar10 != 0) {
        do {
          UVar1 = *pUVar8;
          iVar10 = iVar10 + -1;
          pUVar9[1] = pUVar8[1];
          *pUVar9 = UVar1;
          pUVar9 = pUVar9 + 2;
          pUVar8 = pUVar8 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
    }
  }
  else if (uVar6 == 0x8008) {
                    /* Unresolved local var: Sint8 * src@[???]
                       Unresolved local var: Sint8 * dst@[???] */
    iVar7 = cvt->len_cvt;
    iVar10 = iVar7 / 4;
    pUVar9 = cvt->buf;
    pUVar8 = pUVar9;
    if (iVar10 != 0) {
      do {
        UVar1 = *pUVar9;
        iVar10 = iVar10 + -1;
        pUVar8[1] = pUVar9[1];
        *pUVar8 = UVar1;
        pUVar9 = pUVar9 + 4;
        pUVar8 = pUVar8 + 2;
      } while (iVar10 != 0);
      iVar7 = cvt->len_cvt;
    }
  }
  else if (uVar6 == 0x8010) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    pUVar8 = cvt->buf;
    if ((format & 0x1000) == 0) {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 8;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          uVar4 = *(undefined2 *)pUVar8;
          uVar5 = *(undefined2 *)(pUVar8 + 2);
          iVar10 = iVar10 + -1;
          pUVar9[1] = (Uint8)((ushort)uVar4 >> 8);
          pUVar9[3] = (Uint8)((ushort)uVar5 >> 8);
          *pUVar9 = (Uint8)uVar4;
          pUVar9[2] = (Uint8)uVar5;
          pUVar8 = pUVar8 + 8;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
    else {
      iVar7 = cvt->len_cvt;
      iVar10 = iVar7 / 8;
      pUVar9 = pUVar8;
      if (iVar10 != 0) {
        do {
          UVar1 = pUVar8[2];
          UVar2 = pUVar8[1];
          UVar3 = pUVar8[3];
          iVar10 = iVar10 + -1;
          *pUVar9 = *pUVar8;
          pUVar9[2] = UVar1;
          pUVar9[1] = UVar2;
          pUVar9[3] = UVar3;
          pUVar8 = pUVar8 + 8;
          pUVar9 = pUVar9 + 4;
        } while (iVar10 != 0);
        iVar7 = cvt->len_cvt;
      }
    }
  }
  else {
    iVar7 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar7 / 2;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08925cc0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ConvertStereo @ 08925f54

/* WARNING: Removing unreachable block (ram,0x08925fdc) */

void SDL_ConvertStereo(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  Uint8 *pUVar2;
  int iVar3;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar4;
  
                    /* Unresolved local var: int i@[???] */
  iVar3 = cvt->len_cvt;
  if ((format & 0xff) == 0x10) {
                    /* Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???] */
    iVar4 = iVar3 / 2;
    if (iVar4 != 0) {
      pUVar1 = cvt->buf + iVar3;
      pUVar2 = cvt->buf + iVar3 * 2;
      do {
        pUVar1 = pUVar1 + -2;
        iVar4 = iVar4 + -1;
        *(undefined2 *)(pUVar2 + -4) = *(undefined2 *)pUVar1;
        *(undefined2 *)(pUVar2 + -2) = *(undefined2 *)pUVar1;
        pUVar2 = pUVar2 + -4;
      } while (iVar4 != 0);
      cvt->len_cvt = iVar3 << 1;
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08926034;
    }
  }
  else {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    if (iVar3 != 0) {
      pUVar1 = cvt->buf + iVar3;
      pUVar2 = cvt->buf + iVar3 * 2;
      do {
        pUVar1 = pUVar1 + -1;
        iVar3 = iVar3 + -1;
        pUVar2[-2] = *pUVar1;
        pUVar2[-1] = *pUVar1;
        pUVar2 = pUVar2 + -2;
      } while (iVar3 != 0);
      iVar3 = cvt->len_cvt;
    }
  }
  cvt->len_cvt = iVar3 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
joined_r0x08926034:
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08925fc8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ConvertSurround @ 08926044

/* WARNING: Removing unreachable block (ram,0x089264dc) */
/* WARNING: Removing unreachable block (ram,0x08926468) */
/* WARNING: Removing unreachable block (ram,0x0892649c) */
/* WARNING: Removing unreachable block (ram,0x0892615c) */
/* WARNING: Removing unreachable block (ram,0x08926408) */
/* WARNING: Removing unreachable block (ram,0x08926424) */
/* WARNING: Removing unreachable block (ram,0x08926368) */
/* WARNING: Removing unreachable block (ram,0x089262f4) */
/* WARNING: Removing unreachable block (ram,0x0892621c) */
/* WARNING: Removing unreachable block (ram,0x08926328) */

void SDL_ConvertSurround(SDL_AudioCVT *cvt,Uint16 format)

{
  byte bVar1;
  byte bVar2;
  Uint8 UVar3;
  ushort uVar4;
  ushort uVar5;
  short sVar6;
  uint uVar7;
  byte bVar8;
  Uint8 UVar9;
  ushort uVar10;
  short sVar11;
  short sVar12;
  int iVar13;
  uint uVar14;
  Uint8 UVar15;
  byte *pbVar16;
  Uint8 *pUVar17;
  byte *pbVar18;
  Uint8 *pUVar19;
  short *psVar20;
  ushort *puVar21;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar22;
  
                    /* Unresolved local var: int i@[???] */
  uVar10 = format & 0x8018;
  if (uVar10 == 0x10) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Uint16 lf@[???]
                       Unresolved local var: Uint16 rf@[???]
                       Unresolved local var: Uint16 ce@[???]
                       Unresolved local var: Uint16 lr@[???]
                       Unresolved local var: Uint16 rr@[???] */
    iVar13 = cvt->len_cvt;
    puVar21 = (ushort *)(cvt->buf + iVar13);
    pUVar19 = cvt->buf + iVar13 * 3;
    if ((format & 0x1000) == 0) {
      iVar22 = iVar13 / 4;
      if (iVar22 != 0) {
        do {
          uVar10 = puVar21[-2];
          uVar4 = puVar21[-1];
          iVar13 = (uint)(uVar10 >> 1) + (uint)(uVar4 >> 1);
          uVar14 = (uint)uVar10 - iVar13 & 0xffff;
          uVar7 = (uint)uVar4 - iVar13 & 0xffff;
          iVar22 = iVar22 + -1;
          pUVar19[-0xb] = (Uint8)(uVar10 >> 8);
          pUVar19[-9] = (Uint8)(uVar4 >> 8);
          pUVar19[-7] = (Uint8)(uVar7 >> 8);
          pUVar19[-5] = (Uint8)(uVar14 >> 8);
          pUVar19[-2] = (Uint8)iVar13;
          UVar15 = (Uint8)((uint)iVar13 >> 8);
          pUVar19[-1] = UVar15;
          pUVar19[-0xc] = (Uint8)uVar10;
          pUVar19[-10] = (Uint8)uVar4;
          pUVar19[-8] = (Uint8)uVar7;
          pUVar19[-6] = (Uint8)uVar14;
          pUVar19[-4] = (Uint8)iVar13;
          pUVar19[-3] = UVar15;
          pUVar19 = pUVar19 + -0xc;
          puVar21 = puVar21 + -2;
        } while (iVar22 != 0);
        iVar13 = cvt->len_cvt;
      }
    }
    else {
      iVar22 = iVar13 / 4;
      if (iVar22 != 0) {
        do {
          UVar15 = (Uint8)puVar21[-2];
          uVar5 = puVar21[-1];
          UVar3 = *(Uint8 *)((int)puVar21 + -3);
          UVar9 = *(Uint8 *)((int)puVar21 + -1);
          uVar10 = CONCAT11(UVar15,UVar3);
          uVar4 = CONCAT11((Uint8)uVar5,UVar9);
          iVar13 = (uint)(uVar10 >> 1) + (uint)(uVar4 >> 1);
          uVar14 = (uint)uVar10 - iVar13 & 0xffff;
          uVar7 = (uint)uVar4 - iVar13 & 0xffff;
          iVar22 = iVar22 + -1;
          pUVar19[-0xc] = UVar15;
          pUVar19[-10] = (Uint8)uVar5;
          pUVar19[-8] = (Uint8)(uVar7 >> 8);
          pUVar19[-6] = (Uint8)(uVar14 >> 8);
          pUVar19[-1] = (Uint8)iVar13;
          UVar15 = (Uint8)((uint)iVar13 >> 8);
          pUVar19[-2] = UVar15;
          pUVar19[-0xb] = UVar3;
          pUVar19[-9] = UVar9;
          pUVar19[-7] = (Uint8)uVar7;
          pUVar19[-5] = (Uint8)uVar14;
          pUVar19[-3] = (Uint8)iVar13;
          pUVar19[-4] = UVar15;
          pUVar19 = pUVar19 + -0xc;
          puVar21 = puVar21 + -2;
        } while (iVar22 != 0);
        iVar13 = cvt->len_cvt;
      }
    }
  }
  else if (uVar10 < 0x11) {
    if (uVar10 == 8) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Uint8 lf@[???]
                       Unresolved local var: Uint8 rf@[???]
                       Unresolved local var: Uint8 ce@[???] */
      iVar22 = cvt->len_cvt;
      iVar13 = 0;
      if (iVar22 != 0) {
        pbVar16 = cvt->buf + iVar22 * 3;
        pbVar18 = cvt->buf + iVar22;
        do {
          bVar1 = pbVar18[-2];
          bVar2 = pbVar18[-1];
          bVar8 = (bVar1 >> 1) + (bVar2 >> 1);
          iVar22 = iVar22 + -1;
          pbVar16[-4] = bVar1 - bVar8;
          pbVar16[-3] = bVar2 - bVar8;
          pbVar16[-1] = bVar8;
          pbVar16[-6] = bVar1;
          pbVar16[-5] = bVar2;
          pbVar16[-2] = bVar8;
          pbVar16 = pbVar16 + -6;
          pbVar18 = pbVar18 + -2;
        } while (iVar22 != 0);
        iVar13 = cvt->len_cvt;
      }
    }
    else {
      iVar13 = cvt->len_cvt;
    }
  }
  else if (uVar10 == 0x8008) {
                    /* Unresolved local var: Sint8 * src@[???]
                       Unresolved local var: Sint8 * dst@[???]
                       Unresolved local var: Sint8 lf@[???]
                       Unresolved local var: Sint8 rf@[???]
                       Unresolved local var: Sint8 ce@[???] */
    iVar22 = cvt->len_cvt;
    iVar13 = 0;
    if (iVar22 != 0) {
      pUVar19 = cvt->buf + iVar22 * 3;
      pUVar17 = cvt->buf + iVar22;
      do {
        UVar15 = pUVar17[-2];
        UVar3 = pUVar17[-1];
        pUVar19[-6] = UVar15;
        pUVar19[-5] = UVar3;
        iVar22 = iVar22 + -1;
        UVar9 = (char)UVar15 / '\x02' + (char)UVar3 / '\x02';
        pUVar19[-4] = UVar15 - UVar9;
        pUVar19[-3] = UVar3 - UVar9;
        pUVar19[-1] = UVar9;
        pUVar19[-2] = UVar9;
        pUVar19 = pUVar19 + -6;
        pUVar17 = pUVar17 + -2;
      } while (iVar22 != 0);
      iVar13 = cvt->len_cvt;
    }
  }
  else if (uVar10 == 0x8010) {
    iVar13 = cvt->len_cvt;
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Sint16 lf@[???]
                       Unresolved local var: Sint16 rf@[???]
                       Unresolved local var: Sint16 ce@[???]
                       Unresolved local var: Sint16 lr@[???]
                       Unresolved local var: Sint16 rr@[???] */
    psVar20 = (short *)(cvt->buf + iVar13);
    pUVar19 = cvt->buf + iVar13 * 3;
    if ((format & 0x1000) == 0) {
      iVar22 = iVar13 / 4;
      if (iVar22 != 0) {
        do {
          sVar11 = psVar20[-2];
          UVar15 = *(Uint8 *)((int)psVar20 + -1);
          sVar12 = psVar20[-1];
          sVar6 = psVar20[-1];
          pUVar19[-0xb] = (Uint8)((ushort)sVar11 >> 8);
          pUVar19[-0xc] = (Uint8)sVar11;
          pUVar19[-10] = (Uint8)sVar12;
          pUVar19[-9] = UVar15;
          iVar22 = iVar22 + -1;
          sVar12 = sVar11 / 2 + sVar6 / 2;
          sVar6 = sVar6 - sVar12;
          pUVar19[-7] = (Uint8)((ushort)sVar6 >> 8);
          pUVar19[-5] = (Uint8)((ushort)(sVar11 - sVar12) >> 8);
          *(short *)(pUVar19 + -2) = sVar12;
          pUVar19[-8] = (Uint8)sVar6;
          pUVar19[-6] = (Uint8)(sVar11 - sVar12);
          *(short *)(pUVar19 + -4) = sVar12;
          pUVar19 = pUVar19 + -0xc;
          psVar20 = psVar20 + -2;
        } while (iVar22 != 0);
        iVar13 = cvt->len_cvt;
      }
    }
    else {
      iVar22 = iVar13 / 4;
      if (iVar22 != 0) {
        do {
          UVar15 = (Uint8)psVar20[-2];
          UVar3 = *(Uint8 *)((int)psVar20 + -3);
          sVar12 = psVar20[-1];
          sVar11 = CONCAT11(UVar15,UVar3);
          UVar9 = *(Uint8 *)((int)psVar20 + -1);
          sVar6 = CONCAT11((Uint8)sVar12,UVar9);
          pUVar19[-0xc] = UVar15;
          pUVar19[-0xb] = UVar3;
          pUVar19[-9] = UVar9;
          pUVar19[-10] = (Uint8)sVar12;
          iVar22 = iVar22 + -1;
          sVar12 = sVar11 / 2 + sVar6 / 2;
          sVar6 = sVar6 - sVar12;
          sVar11 = sVar11 - sVar12;
          pUVar19[-8] = (Uint8)((ushort)sVar6 >> 8);
          pUVar19[-6] = (Uint8)((ushort)sVar11 >> 8);
          pUVar19[-1] = (Uint8)sVar12;
          UVar15 = (Uint8)((ushort)sVar12 >> 8);
          pUVar19[-2] = UVar15;
          pUVar19[-7] = (Uint8)sVar6;
          pUVar19[-5] = (Uint8)sVar11;
          pUVar19[-3] = (Uint8)sVar12;
          pUVar19[-4] = UVar15;
          pUVar19 = pUVar19 + -0xc;
          psVar20 = psVar20 + -2;
        } while (iVar22 != 0);
        iVar13 = cvt->len_cvt;
      }
    }
  }
  else {
    iVar13 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar13 * 3;
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x089260ac. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format);
  return;
}



----------------------------------------

// Function: SDL_ConvertSurround_4 @ 0892653c

/* WARNING: Removing unreachable block (ram,0x0892694c) */
/* WARNING: Removing unreachable block (ram,0x089268d8) */
/* WARNING: Removing unreachable block (ram,0x0892690c) */
/* WARNING: Removing unreachable block (ram,0x08926634) */
/* WARNING: Removing unreachable block (ram,0x08926884) */
/* WARNING: Removing unreachable block (ram,0x089268a0) */
/* WARNING: Removing unreachable block (ram,0x08926808) */
/* WARNING: Removing unreachable block (ram,0x08926794) */
/* WARNING: Removing unreachable block (ram,0x089266dc) */
/* WARNING: Removing unreachable block (ram,0x089267c8) */

void SDL_ConvertSurround_4(SDL_AudioCVT *cvt,Uint16 format)

{
  byte bVar1;
  byte bVar2;
  Uint8 UVar3;
  Uint8 UVar4;
  Uint8 UVar5;
  ushort uVar6;
  ushort uVar7;
  char cVar8;
  short sVar9;
  short sVar10;
  ushort uVar11;
  short sVar12;
  uint uVar13;
  int iVar14;
  uint uVar15;
  byte *pbVar16;
  Uint8 *pUVar17;
  Uint8 *pUVar18;
  byte *pbVar19;
  short *psVar20;
  ushort *puVar21;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar22;
  
                    /* Unresolved local var: int i@[???] */
  uVar11 = format & 0x8018;
  if (uVar11 == 0x10) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Uint16 lf@[???]
                       Unresolved local var: Uint16 rf@[???]
                       Unresolved local var: Uint16 ce@[???]
                       Unresolved local var: Uint16 lr@[???]
                       Unresolved local var: Uint16 rr@[???] */
    iVar14 = cvt->len_cvt;
    pUVar17 = cvt->buf + iVar14 * 2;
    puVar21 = (ushort *)(cvt->buf + iVar14);
    if ((format & 0x1000) == 0) {
      iVar22 = iVar14 / 4;
      if (iVar22 == 0) {
        iVar22 = cvt->filter_index;
        goto LAB_08926578;
      }
      do {
        uVar11 = puVar21[-2];
        uVar6 = puVar21[-1];
        iVar14 = (uint)(uVar11 >> 1) + (uint)(uVar6 >> 1);
        uVar13 = (uint)uVar11 - iVar14 & 0xffff;
        uVar15 = (uint)uVar6 - iVar14 & 0xffff;
        iVar22 = iVar22 + -1;
        pUVar17[-7] = (Uint8)(uVar11 >> 8);
        pUVar17[-5] = (Uint8)(uVar6 >> 8);
        pUVar17[-3] = (Uint8)(uVar15 >> 8);
        pUVar17[-1] = (Uint8)(uVar13 >> 8);
        pUVar17[-8] = (Uint8)uVar11;
        pUVar17[-6] = (Uint8)uVar6;
        pUVar17[-4] = (Uint8)uVar15;
        pUVar17[-2] = (Uint8)uVar13;
        pUVar17 = pUVar17 + -8;
        puVar21 = puVar21 + -2;
      } while (iVar22 != 0);
      iVar14 = cvt->len_cvt;
    }
    else {
      iVar22 = iVar14 / 4;
      if (iVar22 == 0) {
        iVar22 = cvt->filter_index;
        goto LAB_08926578;
      }
      do {
        UVar3 = (Uint8)puVar21[-2];
        uVar7 = puVar21[-1];
        UVar4 = *(Uint8 *)((int)puVar21 + -3);
        UVar5 = *(Uint8 *)((int)puVar21 + -1);
        uVar11 = CONCAT11(UVar3,UVar4);
        uVar6 = CONCAT11((Uint8)uVar7,UVar5);
        iVar14 = (uint)(uVar11 >> 1) + (uint)(uVar6 >> 1);
        uVar13 = (uint)uVar11 - iVar14 & 0xffff;
        uVar15 = (uint)uVar6 - iVar14 & 0xffff;
        iVar22 = iVar22 + -1;
        pUVar17[-8] = UVar3;
        pUVar17[-6] = (Uint8)uVar7;
        pUVar17[-4] = (Uint8)(uVar15 >> 8);
        pUVar17[-2] = (Uint8)(uVar13 >> 8);
        pUVar17[-7] = UVar4;
        pUVar17[-5] = UVar5;
        pUVar17[-3] = (Uint8)uVar15;
        pUVar17[-1] = (Uint8)uVar13;
        pUVar17 = pUVar17 + -8;
        puVar21 = puVar21 + -2;
      } while (iVar22 != 0);
      iVar14 = cvt->len_cvt;
    }
  }
  else if (uVar11 < 0x11) {
    if (uVar11 == 8) {
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Uint8 lf@[???]
                       Unresolved local var: Uint8 rf@[???]
                       Unresolved local var: Uint8 ce@[???] */
      iVar22 = cvt->len_cvt;
      iVar14 = 0;
      if (iVar22 != 0) {
        pbVar16 = cvt->buf + iVar22 * 2;
        pbVar19 = cvt->buf + iVar22;
        do {
          bVar1 = pbVar19[-2];
          bVar2 = pbVar19[-1];
          cVar8 = (bVar1 >> 1) + (bVar2 >> 1);
          iVar22 = iVar22 + -1;
          pbVar16[-2] = bVar1 - cVar8;
          pbVar16[-1] = bVar2 - cVar8;
          pbVar16[-4] = bVar1;
          pbVar16[-3] = bVar2;
          pbVar16 = pbVar16 + -4;
          pbVar19 = pbVar19 + -2;
        } while (iVar22 != 0);
        iVar14 = cvt->len_cvt;
      }
    }
    else {
      iVar14 = cvt->len_cvt;
    }
  }
  else if (uVar11 == 0x8008) {
                    /* Unresolved local var: Sint8 * src@[???]
                       Unresolved local var: Sint8 * dst@[???]
                       Unresolved local var: Sint8 lf@[???]
                       Unresolved local var: Sint8 rf@[???]
                       Unresolved local var: Sint8 ce@[???] */
    iVar22 = cvt->len_cvt;
    iVar14 = 0;
    if (iVar22 != 0) {
      pUVar17 = cvt->buf + iVar22 * 2;
      pUVar18 = cvt->buf + iVar22;
      do {
        UVar3 = pUVar18[-2];
        UVar4 = pUVar18[-1];
        pUVar17[-4] = UVar3;
        pUVar17[-3] = UVar4;
        iVar22 = iVar22 + -1;
        cVar8 = (char)UVar3 / '\x02' + (char)UVar4 / '\x02';
        pUVar17[-2] = UVar3 - cVar8;
        pUVar17[-1] = UVar4 - cVar8;
        pUVar17 = pUVar17 + -4;
        pUVar18 = pUVar18 + -2;
      } while (iVar22 != 0);
      iVar14 = cvt->len_cvt;
    }
  }
  else if (uVar11 == 0x8010) {
    iVar14 = cvt->len_cvt;
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Sint16 lf@[???]
                       Unresolved local var: Sint16 rf@[???]
                       Unresolved local var: Sint16 ce@[???]
                       Unresolved local var: Sint16 lr@[???]
                       Unresolved local var: Sint16 rr@[???] */
    pUVar17 = cvt->buf + iVar14 * 2;
    psVar20 = (short *)(cvt->buf + iVar14);
    if ((format & 0x1000) == 0) {
      iVar22 = iVar14 / 4;
      if (iVar22 != 0) {
        do {
          sVar12 = psVar20[-2];
          UVar3 = *(Uint8 *)((int)psVar20 + -1);
          sVar10 = psVar20[-1];
          sVar9 = psVar20[-1];
          pUVar17[-7] = (Uint8)((ushort)sVar12 >> 8);
          pUVar17[-8] = (Uint8)sVar12;
          pUVar17[-6] = (Uint8)sVar10;
          iVar22 = iVar22 + -1;
          pUVar17[-5] = UVar3;
          sVar10 = sVar12 / 2 + sVar9 / 2;
          sVar9 = sVar9 - sVar10;
          sVar12 = sVar12 - sVar10;
          pUVar17[-3] = (Uint8)((ushort)sVar9 >> 8);
          pUVar17[-1] = (Uint8)((ushort)sVar12 >> 8);
          pUVar17[-4] = (Uint8)sVar9;
          pUVar17[-2] = (Uint8)sVar12;
          pUVar17 = pUVar17 + -8;
          psVar20 = psVar20 + -2;
        } while (iVar22 != 0);
        iVar14 = cvt->len_cvt;
      }
    }
    else {
      iVar22 = iVar14 / 4;
      if (iVar22 != 0) {
        do {
          UVar3 = (Uint8)psVar20[-2];
          UVar4 = *(Uint8 *)((int)psVar20 + -3);
          sVar9 = psVar20[-1];
          sVar12 = CONCAT11(UVar3,UVar4);
          UVar5 = *(Uint8 *)((int)psVar20 + -1);
          sVar10 = CONCAT11((Uint8)sVar9,UVar5);
          pUVar17[-8] = UVar3;
          pUVar17[-7] = UVar4;
          pUVar17[-5] = UVar5;
          iVar22 = iVar22 + -1;
          pUVar17[-6] = (Uint8)sVar9;
          sVar9 = sVar12 / 2 + sVar10 / 2;
          sVar10 = sVar10 - sVar9;
          sVar12 = sVar12 - sVar9;
          pUVar17[-4] = (Uint8)((ushort)sVar10 >> 8);
          pUVar17[-2] = (Uint8)((ushort)sVar12 >> 8);
          pUVar17[-3] = (Uint8)sVar10;
          pUVar17[-1] = (Uint8)sVar12;
          pUVar17 = pUVar17 + -8;
          psVar20 = psVar20 + -2;
        } while (iVar22 != 0);
        iVar14 = cvt->len_cvt;
      }
    }
  }
  else {
    iVar14 = cvt->len_cvt;
  }
  iVar22 = cvt->filter_index;
LAB_08926578:
  cvt->len_cvt = iVar14 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar22 + 1];
  cvt->filter_index = iVar22 + 1;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0892659c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_Convert16LSB @ 08926990

void SDL_Convert16LSB(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  int iVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar2 = cvt->len_cvt;
  iVar4 = 0;
  if (iVar2 != 0) {
    pUVar3 = cvt->buf + iVar2;
    pUVar1 = cvt->buf + iVar2 * 2;
    do {
      pUVar3 = pUVar3 + -1;
      iVar2 = iVar2 + -1;
      pUVar1[-1] = *pUVar3;
      pUVar1[-2] = '\0';
      pUVar1 = pUVar1 + -2;
    } while (iVar2 != 0);
    iVar4 = cvt->len_cvt;
  }
  cvt->len_cvt = iVar4 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089269f8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format & 0xfff7 | 0x10);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_Convert16MSB @ 08926a08

void SDL_Convert16MSB(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  int iVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar2 = cvt->len_cvt;
  iVar4 = 0;
  if (iVar2 != 0) {
    pUVar3 = cvt->buf + iVar2;
    pUVar1 = cvt->buf + iVar2 * 2;
    do {
      pUVar3 = pUVar3 + -1;
      iVar2 = iVar2 + -1;
      pUVar1[-2] = *pUVar3;
      pUVar1[-1] = '\0';
      pUVar1 = pUVar1 + -2;
    } while (iVar2 != 0);
    iVar4 = cvt->len_cvt;
  }
  cvt->len_cvt = iVar4 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926a70. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format & 0xfff7 | 0x1010);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_Convert8 @ 08926a80

/* WARNING: Removing unreachable block (ram,0x08926aa8) */
/* WARNING: Removing unreachable block (ram,0x08926ae4) */

void SDL_Convert8(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 UVar1;
  int iVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  pUVar4 = cvt->buf;
  pUVar3 = pUVar4;
  if ((format & 0x1000) == 0) {
    pUVar3 = pUVar4 + 1;
  }
  iVar2 = cvt->len_cvt;
  iVar5 = iVar2 / 2;
  if (iVar5 != 0) {
    do {
      UVar1 = *pUVar3;
      iVar5 = iVar5 + -1;
      pUVar3 = pUVar3 + 2;
      *pUVar4 = UVar1;
      pUVar4 = pUVar4 + 1;
    } while (iVar5 != 0);
    iVar2 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926b14. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format & 0x6fef | 8);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_ConvertSign @ 08926b2c

/* WARNING: Removing unreachable block (ram,0x08926ba8) */

void SDL_ConvertSign(SDL_AudioCVT *cvt,Uint16 format)

{
  int iVar1;
  byte *pbVar2;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * data@[???] */
  pbVar2 = cvt->buf;
  if ((format & 0xff) == 0x10) {
    if ((format & 0x1000) == 0) {
      pbVar2 = pbVar2 + 1;
    }
    iVar1 = cvt->len_cvt / 2;
    if (iVar1 != 0) {
      do {
        iVar1 = iVar1 + -1;
        *pbVar2 = *pbVar2 ^ 0x80;
        pbVar2 = pbVar2 + 2;
      } while (iVar1 != 0);
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08926be8;
    }
    iVar1 = cvt->filter_index;
  }
  else {
    iVar1 = cvt->len_cvt;
    if (iVar1 == 0) {
      iVar1 = cvt->filter_index;
    }
    else {
      do {
        iVar1 = iVar1 + -1;
        *pbVar2 = *pbVar2 ^ 0x80;
        pbVar2 = pbVar2 + 1;
      } while (iVar1 != 0);
      iVar1 = cvt->filter_index;
    }
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar1 + 1];
  cvt->filter_index = iVar1 + 1;
joined_r0x08926be8:
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x08926b84. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format ^ 0x8000);
  return;
}



----------------------------------------

// Function: SDL_ConvertEndian @ 08926bf8

/* WARNING: Removing unreachable block (ram,0x08926c0c) */

void SDL_ConvertEndian(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 UVar1;
  Uint8 *pUVar2;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * data@[???]
                       Unresolved local var: Uint8 tmp@[???] */
  pUVar2 = cvt->buf;
  for (iVar3 = cvt->len_cvt / 2; iVar3 != 0; iVar3 = iVar3 + -1) {
    UVar1 = pUVar2[1];
    pUVar2[1] = *pUVar2;
    *pUVar2 = UVar1;
    pUVar2 = pUVar2 + 2;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926c54. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format ^ 0x1000);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateMUL2 @ 08926c64

/* WARNING: Removing unreachable block (ram,0x08926d24) */

void SDL_RateMUL2(SDL_AudioCVT *cvt,Uint16 format)

{
  int iVar1;
  Uint8 *pUVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  int iVar5;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar5 = cvt->len_cvt;
  pUVar4 = cvt->buf + iVar5 * 2;
  pUVar2 = cvt->buf + iVar5;
  if ((format & 0xff) == 8) {
    if (iVar5 != 0) {
      do {
        pUVar2 = pUVar2 + -1;
        iVar5 = iVar5 + -1;
        pUVar4[-2] = *pUVar2;
        pUVar4[-1] = *pUVar2;
        pUVar4 = pUVar4 + -2;
      } while (iVar5 != 0);
LAB_08926cec:
      iVar5 = cvt->len_cvt;
LAB_08926cf0:
      cvt->len_cvt = iVar5 << 1;
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08926d0c;
    }
    iVar1 = cvt->filter_index;
  }
  else if ((format & 0xff) == 0x10) {
    iVar1 = iVar5 / 2;
    if (iVar1 != 0) {
      do {
        pUVar4[-4] = pUVar2[-2];
        pUVar4[-3] = pUVar2[-1];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        if (iVar1 == 1) goto LAB_08926cec;
        pUVar3 = pUVar2 + -4;
        iVar1 = iVar1 + -2;
        pUVar4[-8] = *pUVar3;
        pUVar4[-7] = pUVar2[-3];
        pUVar4[-6] = *pUVar3;
        pUVar4[-5] = pUVar2[-3];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -8;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
      goto LAB_08926cf0;
    }
    iVar1 = cvt->filter_index;
  }
  else {
    iVar1 = cvt->filter_index;
  }
  cvt->len_cvt = iVar5 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar1 + 1];
  cvt->filter_index = iVar1 + 1;
joined_r0x08926d0c:
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926cbc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateMUL2_c2 @ 08926d9c

/* WARNING: Removing unreachable block (ram,0x08926e7c) */
/* WARNING: Removing unreachable block (ram,0x08926e04) */

void SDL_RateMUL2_c2(SDL_AudioCVT *cvt,Uint16 format)

{
  int iVar1;
  Uint8 *pUVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  int iVar5;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar5 = cvt->len_cvt;
  pUVar4 = cvt->buf + iVar5 * 2;
  pUVar2 = cvt->buf + iVar5;
  if ((format & 0xff) == 8) {
    iVar1 = iVar5 / 2;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -2;
        iVar1 = iVar1 + -1;
        pUVar4[-4] = *pUVar3;
        pUVar4[-3] = pUVar2[-1];
        pUVar4[-2] = *pUVar3;
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -4;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
LAB_08926e48:
      cvt->len_cvt = iVar5 << 1;
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08926e64;
    }
    iVar1 = cvt->filter_index;
  }
  else if ((format & 0xff) == 0x10) {
    iVar1 = iVar5 / 4;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -4;
        iVar1 = iVar1 + -1;
        pUVar4[-8] = *pUVar3;
        pUVar4[-7] = pUVar2[-3];
        pUVar4[-6] = pUVar2[-2];
        pUVar4[-5] = pUVar2[-1];
        pUVar4[-4] = *pUVar3;
        pUVar4[-3] = pUVar2[-3];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -8;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
      goto LAB_08926e48;
    }
    iVar1 = cvt->filter_index;
  }
  else {
    iVar1 = cvt->filter_index;
  }
  cvt->len_cvt = iVar5 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar1 + 1];
  cvt->filter_index = iVar1 + 1;
joined_r0x08926e64:
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926df0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateMUL2_c4 @ 08926ee4

/* WARNING: Removing unreachable block (ram,0x08926fe4) */
/* WARNING: Removing unreachable block (ram,0x08926f4c) */

void SDL_RateMUL2_c4(SDL_AudioCVT *cvt,Uint16 format)

{
  int iVar1;
  Uint8 *pUVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  int iVar5;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar5 = cvt->len_cvt;
  pUVar4 = cvt->buf + iVar5 * 2;
  pUVar2 = cvt->buf + iVar5;
  if ((format & 0xff) == 8) {
    iVar1 = iVar5 / 4;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -4;
        iVar1 = iVar1 + -1;
        pUVar4[-8] = *pUVar3;
        pUVar4[-7] = pUVar2[-3];
        pUVar4[-6] = pUVar2[-2];
        pUVar4[-5] = pUVar2[-1];
        pUVar4[-4] = *pUVar3;
        pUVar4[-3] = pUVar2[-3];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -8;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
LAB_08926fb0:
      cvt->len_cvt = iVar5 << 1;
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08926fcc;
    }
    iVar1 = cvt->filter_index;
  }
  else if ((format & 0xff) == 0x10) {
    iVar1 = iVar5 / 8;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -8;
        iVar1 = iVar1 + -1;
        pUVar4[-0x10] = *pUVar3;
        pUVar4[-0xf] = pUVar2[-7];
        pUVar4[-0xe] = pUVar2[-6];
        pUVar4[-0xd] = pUVar2[-5];
        pUVar4[-0xc] = pUVar2[-4];
        pUVar4[-0xb] = pUVar2[-3];
        pUVar4[-10] = pUVar2[-2];
        pUVar4[-9] = pUVar2[-1];
        pUVar4[-8] = *pUVar3;
        pUVar4[-7] = pUVar2[-7];
        pUVar4[-6] = pUVar2[-6];
        pUVar4[-5] = pUVar2[-5];
        pUVar4[-4] = pUVar2[-4];
        pUVar4[-3] = pUVar2[-3];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -0x10;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
      goto LAB_08926fb0;
    }
    iVar1 = cvt->filter_index;
  }
  else {
    iVar1 = cvt->filter_index;
  }
  cvt->len_cvt = iVar5 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar1 + 1];
  cvt->filter_index = iVar1 + 1;
joined_r0x08926fcc:
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08926f38. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateMUL2_c6 @ 0892708c

/* WARNING: Removing unreachable block (ram,0x089271ac) */
/* WARNING: Removing unreachable block (ram,0x089270f4) */

void SDL_RateMUL2_c6(SDL_AudioCVT *cvt,Uint16 format)

{
  int iVar1;
  Uint8 *pUVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  int iVar5;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  iVar5 = cvt->len_cvt;
  pUVar4 = cvt->buf + iVar5 * 2;
  pUVar2 = cvt->buf + iVar5;
  if ((format & 0xff) == 8) {
    iVar1 = iVar5 / 6;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -6;
        iVar1 = iVar1 + -1;
        pUVar4[-0xc] = *pUVar3;
        pUVar4[-0xb] = pUVar2[-5];
        pUVar4[-10] = pUVar2[-4];
        pUVar4[-9] = pUVar2[-3];
        pUVar4[-8] = pUVar2[-2];
        pUVar4[-7] = pUVar2[-1];
        pUVar4[-6] = *pUVar3;
        pUVar4[-5] = pUVar2[-5];
        pUVar4[-4] = pUVar2[-4];
        pUVar4[-3] = pUVar2[-3];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -0xc;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
LAB_08927178:
      cvt->len_cvt = iVar5 << 1;
      UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
      cvt->filter_index = cvt->filter_index + 1;
      goto joined_r0x08927194;
    }
    iVar1 = cvt->filter_index;
  }
  else if ((format & 0xff) == 0x10) {
    iVar1 = iVar5 / 0xc;
    if (iVar1 != 0) {
      do {
        pUVar3 = pUVar2 + -0xc;
        iVar1 = iVar1 + -1;
        pUVar4[-0x18] = *pUVar3;
        pUVar4[-0x17] = pUVar2[-0xb];
        pUVar4[-0x16] = pUVar2[-10];
        pUVar4[-0x15] = pUVar2[-9];
        pUVar4[-0x14] = pUVar2[-8];
        pUVar4[-0x13] = pUVar2[-7];
        pUVar4[-0x12] = pUVar2[-6];
        pUVar4[-0x11] = pUVar2[-5];
        pUVar4[-0x10] = pUVar2[-4];
        pUVar4[-0xf] = pUVar2[-3];
        pUVar4[-0xe] = pUVar2[-2];
        pUVar4[-0xd] = pUVar2[-1];
        pUVar4[-0xc] = *pUVar3;
        pUVar4[-0xb] = pUVar2[-0xb];
        pUVar4[-10] = pUVar2[-10];
        pUVar4[-9] = pUVar2[-9];
        pUVar4[-8] = pUVar2[-8];
        pUVar4[-7] = pUVar2[-7];
        pUVar4[-6] = pUVar2[-6];
        pUVar4[-5] = pUVar2[-5];
        pUVar4[-4] = pUVar2[-4];
        pUVar4[-3] = pUVar2[-3];
        pUVar4[-2] = pUVar2[-2];
        pUVar4[-1] = pUVar2[-1];
        pUVar2 = pUVar3;
        pUVar4 = pUVar4 + -0x18;
      } while (iVar1 != 0);
      iVar5 = cvt->len_cvt;
      goto LAB_08927178;
    }
    iVar1 = cvt->filter_index;
  }
  else {
    iVar1 = cvt->filter_index;
  }
  cvt->len_cvt = iVar5 << 1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar1 + 1];
  cvt->filter_index = iVar1 + 1;
joined_r0x08927194:
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089270e0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateDIV2 @ 08927294

/* WARNING: Removing unreachable block (ram,0x0892734c) */
/* WARNING: Removing unreachable block (ram,0x08927304) */
/* WARNING: Removing unreachable block (ram,0x089272c8) */

void SDL_RateDIV2(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  pUVar3 = cvt->buf;
  if ((format & 0xff) == 8) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 2;
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar3 = pUVar3 + 1;
        pUVar4 = pUVar4 + 2;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else if ((format & 0xff) == 0x10) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 4;
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar1 = pUVar4 + 1;
        pUVar4 = pUVar4 + 4;
        pUVar3[1] = *pUVar1;
        pUVar3 = pUVar3 + 2;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else {
    iVar2 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089272f0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(cvt,format);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_RateDIV2_c2 @ 08927388

/* WARNING: Removing unreachable block (ram,0x08927448) */
/* WARNING: Removing unreachable block (ram,0x089273f0) */
/* WARNING: Removing unreachable block (ram,0x089273b8) */

void SDL_RateDIV2_c2(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  pUVar3 = cvt->buf;
  if ((format & 0xff) == 8) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 4;
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar1 = pUVar4 + 1;
        pUVar4 = pUVar4 + 4;
        pUVar3[1] = *pUVar1;
        pUVar3 = pUVar3 + 2;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else {
    iVar2 = cvt->len_cvt;
    if (((format & 0xff) == 0x10) && (iVar5 = iVar2 / 8, pUVar4 = pUVar3, iVar5 != 0)) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar3[1] = pUVar4[1];
        pUVar3[2] = pUVar4[2];
        pUVar1 = pUVar4 + 3;
        pUVar4 = pUVar4 + 8;
        pUVar3[3] = *pUVar1;
        pUVar3 = pUVar3 + 4;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x089273e0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format);
  return;
}



----------------------------------------

// Function: SDL_RateDIV2_c4 @ 08927488

/* WARNING: Removing unreachable block (ram,0x089274b8) */

void SDL_RateDIV2_c4(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  pUVar3 = cvt->buf;
  if ((format & 0xff) == 8) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 8;
    if ((format & 0xff) == 0) {
      trap(7);
    }
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar4 = *pUVar3;
        pUVar4[1] = pUVar3[1];
        pUVar4[2] = pUVar3[2];
        pUVar1 = pUVar3 + 3;
        pUVar3 = pUVar3 + 8;
        pUVar4[3] = *pUVar1;
        pUVar4 = pUVar4 + 4;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else {
    iVar2 = cvt->len_cvt;
    if ((format & 0xff) == 0x10) {
      iVar5 = iVar2 / 0x10;
      if ((format & 0xff) == 0) {
        trap(7);
      }
      pUVar4 = pUVar3;
      if (iVar5 != 0) {
        do {
          iVar5 = iVar5 + -1;
          *pUVar4 = *pUVar3;
          pUVar4[1] = pUVar3[1];
          pUVar4[2] = pUVar3[2];
          pUVar4[3] = pUVar3[3];
          pUVar4[4] = pUVar3[4];
          pUVar4[5] = pUVar3[5];
          pUVar4[6] = pUVar3[6];
          pUVar1 = pUVar3 + 7;
          pUVar3 = pUVar3 + 0x10;
          pUVar4[7] = *pUVar1;
          pUVar4 = pUVar4 + 8;
        } while (iVar5 != 0);
        iVar2 = cvt->len_cvt;
      }
    }
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x089274e0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format);
  return;
}



----------------------------------------

// Function: SDL_RateDIV2_c6 @ 089275b4

/* WARNING: Removing unreachable block (ram,0x089276bc) */
/* WARNING: Removing unreachable block (ram,0x08927624) */
/* WARNING: Removing unreachable block (ram,0x089275e8) */

void SDL_RateDIV2_c6(SDL_AudioCVT *cvt,Uint16 format)

{
  Uint8 *pUVar1;
  int iVar2;
  Uint8 *pUVar3;
  Uint8 *pUVar4;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
  pUVar3 = cvt->buf;
  if ((format & 0xff) == 8) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 0xc;
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar3[1] = pUVar4[1];
        pUVar3[2] = pUVar4[2];
        pUVar3[3] = pUVar4[3];
        pUVar3[4] = pUVar4[4];
        pUVar1 = pUVar4 + 5;
        pUVar4 = pUVar4 + 0xc;
        pUVar3[5] = *pUVar1;
        pUVar3 = pUVar3 + 6;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else if ((format & 0xff) == 0x10) {
    iVar2 = cvt->len_cvt;
    iVar5 = iVar2 / 0x18;
    pUVar4 = pUVar3;
    if (iVar5 != 0) {
      do {
        iVar5 = iVar5 + -1;
        *pUVar3 = *pUVar4;
        pUVar3[1] = pUVar4[1];
        pUVar3[2] = pUVar4[2];
        pUVar3[3] = pUVar4[3];
        pUVar3[4] = pUVar4[4];
        pUVar3[5] = pUVar4[5];
        pUVar3[6] = pUVar4[6];
        pUVar3[7] = pUVar4[7];
        pUVar3[8] = pUVar4[8];
        pUVar3[9] = pUVar4[9];
        pUVar3[10] = pUVar4[10];
        pUVar1 = pUVar4 + 0xb;
        pUVar4 = pUVar4 + 0x18;
        pUVar3[0xb] = *pUVar1;
        pUVar3 = pUVar3 + 0xc;
      } while (iVar5 != 0);
      iVar2 = cvt->len_cvt;
    }
  }
  else {
    iVar2 = cvt->len_cvt;
  }
  UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
  cvt->filter_index = cvt->filter_index + 1;
  cvt->len_cvt = iVar2 / 2;
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x08927610. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format);
  return;
}



----------------------------------------

// Function: SDL_RateSLOW @ 0892771c

/* WARNING: Removing unreachable block (ram,0x0892799c) */
/* WARNING: Removing unreachable block (ram,0x089278fc) */

void SDL_RateSLOW(SDL_AudioCVT *cvt,Uint16 format)

{
  uint uVar1;
  SItype SVar2;
  int iVar3;
  uint uVar4;
  Uint8 *pUVar5;
  Uint8 *pUVar6;
  _func_void_SDL_AudioCVT_ptr_Uint16 *UNRECOVERED_JUMPTABLE;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double ipos@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int clen@[???] */
  __floatsidf(cvt->len_cvt);
  __divdf3(in_f12_13,in_f14_15);
  uVar1 = __fixdfsi(in_f12_13);
  SVar2 = __gtdf2(in_f12_13,in_f14_15);
  if (SVar2 < 1) {
    if ((format & 0xff) == 8) {
                    /* Unresolved local var: Uint8 * output@[???] */
      pUVar5 = cvt->buf;
      if (uVar1 == 0) goto LAB_089277c8;
      pUVar6 = pUVar5 + uVar1;
      uVar4 = uVar1;
      while( true ) {
        __subdf3(in_f12_13,in_f14_15);
        SVar2 = __fixdfsi(in_f12_13);
        pUVar6 = pUVar6 + -1;
        uVar4 = uVar4 - 1;
        *pUVar6 = pUVar5[SVar2];
        if (uVar4 == 0) break;
        pUVar5 = cvt->buf;
      }
      iVar3 = cvt->filter_index;
    }
    else if ((format & 0xff) == 0x10) {
                    /* Unresolved local var: Uint16 * output@[???] */
      uVar1 = uVar1 & 0xfffffffe;
      iVar3 = (int)uVar1 / 2;
      pUVar5 = cvt->buf;
      if (iVar3 == 0) goto LAB_089277c8;
      __muldf3(in_f12_13,in_f14_15);
      pUVar6 = pUVar5 + uVar1;
      do {
        __subdf3(in_f12_13,in_f14_15);
        SVar2 = __fixdfsi(in_f12_13);
        pUVar6 = pUVar6 + -2;
        iVar3 = iVar3 + -1;
        *(undefined2 *)pUVar6 = *(undefined2 *)(pUVar5 + SVar2 * 2);
      } while (iVar3 != 0);
      iVar3 = cvt->filter_index;
    }
    else {
      iVar3 = cvt->filter_index;
    }
  }
  else {
    if ((format & 0xff) == 8) {
                    /* Unresolved local var: Uint8 * output@[???] */
      pUVar6 = cvt->buf;
      uVar4 = uVar1;
      pUVar5 = pUVar6;
      if (uVar1 != 0) {
        while( true ) {
          SVar2 = __fixdfsi(in_f12_13);
          *pUVar6 = pUVar5[SVar2];
          pUVar6 = pUVar6 + 1;
          __adddf3(in_f12_13,in_f14_15);
          if (uVar4 - 1 == 0) break;
          uVar4 = uVar4 - 1;
          pUVar5 = cvt->buf;
        }
        cvt->len_cvt = uVar1;
        UNRECOVERED_JUMPTABLE = cvt->filters[cvt->filter_index + 1];
        cvt->filter_index = cvt->filter_index + 1;
        goto joined_r0x08927898;
      }
    }
    else if ((format & 0xff) == 0x10) {
                    /* Unresolved local var: Uint16 * output@[???] */
      uVar1 = uVar1 & 0xfffffffe;
      iVar3 = (int)uVar1 / 2;
      pUVar6 = cvt->buf;
      pUVar5 = pUVar6;
      if (iVar3 != 0) {
        do {
          SVar2 = __fixdfsi(in_f12_13);
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar6 + SVar2 * 2);
          __adddf3(in_f12_13,in_f14_15);
          iVar3 = iVar3 + -1;
          pUVar5 = pUVar5 + 2;
        } while (iVar3 != 0);
        iVar3 = cvt->filter_index;
        goto LAB_089277cc;
      }
    }
LAB_089277c8:
    iVar3 = cvt->filter_index;
  }
LAB_089277cc:
  cvt->len_cvt = uVar1;
  UNRECOVERED_JUMPTABLE = cvt->filters[iVar3 + 1];
  cvt->filter_index = iVar3 + 1;
joined_r0x08927898:
  if (UNRECOVERED_JUMPTABLE == (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x08927818. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(cvt,format);
  return;
}



----------------------------------------

// Function: SDL_BuildAudioCVT @ 08927a6c

/* WARNING: Removing unreachable block (ram,0x08928050) */
/* WARNING: Removing unreachable block (ram,0x08927ca8) */
/* WARNING: Removing unreachable block (ram,0x08927cbc) */
/* WARNING: Removing unreachable block (ram,0x089280a0) */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,Uint16 src_format,Uint8 src_channels,int src_rate,
                     Uint16 dst_format,Uint8 dst_channels,int dst_rate)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 extraout_v0;
  undefined4 extraout_v0_00;
  undefined4 extraout_v0_01;
  undefined4 extraout_v0_02;
  code *pcVar3;
  undefined4 extraout_v0_03;
  undefined4 extraout_v0_04;
  undefined4 extraout_v0_05;
  int iVar4;
  undefined4 extraout_v0_06;
  undefined4 extraout_v0_07;
  undefined4 extraout_v0_08;
  ushort uVar5;
  undefined4 extraout_v1;
  undefined4 extraout_v1_00;
  undefined4 extraout_v1_01;
  undefined4 extraout_v1_02;
  undefined4 extraout_v1_03;
  undefined4 extraout_v1_04;
  undefined4 extraout_v1_05;
  undefined4 extraout_v1_06;
  undefined4 extraout_v1_07;
  undefined4 extraout_v1_08;
  uint uVar6;
  ushort in_t0;
  uint in_t1;
  uint in_t2;
  _func_void_SDL_AudioCVT_ptr_Uint16 **pp_Var7;
  int iVar8;
  uint uVar9;
  int iVar10;
  uint uVar11;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
  uVar2 = DAT_089dbcc4;
  uVar1 = DAT_089dbcc0;
  cvt->len_mult = 1;
  *(undefined4 *)&cvt->len_ratio = uVar1;
  *(undefined4 *)((int)&cvt->len_ratio + 4) = uVar2;
  uVar9 = (uint)src_channels;
  uVar11 = in_t1 & 0xff;
  cvt->needed = 0;
  cvt->filter_index = 0;
  cvt->filters[0] = (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0;
  if (((src_format & 0x1000) != (in_t0 & 0x1000)) && ((src_format & 0xff) != 8)) {
    cvt->filters[0] = SDL_ConvertEndian;
    cvt->filter_index = 1;
  }
  if ((src_format & 0x8000) != (in_t0 & 0x8000)) {
    iVar8 = cvt->filter_index;
    cvt->filters[iVar8] = SDL_ConvertSign;
    cvt->filter_index = iVar8 + 1;
  }
  uVar5 = in_t0 & 0x10ff;
  if ((in_t0 & 0xff) != (src_format & 0xff)) {
    if (uVar5 == 0x10) {
      iVar8 = cvt->filter_index;
      iVar10 = cvt->len_mult;
      pcVar3 = SDL_Convert16LSB;
    }
    else {
      if (uVar5 != 0x1010) {
        if (uVar5 == 8) {
          iVar8 = cvt->filter_index;
          cvt->filters[iVar8] = SDL_Convert8;
          cvt->filter_index = iVar8 + 1;
          __muldf3(in_f12_13,in_f14_15);
          *(undefined4 *)&cvt->len_ratio = extraout_v0_03;
          *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_03;
        }
        goto LAB_08927b78;
      }
      iVar8 = cvt->filter_index;
      iVar10 = cvt->len_mult;
      pcVar3 = SDL_Convert16MSB;
    }
    cvt->filters[iVar8] = pcVar3;
    cvt->filter_index = iVar8 + 1;
    cvt->len_mult = iVar10 << 1;
    __adddf3(in_f12_13,in_f14_15);
    *(undefined4 *)&cvt->len_ratio = extraout_v0_02;
    *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_02;
  }
LAB_08927b78:
  if (uVar9 == uVar11) goto LAB_08927ca0;
  if (uVar9 == 1) {
    if (1 < uVar11) {
      iVar8 = cvt->filter_index;
      iVar10 = cvt->len_mult;
      cvt->filters[iVar8] = SDL_ConvertStereo;
      cvt->filter_index = iVar8 + 1;
      cvt->len_mult = iVar10 << 1;
      __adddf3(in_f12_13,in_f14_15);
      *(undefined4 *)&cvt->len_ratio = extraout_v0_01;
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_01;
      goto LAB_08927dd8;
    }
    uVar6 = 2;
LAB_08927b90:
    if (uVar6 <= uVar11) {
      iVar8 = cvt->filter_index;
      iVar10 = cvt->len_mult;
      pp_Var7 = cvt->filters + iVar8;
      do {
        iVar8 = iVar8 + 1;
        iVar10 = iVar10 << 1;
        *pp_Var7 = SDL_ConvertStereo;
        uVar9 = uVar6 & 0xff;
        cvt->filter_index = iVar8;
        cvt->len_mult = iVar10;
        __adddf3(in_f12_13,in_f14_15);
        uVar6 = uVar9 << 1;
        pp_Var7 = pp_Var7 + 1;
        *(undefined4 *)&cvt->len_ratio = extraout_v0;
        *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1;
      } while (uVar6 <= uVar11);
    }
    if (uVar9 != 6) {
      if ((uVar9 & 1) != 0) goto LAB_08927ca0;
      goto LAB_08927c20;
    }
    if (uVar11 < 3) {
      iVar8 = cvt->filter_index;
      cvt->filters[iVar8] = SDL_ConvertStrip;
      cvt->filter_index = iVar8 + 1;
      __divdf3(in_f12_13,in_f14_15);
      uVar9 = 2;
      *(undefined4 *)&cvt->len_ratio = extraout_v0_04;
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_04;
      goto LAB_08927c20;
    }
    if (uVar11 == 4) {
      iVar8 = cvt->filter_index;
      cvt->filters[iVar8] = SDL_ConvertStrip_2;
      cvt->filter_index = iVar8 + 1;
      __muldf3(in_f12_13,in_f14_15);
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_08;
      uVar9 = 4;
      uVar6 = 2;
      *(undefined4 *)&cvt->len_ratio = extraout_v0_08;
    }
    else {
      uVar6 = 3;
    }
  }
  else {
    uVar6 = uVar9 << 1;
    if (uVar9 != 2) goto LAB_08927b90;
LAB_08927dd8:
    if (uVar11 == 6) {
      iVar10 = cvt->len_mult;
      iVar8 = cvt->filter_index;
      cvt->filters[iVar8] = SDL_ConvertSurround;
      cvt->filter_index = iVar8 + 1;
      uVar9 = 6;
      cvt->len_mult = iVar10 * 3;
      __muldf3(in_f12_13,in_f14_15);
      uVar6 = 0xc;
      *(undefined4 *)&cvt->len_ratio = extraout_v0_07;
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_07;
      goto LAB_08927b90;
    }
    if (uVar11 != 4) {
      uVar9 = 2;
      uVar6 = 4;
      goto LAB_08927b90;
    }
    iVar10 = cvt->filter_index;
    iVar8 = cvt->len_mult;
    cvt->filters[iVar10] = SDL_ConvertSurround_4;
    cvt->filter_index = iVar10 + 1;
    cvt->len_mult = iVar8 << 1;
    __adddf3(in_f12_13,in_f14_15);
    uVar9 = 4;
    *(undefined4 *)&cvt->len_ratio = extraout_v0_05;
    *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_05;
LAB_08927c20:
    uVar6 = uVar9 >> 1;
  }
  if (uVar11 <= uVar6) {
    iVar8 = cvt->filter_index;
    pp_Var7 = cvt->filters + iVar8;
    do {
      uVar9 = uVar6;
      iVar8 = iVar8 + 1;
      *pp_Var7 = SDL_ConvertMono;
      cvt->filter_index = iVar8;
      __muldf3(in_f12_13,in_f14_15);
      *(undefined4 *)&cvt->len_ratio = extraout_v0_00;
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_00;
      pp_Var7 = pp_Var7 + 1;
      if ((uVar9 & 1) != 0) break;
      uVar6 = uVar9 >> 1;
    } while (uVar11 <= uVar9 >> 1);
  }
LAB_08927ca0:
  *(undefined4 *)&cvt->rate_incr = 0;
  *(undefined4 *)((int)&cvt->rate_incr + 4) = 0;
  if (src_rate / 100 == (int)in_t2 / 100) {
    iVar8 = cvt->filter_index;
  }
  else {
                    /* Unresolved local var: Uint32 hi_rate@[???]
                       Unresolved local var: Uint32 lo_rate@[???]
                       Unresolved local var: int len_mult@[???]
                       Unresolved local var: double len_ratio@[???]
                       Unresolved local var: _func_void_SDL_AudioCVT_ptr_Uint16 * rate_cvt@[???] */
    if ((int)in_t2 < src_rate) {
      uVar11 = src_rate;
      if (uVar9 == 2) {
        pcVar3 = SDL_RateDIV2_c2;
        iVar10 = 1;
      }
      else if (uVar9 < 3) {
        if (uVar9 != 1) {
          return -1;
        }
        pcVar3 = SDL_RateDIV2;
        iVar10 = 1;
      }
      else if (uVar9 == 4) {
        pcVar3 = SDL_RateDIV2_c4;
        iVar10 = 1;
      }
      else {
        if (uVar9 != 6) {
          return -1;
        }
        pcVar3 = SDL_RateDIV2_c6;
        iVar10 = 1;
      }
    }
    else {
      uVar11 = in_t2;
      in_t2 = src_rate;
      if (uVar9 == 2) {
        pcVar3 = SDL_RateMUL2_c2;
        iVar10 = 2;
      }
      else if (uVar9 < 3) {
        if (uVar9 != 1) {
          return -1;
        }
        pcVar3 = SDL_RateMUL2;
        iVar10 = 2;
      }
      else if (uVar9 == 4) {
        pcVar3 = SDL_RateMUL2_c4;
        iVar10 = 2;
      }
      else {
        if (uVar9 != 6) {
          return -1;
        }
        pcVar3 = SDL_RateMUL2_c6;
        iVar10 = 2;
      }
    }
    iVar8 = cvt->filter_index;
    while (in_t2 = in_t2 << 1, in_t2 / 100 <= uVar11 / 100) {
      iVar4 = cvt->len_mult;
      cvt->filters[iVar8] = pcVar3;
      cvt->filter_index = iVar8 + 1;
      cvt->len_mult = iVar4 * iVar10;
      __muldf3(in_f12_13,in_f14_15);
      *(undefined4 *)&cvt->len_ratio = extraout_v0_06;
      *(undefined4 *)((int)&cvt->len_ratio + 4) = extraout_v1_06;
      iVar8 = iVar8 + 1;
    }
  }
  if (iVar8 == 0) {
    iVar8 = cvt->needed;
  }
  else {
    cvt->needed = 1;
    cvt->src_format = src_format;
    cvt->dst_format = in_t0;
    cvt->filters[iVar8] = (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0;
    cvt->len = 0;
    cvt->buf = (Uint8 *)0x0;
    iVar8 = cvt->needed;
  }
  return iVar8;
}



----------------------------------------

// Function: SDL_ConvertAudio @ 089281f0

int SDL_ConvertAudio(SDL_AudioCVT *cvt)

{
  int iVar1;
  
  if (cvt->buf == (Uint8 *)0x0) {
    SDL_SetError("No buffer allocated for conversion");
    iVar1 = -1;
  }
  else {
    iVar1 = 0;
    cvt->len_cvt = cvt->len;
    if (cvt->filters[0] != (_func_void_SDL_AudioCVT_ptr_Uint16 *)0x0) {
      cvt->filter_index = 0;
      (*cvt->filters[0])(cvt,cvt->src_format);
      iVar1 = 0;
    }
  }
  return iVar1;
}



----------------------------------------

// Function: SDL_FreeAudioMem @ 08928248

void SDL_FreeAudioMem(void *chunk)

{
  _free_r(_impure_ptr,chunk);
  return;
}



----------------------------------------

// Function: SDL_AllocAudioMem @ 08928250

void * SDL_AllocAudioMem(int size)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * chunk@[???] */
  pvVar1 = _malloc_r(_impure_ptr,size);
  return pvVar1;
}



----------------------------------------

// Function: SDL_CalculateBlit @ 08928258

int SDL_CalculateBlit(SDL_Surface *surface)

{
  SDL_VideoInfo *pSVar1;
  byte bVar2;
  uint uVar3;
  SDL_blit p_Var4;
  int iVar5;
  SDL_loblit p_Var6;
  SDL_PixelFormat *pSVar7;
  SDL_BlitMap *map;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  SDL_Surface *pSVar11;
  private_swaccel *ppVar12;
  
                    /* Unresolved local var: int blit_index@[???] */
  uVar8 = surface->flags;
  if ((uVar8 & 0x4000) != 0) {
    SDL_UnRLESurface(surface,1);
    uVar8 = surface->flags;
  }
  map = surface->map;
  uVar9 = uVar8 & 0xfffffeff;
  surface->flags = uVar9;
  map->sw_blit = (SDL_blit)0x0;
  uVar10 = uVar9;
  if (map->identity == 0) {
LAB_08928314:
    if ((uVar10 & 1) == 0) goto LAB_089283e8;
LAB_08928324:
    if (current_video->displayformatalphapixel == (SDL_PixelFormat *)0x0) goto LAB_089283e8;
    uVar8 = (uVar9 & 0x1fff) >> 0xc;
    if ((uVar9 & 0x10000) != 0) {
      if ((&current_video->info)->blit_hw_A != 0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
        (*current_video->CheckHWBlit)(current_video,surface,map->dst);
        uVar9 = surface->flags;
        map = surface->map;
        goto LAB_089283e8;
      }
      goto LAB_0892834c;
    }
    goto LAB_08928364;
  }
                    /* Unresolved local var: int hw_blit_ok@[???] */
  pSVar11 = map->dst;
  if ((uVar8 & 1) != 0) {
    if ((((pSVar11->flags & 1) != 0) && ((BADTYPE)pSVar1->blit_hw)) &&
       (((uVar8 & 0x1000) == 0 || ((BADTYPE)pSVar1->blit_hw_CC)))) {
      if ((uVar8 & 0x10000) != 0) {
        uVar3 = pSVar1->blit_hw_A;
        goto LAB_089282f0;
      }
      goto LAB_089282fc;
    }
    goto LAB_08928324;
  }
  if ((((pSVar11->flags & 1) != 0) && ((BADTYPE)pSVar1->blit_sw)) &&
     ((uVar10 = uVar8, (uVar8 & 0x1000) == 0 || (uVar10 = uVar9, (BADTYPE)pSVar1->blit_sw_CC)))) {
    if ((uVar10 & 0x10000) != 0) {
      uVar3 = pSVar1->blit_sw_A;
LAB_089282f0:
      uVar10 = uVar8;
      if (uVar3 == 0) goto LAB_08928314;
    }
LAB_089282fc:
    (*current_video->CheckHWBlit)(current_video,surface,pSVar11);
    uVar9 = surface->flags;
    map = surface->map;
    uVar10 = uVar9;
    goto LAB_08928314;
  }
LAB_089283e8:
  uVar8 = (uVar9 & 0x1fff) >> 0xc;
  if ((uVar9 & 0x10000) == 0) {
    if (map->identity == 0) {
      pSVar7 = surface->format;
      goto LAB_08928404;
    }
LAB_08928370:
    if (uVar8 != 0) {
      pSVar7 = surface->format;
      goto LAB_08928404;
    }
    ppVar12 = map->sw_data;
    pSVar11 = map->dst;
    ppVar12->blit = SDL_BlitCopy;
    if (surface == pSVar11) {
      ppVar12->blit = SDL_BlitCopyOverlap;
    }
    if ((surface->flags & 0x2100) == 0x2000) {
      iVar5 = map->identity;
      goto LAB_089284f8;
    }
  }
  else {
LAB_0892834c:
    if (surface->format->alpha == 0xff) {
      if (surface->format->Amask != 0) {
        uVar8 = uVar8 | 2;
        goto LAB_08928364;
      }
      iVar5 = map->identity;
    }
    else {
      uVar8 = uVar8 | 2;
LAB_08928364:
      iVar5 = map->identity;
    }
    if (iVar5 != 0) goto LAB_08928370;
    pSVar7 = surface->format;
LAB_08928404:
    if (pSVar7->BitsPerPixel < 8) {
      ppVar12 = map->sw_data;
      p_Var6 = SDL_CalculateBlit0(surface,uVar8);
      ppVar12->blit = p_Var6;
    }
    else {
      bVar2 = pSVar7->BytesPerPixel;
      if (bVar2 != 1) {
        if (bVar2 == 0) {
          ppVar12 = map->sw_data;
        }
        else {
          if (bVar2 < 5) {
            ppVar12 = map->sw_data;
            p_Var6 = SDL_CalculateBlitN(surface,uVar8);
            ppVar12->blit = p_Var6;
            goto LAB_089284d0;
          }
          ppVar12 = map->sw_data;
        }
        ppVar12->blit = (SDL_loblit)0x0;
        goto LAB_08928430;
      }
      ppVar12 = map->sw_data;
      p_Var6 = SDL_CalculateBlit1(surface,uVar8);
      ppVar12->blit = p_Var6;
    }
LAB_089284d0:
    map = surface->map;
    if (map->sw_data->blit == (SDL_loblit)0x0) {
LAB_08928430:
      SDL_InvalidateMap(map);
      SDL_SetError("Blit combination not supported");
      return -1;
    }
    if ((surface->flags & 0x2100) != 0x2000) {
      p_Var4 = map->sw_blit;
      goto LAB_089283a8;
    }
    iVar5 = map->identity;
LAB_089284f8:
    if (iVar5 == 0) {
LAB_08928514:
      if (uVar8 != 2) {
        p_Var4 = map->sw_blit;
        goto LAB_089283a8;
      }
      if (surface->format->Amask == 0) {
        p_Var4 = map->sw_blit;
        goto LAB_089283a8;
      }
      iVar5 = SDL_RLESurface(surface);
      map = surface->map;
      if (iVar5 == 0) {
        map->sw_blit = SDL_RLEAlphaBlit;
      }
    }
    else {
      if (uVar8 != 1) {
        if (uVar8 != 3) goto LAB_08928514;
        if (surface->format->Amask != 0) {
          p_Var4 = map->sw_blit;
          goto LAB_089283a8;
        }
      }
      iVar5 = SDL_RLESurface(surface);
      map = surface->map;
      if (iVar5 == 0) {
        map->sw_blit = SDL_RLEBlit;
      }
    }
  }
  p_Var4 = map->sw_blit;
LAB_089283a8:
  if (p_Var4 == (SDL_blit)0x0) {
    map->sw_blit = SDL_SoftBlit;
    return 0;
  }
  return 0;
}



----------------------------------------

// Function: SDL_SoftBlit @ 0892861c

int SDL_SoftBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  ushort uVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  int iVar5;
  private_swaccel *ppVar6;
  uint uVar7;
  SDL_BlitInfo local_58;
  
                    /* Unresolved local var: int okay@[???]
                       Unresolved local var: int src_locked@[???]
                       Unresolved local var: int dst_locked@[???] */
  if ((dst->offset == 0) && (bVar2 = true, (dst->flags & 0x4005) == 0)) {
    bVar3 = false;
  }
  else {
    iVar5 = SDL_LockSurface(dst);
    bVar2 = false;
    if (iVar5 < 0) {
      bVar3 = false;
    }
    else {
      bVar2 = true;
      bVar3 = true;
    }
  }
  if ((src->offset == 0) && ((src->flags & 0x4005) == 0)) {
    bVar4 = false;
    if (!bVar2) goto joined_r0x0892885c;
    uVar1 = srcrect->w;
  }
  else {
    iVar5 = SDL_LockSurface(src);
    if (iVar5 < 0) {
      bVar2 = false;
      bVar4 = false;
      goto joined_r0x0892885c;
    }
    bVar4 = true;
    if (!bVar2) goto joined_r0x0892885c;
    uVar1 = srcrect->w;
  }
  uVar7 = (uint)uVar1;
  if ((uVar7 != 0) && (srcrect->h != 0)) {
                    /* Unresolved local var: SDL_BlitInfo info@[???]
                       Unresolved local var: SDL_loblit RunBlit@[???] */
    local_58.src = src->format;
    ppVar6 = src->map->sw_data;
    local_58.d_width = (int)dstrect->w;
    local_58.d_height = (int)dstrect->h;
    local_58.aux_data = ppVar6->aux_data;
    local_58.dst = dst->format;
    local_58.s_pixels =
         (Uint8 *)((int)src->pixels +
                  (uint)(ushort)srcrect->x * (uint)(local_58.src)->BytesPerPixel +
                  (uint)(ushort)srcrect->y * (uint)src->pitch);
    local_58.s_skip = (uint)src->pitch - uVar7 * (local_58.src)->BytesPerPixel;
    local_58.d_pixels =
         (Uint8 *)((int)dst->pixels +
                  (uint)(ushort)dstrect->x * (uint)(local_58.dst)->BytesPerPixel +
                  (uint)(ushort)dstrect->y * (uint)dst->pitch);
    local_58.table = src->map->table;
    local_58.d_skip = (uint)dst->pitch - local_58.d_width * (uint)(local_58.dst)->BytesPerPixel;
    local_58.s_width = uVar7;
    local_58.s_height = (uint)srcrect->h;
    (*ppVar6->blit)(&local_58);
  }
joined_r0x0892885c:
  if (bVar3) {
    SDL_UnlockSurface(dst);
  }
  if (bVar4) {
    SDL_UnlockSurface(src);
    iVar5 = -1;
    if (bVar2) {
      iVar5 = 0;
    }
    return iVar5;
  }
  iVar5 = -1;
  if (bVar2) {
    iVar5 = 0;
  }
  return iVar5;
}



----------------------------------------

// Function: SDL_BlitCopy @ 0892886c

void SDL_BlitCopy(SDL_BlitInfo *info)

{
  size_t len0;
  int iVar1;
  int iVar2;
  Uint8 *dst0;
  Uint8 *src0;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar4 = info->d_height;
  iVar2 = info->d_skip;
  src0 = info->s_pixels;
  dst0 = info->d_pixels;
  iVar1 = info->s_skip;
  if (iVar4 != 0) {
    len0 = info->d_width * (uint)info->dst->BytesPerPixel;
    iVar3 = 0;
    do {
      iVar3 = iVar3 + 1;
      memcpy(dst0,src0,len0);
      src0 = src0 + len0 + iVar1;
      dst0 = dst0 + len0 + iVar2;
    } while (iVar4 != iVar3);
  }
  return;
}



----------------------------------------

// Function: SDL_BlitCopyOverlap @ 08928910

void SDL_BlitCopyOverlap(SDL_BlitInfo *info)

{
  size_t length;
  int iVar1;
  Uint8 *pUVar2;
  int iVar3;
  Uint8 *pUVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???] */
  pUVar4 = info->s_pixels;
  pUVar2 = info->d_pixels;
  length = (uint)info->dst->BytesPerPixel * info->d_width;
  iVar5 = info->d_height;
  iVar6 = length + info->s_skip;
  iVar3 = length + info->d_skip;
  if (pUVar2 < pUVar4) {
    iVar1 = 0;
    if (iVar5 != 0) {
      do {
        iVar1 = iVar1 + 1;
        memcpy(pUVar2,pUVar4,length);
        pUVar4 = pUVar4 + iVar6;
        pUVar2 = pUVar2 + iVar3;
      } while (iVar5 != iVar1);
    }
  }
  else if (iVar5 != 0) {
    iVar1 = 0;
    pUVar2 = pUVar2 + iVar3 * (iVar5 + -1);
    pUVar4 = pUVar4 + iVar6 * (iVar5 + -1);
    do {
      iVar1 = iVar1 + 1;
      memmove(pUVar2,pUVar4,length);
      pUVar4 = pUVar4 + -iVar6;
      pUVar2 = pUVar2 + -iVar3;
    } while (iVar5 != iVar1);
    return;
  }
  return;
}



----------------------------------------

// Function: PSP_Available @ 08928a48

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int PSP_Available(void)

{
  return 1;
}



----------------------------------------

// Function: PSP_ListModes @ 08928a50

/* DWARF original prototype: SDL_Rect * * PSP_ListModes(SDL_VideoDevice * this, SDL_PixelFormat *
   format, Uint32 flags) */

SDL_Rect ** __thiscall PSP_ListModes(void *this,SDL_PixelFormat *format,Uint32 flags)

{
  uint uVar1;
  SDL_Rect **ppSVar2;
  
  ppSVar2 = (SDL_Rect **)0xffffffff;
  if ((flags & 1) != 0) {
    uVar1 = format->BitsPerPixel - 8;
    ppSVar2 = (SDL_Rect **)0x0;
    if (((uVar1 & 0xff) < 0x19) && ((1 << (uVar1 & 0x1f) & 0x1000181U) != 0)) {
      ppSVar2 = modelist;
    }
  }
  return ppSVar2;
}



----------------------------------------

// Function: PSP_LockHWSurface @ 08928aa4

/* DWARF original prototype: int PSP_LockHWSurface(SDL_VideoDevice * this, SDL_Surface * surface) */

int __thiscall PSP_LockHWSurface(void *this,SDL_Surface *surface)

{
  return 0;
}



----------------------------------------

// Function: PSP_UpdateRects @ 08928aac

/* DWARF original prototype: void PSP_UpdateRects(SDL_VideoDevice * this, int numrects, SDL_Rect *
   rects) */

void __thiscall PSP_UpdateRects(void *this,int numrects,SDL_Rect *rects)

{
  return;
}



----------------------------------------

// Function: PSP_CheckHWBlit @ 08928ab4

/* DWARF original prototype: int PSP_CheckHWBlit(SDL_VideoDevice * this, SDL_Surface * src,
   SDL_Surface * dst) */

int __thiscall PSP_CheckHWBlit(void *this,SDL_Surface *src,SDL_Surface *dst)

{
  uint uVar1;
  
  uVar1 = src->flags;
  src->map->hw_blit = HWAccelBlit;
  src->flags = uVar1 | 0x100;
  return 1;
}



----------------------------------------

// Function: PSP_CreateDevice @ 08928ad8

SDL_VideoDevice * PSP_CreateDevice(int devindex)

{
  SDL_VideoDevice *m;
  SDL_PrivateVideoData *pSVar1;
  SDL_PrivateGLData *pSVar2;
  
                    /* Unresolved local var: SDL_VideoDevice * device@[???] */
  m = malloc(0x2ac);
  if (m == (SDL_VideoDevice *)0x0) {
    SDL_Error(SDL_ENOMEM);
    m = (SDL_VideoDevice *)0x0;
  }
  else {
    memset(m,0,0x2ac);
    pSVar1 = malloc(0x2c);
    m->hidden = pSVar1;
    pSVar2 = malloc(0xc);
    pSVar1 = m->hidden;
    m->gl_data = pSVar2;
    if ((pSVar1 == (SDL_PrivateVideoData *)0x0) || (pSVar2 == (SDL_PrivateGLData *)0x0)) {
      SDL_Error(SDL_ENOMEM);
      free(m);
      return (SDL_VideoDevice *)0x0;
    }
    pSVar1->vram_base = (void *)0x0;
    pSVar1->pixel_format = 0;
    pSVar1->frame = 0;
    (pSVar1->sw_rect).w = 0;
    (pSVar1->sw_rect).h = 0;
    pSVar1->frame_offset = 0;
    pSVar1->psm = 0;
    pSVar1->tpsm = 0;
    pSVar1->gu_palette = (void *)0x0;
    (pSVar1->hw_rect).x = 0;
    (pSVar1->hw_rect).y = 0;
    (pSVar1->hw_rect).w = 0;
    (pSVar1->hw_rect).h = 0;
    (pSVar1->sw_rect).x = 0;
    (pSVar1->sw_rect).y = 0;
    pSVar2 = m->gl_data;
    pSVar2->surface = (EGLSurface)0x0;
    pSVar2->display = (EGLDisplay)0x0;
    pSVar2->context = (EGLContext)0x0;
    m->VideoInit = PSP_VideoInit;
    m->SetVideoMode = PSP_SetVideoMode;
    m->ListModes = PSP_ListModes;
    m->UpdateRects = PSP_UpdateRects;
    m->SetColors = PSP_SetColors;
    m->AllocHWSurface = PSP_AllocHWSurface;
    m->VideoQuit = PSP_VideoQuit;
    m->FillHWRect = PSP_FillHWRect;
    m->CheckHWBlit = PSP_CheckHWBlit;
    m->UnlockHWSurface = PSP_UnlockHWSurface;
    m->LockHWSurface = PSP_LockHWSurface;
    m->FreeHWSurface = PSP_FreeHWSurface;
    m->FlipHWSurface = PSP_FlipHWSurface;
    m->GL_GetAttribute = PSP_GL_GetAttribute;
    m->GL_GetProcAddress = PSP_GL_GetProcAddress;
    m->CreateYUVOverlay =
         (_func_SDL_Overlay_ptr_SDL_VideoDevice_ptr_int_int_Uint32_SDL_Surface_ptr *)0x0;
    m->SetHWColorKey = (_func_int_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint32 *)0x0;
    m->SetHWAlpha = (_func_int_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8 *)0x0;
    m->GL_MakeCurrent = PSP_GL_MakeCurrent;
    m->GL_SwapBuffers = PSP_GL_SwapBuffers;
    m->InitOSKeymap = PSP_InitOSKeymap;
    m->PumpEvents = PSP_PumpEvents;
    m->free = PSP_DeleteDevice;
    m->SetCaption = (_func_void_SDL_VideoDevice_ptr_char_ptr_char_ptr *)0x0;
    m->SetIcon = (_func_void_SDL_VideoDevice_ptr_SDL_Surface_ptr_Uint8_ptr *)0x0;
    m->IconifyWindow = (_func_int_SDL_VideoDevice_ptr *)0x0;
    m->GrabInput = (_func_SDL_GrabMode_SDL_VideoDevice_ptr_SDL_GrabMode *)0x0;
    m->GetWMInfo = (_func_int_SDL_VideoDevice_ptr_SDL_SysWMinfo_ptr *)0x0;
  }
  return m;
}



----------------------------------------

// Function: PSP_DeleteDevice @ 08928cd0

void PSP_DeleteDevice(SDL_VideoDevice *device)

{
  if (device != (SDL_VideoDevice *)0x0) {
    if (device->hidden != (SDL_PrivateVideoData *)0x0) {
      free(device->hidden);
    }
    if (device->gl_data != (SDL_PrivateGLData *)0x0) {
      free(device->gl_data);
    }
    free(device);
    return;
  }
  return;
}



----------------------------------------

// Function: PSP_UnlockHWSurface @ 08928d30

/* DWARF original prototype: void PSP_UnlockHWSurface(SDL_VideoDevice * this, SDL_Surface * surface)
    */

void __thiscall PSP_UnlockHWSurface(void *this,SDL_Surface *surface)

{
  return;
}



----------------------------------------

// Function: PSP_SetColors @ 08928d38

/* DWARF original prototype: int PSP_SetColors(SDL_VideoDevice * this, int firstcolor, int ncolors,
   SDL_Color * colors) */

int __thiscall PSP_SetColors(void *this,int firstcolor,int ncolors,SDL_Color *colors)

{
  bool bVar1;
  void *pvVar2;
  uint *puVar3;
  Uint8 *pUVar4;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int ret@[???]
                       Unresolved local var: uint * palette@[???] */
  bVar1 = 0x100 < ncolors;
  if (bVar1) {
    ncolors = 0x100;
  }
  iVar5 = *(int *)((int)this + 0x2a0);
  if (*(int *)(iVar5 + 0x18) == 0) {
    pvVar2 = memalign(0x10,0x400);
    *(void **)(iVar5 + 0x18) = pvVar2;
    iVar5 = *(int *)((int)this + 0x2a0);
    *(undefined4 *)(iVar5 + 0x14) = 5;
  }
  if (0 < ncolors) {
    puVar3 = (uint *)(*(int *)(iVar5 + 0x18) + firstcolor * 4);
    pUVar4 = &colors->b;
    iVar5 = 0;
    do {
      iVar5 = iVar5 + 1;
      *puVar3 = (uint)pUVar4[-1] << 8 |
                (uint)*pUVar4 << 0x10 | (uint)((SDL_Color *)(pUVar4 + -2))->r;
      pUVar4 = pUVar4 + 4;
      puVar3 = puVar3 + 1;
    } while (ncolors != iVar5);
  }
  sceKernelDcacheWritebackAll();
  sceGuStart(0,list);
  sceGuClutLoad(0x20,*(void **)(*(int *)((int)this + 0x2a0) + 0x18));
  sceGuFinish();
  sceGuSync(0,0);
  return (uint)!bVar1;
}



----------------------------------------

// Function: PSP_VideoInit @ 08928e58

/* DWARF original prototype: int PSP_VideoInit(SDL_VideoDevice * this, SDL_PixelFormat * vformat) */

int __thiscall PSP_VideoInit(void *this,SDL_PixelFormat *vformat)

{
  vformat->BytesPerPixel = '\x04';
  vformat->BitsPerPixel = ' ';
  *(uint *)((int)this + 0x28) = *(uint *)((int)this + 0x28) & 0xffff77fd | 0x601;
  PSP_EventInit(this);
  return 0;
}



----------------------------------------

// Function: vidmem_free @ 08928eb0

void vidmem_free(void *ptr)

{
  int *dst_void;
  vidmem_chunk *pvVar1;
  ulong uVar2;
  int iVar3;
  uint uVar4;
  
                    /* Unresolved local var: int i@[???] */
  if (vidmem_map_len != 0) {
    uVar4 = 0;
    iVar3 = 0;
    do {
                    /* Unresolved local var: void * tmp@[???] */
      uVar2 = vidmem_map_len - 1;
      dst_void = (int *)((int)&vidmem_map->ptr + iVar3);
      iVar3 = iVar3 + 8;
      pvVar1 = vidmem_map;
      if ((void *)*dst_void == ptr) {
        vidmem_map_len = uVar2;
        memmove(dst_void,dst_void + 2,(uVar2 - uVar4) * 8);
        pvVar1 = realloc(vidmem_map,vidmem_map_len << 3);
        if (pvVar1 != (vidmem_chunk *)0x0) goto LAB_08928f1c;
      }
      else {
LAB_08928f1c:
        vidmem_map = pvVar1;
      }
      uVar4 = uVar4 + 1;
    } while (uVar4 < vidmem_map_len);
  }
  return;
}



----------------------------------------

// Function: PSP_VideoQuit @ 08928f7c

/* DWARF original prototype: void PSP_VideoQuit(SDL_VideoDevice * this) */

void __thiscall PSP_VideoQuit(void *this)

{
  void *aptr;
  
  aptr = *(void **)(*(int *)((int)this + 0x2a0) + 0x18);
  if (aptr != (void *)0x0) {
    free(aptr);
    *(undefined4 *)(*(int *)((int)this + 0x2a0) + 0x18) = 0;
  }
  sceGuTerm();
  PSP_EventQuit(this);
  vidmem_free((void *)**(undefined4 **)((int)this + 0x2a0));
  if ((**(uint **)((int)this + 0x130) & 0x40000000) == 0) {
    return;
  }
  vidmem_free((void *)(**(int **)((int)this + 0x2a0) + (*(int **)((int)this + 0x2a0))[3]));
  return;
}



----------------------------------------

// Function: PSP_FreeHWSurface @ 08929008

/* DWARF original prototype: void PSP_FreeHWSurface(SDL_VideoDevice * this, SDL_Surface * surface)
    */

void __thiscall PSP_FreeHWSurface(void *this,SDL_Surface *surface)

{
  vidmem_free(surface->pixels);
  surface->pixels = (void *)0x0;
  return;
}



----------------------------------------

// Function: vidmem_map_insert_new @ 08929034

void * vidmem_map_insert_new(ulong idx,ulong adr,ulong size)

{
  vidmem_chunk *pvVar1;
  void *pvVar2;
  
                    /* Unresolved local var: void * tmp@[???] */
  pvVar1 = realloc(vidmem_map,vidmem_map_len * 8 + 8);
  pvVar2 = (void *)0x0;
  if (pvVar1 != (vidmem_chunk *)0x0) {
    vidmem_map = pvVar1;
    memmove(pvVar1 + idx + 1,pvVar1 + idx,(vidmem_map_len - idx) * 8);
    vidmem_map_len = vidmem_map_len + 1;
    pvVar1 = vidmem_map + idx;
    pvVar1->ptr = (void *)adr;
    pvVar1->len = size;
    pvVar2 = (void *)adr;
  }
  return pvVar2;
}



----------------------------------------

// Function: vidmem_alloc @ 089290f0

void * vidmem_alloc(ulong size)

{
  ulong uVar1;
  int iVar2;
  void *pvVar3;
  ulong idx;
  vidmem_chunk *pvVar4;
  ulong adr;
  
                    /* Unresolved local var: ulong start@[???]
                       Unresolved local var: ulong adr@[???]
                       Unresolved local var: ulong i@[???] */
  uVar1 = sceGeEdramGetAddr();
  if ((size & 0xf) != 0) {
    size = (size & 0xfffffff0) + 0x10;
  }
  adr = uVar1;
  if (vidmem_map_len != 0) {
    idx = 0;
    pvVar4 = vidmem_map;
    do {
      pvVar3 = pvVar4->ptr;
                    /* Unresolved local var: ulong new_adr@[???] */
      if (pvVar3 != (void *)0x0) {
        if (size <= (int)pvVar3 - adr) goto LAB_089291b0;
        adr = (int)pvVar3 + pvVar4->len;
      }
      idx = idx + 1;
      pvVar4 = pvVar4 + 1;
    } while (idx != vidmem_map_len);
  }
  iVar2 = sceGeEdramGetSize();
  idx = vidmem_map_len;
  if (uVar1 + iVar2 < size + adr) {
    return (void *)0x0;
  }
LAB_089291b0:
  pvVar3 = vidmem_map_insert_new(idx,adr,size);
  return pvVar3;
}



----------------------------------------

// Function: PSP_AllocHWSurface @ 089291d8

/* WARNING: Control flow encountered bad instruction data */
/* DWARF original prototype: int PSP_AllocHWSurface(SDL_VideoDevice * this, SDL_Surface * surface)
    */

int __thiscall PSP_AllocHWSurface(void *this,SDL_Surface *surface)

{
                    /* Unresolved local var: int pitch@[???] */
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: PSP_SetVideoMode @ 08929258

/* WARNING: Removing unreachable block (ram,0x0892967c) */
/* WARNING: Removing unreachable block (ram,0x089296f0) */
/* WARNING: Removing unreachable block (ram,0x089295b4) */
/* DWARF original prototype: SDL_Surface * PSP_SetVideoMode(SDL_VideoDevice * this, SDL_Surface *
   current, int width, int height, int bpp, Uint32 flags) */

SDL_Surface * __thiscall
PSP_SetVideoMode(void *this,SDL_Surface *current,int width,int height,int bpp,Uint32 flags)

{
  SDL_PixelFormat *pSVar1;
  undefined4 uVar2;
  void *pvVar3;
  char *s1;
  uint uVar4;
  int iVar5;
  int iVar6;
  Uint32 Rmask;
  Uint32 Gmask;
  int in_t0;
  uint in_t1;
  Uint32 unaff_s0;
  undefined4 *puVar7;
  int *piVar8;
  Uint32 unaff_s1;
  undefined4 local_38;
  int local_34;
  int local_30;
  
                    /* Unresolved local var: int disp_pitch@[???]
                       Unresolved local var: int draw_pitch@[???]
                       Unresolved local var: int pixel_format@[???]
                       Unresolved local var: Uint32 Amask@[???]
                       Unresolved local var: Uint32 Rmask@[???]
                       Unresolved local var: Uint32 Gmask@[???]
                       Unresolved local var: Uint32 Bmask@[???] */
  if (((in_t1 & 1) != 0) && ((width != 0x1e0 || (height != 0x110)))) {
LAB_089292c0:
    SDL_SetError("Couldn\'t find requested mode");
    return (SDL_Surface *)0x0;
  }
  if (in_t0 == 0xf) {
    local_30 = 0x400;
    local_34 = 0x400;
    local_38 = 1;
    Rmask = 0x1f;
    Gmask = 0x3e0;
  }
  else if (in_t0 < 0x10) {
    if (in_t0 != 8) goto LAB_089292c0;
    Rmask = 0;
    Gmask = 0;
    local_30 = 0x800;
    local_34 = 0x200;
    local_38 = 3;
  }
  else if (in_t0 == 0x10) {
    Rmask = 0x1f;
    Gmask = 0x7e0;
    local_30 = 0x400;
    local_34 = 0x400;
    local_38 = 0;
  }
  else {
    if (in_t0 != 0x20) goto LAB_089292c0;
    Rmask = 0xff;
    Gmask = 0xff00;
    local_30 = 0x800;
    local_34 = 0x800;
    local_38 = 3;
  }
  pSVar1 = SDL_ReallocFormat(current,in_t0,Rmask,Gmask,unaff_s0,unaff_s1);
  if (pSVar1 == (SDL_PixelFormat *)0x0) {
    SDL_SetError("Couldn\'t allocate color format");
    return (SDL_Surface *)0x0;
  }
  current->flags = in_t1 | 0x80000000;
  current->w = width;
  current->h = height;
  if ((in_t1 & 2) != 0) {
    *(undefined4 *)((int)this + 0x198) = 1;
    current->flags = 0x80000002;
    pvVar3 = memalign(0x10,local_34 * height);
    current->pixels = pvVar3;
    iVar5 = PSP_GL_Init(this);
    if (iVar5 == 0) {
      return (SDL_Surface *)0x0;
    }
    return current;
  }
  puVar7 = *(undefined4 **)((int)this + 0x2a0);
  if (in_t0 == 0xf) {
    uVar2 = 1;
  }
  else {
    uVar2 = 3;
    if (in_t0 == 0x10) {
      uVar2 = 0;
    }
  }
  puVar7[5] = uVar2;
  puVar7[4] = uVar2;
  puVar7[2] = 0;
  puVar7[3] = 0;
  puVar7[1] = local_38;
  pvVar3 = vidmem_alloc(local_30 * 0x110);
  *puVar7 = pvVar3;
  sceDisplaySetMode(0,0x1e0,0x110);
  sceDisplaySetFrameBuf(**(undefined4 **)((int)this + 0x2a0),0x200,local_38,1);
  if ((in_t1 & 1) != 0) {
    current->pitch = (Uint16)local_34;
    if ((in_t1 & 0x40000000) != 0) {
      iVar5 = *(int *)((int)this + 0x2a0);
      *(undefined4 *)(iVar5 + 8) = 1;
      *(int *)(iVar5 + 0xc) = local_30 * height;
      vidmem_alloc(local_30 * height);
    }
    if (in_t0 == 8) {
      pvVar3 = memalign(0x10,height * (uint)current->pitch);
      current->pixels = pvVar3;
      piVar8 = *(int **)((int)this + 0x2a0);
      *(uint *)((int)this + 0x28) = *(uint *)((int)this + 0x28) & 0xffff7dff;
    }
    else {
      piVar8 = *(int **)((int)this + 0x2a0);
      iVar5 = *piVar8;
      iVar6 = piVar8[3];
      current->flags = current->flags | 0x1000000;
      current->pixels = (void *)(iVar5 + iVar6);
    }
    goto LAB_08929480;
  }
                    /* Unresolved local var: char * aspect_ratio@[???] */
  s1 = getenv("SDL_ASPECT_RATIO");
  if (s1 == (char *)0x0) {
    iVar5 = *(int *)((int)this + 0x2a0);
LAB_089296c0:
    *(undefined2 *)(iVar5 + 0x20) = 0x1e0;
    *(undefined2 *)(iVar5 + 0x22) = 0x110;
    *(undefined2 *)(iVar5 + 0x1c) = 0;
    *(undefined2 *)(iVar5 + 0x1e) = 0;
  }
  else {
    iVar6 = strcmp(s1,"4:3");
    iVar5 = *(int *)((int)this + 0x2a0);
    if (iVar6 != 0) goto LAB_089296c0;
    *(undefined2 *)(iVar5 + 0x20) = 0x168;
    *(undefined2 *)(iVar5 + 0x22) = 0x110;
    *(undefined2 *)(iVar5 + 0x1c) = 0x3c;
    *(undefined2 *)(iVar5 + 0x1e) = 0;
  }
  *(short *)(iVar5 + 0x2a) = (short)height;
  *(undefined2 *)(iVar5 + 0x24) = 0;
  *(undefined2 *)(iVar5 + 0x26) = 0;
  *(short *)(iVar5 + 0x28) = (short)width;
  if (width < 0x201) {
    uVar4 = in_t0 / 8 << 9;
  }
  else {
    uVar4 = width * (in_t0 / 8);
  }
  current->pitch = (Uint16)uVar4;
  pvVar3 = memalign(0x10,height * (uVar4 & 0xffff));
  piVar8 = *(int **)((int)this + 0x2a0);
  current->pixels = pvVar3;
  *(code **)((int)this + 0x20) = PSP_GuUpdateRects;
LAB_08929480:
                    /* Unresolved local var: void * dispbuffer@[???]
                       Unresolved local var: void * drawbuffer@[???] */
  pvVar3 = (void *)piVar8[3];
  sceGuInit();
  sceGuStart(0,list);
  sceGuDispBuffer(0x1e0,0x110,(void *)0x0,0x200);
  if ((current->flags & 0x20000001) == 1) {
    if (in_t0 == 0xf) {
      iVar5 = 1;
    }
    else {
      iVar5 = 0;
      if (in_t0 != 0x10) {
        iVar5 = 3;
      }
    }
    sceGuDrawBuffer(iVar5,pvVar3,0x200);
  }
  else {
    sceGuClutMode(3,0,0xff,0);
    sceGuDrawBuffer(3,pvVar3,0x200);
  }
  sceGuClear(5);
  sceGuOffset(0x710,0x778);
  sceGuViewport(0x800,0x800,0x1e0,0x110);
  sceGuScissor(0,0,0x1e0,0x110);
  sceGuEnable(2);
  sceGuFrontFace(0);
  sceGuFinish();
  sceGuSync(0,0);
  sceDisplayWaitVblankStart();
  sceGuDisplay(1);
  return current;
}



----------------------------------------

// Function: PSP_FillHWRect @ 08929794

/* DWARF original prototype: int PSP_FillHWRect(SDL_VideoDevice * this, SDL_Surface * dst, SDL_Rect
   * rect, Uint32 color) */

int __thiscall PSP_FillHWRect(void *this,SDL_Surface *dst,SDL_Rect *rect,Uint32 color)

{
  Uint8 UVar1;
  short sVar2;
  short *psVar3;
  uint uVar4;
  int psm;
  SDL_PixelFormat *pSVar5;
  void *unaff_s4;
  void *pvVar6;
  
                    /* Unresolved local var: rectVertex * vertices@[???]
                       Unresolved local var: void * gu_offset@[???] */
  pvVar6 = current_video->screen->pixels;
  sceGuStart(0,list);
  psVar3 = sceGuGetMemory(0xc);
  sVar2 = rect->x;
  pSVar5 = dst->format;
  *psVar3 = sVar2;
  psm = 1;
  psVar3[3] = sVar2 + rect->w;
  sVar2 = rect->y;
  psVar3[1] = sVar2;
  psVar3[4] = sVar2 + rect->h;
  UVar1 = pSVar5->BitsPerPixel;
  if ((UVar1 != '\x0f') && (psm = 0, UVar1 != '\x10')) {
    psm = 3;
  }
  uVar4 = (uint)pSVar5->BytesPerPixel;
  if (uVar4 == 0) {
    trap(7);
  }
  sceGuDrawBuffer(psm,(void *)((uint)dst->pixels & 0xffffff),dst->pitch / uVar4);
  sceGuColor(color);
  sceGuDrawArray(6,0x800100,2,(void *)0x0,unaff_s4);
  sceGuDrawBuffer(*(int *)(*(int *)((int)this + 0x2a0) + 0x10),(void *)((uint)pvVar6 & 0xffffff),
                  0x200);
  sceGuFinish();
  sceGuSync(0,0);
  return 0;
}



----------------------------------------

// Function: PSP_GuStretchBlit @ 089298dc

/* WARNING: Control flow encountered bad instruction data */

int PSP_GuStretchBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Rect *dstrect)

{
                    /* Unresolved local var: ushort old_slice@[???]
                       Unresolved local var: uint slice@[???]
                       Unresolved local var: uint num_slices@[???]
                       Unresolved local var: uint width@[???]
                       Unresolved local var: uint height@[???]
                       Unresolved local var: uint tbw@[???]
                       Unresolved local var: uint off_x@[???]
                       Unresolved local var: uint off_bytes@[???]
                       Unresolved local var: texVertex * vertices@[???]
                       Unresolved local var: void * pixels@[???] */
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: PSP_GuUpdateRects @ 08929c14

/* DWARF original prototype: void PSP_GuUpdateRects(SDL_VideoDevice * this, int numrects, SDL_Rect *
   rects) */

void __thiscall PSP_GuUpdateRects(void *this,int numrects,SDL_Rect *rects)

{
  int iVar1;
  SDL_Surface *src;
  
                    /* Unresolved local var: SDL_Surface * src@[???] */
  src = current_video->screen;
  sceKernelDcacheWritebackAll();
  if (src->w == 0x1e0) {
    if (src->h == 0x110) {
      iVar1 = 0;
      if (numrects != 0) {
        do {
          iVar1 = iVar1 + 1;
          PSP_GuStretchBlit(src,rects,rects);
          rects = rects + 1;
        } while (numrects != iVar1);
        sceGuSync(0,0);
        return;
      }
      goto LAB_08929c6c;
    }
    iVar1 = *(int *)((int)this + 0x2a0);
  }
  else {
    iVar1 = *(int *)((int)this + 0x2a0);
  }
  PSP_GuStretchBlit(src,(SDL_Rect *)(iVar1 + 0x24),(SDL_Rect *)(iVar1 + 0x1c));
LAB_08929c6c:
  sceGuSync(0,0);
  return;
}



----------------------------------------

// Function: HWAccelBlit @ 08929ce4

int HWAccelBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  int unaff_s0;
  int unaff_s1;
  void *unaff_s2;
  int unaff_s3;
  int unaff_s4;
  int unaff_retaddr;
  void *in_stack_00000000;
  
  sceKernelDcacheWritebackAll();
  if ((current_video->screen == dst) && ((src->flags & 1) != 0)) {
    PSP_GuStretchBlit(src,srcrect,dstrect);
    sceGuSync(0,0);
    return 0;
  }
  sceGuStart(0,list);
  if (src->format->BytesPerPixel == '\0') {
    trap(7);
  }
  if (dst->format->BytesPerPixel == '\0') {
    trap(7);
  }
  sceGuCopyImage(current_video->hidden->psm,(int)srcrect->x,(int)srcrect->y,(uint)srcrect->w,
                 unaff_s0,unaff_s1,unaff_s2,unaff_s3,unaff_s4,unaff_retaddr,in_stack_00000000);
  sceGuFinish();
  sceGuSync(0,0);
  return 0;
}



----------------------------------------

// Function: PSP_FlipHWSurface @ 08929e30

/* DWARF original prototype: int PSP_FlipHWSurface(SDL_VideoDevice * this, SDL_Surface * surface) */

int __thiscall PSP_FlipHWSurface(void *this,SDL_Surface *surface)

{
  uint uVar1;
  int *piVar2;
  
                    /* Unresolved local var: void * new_pixels@[???] */
  sceKernelDcacheWritebackAll();
  if (surface->format->BitsPerPixel != '\b') {
    piVar2 = *(int **)((int)this + 0x2a0);
    uVar1 = piVar2[2];
    piVar2[2] = uVar1 ^ 1;
    surface->pixels = (void *)(*piVar2 + piVar2[3] * (uVar1 ^ 1));
    sceGuSwapBuffers();
    return 0;
  }
  PSP_GuStretchBlit(surface,&RECT_480x272,&RECT_480x272);
  sceGuSync(0,0);
  sceGuSwapBuffers();
  return 0;
}



----------------------------------------

// Function: SDL_GetCursor @ 08929ee4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_Cursor * SDL_GetCursor(void)

{
  return SDL_cursor;
}



----------------------------------------

// Function: SDL_CursorPaletteChanged @ 08929ef0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_CursorPaletteChanged(void)

{
  palette_changed = 1;
  return;
}



----------------------------------------

// Function: SDL_MouseRect @ 08929f00

void SDL_MouseRect(SDL_Rect *area)

{
  short sVar1;
  ushort uVar2;
  Sint16 SVar3;
  Uint16 UVar4;
  Uint16 UVar5;
  int iVar6;
  int iVar7;
  
                    /* Unresolved local var: int clip_diff@[???] */
  SVar3 = (SDL_cursor->area).y;
  UVar4 = (SDL_cursor->area).w;
  UVar5 = (SDL_cursor->area).h;
  area->x = (SDL_cursor->area).x;
  area->y = SVar3;
  area->w = UVar4;
  area->h = UVar5;
  sVar1 = area->x;
  iVar6 = (int)sVar1;
  if (iVar6 < 0) {
    area->x = 0;
    iVar6 = 0;
    area->w = sVar1 + area->w;
  }
  sVar1 = area->y;
  iVar7 = (int)sVar1;
  if (iVar7 < 0) {
    area->y = 0;
    iVar7 = 0;
    area->h = sVar1 + area->h;
  }
  uVar2 = area->w;
  iVar6 = (iVar6 + (uint)uVar2) - current_video->screen->w;
  if (0 < iVar6) {
    if ((int)(uint)uVar2 < iVar6) {
      area->w = 0;
    }
    else {
      area->w = uVar2 - (short)iVar6;
    }
  }
  uVar2 = area->h;
  iVar6 = (iVar7 + (uint)uVar2) - current_video->screen->h;
  if (0 < iVar6) {
    if ((int)(uint)uVar2 < iVar6) {
      area->h = 0;
      return;
    }
    area->h = uVar2 - (short)iVar6;
  }
  return;
}



----------------------------------------

// Function: SDL_ResetCursor @ 08929fe8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_ResetCursor(void)

{
  ushort uVar1;
  ushort uVar2;
  SDL_Cursor *pSVar3;
  Uint8 *m;
  
                    /* Unresolved local var: int savelen@[???] */
  pSVar3 = SDL_cursor;
  if (SDL_cursor != (SDL_Cursor *)0x0) {
    uVar1 = (SDL_cursor->area).w;
    uVar2 = (SDL_cursor->area).h;
    m = SDL_cursor->save[0];
    (SDL_cursor->area).x = 0;
    (pSVar3->area).y = 0;
    memset(m,0,(uint)uVar2 * (uint)uVar1 * 4);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_EraseCursorNoLock @ 0892a024

void SDL_EraseCursorNoLock(SDL_Surface *screen)

{
  size_t len0;
  SDL_PixelFormat *pSVar1;
  SDL_PixelFormat *pSVar2;
  SDL_BlitMap *pSVar3;
  void *dst0;
  Uint8 *src0;
  uint uVar4;
  uint uVar5;
  SDL_Rect local_60;
  SDL_BlitInfo local_58;
  
                    /* Unresolved local var: SDL_Rect area@[???] */
  SDL_MouseRect(&local_60);
  uVar5 = (uint)local_60.h;
  if ((local_60.w != 0) && (uVar5 != 0)) {
                    /* Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int screenbpp@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    pSVar1 = screen->format;
    if ((screen == current_video->screen) ||
       (((pSVar2 = current_video->screen->format, pSVar1->BitsPerPixel == pSVar2->BitsPerPixel &&
         (pSVar1->Rmask == pSVar2->Rmask)) && (pSVar1->Amask == pSVar2->Amask)))) {
      src0 = SDL_cursor->save[0];
    }
    else {
      src0 = SDL_cursor->save[1];
    }
    if (uVar5 != 0) {
      uVar4 = 0;
      dst0 = (void *)((int)screen->pixels +
                     (uint)pSVar1->BytesPerPixel * (int)local_60.x +
                     (int)local_60.y * (uint)screen->pitch);
      len0 = (uint)pSVar1->BytesPerPixel * (uint)local_60.w;
      do {
        memcpy(dst0,src0,len0);
        uVar4 = uVar4 + 1;
        src0 = src0 + len0;
        dst0 = (void *)((int)dst0 + (uint)screen->pitch);
      } while (uVar4 != uVar5);
    }
    local_58.s_pixels = SDL_cursor->save[1];
    if (local_58.s_pixels < src0) {
                    /* Unresolved local var: SDL_BlitInfo info@[???]
                       Unresolved local var: SDL_loblit RunBlit@[???] */
      pSVar3 = screen->map;
      local_58.s_width = (int)local_60.w;
      local_58.s_height = (int)local_60.h;
      if (pSVar3->dst == current_video->screen) {
        local_58.d_pixels = SDL_cursor->save[0];
        local_58.src = screen->format;
        local_58.aux_data = pSVar3->sw_data->aux_data;
        local_58.table = pSVar3->table;
        local_58.dst = pSVar3->dst->format;
        local_58.s_skip = 0;
        local_58.d_skip = 0;
        local_58.d_width = local_58.s_width;
        local_58.d_height = local_58.s_height;
        (*pSVar3->sw_data->blit)(&local_58);
      }
    }
  }
  return;
}



----------------------------------------

// Function: SDL_EraseCursor @ 0892a1dc

void SDL_EraseCursor(SDL_Surface *screen)

{
  SDL_VideoDevice *pSVar1;
  uint uVar2;
  int iVar3;
  _func_void_SDL_VideoDevice_ptr_int_SDL_Rect_ptr *p_Var4;
  SDL_Rect SStack_18;
  
  if (screen == (SDL_Surface *)0x0) {
    return;
  }
  if ((screen->offset == 0) && ((screen->flags & 0x4005) == 0)) {
    SDL_EraseCursorNoLock(screen);
    if (screen->offset == 0) {
      uVar2 = screen->flags;
LAB_0892a228:
      if ((uVar2 & 0x4005) == 0) {
        if (screen != current_video->screen) {
          return;
        }
        uVar2 = screen->flags;
        goto LAB_0892a29c;
      }
    }
  }
  else {
    iVar3 = SDL_LockSurface(screen);
    if (iVar3 < 0) {
      return;
    }
    SDL_EraseCursorNoLock(screen);
    if (screen->offset == 0) {
      uVar2 = screen->flags;
      goto LAB_0892a228;
    }
  }
  SDL_UnlockSurface(screen);
  if (screen != current_video->screen) {
    return;
  }
  uVar2 = screen->flags;
LAB_0892a29c:
  pSVar1 = current_video;
  if ((uVar2 & 1) == 0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Rect area@[???] */
    SDL_MouseRect(&SStack_18);
    p_Var4 = pSVar1->UpdateRects;
    if (p_Var4 != (_func_void_SDL_VideoDevice_ptr_int_SDL_Rect_ptr *)0x0) {
      (*p_Var4)(pSVar1,1,&SStack_18);
    }
  }
  return;
}



----------------------------------------

// Function: SDL_DrawCursorNoLock @ 0892a2d0

/* WARNING: Removing unreachable block (ram,0x0892a5dc) */
/* WARNING: Removing unreachable block (ram,0x0892a45c) */
/* WARNING: Removing unreachable block (ram,0x0892a89c) */
/* WARNING: Removing unreachable block (ram,0x0892a9d4) */

void SDL_DrawCursorNoLock(SDL_Surface *screen)

{
  byte bVar1;
  bool bVar2;
  bool bVar3;
  size_t len0;
  uint uVar4;
  SDL_PixelFormat *pSVar5;
  undefined2 *puVar6;
  int *piVar7;
  undefined1 *puVar8;
  uint uVar9;
  undefined2 *puVar10;
  int *piVar11;
  uint uVar12;
  int iVar13;
  undefined1 *puVar14;
  SDL_PixelFormat *format;
  void *pvVar15;
  uint uVar16;
  Uint8 *pUVar17;
  void *m;
  Uint8 UVar18;
  uint uVar19;
  uint uVar20;
  byte *pbVar21;
  byte *pbVar22;
  int iVar23;
  int iVar24;
  SDL_Rect local_60;
  int local_58 [4];
  uint local_48;
  uint local_44;
  uint local_40;
  uint local_3c;
  int local_38;
  int local_34;
  SDL_Surface *local_30;
  
                    /* Unresolved local var: SDL_Rect area@[???] */
  local_30 = screen;
  SDL_MouseRect(&local_60);
  uVar12 = (uint)local_60.w;
  uVar20 = (uint)local_60.h;
  if ((uVar12 != 0) && (uVar20 != 0)) {
                    /* Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int screenbpp@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
    format = local_30->format;
    if ((local_30 == current_video->screen) ||
       (((pSVar5 = current_video->screen->format, format->BitsPerPixel == pSVar5->BitsPerPixel &&
         (format->Rmask == pSVar5->Rmask)) && (format->Amask == pSVar5->Amask)))) {
      pUVar17 = SDL_cursor->save[0];
    }
    else {
      pUVar17 = SDL_cursor->save[1];
    }
    uVar9 = (uint)local_30->pitch;
    if (uVar20 != 0) {
      uVar19 = 0;
      pvVar15 = (void *)((int)local_30->pixels +
                        (uint)format->BytesPerPixel * (int)local_60.x + (int)local_60.y * uVar9);
      len0 = format->BytesPerPixel * uVar12;
      do {
        memcpy(pUVar17,pvVar15,len0);
        uVar19 = uVar19 + 1;
        pUVar17 = pUVar17 + len0;
        uVar9 = (uint)local_30->pitch;
        pvVar15 = (void *)((int)pvVar15 + uVar9);
      } while (uVar19 != uVar20);
      uVar12 = (uint)local_60.w;
      format = local_30->format;
    }
    local_60.x = local_60.x - (SDL_cursor->area).x;
    local_60.y = local_60.y - (SDL_cursor->area).y;
    iVar13 = (int)local_60.y;
    iVar23 = (int)local_60.x;
    if (local_60.x == 0) {
      uVar20 = (uint)(SDL_cursor->area).w;
      if (uVar20 == uVar12) {
                    /* Unresolved local var: Uint32[2] pixels@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: Uint8 * data@[???]
                       Unresolved local var: Uint8 datab@[???]
                       Unresolved local var: Uint8 * mask@[???]
                       Unresolved local var: Uint8 maskb@[???] */
        local_58[1] = DAT_089e12c0;
        local_58[0] = C_37_10351;
        bVar1 = format->BytesPerPixel;
        iVar23 = (int)(iVar13 * uVar12) / 8;
        pUVar17 = SDL_cursor->mask + iVar23;
        pbVar21 = SDL_cursor->data + iVar23;
        if (bVar1 == 2) {
                    /* Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: int dstskip@[???] */
          iVar23 = (uVar9 >> 1) - uVar12;
          if (local_60.h == 0) {
            return;
          }
          uVar20 = 0;
          puVar6 = (undefined2 *)
                   ((int)local_30->pixels +
                   ((int)(SDL_cursor->area).x + (int)((iVar13 + (SDL_cursor->area).y) * uVar9) / 2)
                   * 2);
          do {
            if (uVar12 >> 3 != 0) {
              pbVar22 = pbVar21 + (uVar12 >> 3);
              do {
                UVar18 = *pUVar17;
                uVar12 = (uint)*pbVar21;
                pUVar17 = pUVar17 + 1;
                pbVar21 = pbVar21 + 1;
                iVar13 = 0;
                puVar10 = puVar6;
                do {
                  while( true ) {
                    uVar9 = uVar12 >> 7;
                    uVar12 = (uVar12 & 0x7f) << 1;
                    iVar13 = iVar13 + 1;
                    bVar2 = -1 < (char)UVar18;
                    UVar18 = UVar18 << 1;
                    if (bVar2) break;
                    *puVar10 = (short)local_58[uVar9];
                    puVar10 = puVar10 + 1;
                    if (iVar13 == 8) goto LAB_0892a920;
                  }
                  puVar10 = puVar10 + 1;
                } while (iVar13 != 8);
LAB_0892a920:
                puVar6 = puVar6 + 8;
              } while (pbVar22 != pbVar21);
            }
            uVar20 = uVar20 + 1;
            uVar12 = (uint)local_60.w;
            if (uVar20 == local_60.h) {
              return;
            }
            puVar6 = puVar6 + iVar23;
          } while( true );
        }
        if (2 < bVar1) {
          if (bVar1 == 3) {
                    /* Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int dstskip@[???] */
            local_58[3] = (uint)local_60.h;
            local_34 = uVar9 + uVar12 * -3;
            if (local_60.h == 0) {
              return;
            }
            local_48 = 0;
            pvVar15 = (void *)((int)local_30->pixels +
                              (SDL_cursor->area).x * 3 + (iVar13 + (SDL_cursor->area).y) * uVar9);
            local_60.x = 0;
            while( true ) {
              if (uVar12 >> 3 != 0) {
                pbVar22 = pbVar21 + (uVar12 >> 3);
                do {
                  UVar18 = *pUVar17;
                  uVar12 = (uint)*pbVar21;
                  pUVar17 = pUVar17 + 1;
                  pbVar21 = pbVar21 + 1;
                  iVar13 = 0;
                  m = pvVar15;
                  while( true ) {
                    iVar13 = iVar13 + 1;
                    if ((char)UVar18 < '\0') {
                      memset(m,local_58[uVar12 >> 7],3);
                    }
                    m = (void *)((int)m + 3);
                    if (iVar13 == 8) break;
                    UVar18 = UVar18 << 1;
                    uVar12 = (uVar12 & 0x7f) << 1;
                  }
                  pvVar15 = (void *)((int)pvVar15 + 0x18);
                } while (pbVar22 != pbVar21);
              }
              local_48 = local_48 + 1;
              if (local_48 == local_58[3]) break;
              uVar12 = (uint)local_60.w;
              pvVar15 = (void *)((int)pvVar15 + local_34);
            }
            return;
          }
          if (bVar1 != 4) {
            return;
          }
                    /* Unresolved local var: Uint32 * dst@[???]
                       Unresolved local var: int dstskip@[???] */
          if (local_60.h == 0) {
            return;
          }
          uVar20 = 0;
          piVar7 = (int *)((int)local_30->pixels +
                          ((int)(SDL_cursor->area).x +
                          (int)((iVar13 + (SDL_cursor->area).y) * uVar9) / 4) * 4);
          do {
            if (uVar12 >> 3 != 0) {
              pbVar22 = pbVar21 + (uVar12 >> 3);
              do {
                UVar18 = *pUVar17;
                uVar19 = (uint)*pbVar21;
                pUVar17 = pUVar17 + 1;
                pbVar21 = pbVar21 + 1;
                iVar13 = 0;
                piVar11 = piVar7;
                do {
                  while( true ) {
                    uVar16 = uVar19 >> 7;
                    uVar19 = (uVar19 & 0x7f) << 1;
                    iVar13 = iVar13 + 1;
                    bVar2 = -1 < (char)UVar18;
                    UVar18 = UVar18 << 1;
                    if (bVar2) break;
                    *piVar11 = local_58[uVar16];
                    piVar11 = piVar11 + 1;
                    if (iVar13 == 8) goto LAB_0892aa54;
                  }
                  piVar11 = piVar11 + 1;
                } while (iVar13 != 8);
LAB_0892aa54:
                piVar7 = piVar7 + 8;
              } while (pbVar21 != pbVar22);
            }
            uVar20 = uVar20 + 1;
            piVar7 = piVar7 + ((uVar9 >> 2) - uVar12);
            if (uVar20 == local_60.h) {
              return;
            }
          } while( true );
        }
        if (bVar1 != 1) {
          return;
        }
                    /* Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int dstskip@[???] */
        if (palette_changed != 0) {
          pixels8[0] = SDL_MapRGB(format,0xff,0xff,0xff);
          pixels8[1] = SDL_MapRGB(local_30->format,'\0','\0','\0');
          uVar12 = (uint)local_60.w;
          uVar9 = (uint)local_30->pitch;
          palette_changed = 0;
        }
        iVar13 = uVar9 - uVar12;
        if (local_60.h == 0) {
          return;
        }
        uVar20 = 0;
        puVar14 = (undefined1 *)
                  ((int)local_30->pixels +
                  (int)(SDL_cursor->area).x + ((int)(SDL_cursor->area).y + (int)local_60.y) * uVar9)
        ;
        do {
          if (uVar12 >> 3 != 0) {
            pbVar22 = pbVar21 + (uVar12 >> 3);
            do {
              UVar18 = *pUVar17;
              uVar12 = (uint)*pbVar21;
              pUVar17 = pUVar17 + 1;
              pbVar21 = pbVar21 + 1;
              iVar23 = 0;
              puVar8 = puVar14;
              do {
                while( true ) {
                  uVar9 = uVar12 >> 7;
                  uVar12 = (uVar12 & 0x7f) << 1;
                  iVar23 = iVar23 + 1;
                  bVar2 = -1 < (char)UVar18;
                  UVar18 = UVar18 << 1;
                  if (bVar2) break;
                  *puVar8 = (char)pixels8[uVar9];
                  puVar8 = puVar8 + 1;
                  if (iVar23 == 8) goto LAB_0892a724;
                }
                puVar8 = puVar8 + 1;
              } while (iVar23 != 8);
LAB_0892a724:
              puVar14 = puVar14 + 8;
            } while (pbVar21 != pbVar22);
          }
          uVar20 = uVar20 + 1;
          uVar12 = (uint)local_60.w;
          if (uVar20 == local_60.h) {
            return;
          }
          puVar14 = puVar14 + iVar13;
        } while( true );
      }
    }
    else {
      uVar20 = (uint)(SDL_cursor->area).w;
    }
                    /* Unresolved local var: Uint32[2] pixels@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int x@[???]
                       Unresolved local var: int minx@[???]
                       Unresolved local var: int maxx@[???]
                       Unresolved local var: Uint8 * data@[???]
                       Unresolved local var: Uint8 datab@[???]
                       Unresolved local var: Uint8 * mask@[???]
                       Unresolved local var: Uint8 maskb@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: int dstskip@[???] */
    local_58[1] = DAT_089e12c8;
    local_58[0] = C_47_10458;
    uVar19 = (uint)format->BytesPerPixel;
    iVar24 = (int)(iVar13 * uVar20) / 8;
    pbVar22 = SDL_cursor->mask + iVar24;
    pbVar21 = SDL_cursor->data + iVar24;
    pvVar15 = (void *)(uVar19 * (int)(SDL_cursor->area).x + (iVar13 + (SDL_cursor->area).y) * uVar9
                      + (int)local_30->pixels);
    local_38 = uVar9 - uVar20 * uVar19;
    if (uVar19 == 1) {
      if (palette_changed != 0) {
        pixels8[0] = SDL_MapRGB(format,0xff,0xff,0xff);
        pixels8[1] = SDL_MapRGB(local_30->format,'\0','\0','\0');
        palette_changed = 0;
      }
      local_58[2] = (int)local_60.h;
      if (local_58[2] != 0) {
        uVar9 = 0;
        uVar20 = 0;
        local_40 = 0;
        while( true ) {
          if ((SDL_cursor->area).w != 0) {
            uVar19 = 0;
            do {
              uVar16 = uVar19 & 7;
              bVar2 = iVar23 <= (int)uVar19;
              bVar3 = (int)uVar19 < (int)(iVar23 + uVar12);
              uVar19 = uVar19 + 1;
              if (uVar16 == 0) {
                uVar20 = (uint)*pbVar22;
                uVar9 = (uint)*pbVar21;
                pbVar22 = pbVar22 + 1;
                pbVar21 = pbVar21 + 1;
              }
              if (((bVar2) && (bVar3)) && ((char)uVar20 < '\0')) {
                memset(pvVar15,pixels8[uVar9 >> 7],1);
              }
              uVar20 = (uVar20 & 0x7f) << 1;
              pvVar15 = (void *)((int)pvVar15 + 1);
              uVar9 = (uVar9 & 0x7f) << 1;
            } while ((int)uVar19 < (int)(uint)(SDL_cursor->area).w);
          }
          local_40 = local_40 + 1;
          if (local_58[2] == local_40) break;
          pvVar15 = (void *)((int)pvVar15 + local_38);
        }
      }
    }
    else {
      local_3c = (uint)local_60.h;
      if (local_60.h != 0) {
        uVar9 = 0;
        uVar20 = 0;
        local_44 = 0;
        while( true ) {
          if ((SDL_cursor->area).w != 0) {
            uVar16 = 0;
            do {
              uVar4 = uVar16 & 7;
              bVar2 = iVar23 <= (int)uVar16;
              bVar3 = (int)uVar16 < (int)(iVar23 + uVar12);
              uVar16 = uVar16 + 1;
              if (uVar4 == 0) {
                uVar20 = (uint)*pbVar22;
                uVar9 = (uint)*pbVar21;
                pbVar22 = pbVar22 + 1;
                pbVar21 = pbVar21 + 1;
              }
              if (((bVar2) && (bVar3)) && ((char)uVar20 < '\0')) {
                memset(pvVar15,local_58[uVar9 >> 7],uVar19);
              }
              uVar20 = (uVar20 & 0x7f) << 1;
              pvVar15 = (void *)((int)pvVar15 + uVar19);
              uVar9 = (uVar9 & 0x7f) << 1;
            } while ((int)uVar16 < (int)(uint)(SDL_cursor->area).w);
          }
          local_44 = local_44 + 1;
          if (local_44 == local_3c) break;
          pvVar15 = (void *)((int)pvVar15 + local_38);
        }
      }
    }
  }
  return;
}



----------------------------------------

// Function: SDL_DrawCursor @ 0892ab70

void SDL_DrawCursor(SDL_Surface *screen)

{
  SDL_VideoDevice *pSVar1;
  uint uVar2;
  int iVar3;
  _func_void_SDL_VideoDevice_ptr_int_SDL_Rect_ptr *p_Var4;
  SDL_Rect SStack_18;
  
  if (screen == (SDL_Surface *)0x0) {
    return;
  }
  if ((screen->offset == 0) && ((screen->flags & 0x4005) == 0)) {
    SDL_DrawCursorNoLock(screen);
    if (screen->offset == 0) {
      uVar2 = screen->flags;
LAB_0892abbc:
      if ((uVar2 & 0x4005) == 0) {
        if (screen != current_video->screen) {
          return;
        }
        uVar2 = screen->flags;
        goto LAB_0892ac30;
      }
    }
  }
  else {
    iVar3 = SDL_LockSurface(screen);
    if (iVar3 < 0) {
      return;
    }
    SDL_DrawCursorNoLock(screen);
    if (screen->offset == 0) {
      uVar2 = screen->flags;
      goto LAB_0892abbc;
    }
  }
  SDL_UnlockSurface(screen);
  if (screen != current_video->screen) {
    return;
  }
  uVar2 = screen->flags;
LAB_0892ac30:
  pSVar1 = current_video;
  if ((uVar2 & 1) == 0) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???]
                       Unresolved local var: SDL_Rect area@[???] */
    SDL_MouseRect(&SStack_18);
    p_Var4 = pSVar1->UpdateRects;
    if (p_Var4 != (_func_void_SDL_VideoDevice_ptr_int_SDL_Rect_ptr *)0x0) {
      (*p_Var4)(pSVar1,1,&SStack_18);
    }
  }
  return;
}



----------------------------------------

// Function: SDL_MoveCursor @ 0892ac64

void SDL_MoveCursor(int x,int y)

{
  short sVar1;
  SDL_Cursor *pSVar2;
  SDL_Surface *screen;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???] */
  if ((SDL_cursorstate & 0x11U) == 0x11) {
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexP(SDL_cursorlock);
    }
    SDL_EraseCursor(current_video->screen);
    pSVar2 = SDL_cursor;
    sVar1 = SDL_cursor->hot_x;
    screen = current_video->screen;
    (SDL_cursor->area).y = (short)y - SDL_cursor->hot_y;
    (pSVar2->area).x = (short)x - sVar1;
    SDL_DrawCursor(screen);
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexV(SDL_cursorlock);
      return;
    }
  }
  else if (current_video->MoveWMCursor != (_func_void_SDL_VideoDevice_ptr_int_int *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0892accc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_video->MoveWMCursor)(current_video,x,y);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_WarpMouse @ 0892ad64

void SDL_WarpMouse(Uint16 x,Uint16 y)

{
  Uint16 x_00;
  Uint16 y_00;
  SDL_Surface *pSVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  if ((current_video == (SDL_VideoDevice *)0x0) || (current_video->visible == (SDL_Surface *)0x0)) {
    SDL_SetError("A video mode must be set before warping mouse");
    return;
  }
  pSVar1 = current_video->screen;
  uVar3 = (uint)pSVar1->pitch;
  if (uVar3 == 0) {
    trap(7);
  }
  uVar2 = (uint)pSVar1->format->BytesPerPixel;
  y_00 = y + (short)(pSVar1->offset / (int)uVar3);
  if (uVar2 == 0) {
    trap(7);
  }
  x_00 = x + (short)((pSVar1->offset % (int)uVar3) / (int)uVar2);
  if (current_video->WarpWMCursor != (_func_void_SDL_VideoDevice_ptr_Uint16_Uint16 *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0892ade8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*current_video->WarpWMCursor)(current_video,x_00,y_00);
    return;
  }
  SDL_PrivateMouseMotion('\0',0,x_00,y_00);
  return;
}



----------------------------------------

// Function: SDL_SetCursor @ 0892ae04

void SDL_SetCursor(SDL_Cursor *cursor)

{
  short sVar1;
  SDL_VideoDevice *pSVar2;
  SDL_Cursor *pSVar3;
  int iVar4;
  SDL_Surface *screen;
  short local_28 [2];
  short local_24 [2];
  
  pSVar2 = current_video;
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
  if (current_video == (SDL_VideoDevice *)0x0) {
    return;
  }
  if (SDL_cursorlock != (SDL_mutex *)0x0) {
    SDL_mutexP(SDL_cursorlock);
  }
  if ((cursor == (SDL_Cursor *)0x0) || (cursor == SDL_cursor)) {
    pSVar3 = SDL_cursor;
    if (SDL_cursor != (SDL_Cursor *)0x0) goto LAB_0892ae9c;
  }
  else {
    if ((SDL_cursorstate & 0x11U) == 0x11) {
      SDL_EraseCursor(current_video->screen);
      pSVar3 = cursor;
    }
    else {
      pSVar3 = cursor;
      if ((pSVar2->MoveWMCursor != (_func_void_SDL_VideoDevice_ptr_int_int *)0x0) &&
         (pSVar3 = cursor, SDL_cursor != (SDL_Cursor *)0x0)) {
        (*pSVar2->ShowWMCursor)(pSVar2,(WMcursor *)0x0);
        pSVar3 = cursor;
      }
    }
LAB_0892ae9c:
    SDL_cursor = pSVar3;
    if ((SDL_cursorstate & 1U) != 0) {
      if ((SDL_cursor->wm_cursor == (WMcursor *)0x0) ||
         (iVar4 = (*pSVar2->ShowWMCursor)(pSVar2,SDL_cursor->wm_cursor), iVar4 == 0)) {
        SDL_cursorstate = SDL_cursorstate | 0x10;
        if (pSVar2->ShowWMCursor != (_func_int_SDL_VideoDevice_ptr_WMcursor_ptr *)0x0) {
          (*pSVar2->ShowWMCursor)(pSVar2,(WMcursor *)0x0);
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???] */
        }
        SDL_GetMouseState((int *)local_28,(int *)local_24);
        pSVar3 = SDL_cursor;
        sVar1 = SDL_cursor->hot_y;
        screen = current_video->screen;
        (SDL_cursor->area).x = local_28[0] - SDL_cursor->hot_x;
        (pSVar3->area).y = local_24[0] - sVar1;
        SDL_DrawCursor(screen);
      }
      else {
        SDL_cursorstate = SDL_cursorstate & 0xffffffef;
      }
      goto LAB_0892aed0;
    }
    if ((SDL_cursorstate & 0x10U) != 0) {
      SDL_EraseCursor(current_video->screen);
      goto LAB_0892aed0;
    }
  }
  (*pSVar2->ShowWMCursor)(pSVar2,(WMcursor *)0x0);
LAB_0892aed0:
  if (SDL_cursorlock != (SDL_mutex *)0x0) {
    SDL_mutexV(SDL_cursorlock);
  }
  return;
}



----------------------------------------

// Function: SDL_ShowCursor @ 0892afdc

int SDL_ShowCursor(int toggle)

{
  SDL_VideoDevice *pSVar1;
  uint uVar2;
  
                    /* Unresolved local var: int showing@[???] */
  uVar2 = SDL_cursorstate & 1;
  if (-1 < toggle) {
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexP(SDL_cursorlock);
    }
    if (toggle == 0) {
      SDL_cursorstate = SDL_cursorstate & 0xfffffffe;
    }
    else {
      SDL_cursorstate = SDL_cursorstate | 1;
    }
    if (SDL_cursorlock != (SDL_mutex *)0x0) {
      SDL_mutexV(SDL_cursorlock);
    }
    pSVar1 = current_video;
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
    if (((uVar2 != (SDL_cursorstate & 1U)) &&
        (SDL_SetCursor((SDL_Cursor *)0x0), pSVar1 != (SDL_VideoDevice *)0x0)) &&
       (pSVar1->CheckMouseMode != (_func_void_SDL_VideoDevice_ptr *)0x0)) {
      (*pSVar1->CheckMouseMode)(pSVar1);
    }
  }
  return uVar2;
}



----------------------------------------

// Function: SDL_FreeCursor @ 0892b0b8

void SDL_FreeCursor(SDL_Cursor *cursor)

{
  SDL_VideoDevice *pSVar1;
  
  if (cursor != (SDL_Cursor *)0x0) {
    if (cursor == SDL_cursor) {
      SDL_SetCursor(SDL_defcursor);
    }
    pSVar1 = current_video;
    if (cursor != SDL_defcursor) {
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: SDL_VideoDevice * this@[???] */
      if (cursor->data != (Uint8 *)0x0) {
        free(cursor->data);
      }
      if (cursor->save[0] != (Uint8 *)0x0) {
        free(cursor->save[0]);
      }
      if ((pSVar1 != (SDL_VideoDevice *)0x0) && (cursor->wm_cursor != (WMcursor *)0x0)) {
        (*pSVar1->FreeWMCursor)(pSVar1,cursor->wm_cursor);
      }
      free(cursor);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_CreateCursor @ 0892b170

SDL_Cursor * SDL_CreateCursor(Uint8 *data,Uint8 *mask,int w,int h,int hot_x,int hot_y)

{
  byte *pbVar1;
  int iVar2;
  SDL_VideoDevice *pSVar3;
  SDL_Cursor *cursor;
  Uint8 *pUVar4;
  size_t nbytes;
  int iVar5;
  byte *pbVar6;
  _func_WMcursor_ptr_SDL_VideoDevice_ptr_Uint8_ptr_Uint8_ptr_int_int_int_int *p_Var7;
  WMcursor *pWVar8;
  Uint8 *pUVar9;
  int in_t0;
  Uint8 *pUVar10;
  int in_t1;
  int iVar11;
  int unaff_s0;
  int unaff_s1;
  int unaff_s2;
  uint uVar12;
  
                    /* Unresolved local var: SDL_VideoDevice * video@[???]
                       Unresolved local var: int savelen@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: SDL_Cursor * cursor@[???] */
  pSVar3 = current_video;
  if ((-1 < in_t0) && (-1 < in_t1)) {
    uVar12 = w + 7U & 0xfffffff8;
    if ((in_t0 < (int)uVar12) && (in_t1 < h)) {
      cursor = malloc(0x20);
      if (cursor != (SDL_Cursor *)0x0) {
        iVar2 = h * ((int)(w + 7U) >> 3);
        (cursor->area).x = 0;
        (cursor->area).y = 0;
        (cursor->area).w = (Uint16)uVar12;
        (cursor->area).h = (Uint16)h;
        cursor->hot_x = (Sint16)in_t0;
        cursor->hot_y = (Sint16)in_t1;
        iVar5 = uVar12 * h * 4;
        pUVar4 = malloc(iVar2 * 2);
        cursor->mask = pUVar4 + iVar2;
        nbytes = iVar5 * 2;
        cursor->data = pUVar4;
        pUVar4 = malloc(nbytes);
        pUVar9 = cursor->data;
        cursor->save[1] = pUVar4 + iVar5;
        cursor->save[0] = pUVar4;
        cursor->wm_cursor = (WMcursor *)0x0;
        if ((pUVar9 != (Uint8 *)0x0) && (iVar5 = iVar2 + -1, pUVar4 != (Uint8 *)0x0)) {
          if (-1 < iVar5) {
            iVar11 = iVar2 - iVar5;
            pUVar4 = data + iVar2;
            pUVar10 = mask + iVar2;
            while( true ) {
              pUVar9[iVar5] = pUVar4[-1];
              pbVar1 = pUVar4 + -1;
              pUVar4 = pUVar4 + -1;
              pbVar6 = cursor->mask + iVar5;
              iVar5 = iVar5 + -1;
              *pbVar6 = pUVar10[-1] | *pbVar1;
              pUVar10 = pUVar10 + -1;
              if (iVar5 == iVar11 + -2) break;
              pUVar9 = cursor->data;
            }
          }
          memset(cursor->save[0],0,nbytes);
          p_Var7 = pSVar3->CreateWMCursor;
          if (p_Var7 != (_func_WMcursor_ptr_SDL_VideoDevice_ptr_Uint8_ptr_Uint8_ptr_int_int_int_int
                         *)0x0) {
            pWVar8 = (*p_Var7)(pSVar3,data,mask,uVar12,unaff_s0,unaff_s1,unaff_s2);
            cursor->wm_cursor = pWVar8;
            return cursor;
          }
          cursor->wm_cursor = (WMcursor *)0x0;
          return cursor;
        }
        SDL_FreeCursor(cursor);
      }
      SDL_Error(SDL_ENOMEM);
      return (SDL_Cursor *)0x0;
    }
  }
  SDL_SetError("Cursor hot spot doesn\'t lie within cursor");
  return (SDL_Cursor *)0x0;
}



----------------------------------------

// Function: SDL_CursorInit @ 0892b36c

int SDL_CursorInit(Uint32 multithreaded)

{
  int in_stack_00000000;
  int in_stack_00000004;
  
  SDL_cursorstate = 1;
  if (SDL_defcursor == (SDL_Cursor *)0x0) {
    SDL_defcursor =
         SDL_CreateCursor(default_cdata,default_cmask,0x10,0x10,in_stack_00000000,in_stack_00000004)
    ;
    SDL_SetCursor(SDL_defcursor);
  }
  if (multithreaded != 0) {
    SDL_cursorlock = SDL_CreateMutex();
  }
  return 0;
}



----------------------------------------

// Function: SDL_CursorQuit @ 0892b404

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_CursorQuit(void)

{
  SDL_Cursor *cursor;
  
                    /* Unresolved local var: SDL_Cursor * cursor@[???] */
  if (SDL_cursor != (SDL_Cursor *)0x0) {
    SDL_cursorstate = SDL_cursorstate & 0xfffffffe;
    if (SDL_cursor != SDL_defcursor) {
      SDL_FreeCursor(SDL_cursor);
    }
    cursor = SDL_defcursor;
    SDL_cursor = (SDL_Cursor *)0x0;
    if (SDL_defcursor != (SDL_Cursor *)0x0) {
      SDL_defcursor = (SDL_Cursor *)0x0;
      SDL_FreeCursor(cursor);
    }
  }
  if (SDL_cursorlock != (SDL_mutex *)0x0) {
    SDL_DestroyMutex(SDL_cursorlock);
    SDL_cursorlock = (SDL_mutex *)0x0;
  }
  return;
}



----------------------------------------

// Function: BlitBto1 @ 0892b4a0

/* WARNING: Removing unreachable block (ram,0x0892b4b8) */

void BlitBto1(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  byte *pbVar6;
  byte *pbVar7;
  int iVar8;
  Uint8 *pUVar9;
  int iVar10;
  int iVar11;
  
                    /* Unresolved local var: int c@[???]
                       Unresolved local var: int width@[DW_OP_reg11(t3)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint8 * map@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)] */
  iVar8 = info->d_width;
  pUVar9 = info->table;
  iVar3 = info->d_height;
  pbVar7 = info->s_pixels;
  pbVar6 = info->d_pixels;
  iVar11 = info->d_skip;
  iVar4 = info->s_skip + (iVar8 - (iVar8 + 7) / 8);
  if (pUVar9 == (Uint8 *)0x0) {
    if (iVar3 != 0) {
      iVar10 = 0;
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
      while (iVar8 < 1) {
LAB_0892b5e4:
        pbVar7 = pbVar7 + iVar4;
        if (iVar3 + -1 == iVar10) {
          return;
        }
        pbVar6 = pbVar6 + iVar11;
        iVar10 = iVar10 + 1;
      }
      uVar5 = 0;
      do {
        bVar1 = *pbVar7;
        *pbVar6 = bVar1 >> 7;
        pbVar7 = pbVar7 + 1;
        uVar2 = (uint)bVar1;
        while( true ) {
          uVar5 = uVar5 + 1;
          pbVar6 = pbVar6 + 1;
          if (iVar8 <= (int)uVar5) goto LAB_0892b5e4;
          if ((uVar5 & 7) == 0) break;
          *pbVar6 = (byte)((uVar2 & 0x7f) >> 6);
          uVar2 = (uVar2 & 0x7f) << 1;
        }
      } while( true );
    }
  }
  else if (iVar3 != 0) {
    iVar10 = 0;
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
    while (iVar8 < 1) {
LAB_0892b55c:
      pbVar7 = pbVar7 + iVar4;
      if (iVar3 + -1 == iVar10) {
        return;
      }
      pbVar6 = pbVar6 + iVar11;
      iVar10 = iVar10 + 1;
    }
    uVar5 = 0;
    do {
      bVar1 = *pbVar7;
      pbVar7 = pbVar7 + 1;
      *pbVar6 = pUVar9[bVar1 >> 7];
      uVar2 = (uint)bVar1;
      while( true ) {
        uVar5 = uVar5 + 1;
        pbVar6 = pbVar6 + 1;
        if (iVar8 <= (int)uVar5) goto LAB_0892b55c;
        if ((uVar5 & 7) == 0) break;
        *pbVar6 = pUVar9[(uVar2 & 0x7f) >> 6];
        uVar2 = (uVar2 & 0x7f) << 1;
      }
    } while( true );
  }
  return;
}



----------------------------------------

// Function: BlitBto2 @ 0892b5f8

/* WARNING: Removing unreachable block (ram,0x0892b610) */
/* WARNING: Removing unreachable block (ram,0x0892b640) */

void BlitBto2(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  Uint8 *pUVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  byte *pbVar8;
  int iVar9;
  Uint8 *pUVar10;
  int iVar11;
  
                    /* Unresolved local var: int c@[DW_OP_reg8(t0)]
                       Unresolved local var: int width@[DW_OP_reg12(t4)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg11(t3)]
                       Unresolved local var: Uint16 * map@[DW_OP_reg13(t5)]
                       Unresolved local var: Uint16 * dst@[DW_OP_reg10(t2)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar9 = info->d_width;
  iVar5 = info->d_height;
  iVar6 = info->s_skip;
  iVar4 = info->d_skip;
  pUVar10 = info->table;
  pbVar8 = info->s_pixels;
  pUVar3 = info->d_pixels;
  if (iVar5 == 0) {
    return;
  }
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 bit@[???] */
  iVar11 = 0;
  while (iVar9 < 1) {
LAB_0892b6d4:
    pbVar8 = pbVar8 + iVar6 + (iVar9 - (iVar9 + 7) / 8);
    if (iVar5 + -1 == iVar11) {
      return;
    }
    pUVar3 = pUVar3 + (iVar4 / 2) * 2;
    iVar11 = iVar11 + 1;
  }
  uVar7 = 0;
  do {
    bVar1 = *pbVar8;
    pbVar8 = pbVar8 + 1;
    *(undefined2 *)pUVar3 = *(undefined2 *)(pUVar10 + (uint)(bVar1 >> 7) * 2);
    uVar2 = (uint)bVar1;
    while( true ) {
      uVar7 = uVar7 + 1;
      pUVar3 = pUVar3 + 2;
      if (iVar9 <= (int)uVar7) goto LAB_0892b6d4;
      if ((uVar7 & 7) == 0) break;
      *(undefined2 *)pUVar3 = *(undefined2 *)(pUVar10 + ((uVar2 & 0x7f) >> 6) * 2);
      uVar2 = (uVar2 & 0x7f) << 1;
    }
  } while( true );
}



----------------------------------------

// Function: BlitBto3 @ 0892b6f0

/* WARNING: Removing unreachable block (ram,0x0892b708) */

void BlitBto3(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  Uint8 *pUVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  Uint8 *pUVar7;
  uint uVar8;
  byte *pbVar9;
  Uint8 *pUVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  
                    /* Unresolved local var: int c@[DW_OP_reg8(t0)]
                       Unresolved local var: int o@[???]
                       Unresolved local var: int width@[DW_OP_reg12(t4)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint8 * map@[DW_OP_reg11(t3)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg7(a3)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)] */
  iVar11 = info->d_width;
  iVar5 = info->d_height;
  iVar4 = info->s_skip;
  pUVar10 = info->table;
  pbVar9 = info->s_pixels;
  pUVar7 = info->d_pixels;
  iVar13 = info->d_skip;
  if (iVar5 == 0) {
    return;
  }
  iVar12 = 0;
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 bit@[???] */
  while (uVar8 = 0, iVar11 < 1) {
LAB_0892b7a0:
    pbVar9 = pbVar9 + iVar4 + (iVar11 - (iVar11 + 7) / 8);
    if (iVar5 + -1 == iVar12) {
      return;
    }
    pUVar7 = pUVar7 + iVar13;
    iVar12 = iVar12 + 1;
  }
  bVar1 = *pbVar9;
  do {
    pbVar9 = pbVar9 + 1;
    uVar2 = (uint)(bVar1 >> 7);
    uVar6 = (uint)bVar1;
    do {
      pUVar3 = pUVar10 + uVar2 * 4 + 1;
      *pUVar7 = pUVar10[uVar2 * 4];
      uVar8 = uVar8 + 1;
      pUVar7[1] = *pUVar3;
      pUVar7[2] = pUVar3[1];
      pUVar7 = pUVar7 + 3;
      if (iVar11 <= (int)uVar8) goto LAB_0892b7a0;
      uVar2 = (uVar6 & 0x7f) >> 6;
      uVar6 = (uVar6 & 0x7f) << 1;
    } while ((uVar8 & 7) != 0);
    bVar1 = *pbVar9;
  } while( true );
}



----------------------------------------

// Function: BlitBto4 @ 0892b7bc

/* WARNING: Removing unreachable block (ram,0x0892b7d4) */
/* WARNING: Removing unreachable block (ram,0x0892b804) */

void BlitBto4(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  Uint8 *pUVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  byte *pbVar8;
  int iVar9;
  Uint8 *pUVar10;
  int iVar11;
  
                    /* Unresolved local var: int width@[DW_OP_reg12(t4)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg11(t3)]
                       Unresolved local var: Uint32 * map@[DW_OP_reg13(t5)]
                       Unresolved local var: Uint32 * dst@[DW_OP_reg10(t2)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: int c@[DW_OP_reg8(t0)] */
  iVar9 = info->d_width;
  iVar5 = info->d_height;
  iVar6 = info->s_skip;
  iVar4 = info->d_skip;
  pUVar10 = info->table;
  pbVar8 = info->s_pixels;
  pUVar3 = info->d_pixels;
  if (iVar5 == 0) {
    return;
  }
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 bit@[???] */
  iVar11 = 0;
  while (iVar9 < 1) {
LAB_0892b898:
    pbVar8 = pbVar8 + iVar6 + (iVar9 - (iVar9 + 7) / 8);
    if (iVar5 + -1 == iVar11) {
      return;
    }
    pUVar3 = pUVar3 + (iVar4 / 4) * 4;
    iVar11 = iVar11 + 1;
  }
  uVar7 = 0;
  do {
    bVar1 = *pbVar8;
    pbVar8 = pbVar8 + 1;
    *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)(bVar1 >> 7) * 4);
    uVar2 = (uint)bVar1;
    while( true ) {
      uVar7 = uVar7 + 1;
      pUVar3 = pUVar3 + 4;
      if (iVar9 <= (int)uVar7) goto LAB_0892b898;
      if ((uVar7 & 7) == 0) break;
      *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + ((uVar2 & 0x7f) >> 6) * 4);
      uVar2 = (uVar2 & 0x7f) << 1;
    }
  } while( true );
}



----------------------------------------

// Function: BlitBto1Key @ 0892b8b4

/* WARNING: Removing unreachable block (ram,0x0892b8cc) */

void BlitBto1Key(SDL_BlitInfo *info)

{
  uint uVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  Uint8 *pUVar6;
  byte *pbVar7;
  uint uVar8;
  Uint8 *pUVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[DW_OP_reg10(t2)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg9(t1)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg8(t0)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg12(t4)]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: int c@[???] */
  uVar8 = info->d_width;
  pUVar9 = info->table;
  iVar4 = info->d_height;
  pbVar7 = info->s_pixels;
  uVar10 = info->src->colorkey;
  pUVar6 = info->d_pixels;
  iVar12 = info->d_skip;
  iVar3 = info->s_skip + (uVar8 - (int)(uVar8 + 7) / 8);
  if (pUVar9 == (Uint8 *)0x0) {
    if (iVar4 != 0) {
      iVar11 = 0;
      while( true ) {
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
        if (0 < (int)uVar8) {
          uVar5 = 0;
          uVar2 = 0;
          do {
            uVar1 = uVar5 & 7;
            uVar5 = uVar5 + 1;
            if (uVar1 == 0) {
              uVar2 = (uint)*pbVar7;
              pbVar7 = pbVar7 + 1;
            }
            uVar1 = uVar2 >> 7;
            uVar2 = (uVar2 & 0x7f) << 1;
            if (uVar10 != uVar1) {
              *pUVar6 = (Uint8)uVar1;
            }
            pUVar6 = pUVar6 + 1;
          } while (uVar8 != uVar5);
        }
        pbVar7 = pbVar7 + iVar3;
        if (iVar4 + -1 == iVar11) break;
        pUVar6 = pUVar6 + iVar12;
        iVar11 = iVar11 + 1;
      }
    }
  }
  else if (iVar4 != 0) {
    iVar11 = 0;
    while( true ) {
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
      if (0 < (int)uVar8) {
        uVar5 = 0;
        uVar2 = 0;
        do {
          uVar1 = uVar5 & 7;
          uVar5 = uVar5 + 1;
          if (uVar1 == 0) {
            uVar2 = (uint)*pbVar7;
            pbVar7 = pbVar7 + 1;
          }
          uVar1 = uVar2 >> 7;
          uVar2 = (uVar2 & 0x7f) << 1;
          if (uVar10 != uVar1) {
            *pUVar6 = pUVar9[uVar1];
          }
          pUVar6 = pUVar6 + 1;
        } while (uVar8 != uVar5);
      }
      pbVar7 = pbVar7 + iVar3;
      if (iVar11 == iVar4 + -1) break;
      pUVar6 = pUVar6 + iVar12;
      iVar11 = iVar11 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitBto2Key @ 0892b9cc

/* WARNING: Removing unreachable block (ram,0x0892b9e4) */
/* WARNING: Removing unreachable block (ram,0x0892ba1c) */

void BlitBto2Key(SDL_BlitInfo *info)

{
  uint uVar1;
  Uint8 *pUVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  byte *pbVar8;
  uint uVar9;
  uint uVar10;
  Uint8 *pUVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[DW_OP_reg11(t3)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg12(t4)]
                       Unresolved local var: Uint8 * palmap@[DW_OP_reg13(t5)]
                       Unresolved local var: int c@[DW_OP_reg7(a3)] */
  uVar9 = info->d_width;
  iVar5 = info->d_height;
  iVar7 = info->s_skip;
  iVar4 = info->d_skip;
  uVar10 = info->src->colorkey;
  pUVar11 = info->table;
  pbVar8 = info->s_pixels;
  pUVar2 = info->d_pixels;
  if (iVar5 != 0) {
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg5(a1)]
                       Unresolved local var: Uint8 bit@[???] */
    iVar12 = 0;
    while( true ) {
      if (0 < (int)uVar9) {
        uVar6 = 0;
        uVar3 = 0;
        do {
          uVar1 = uVar6 & 7;
          uVar6 = uVar6 + 1;
          if (uVar1 == 0) {
            uVar3 = (uint)*pbVar8;
            pbVar8 = pbVar8 + 1;
          }
          uVar1 = uVar3 >> 7;
          uVar3 = (uVar3 & 0x7f) << 1;
          if (uVar10 != uVar1) {
            *(undefined2 *)pUVar2 = *(undefined2 *)(pUVar11 + uVar1 * 2);
          }
          pUVar2 = pUVar2 + 2;
        } while (uVar9 != uVar6);
      }
      pbVar8 = pbVar8 + iVar7 + (uVar9 - (int)(uVar9 + 7) / 8);
      if (iVar5 + -1 == iVar12) break;
      pUVar2 = pUVar2 + (iVar4 / 2) * 2;
      iVar12 = iVar12 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitBto4Key @ 0892baa0

/* WARNING: Removing unreachable block (ram,0x0892bab8) */
/* WARNING: Removing unreachable block (ram,0x0892baf0) */

void BlitBto4Key(SDL_BlitInfo *info)

{
  uint uVar1;
  Uint8 *pUVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  byte *pbVar8;
  uint uVar9;
  uint uVar10;
  Uint8 *pUVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[DW_OP_reg11(t3)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint32 * dstp@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg12(t4)]
                       Unresolved local var: Uint8 * palmap@[DW_OP_reg13(t5)]
                       Unresolved local var: int c@[DW_OP_reg7(a3)] */
  uVar9 = info->d_width;
  iVar5 = info->d_height;
  iVar7 = info->s_skip;
  iVar4 = info->d_skip;
  uVar10 = info->src->colorkey;
  pUVar11 = info->table;
  pbVar8 = info->s_pixels;
  pUVar2 = info->d_pixels;
  if (iVar5 != 0) {
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg5(a1)]
                       Unresolved local var: Uint8 bit@[???] */
    iVar12 = 0;
    while( true ) {
      if (0 < (int)uVar9) {
        uVar6 = 0;
        uVar3 = 0;
        do {
          uVar1 = uVar6 & 7;
          uVar6 = uVar6 + 1;
          if (uVar1 == 0) {
            uVar3 = (uint)*pbVar8;
            pbVar8 = pbVar8 + 1;
          }
          uVar1 = uVar3 >> 7;
          uVar3 = (uVar3 & 0x7f) << 1;
          if (uVar10 != uVar1) {
            *(undefined4 *)pUVar2 = *(undefined4 *)(pUVar11 + uVar1 * 4);
          }
          pUVar2 = pUVar2 + 4;
        } while (uVar9 != uVar6);
      }
      pbVar8 = pbVar8 + iVar7 + (uVar9 - (int)(uVar9 + 7) / 8);
      if (iVar5 + -1 == iVar12) break;
      pUVar2 = pUVar2 + (iVar4 / 4) * 4;
      iVar12 = iVar12 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitBtoNAlpha @ 0892bb74

/* WARNING: Removing unreachable block (ram,0x0892bbb4) */

void BlitBtoNAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  SDL_Color *pSVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  uint uVar8;
  int iVar9;
  int iVar10;
  uint uVar11;
  SDL_PixelFormat *pSVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  uint *puVar19;
  uint uVar20;
  uint uVar21;
  byte *pbVar22;
  int iVar23;
  SDL_Color *pSVar24;
  uint uVar25;
  uint uVar26;
  int iVar27;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg15(t7)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_Color * srcpal@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: int dstbpp@[DW_OP_reg11(t3)]
                       Unresolved local var: int c@[DW_OP_reg25(t9)]
                       Unresolved local var: int A@[???] */
  iVar23 = info->d_width;
  pSVar12 = info->dst;
  iVar6 = info->d_height;
  iVar9 = info->s_skip;
  pbVar22 = info->s_pixels;
  puVar19 = (uint *)info->d_pixels;
  iVar4 = info->d_skip;
  uVar21 = (uint)info->src->alpha;
  pSVar24 = info->src->palette->colors;
  uVar15 = (uint)pSVar12->BytesPerPixel;
  if (iVar6 != 0) {
    iVar27 = 0;
    while( true ) {
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
      if (0 < iVar23) {
        uVar26 = 0;
        uVar20 = 0;
        while( true ) {
          uVar2 = uVar20 >> 7;
          if ((uVar26 & 7) == 0) {
            bVar1 = *pbVar22;
            uVar20 = (uint)bVar1;
            pbVar22 = pbVar22 + 1;
            uVar2 = (uint)(bVar1 >> 7);
          }
          pSVar3 = pSVar24 + uVar2;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar2 = (uint)(byte)*puVar19 + (uint)*(byte *)((int)puVar19 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar19 + 2) * 0x10000;
          }
          else {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar15 == 4) {
              uVar2 = *puVar19;
            }
            else if (uVar15 == 2) {
              uVar2 = (uint)(ushort)*puVar19;
            }
            else {
              uVar2 = 0;
            }
          }
          uVar16 = (uint)pSVar12->Rshift;
          uVar13 = (uint)pSVar12->Rloss;
          iVar5 = ((uVar2 & pSVar12->Rmask) >> (uVar16 & 0x1f)) << (uVar13 & 0x1f);
          uVar18 = (uint)pSVar12->Gshift;
          uVar14 = (uint)pSVar12->Gloss;
          iVar7 = ((uVar2 & pSVar12->Gmask) >> (uVar18 & 0x1f)) << (uVar14 & 0x1f);
          uVar25 = (uint)pSVar12->Bshift;
          uVar17 = (uint)pSVar12->Bloss;
          iVar10 = ((uVar2 & pSVar12->Bmask) >> (uVar25 & 0x1f)) << (uVar17 & 0x1f);
          uVar2 = iVar5 + (uVar21 * ((uint)pSVar3->r - iVar5) >> 8);
          uVar8 = iVar7 + (uVar21 * ((uint)pSVar3->g - iVar7) >> 8);
          uVar11 = iVar10 + (uVar21 * ((uint)pSVar3->b - iVar10) >> 8);
          if (uVar15 == 3) {
            *(byte *)((uint)(pSVar12->Rshift >> 3) + (int)puVar19) = (byte)uVar2;
            *(byte *)((uint)(pSVar12->Gshift >> 3) + (int)puVar19) = (byte)uVar8;
            *(byte *)((uint)(pSVar12->Bshift >> 3) + (int)puVar19) = (byte)uVar11;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar2 >> (uVar13 & 0x1f)) << (uVar16 & 0x1f) |
                       (uVar8 >> (uVar14 & 0x1f)) << (uVar18 & 0x1f) |
                       (uVar11 >> (uVar17 & 0x1f)) << (uVar25 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar2 >> (uVar13 & 0x1f)) << (uVar16 & 0x1f)) |
                 (ushort)((uVar8 >> (uVar14 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((uVar11 >> (uVar17 & 0x1f)) << (uVar25 & 0x1f));
          }
          if (iVar23 == uVar26 + 1) break;
          uVar26 = uVar26 + 1;
          puVar19 = (uint *)((int)puVar19 + uVar15);
          uVar20 = (uVar20 & 0x7f) << 1;
        }
        puVar19 = (uint *)((int)puVar19 + uVar15);
      }
      if (iVar6 + -1 == iVar27) break;
      iVar27 = iVar27 + 1;
      pbVar22 = pbVar22 + iVar9 + (iVar23 - (iVar23 + 7) / 8);
      puVar19 = (uint *)((int)puVar19 + iVar4);
    }
  }
  return;
}



----------------------------------------

// Function: BlitBtoNAlphaKey @ 0892be10

/* WARNING: Removing unreachable block (ram,0x0892be50) */

void BlitBtoNAlphaKey(SDL_BlitInfo *info)

{
  byte bVar1;
  uint uVar2;
  SDL_Color *pSVar3;
  int iVar4;
  SDL_PixelFormat *pSVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  SDL_PixelFormat *pSVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint *puVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  uint uVar19;
  uint uVar20;
  byte *pbVar21;
  int iVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  SDL_Color *pSVar26;
  int local_30;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg12(t4)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: SDL_Color * srcpal@[???]
                       Unresolved local var: int dstbpp@[DW_OP_reg9(t1)]
                       Unresolved local var: int c@[DW_OP_reg24(t8)]
                       Unresolved local var: int A@[???]
                       Unresolved local var: Uint32 ckey@[???] */
  iVar22 = info->d_width;
  pSVar5 = info->src;
  pSVar11 = info->dst;
  iVar7 = info->d_height;
  iVar9 = info->s_skip;
  pbVar21 = info->s_pixels;
  puVar15 = (uint *)info->d_pixels;
  iVar4 = info->d_skip;
  pSVar26 = pSVar5->palette->colors;
  uVar20 = (uint)pSVar5->alpha;
  uVar12 = (uint)pSVar11->BytesPerPixel;
  uVar23 = pSVar5->colorkey;
  if (iVar7 != 0) {
    local_30 = 0;
    while( true ) {
                    /* Unresolved local var: Uint8 byte@[???]
                       Unresolved local var: Uint8 bit@[???] */
      if (0 < iVar22) {
        uVar24 = 0;
        uVar19 = 0;
        while( true ) {
          uVar2 = uVar19 >> 7;
          if ((uVar24 & 7) == 0) {
            bVar1 = *pbVar21;
            uVar19 = (uint)bVar1;
            pbVar21 = pbVar21 + 1;
            uVar2 = (uint)(bVar1 >> 7);
          }
          if (uVar23 != uVar2) {
            pSVar3 = pSVar26 + uVar2;
            if (uVar12 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar2 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
            }
            else {
                    /* Unresolved local var: int sR@[???]
                       Unresolved local var: int sG@[???]
                       Unresolved local var: int sB@[???]
                       Unresolved local var: int dR@[???]
                       Unresolved local var: int dG@[???]
                       Unresolved local var: int dB@[???]
                       Unresolved local var: Uint32 pixel@[???] */
              if (uVar12 == 4) {
                uVar2 = *puVar15;
              }
              else if (uVar12 == 2) {
                uVar2 = (uint)(ushort)*puVar15;
              }
              else {
                uVar2 = 0;
              }
            }
            uVar16 = (uint)pSVar11->Rshift;
            uVar13 = (uint)pSVar11->Rloss;
            iVar6 = ((uVar2 & pSVar11->Rmask) >> (uVar16 & 0x1f)) << (uVar13 & 0x1f);
            uVar18 = (uint)pSVar11->Gshift;
            uVar14 = (uint)pSVar11->Gloss;
            iVar8 = ((uVar2 & pSVar11->Gmask) >> (uVar18 & 0x1f)) << (uVar14 & 0x1f);
            uVar25 = (uint)pSVar11->Bshift;
            uVar17 = (uint)pSVar11->Bloss;
            iVar10 = ((uVar2 & pSVar11->Bmask) >> (uVar25 & 0x1f)) << (uVar17 & 0x1f);
            iVar6 = iVar6 + ((int)(uVar20 * ((uint)pSVar3->r - iVar6)) >> 8);
            iVar8 = iVar8 + ((int)(uVar20 * ((uint)pSVar3->g - iVar8)) >> 8);
            iVar10 = iVar10 + ((int)(uVar20 * ((uint)pSVar3->b - iVar10)) >> 8);
            if (uVar12 == 3) {
              *(byte *)((uint)(pSVar11->Rshift >> 3) + (int)puVar15) = (byte)iVar6;
              *(byte *)((uint)(pSVar11->Gshift >> 3) + (int)puVar15) = (byte)iVar8;
              *(byte *)((uint)(pSVar11->Bshift >> 3) + (int)puVar15) = (byte)iVar10;
            }
            else if (uVar12 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
              *puVar15 = (iVar6 >> (uVar13 & 0x1f)) << (uVar16 & 0x1f) |
                         (iVar8 >> (uVar14 & 0x1f)) << (uVar18 & 0x1f) |
                         (iVar10 >> (uVar17 & 0x1f)) << (uVar25 & 0x1f);
            }
            else if (uVar12 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
              *(ushort *)puVar15 =
                   (ushort)((iVar6 >> (uVar13 & 0x1f)) << (uVar16 & 0x1f)) |
                   (ushort)((iVar8 >> (uVar14 & 0x1f)) << (uVar18 & 0x1f)) |
                   (ushort)((iVar10 >> (uVar17 & 0x1f)) << (uVar25 & 0x1f));
            }
          }
          if (iVar22 == uVar24 + 1) break;
          uVar24 = uVar24 + 1;
          puVar15 = (uint *)((int)puVar15 + uVar12);
          uVar19 = (uVar19 & 0x7f) << 1;
        }
        puVar15 = (uint *)((int)puVar15 + uVar12);
      }
      if (iVar7 + -1 == local_30) break;
      pbVar21 = pbVar21 + iVar9 + (iVar22 - (iVar22 + 7) / 8);
      puVar15 = (uint *)((int)puVar15 + iVar4);
      local_30 = local_30 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: SDL_CalculateBlit0 @ 0892c0c0

SDL_loblit SDL_CalculateBlit0(SDL_Surface *surface,int blit_index)

{
  SDL_PixelFormat *pSVar1;
  uint uVar2;
  
                    /* Unresolved local var: int which@[???] */
  if (surface->format->BitsPerPixel == '\x01') {
    pSVar1 = surface->map->dst->format;
    if (pSVar1->BitsPerPixel < 8) {
      uVar2 = 0;
    }
    else {
      uVar2 = (uint)pSVar1->BytesPerPixel;
    }
    if (blit_index == 1) {
      return colorkey_blit[uVar2];
    }
    if (blit_index < 2) {
      if (blit_index == 0) {
        return bitmap_blit[uVar2];
      }
    }
    else if (blit_index == 2) {
      if (1 < uVar2) {
        return BlitBtoNAlpha;
      }
    }
    else if ((blit_index == 4) && (1 < uVar2)) {
      return BlitBtoNAlphaKey;
    }
  }
  return (SDL_loblit)0x0;
}



----------------------------------------

// Function: BlitBto3Key @ 0892c184

/* WARNING: Removing unreachable block (ram,0x0892c19c) */

void BlitBto3Key(SDL_BlitInfo *info)

{
  uint uVar1;
  int iVar2;
  Uint8 *pUVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  Uint8 *pUVar7;
  byte *pbVar8;
  uint uVar9;
  uint uVar10;
  Uint8 *pUVar11;
  int iVar12;
  int iVar13;
  
                    /* Unresolved local var: int width@[DW_OP_reg11(t3)]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg24(t8)]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg12(t4)]
                       Unresolved local var: Uint8 * palmap@[DW_OP_reg13(t5)]
                       Unresolved local var: int c@[DW_OP_reg8(t0)] */
  uVar9 = info->d_width;
  iVar2 = info->d_height;
  iVar4 = info->s_skip;
  pUVar11 = info->table;
  pbVar8 = info->s_pixels;
  uVar10 = info->src->colorkey;
  pUVar7 = info->d_pixels;
  iVar13 = info->d_skip;
  if (iVar2 != 0) {
    iVar12 = 0;
    while( true ) {
                    /* Unresolved local var: Uint8 byte@[DW_OP_reg7(a3)]
                       Unresolved local var: Uint8 bit@[???] */
      if (0 < (int)uVar9) {
        uVar6 = 0;
        uVar5 = 0;
        do {
          uVar1 = uVar6 & 7;
          uVar6 = uVar6 + 1;
          if (uVar1 == 0) {
            uVar5 = (uint)*pbVar8;
            pbVar8 = pbVar8 + 1;
          }
          uVar1 = uVar5 >> 7;
          pUVar3 = pUVar11 + uVar1 * 4;
          uVar5 = (uVar5 & 0x7f) << 1;
          if (uVar10 != uVar1) {
            *pUVar7 = *pUVar3;
            pUVar7[1] = pUVar3[1];
            pUVar7[2] = pUVar3[2];
          }
          pUVar7 = pUVar7 + 3;
        } while (uVar9 != uVar6);
      }
      pbVar8 = pbVar8 + iVar4 + (uVar9 - (int)(uVar9 + 7) / 8);
      if (iVar2 + -1 == iVar12) break;
      pUVar7 = pUVar7 + iVar13;
      iVar12 = iVar12 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: glCopyTexImage1D @ 0892c24c

void glCopyTexImage1D(GLenum target,GLint level,GLenum internalFormat,GLint x,GLint y,GLsizei width,
                     GLint border)

{
  return;
}



----------------------------------------

// Function: PSP_GL_GetAttribute @ 0892c254

/* DWARF original prototype: int PSP_GL_GetAttribute(SDL_VideoDevice * this, SDL_GLattr attrib, int
   * value) */

int __thiscall PSP_GL_GetAttribute(void *this,SDL_GLattr attrib,int *value)

{
  return 0;
}



----------------------------------------

// Function: PSP_GL_Init @ 0892c25c

/* DWARF original prototype: int PSP_GL_Init(SDL_VideoDevice * this) */

int __thiscall PSP_GL_Init(void *this)

{
  EGLDisplay dpy;
  EGLint EVar1;
  int iVar2;
  EGLContext pvVar3;
  EGLSurface pvVar4;
  undefined4 *puVar5;
  int iVar6;
  int iVar7;
  EGLConfig local_a0;
  int local_9c;
  EGLint local_98 [2];
  undefined4 local_78 [24];
  
                    /* Unresolved local var: EGLint[32] attribs@[???]
                       Unresolved local var: EGLDisplay display@[???]
                       Unresolved local var: EGLContext context@[???]
                       Unresolved local var: EGLSurface surface@[???]
                       Unresolved local var: EGLConfig config@[???]
                       Unresolved local var: EGLint num_configs@[???]
                       Unresolved local var: int i@[???] */
                    /* Unresolved local var: EGLint err@[???] */
  dpy = eglGetDisplay(0);
  EVar1 = eglGetError();
  if (EVar1 != 0x3000) {
LAB_0892c2a0:
    SDL_SetError("EGL error %d",EVar1);
    return 0;
  }
                    /* Unresolved local var: EGLint err@[???] */
  eglInitialize(dpy,(EGLint *)0x0,(EGLint *)0x0);
  EVar1 = eglGetError();
  if (EVar1 == 0x3000) {
    local_98[1] = *(undefined4 *)((int)this + 0x15c);
    local_98[0] = 0x3024;
    if (*(int *)((int)this + 0x168) == 0) {
      iVar7 = 8;
    }
    else {
      iVar7 = 10;
    }
    iVar6 = *(int *)((int)this + 0x174);
    iVar2 = iVar7 << 2;
    if (iVar6 != 0) {
      local_98[iVar7] = 0x3026;
      local_98[iVar7 + 1] = iVar6;
      iVar2 = (iVar7 + 2) * 4;
    }
    *(undefined4 *)((int)local_98 + iVar2) = 0x3038;
    eglChooseConfig(dpy,local_98,&local_a0,1,(EGLint *)0x3023);
    EVar1 = eglGetError();
    if (EVar1 != 0x3000) goto LAB_0892c2a0;
    if (local_9c == 0) {
      SDL_SetError("No valid EGL configs for requested mode");
      return 0;
    }
                    /* Unresolved local var: EGLint err@[???] */
    pvVar3 = eglCreateContext(dpy,local_a0,(EGLContext)0x0,(EGLint *)0x0);
    EVar1 = eglGetError();
    if (EVar1 != 0x3000) {
      SDL_SetError("EGL error %d",EVar1);
      return 0;
    }
    pvVar4 = eglCreateWindowSurface(dpy,local_a0,0,(EGLint *)0x0);
    EVar1 = eglGetError();
    if (EVar1 == 0x3000) {
      puVar5 = *(undefined4 **)((int)this + 0x2a4);
      puVar5[2] = pvVar4;
      *puVar5 = dpy;
      puVar5[1] = pvVar3;
      return 1;
    }
  }
  SDL_SetError("EGL error %d",EVar1);
  return 0;
}



----------------------------------------

// Function: PSP_GL_SwapBuffers @ 0892c488

/* DWARF original prototype: void PSP_GL_SwapBuffers(SDL_VideoDevice * this) */

void __thiscall PSP_GL_SwapBuffers(void *this)

{
                    /* Unresolved local var: SDL_PrivateGLData * gl_data@[???] */
  eglSwapBuffers((EGLDisplay)**(undefined4 **)((int)this + 0x2a4),
                 (EGLSurface)(*(undefined4 **)((int)this + 0x2a4))[2]);
  return;
}



----------------------------------------

// Function: PSP_GL_MakeCurrent @ 0892c498

/* DWARF original prototype: int PSP_GL_MakeCurrent(SDL_VideoDevice * this) */

int __thiscall PSP_GL_MakeCurrent(void *this)

{
  undefined4 *puVar1;
  EGLBoolean EVar2;
  int iVar3;
  
                    /* Unresolved local var: SDL_PrivateGLData * gl_data@[???] */
  puVar1 = *(undefined4 **)((int)this + 0x2a4);
  EVar2 = eglMakeCurrent((EGLDisplay)*puVar1,(EGLSurface)puVar1[2],(EGLSurface)puVar1[2],
                         (EGLContext)puVar1[1]);
  iVar3 = 0;
  if (EVar2 == 0) {
    SDL_SetError("Unable to make EGL context current");
    iVar3 = -1;
  }
  return iVar3;
}



----------------------------------------

// Function: PSP_GL_GetProcAddress @ 0892c4e8

/* DWARF original prototype: void * PSP_GL_GetProcAddress(SDL_VideoDevice * this, char * proc) */

void * __thiscall PSP_GL_GetProcAddress(void *this,char *proc)

{
  int iVar1;
  int iVar2;
  anon_struct_8_2_38d8ec4b *paVar3;
  void **ppvVar4;
  
                    /* Unresolved local var: uint i@[???] */
  paVar3 = glfuncs;
  iVar2 = 0;
  ppvVar4 = &glfuncs[0].func;
  do {
    iVar2 = iVar2 + 1;
    iVar1 = strcmp(proc,paVar3->proc);
    paVar3 = paVar3 + 1;
    if (iVar1 == 0) {
      return *ppvVar4;
    }
    ppvVar4 = ppvVar4 + 2;
  } while (iVar2 != 0x1c);
  return (void *)0x0;
}



----------------------------------------

// Function: PSP_InitOSKeymap @ 0892c588

/* WARNING: Enum "SDLKey": Some values do not have unique names */
/* DWARF original prototype: void PSP_InitOSKeymap(SDL_VideoDevice * this) */

void __thiscall PSP_InitOSKeymap(void *this)

{
  SDLKey *pSVar1;
  
                    /* Unresolved local var: int i@[???] */
  pSVar1 = keymap;
  keymap[0] = SDLK_FIRST;
  while (pSVar1 = pSVar1 + 1, pSVar1 != (SDLKey *)&SDL_appstate) {
    *pSVar1 = SDLK_FIRST;
  }
  keymap[1] = SDLK_ESCAPE;
  keymap[0x3b] = SDLK_F1;
  keymap[0x3c] = SDLK_F2;
  keymap[0x3d] = SDLK_F3;
  keymap[0x3e] = SDLK_F4;
  keymap[0x3f] = SDLK_F5;
  keymap[0x40] = SDLK_F6;
  keymap[0x41] = SDLK_F7;
  keymap[0x42] = SDLK_F8;
  keymap[0x43] = SDLK_F9;
  keymap[0x44] = SDLK_F10;
  keymap[0x57] = SDLK_F11;
  keymap[0x58] = SDLK_F12;
  keymap[0x55] = SDLK_PRINT;
  keymap[0x59] = SDLK_PAUSE;
  keymap[0x29] = SDLK_BACKQUOTE;
  keymap[2] = SDLK_1;
  keymap[3] = SDLK_2;
  keymap[4] = SDLK_3;
  keymap[5] = SDLK_4;
  keymap[6] = SDLK_5;
  keymap[7] = SDLK_6;
  keymap[8] = SDLK_7;
  keymap[9] = SDLK_8;
  keymap[10] = SDLK_9;
  keymap[0xb] = SDLK_0;
  keymap[0xc] = SDLK_MINUS;
  keymap[0xd] = SDLK_EQUALS;
  keymap[0xe] = SDLK_BACKSPACE;
  keymap[0xf] = SDLK_TAB;
  keymap[0x10] = SDLK_q;
  keymap[0x11] = SDLK_w;
  keymap[0x12] = SDLK_e;
  keymap[0x13] = SDLK_r;
  keymap[0x14] = SDLK_t;
  keymap[0x15] = SDLK_y;
  keymap[0x16] = SDLK_u;
  keymap[0x17] = SDLK_i;
  keymap[0x18] = SDLK_o;
  keymap[0x19] = SDLK_p;
  keymap[0x1a] = SDLK_LEFTBRACKET;
  keymap[0x1b] = SDLK_RIGHTBRACKET;
  keymap[0x1c] = SDLK_RETURN;
  keymap[0x3a] = SDLK_CAPSLOCK;
  keymap[0x1e] = SDLK_a;
  keymap[0x1f] = SDLK_s;
  keymap[0x20] = SDLK_d;
  keymap[0x21] = SDLK_f;
  keymap[0x22] = SDLK_g;
  keymap[0x23] = SDLK_h;
  keymap[0x24] = SDLK_j;
  keymap[0x25] = SDLK_k;
  keymap[0x26] = SDLK_l;
  keymap[0x27] = SDLK_SEMICOLON;
  keymap[0x28] = SDLK_QUOTE;
  keymap[0x2b] = SDLK_BACKSLASH;
  keymap[0x2c] = SDLK_z;
  keymap[0x2d] = SDLK_x;
  keymap[0x2e] = SDLK_c;
  keymap[0x2f] = SDLK_v;
  keymap[0x30] = SDLK_b;
  keymap[0x31] = SDLK_n;
  keymap[0x32] = SDLK_m;
  keymap[0x33] = SDLK_COMMA;
  keymap[0x34] = SDLK_PERIOD;
  keymap[0x35] = SDLK_SLASH;
  keymap[0x39] = SDLK_SPACE;
  keymap[0x67] = SDLK_UP;
  keymap[0x36] = SDLK_RSHIFT;
  keymap[0x6c] = SDLK_DOWN;
  keymap[0x69] = SDLK_LEFT;
  keymap[0x6a] = SDLK_RIGHT;
  keymap[0x66] = SDLK_HOME;
  keymap[0x6b] = SDLK_END;
  keymap[0x6e] = SDLK_INSERT;
  keymap[0x6f] = SDLK_DELETE;
  keymap[0x45] = SDLK_NUMLOCK;
  keymap[0x7d] = SDLK_LSUPER;
  keymap[0x62] = SDLK_KP_DIVIDE;
  keymap[0x37] = SDLK_KP_MULTIPLY;
  keymap[0x4a] = SDLK_KP_MINUS;
  keymap[0x4e] = SDLK_KP_PLUS;
  keymap[0x53] = SDLK_KP_PERIOD;
  keymap[0x75] = SDLK_KP_EQUALS;
  keymap[0x1d] = SDLK_LCTRL;
  keymap[0x61] = SDLK_RCTRL;
  keymap[0x38] = SDLK_LALT;
  keymap[100] = SDLK_RALT;
  keymap[0x2a] = SDLK_LSHIFT;
  return;
}



----------------------------------------

// Function: PSP_EventQuit @ 0892c878

/* DWARF original prototype: void PSP_EventQuit(SDL_VideoDevice * this) */

void __thiscall PSP_EventQuit(void *this)

{
  running = 0;
  SDL_WaitThread(thread,(int *)0x0);
  SDL_DestroySemaphore(event_sem);
  if (irkbd_ready != 0) {
    pspIrKeybFinish();
    irkbd_ready = 0;
  }
  return;
}



----------------------------------------

// Function: PSP_EventInit @ 0892c8d4

/* DWARF original prototype: void PSP_EventInit(SDL_VideoDevice * this) */

void __thiscall PSP_EventInit(void *this)

{
  int iVar1;
  
                    /* Unresolved local var: int outputmode@[???]
                       Unresolved local var: int ret@[???] */
  iVar1 = pspIrKeybInit(0,0);
  if (iVar1 == 0) {
    pspIrKeybOutputMode(2);
    irkbd_ready = 1;
    event_sem = SDL_CreateSemaphore(1);
  }
  else {
    irkbd_ready = 0;
    event_sem = SDL_CreateSemaphore(1);
  }
  if (event_sem != (SDL_sem *)0x0) {
    running = 1;
    thread = SDL_CreateThread(EventUpdate,(void *)0x0);
    if (thread == (SDL_Thread *)0x0) {
      SDL_SetError("Can\'t create input thread\n");
      return;
    }
    return;
  }
  SDL_SetError("Can\'t create input semaphore\n");
  return;
}



----------------------------------------

// Function: PSP_PumpEvents @ 0892c99c

/* WARNING: Removing unreachable block (ram,0x0892ca94) */
/* WARNING: Enum "SDLKey": Some values do not have unique names */
/* DWARF original prototype: void PSP_PumpEvents(SDL_VideoDevice * this) */

void __thiscall PSP_PumpEvents(void *this)

{
  byte *pbVar1;
  PspHprmKeys PVar2;
  int iVar3;
  PspHprmKeys PVar4;
  anon_struct_8_2_74732d53 *paVar5;
  byte *pbVar6;
  uint uVar7;
  PspHprmKeys PVar8;
  uint local_130;
  SDL_keysym local_12c;
  undefined1 auStack_11c [4];
  byte local_118 [256];
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: PspHprmKeys keys@[???]
                       Unresolved local var: PspHprmKeys changed@[???]
                       Unresolved local var: SDL_keysym sym@[???] */
  SDL_SemWait(event_sem);
  PVar2 = hprm;
  SDL_SemPost(event_sem);
  PVar8 = PVar2 ^ PSP_PumpEvents::old_keys;
  PSP_PumpEvents::old_keys = PVar2;
  if (PVar8 != 0) {
    paVar5 = keymap_psp;
    do {
      PVar4 = paVar5->id;
      while ((PVar8 & PVar4) != 0) {
        local_12c.sym = paVar5->sym;
        paVar5 = paVar5 + 1;
        local_12c.scancode = (Uint8)PVar4;
        SDL_PrivateKeyboard((PVar2 & PVar4) != 0,&local_12c);
        if (paVar5 == (anon_struct_8_2_74732d53 *)&DAT_089e149c) goto LAB_0892ca44;
        PVar4 = paVar5->id;
      }
      paVar5 = paVar5 + 1;
    } while (paVar5 != (anon_struct_8_2_74732d53 *)&DAT_089e149c);
  }
LAB_0892ca44:
                    /* Unresolved local var: uchar[255] buffer@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int length@[???]
                       Unresolved local var: int count@[???]
                       Unresolved local var: SIrKeybScanCodeData * scanData@[???] */
  if ((((irkbd_ready != 0) && (iVar3 = pspIrKeybReadinput(auStack_11c,&local_130), -1 < iVar3)) &&
      (local_130 % 5 == 0)) && (local_130 / 5 != 0)) {
    pbVar6 = local_118;
    uVar7 = 0;
                    /* Unresolved local var: uchar raw@[???]
                       Unresolved local var: uchar pressed@[???] */
    while( true ) {
      pbVar1 = pbVar6 + -1;
      local_12c.sym = keymap[local_118[0]];
      uVar7 = uVar7 + 1;
      pbVar6 = pbVar6 + 5;
      local_12c.scancode = local_118[0];
      SDL_PrivateKeyboard(*pbVar1 != 0,&local_12c);
      if (local_130 / 5 == uVar7) break;
      local_118[0] = *pbVar6;
    }
    sceKernelDelayThread(0);
    return;
  }
  sceKernelDelayThread(0);
  return;
}



----------------------------------------

// Function: EventUpdate @ 0892cb1c

int EventUpdate(void *data)

{
  while (running != 0) {
    SDL_SemWait(event_sem);
    sceHprmPeekCurrentKey(&hprm);
    SDL_SemPost(event_sem);
    sceKernelDelayThread(0x411a);
  }
  return 0;
}



----------------------------------------

// Function: copy_opaque_16 @ 0892cb90

int copy_opaque_16(void *dst,Uint32 *src,int n,SDL_PixelFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  int in_t0;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * d@[DW_OP_reg25(t9)] */
  if (0 < n) {
    uVar5 = sfmt->Rmask;
    uVar4 = sfmt->Gmask;
    uVar3 = sfmt->Bmask;
    iVar2 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???] */
      uVar1 = *src;
      iVar2 = iVar2 + 1;
      *(ushort *)dst =
           (ushort)(((((uVar1 & uVar5) >> (sfmt->Rshift & 0x1f)) << (sfmt->Rloss & 0x1f)) >>
                    (*(byte *)(in_t0 + 6) & 0x1f)) << (*(byte *)(in_t0 + 10) & 0x1f)) |
           (ushort)(((((uVar1 & uVar4) >> (sfmt->Gshift & 0x1f)) << (sfmt->Gloss & 0x1f)) >>
                    (*(byte *)(in_t0 + 7) & 0x1f)) << (*(byte *)(in_t0 + 0xb) & 0x1f)) |
           (ushort)(((((uVar1 & uVar3) >> (sfmt->Bshift & 0x1f)) << (sfmt->Bloss & 0x1f)) >>
                    (*(byte *)(in_t0 + 8) & 0x1f)) << (*(byte *)(in_t0 + 0xc) & 0x1f));
      src = src + 1;
      dst = (void *)((int)dst + 2);
    } while (n != iVar2);
  }
  return n << 1;
}



----------------------------------------

// Function: uncopy_opaque_16 @ 0892cc84

int uncopy_opaque_16(Uint32 *dst,void *src,int n,RLEDestFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  int in_t0;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * s@[???]
                       Unresolved local var: uint alpha@[???] */
  uVar3 = 0xff;
  if (*(int *)(in_t0 + 0x1c) == 0) {
    uVar3 = 0;
  }
  if (0 < n) {
    iVar2 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???] */
      uVar1 = (uint)*(ushort *)src;
      iVar2 = iVar2 + 1;
      *dst = ((((uVar1 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) << (sfmt->Rloss & 0x1f)) >>
             (*(byte *)(in_t0 + 6) & 0x1f)) << (*(byte *)(in_t0 + 10) & 0x1f) |
             ((((uVar1 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) << (sfmt->Gloss & 0x1f)) >>
             (*(byte *)(in_t0 + 7) & 0x1f)) << (*(byte *)(in_t0 + 0xb) & 0x1f) |
             ((((uVar1 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) << (sfmt->Bloss & 0x1f)) >>
             (*(byte *)(in_t0 + 8) & 0x1f)) << (*(byte *)(in_t0 + 0xc) & 0x1f) |
             (uVar3 >> (*(byte *)(in_t0 + 9) & 0x1f)) << (*(byte *)(in_t0 + 0xd) & 0x1f);
      src = (void *)((int)src + 2);
      dst = dst + 1;
    } while (n != iVar2);
  }
  return n << 1;
}



----------------------------------------

// Function: copy_transl_565 @ 0892cd98

int copy_transl_565(void *dst,Uint32 *src,int n,SDL_PixelFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  uint uVar2;
  int in_t0;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * d@[DW_OP_reg24(t8)] */
  if (0 < n) {
    iVar3 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???]
                       Unresolved local var: uint a@[???]
                       Unresolved local var: Uint16 pix@[???] */
      uVar2 = *src;
      uVar1 = (((uVar2 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) >> (*(byte *)(in_t0 + 6) & 0x1f)) <<
              (*(byte *)(in_t0 + 10) & 0x1f) |
              (((uVar2 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) >> (*(byte *)(in_t0 + 7) & 0x1f)) <<
              (*(byte *)(in_t0 + 0xb) & 0x1f) |
              (((uVar2 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) >> (*(byte *)(in_t0 + 8) & 0x1f)) <<
              (*(byte *)(in_t0 + 0xc) & 0x1f);
      iVar3 = iVar3 + 1;
      *(uint *)dst = (uVar1 & 0x7e0) << 0x10 | uVar1 & 0xf81f |
                     ((uVar2 & sfmt->Amask) >> (sfmt->Ashift & 0x1f) & 0x1f8) << 2;
      src = src + 1;
      dst = (void *)((int)dst + 4);
    } while (n != iVar3);
  }
  return n << 2;
}



----------------------------------------

// Function: copy_transl_555 @ 0892ce84

int copy_transl_555(void *dst,Uint32 *src,int n,SDL_PixelFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  uint uVar2;
  int in_t0;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * d@[DW_OP_reg24(t8)] */
  if (0 < n) {
    iVar3 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???]
                       Unresolved local var: uint a@[???]
                       Unresolved local var: Uint16 pix@[???] */
      uVar2 = *src;
      uVar1 = (((uVar2 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) >> (*(byte *)(in_t0 + 6) & 0x1f)) <<
              (*(byte *)(in_t0 + 10) & 0x1f) |
              (((uVar2 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) >> (*(byte *)(in_t0 + 7) & 0x1f)) <<
              (*(byte *)(in_t0 + 0xb) & 0x1f) |
              (((uVar2 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) >> (*(byte *)(in_t0 + 8) & 0x1f)) <<
              (*(byte *)(in_t0 + 0xc) & 0x1f);
      iVar3 = iVar3 + 1;
      *(uint *)dst = (uVar1 & 0x3e0) << 0x10 | uVar1 & 0xfc1f |
                     ((uVar2 & sfmt->Amask) >> (sfmt->Ashift & 0x1f) & 0xf8) << 2;
      src = src + 1;
      dst = (void *)((int)dst + 4);
    } while (n != iVar3);
  }
  return n << 2;
}



----------------------------------------

// Function: uncopy_transl_16 @ 0892cf70

int uncopy_transl_16(Uint32 *dst,void *src,int n,RLEDestFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  uint uVar2;
  int in_t0;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * s@[???] */
  if (0 < n) {
    iVar3 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???]
                       Unresolved local var: uint a@[???]
                       Unresolved local var: Uint32 pix@[???] */
      uVar2 = *(uint *)src;
      uVar1 = uVar2 & 0xfffffc1f | uVar2 >> 0x10;
      iVar3 = iVar3 + 1;
      *dst = ((((uVar1 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) << (sfmt->Bloss & 0x1f)) >>
             (*(byte *)(in_t0 + 8) & 0x1f)) << (*(byte *)(in_t0 + 0xc) & 0x1f) |
             ((((uVar1 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) << (sfmt->Rloss & 0x1f)) >>
             (*(byte *)(in_t0 + 6) & 0x1f)) << (*(byte *)(in_t0 + 10) & 0x1f) |
             ((((uVar1 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) << (sfmt->Gloss & 0x1f)) >>
             (*(byte *)(in_t0 + 7) & 0x1f)) << (*(byte *)(in_t0 + 0xb) & 0x1f) |
             (((uVar2 & 0x3e0) >> 2) >> (*(byte *)(in_t0 + 9) & 0x1f)) <<
             (*(byte *)(in_t0 + 0xd) & 0x1f);
      src = (void *)((int)src + 4);
      dst = dst + 1;
    } while (n != iVar3);
  }
  return n << 2;
}



----------------------------------------

// Function: copy_32 @ 0892d098

int copy_32(void *dst,Uint32 *src,int n,SDL_PixelFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  int in_t0;
  int iVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * d@[???] */
  if (0 < n) {
    iVar2 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???]
                       Unresolved local var: uint a@[???]
                       Unresolved local var: Uint32 pixel@[???] */
      uVar1 = *src;
      iVar2 = iVar2 + 1;
      *(uint *)dst = (((uVar1 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) >>
                     (*(byte *)(in_t0 + 8) & 0x1f)) << (*(byte *)(in_t0 + 0xc) & 0x1f) |
                     (((uVar1 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) >>
                     (*(byte *)(in_t0 + 6) & 0x1f)) << (*(byte *)(in_t0 + 10) & 0x1f) |
                     (((uVar1 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) >>
                     (*(byte *)(in_t0 + 7) & 0x1f)) << (*(byte *)(in_t0 + 0xb) & 0x1f) |
                     ((uVar1 & sfmt->Amask) >> (sfmt->Ashift & 0x1f)) << 0x18;
      src = src + 1;
      dst = (void *)((int)dst + 4);
    } while (n != iVar2);
  }
  return n << 2;
}



----------------------------------------

// Function: uncopy_32 @ 0892d17c

int uncopy_32(Uint32 *dst,void *src,int n,RLEDestFormat *sfmt,SDL_PixelFormat *dfmt)

{
  uint uVar1;
  int in_t0;
  int iVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * s@[???] */
  if (0 < n) {
    iVar2 = 0;
    do {
                    /* Unresolved local var: uint r@[???]
                       Unresolved local var: uint g@[???]
                       Unresolved local var: uint b@[???]
                       Unresolved local var: uint a@[???]
                       Unresolved local var: Uint32 pixel@[???] */
      uVar1 = *(uint *)src;
      iVar2 = iVar2 + 1;
      *dst = ((((uVar1 & sfmt->Bmask) >> (sfmt->Bshift & 0x1f)) << (sfmt->Bloss & 0x1f)) >>
             (*(byte *)(in_t0 + 8) & 0x1f)) << (*(byte *)(in_t0 + 0xc) & 0x1f) |
             ((((uVar1 & sfmt->Rmask) >> (sfmt->Rshift & 0x1f)) << (sfmt->Rloss & 0x1f)) >>
             (*(byte *)(in_t0 + 6) & 0x1f)) << (*(byte *)(in_t0 + 10) & 0x1f) |
             ((((uVar1 & sfmt->Gmask) >> (sfmt->Gshift & 0x1f)) << (sfmt->Gloss & 0x1f)) >>
             (*(byte *)(in_t0 + 7) & 0x1f)) << (*(byte *)(in_t0 + 0xb) & 0x1f) |
             ((uVar1 >> 0x18) >> (*(byte *)(in_t0 + 9) & 0x1f)) << (*(byte *)(in_t0 + 0xd) & 0x1f);
      src = (void *)((int)src + 4);
      dst = dst + 1;
    } while (n != iVar2);
  }
  return n << 2;
}



----------------------------------------

// Function: getpix_8 @ 0892d280

Uint32 getpix_8(Uint8 *srcbuf)

{
  return (uint)*srcbuf;
}



----------------------------------------

// Function: getpix_16 @ 0892d288

Uint32 getpix_16(Uint8 *srcbuf)

{
  return (uint)*(ushort *)srcbuf;
}



----------------------------------------

// Function: getpix_24 @ 0892d290

Uint32 getpix_24(Uint8 *srcbuf)

{
  return (uint)*srcbuf + (uint)srcbuf[1] * 0x100 + (uint)srcbuf[2] * 0x10000;
}



----------------------------------------

// Function: getpix_32 @ 0892d2b0

Uint32 getpix_32(Uint8 *srcbuf)

{
  return *(Uint32 *)srcbuf;
}



----------------------------------------

// Function: SDL_RLEAlphaBlit @ 0892d2b8

int SDL_RLEAlphaBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  byte bVar1;
  ushort uVar2;
  ushort uVar3;
  SDL_BlitMap *pSVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  int iVar10;
  ushort *puVar11;
  uint uVar12;
  uint uVar13;
  uint *puVar14;
  int iVar15;
  uint *puVar16;
  uint uVar17;
  int iVar18;
  int iVar19;
  uint *src0;
  int iVar20;
  int iVar21;
  SDL_PixelFormat *pSVar22;
  int iVar23;
  
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: Uint8 * srcbuf@[???]
                       Unresolved local var: Uint8 * dstbuf@[???]
                       Unresolved local var: SDL_PixelFormat * df@[???] */
  iVar21 = src->w;
  pSVar22 = dst->format;
  if ((dst->offset == 0) && ((dst->flags & 0x4005) == 0)) {
    pSVar4 = src->map;
  }
  else {
    iVar15 = SDL_LockSurface(dst);
    if (iVar15 < 0) {
      return -1;
    }
    pSVar4 = src->map;
  }
                    /* Unresolved local var: int vskip@[???] */
  iVar15 = (int)srcrect->y;
  uVar17 = (uint)pSVar22->BytesPerPixel;
  src0 = (uint *)((int)pSVar4->sw_data->aux_data + 0x18);
  if (iVar15 != 0) {
                    /* Unresolved local var: int ofs@[???] */
    iVar18 = 0;
    if (uVar17 == 2) {
      iVar23 = 0;
LAB_0892d694:
      do {
        bVar1 = *(byte *)((int)src0 + 1);
        puVar14 = src0;
        while( true ) {
          uVar6 = (uint)bVar1;
          src0 = (uint *)((int)puVar14 + 2);
          iVar23 = iVar23 + (uint)(byte)*puVar14;
          if (uVar6 != 0) break;
          if (iVar23 == 0) goto LAB_0892d3d8;
          if (iVar21 <= iVar23) goto LAB_0892d6bc;
          bVar1 = *(byte *)((int)puVar14 + 3);
          puVar14 = src0;
        }
                    /* Unresolved local var: int run@[???] */
        iVar23 = iVar23 + uVar6;
        src0 = (uint *)((int)src0 + uVar6 * 2);
      } while (iVar23 < iVar21);
LAB_0892d6bc:
      src0 = (uint *)((int)src0 + ((uint)src0 & 2));
      iVar23 = 0;
      do {
                    /* Unresolved local var: int run@[???] */
        iVar23 = iVar23 + (uint)(ushort)*src0 + (uint)*(ushort *)((int)src0 + 2);
        src0 = src0 + *(ushort *)((int)src0 + 2) + 1;
      } while (iVar23 < iVar21);
      iVar18 = iVar18 + 1;
      if (iVar18 != iVar15) {
        iVar23 = 0;
        goto LAB_0892d694;
      }
    }
    else {
      iVar15 = iVar15 << 1;
      iVar18 = 0;
LAB_0892d368:
      do {
        uVar2 = *(ushort *)((int)src0 + 2);
        puVar14 = src0;
        while( true ) {
          uVar6 = (uint)uVar2;
          src0 = puVar14 + 1;
          iVar18 = iVar18 + (uint)(ushort)*puVar14;
          if (uVar6 != 0) break;
          if (iVar18 == 0) goto LAB_0892d3d8;
          if (iVar21 <= iVar18) goto LAB_0892d390;
          uVar2 = *(ushort *)((int)puVar14 + 6);
          puVar14 = src0;
        }
                    /* Unresolved local var: int run@[???] */
        iVar18 = iVar18 + uVar6;
        src0 = src0 + uVar6;
      } while (iVar18 < iVar21);
LAB_0892d390:
      iVar15 = iVar15 + -1;
      if (iVar15 != 0) {
        iVar18 = 0;
        goto LAB_0892d368;
      }
    }
  }
  iVar15 = (int)srcrect->x;
  iVar18 = (int)dst->pixels + (int)dstrect->x * uVar17 + (int)dstrect->y * (uint)dst->pitch;
  if (iVar15 == 0) {
    if ((uint)srcrect->w != src->w) {
      pSVar22 = dst->format;
      goto LAB_0892d3c0;
    }
    if (uVar17 == 2) {
      if (pSVar22->Gmask == 0x7e0) {
        uVar17 = (uint)srcrect->h;
      }
      else {
        uVar17 = (uint)srcrect->h;
        if ((pSVar22->Rmask != 0x7e0) && (pSVar22->Bmask != 0x7e0)) {
                    /* Unresolved local var: int linecount@[???] */
          uVar6 = 0;
          while( true ) {
            iVar15 = 0;
            do {
              uVar7 = *src0;
              uVar8 = (uint)*(byte *)((int)src0 + 1);
              src0 = (uint *)((int)src0 + 2);
              iVar15 = iVar15 + (uint)(byte)uVar7;
              if (uVar8 == 0) {
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
                if (iVar15 == 0) {
                  iVar21 = dst->offset;
                  goto LAB_0892d3dc;
                }
              }
              else {
                memcpy((void *)(iVar18 + iVar15 * 2),src0,uVar8 * 2);
                iVar15 = uVar8 + iVar15;
                src0 = (uint *)((int)src0 + uVar8 * 2);
              }
              uVar7 = DAT_089e14a0;
            } while (iVar15 < iVar21);
            src0 = (uint *)((int)src0 + ((uint)src0 & 2));
            iVar15 = 0;
                    /* Unresolved local var: uint run@[???] */
            uVar2 = (ushort)*src0;
            while( true ) {
              uVar8 = (uint)*(ushort *)((int)src0 + 2);
              src0 = src0 + 1;
              iVar15 = iVar15 + (uint)uVar2;
              if (uVar8 != 0) {
                    /* Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: uint i@[???] */
                puVar11 = (ushort *)(iVar15 * 2 + iVar18);
                uVar9 = 0;
                do {
                    /* Unresolved local var: Uint32 src@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???] */
                  uVar13 = *src0;
                  uVar9 = uVar9 + 1;
                  uVar12 = CONCAT22(*puVar11,*puVar11) & uVar7;
                  src0 = src0 + 1;
                  uVar12 = uVar12 + (((uVar13 & 0x3ff) >> 5) * ((uVar13 & uVar7) - uVar12) >> 5) &
                           uVar7;
                  *puVar11 = (ushort)(uVar12 >> 0x10) | (ushort)uVar12;
                  puVar11 = puVar11 + 1;
                } while (uVar8 != uVar9);
                iVar15 = uVar8 + iVar15;
              }
              if (iVar21 <= iVar15) break;
              uVar2 = (ushort)*src0;
            }
            uVar6 = uVar6 + 1;
            if (uVar6 == uVar17) break;
            iVar18 = iVar18 + (uint)dst->pitch;
          }
          goto LAB_0892d3d8;
        }
      }
                    /* Unresolved local var: int linecount@[???] */
      uVar6 = 0;
      while( true ) {
        iVar15 = 0;
        do {
          uVar7 = *src0;
          uVar8 = (uint)*(byte *)((int)src0 + 1);
          src0 = (uint *)((int)src0 + 2);
          iVar15 = iVar15 + (uint)(byte)uVar7;
          if (uVar8 == 0) {
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
            if (iVar15 == 0) {
              iVar21 = dst->offset;
              goto LAB_0892d3dc;
            }
          }
          else {
            memcpy((void *)(iVar18 + iVar15 * 2),src0,uVar8 * 2);
            iVar15 = uVar8 + iVar15;
            src0 = (uint *)((int)src0 + uVar8 * 2);
          }
          uVar7 = DAT_089e149c;
        } while (iVar15 < iVar21);
        src0 = (uint *)((int)src0 + ((uint)src0 & 2));
        iVar15 = 0;
                    /* Unresolved local var: uint run@[???] */
        uVar2 = (ushort)*src0;
        while( true ) {
          uVar8 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar15 = iVar15 + (uint)uVar2;
          if (uVar8 != 0) {
                    /* Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: uint i@[???] */
            puVar11 = (ushort *)(iVar15 * 2 + iVar18);
            uVar9 = 0;
            do {
                    /* Unresolved local var: Uint32 src@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???] */
              uVar13 = *src0;
              uVar9 = uVar9 + 1;
              uVar12 = CONCAT22(*puVar11,*puVar11) & uVar7;
              src0 = src0 + 1;
              uVar12 = uVar12 + (((uVar13 & 0x3ff) >> 5) * ((uVar13 & uVar7) - uVar12) >> 5) & uVar7
              ;
              *puVar11 = (ushort)(uVar12 >> 0x10) | (ushort)uVar12;
              puVar11 = puVar11 + 1;
            } while (uVar8 != uVar9);
            iVar15 = uVar8 + iVar15;
          }
          if (iVar21 <= iVar15) break;
          uVar2 = (ushort)*src0;
        }
        uVar6 = uVar6 + 1;
        if (uVar6 == uVar17) break;
        iVar18 = iVar18 + (uint)dst->pitch;
      }
    }
    else {
      if (uVar17 != 4) {
        iVar21 = dst->offset;
        goto LAB_0892d3dc;
      }
                    /* Unresolved local var: int linecount@[???] */
      uVar2 = srcrect->h;
      uVar17 = 0;
      while( true ) {
        iVar15 = 0;
        do {
          uVar6 = *src0;
          uVar7 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar15 = iVar15 + (uint)(ushort)uVar6;
          if (uVar7 == 0) {
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
            if (iVar15 == 0) {
              iVar21 = dst->offset;
              goto LAB_0892d3dc;
            }
          }
          else {
            memcpy((void *)(iVar18 + iVar15 * 4),src0,uVar7 * 4);
            iVar15 = uVar7 + iVar15;
            src0 = src0 + uVar7;
          }
          uVar6 = DAT_089e14a4;
        } while (iVar15 < iVar21);
        iVar15 = 0;
                    /* Unresolved local var: uint run@[???] */
        uVar3 = (ushort)*src0;
        while( true ) {
          uVar7 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar15 = iVar15 + (uint)uVar3;
          if (uVar7 != 0) {
                    /* Unresolved local var: Uint32 * dst@[???]
                       Unresolved local var: uint i@[???] */
            puVar14 = (uint *)(iVar15 * 4 + iVar18);
            uVar8 = 0;
            do {
                    /* Unresolved local var: Uint32 src@[???] */
              uVar9 = *src0;
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???] */
              uVar8 = uVar8 + 1;
              uVar13 = *puVar14 & 0xff00;
              uVar12 = *puVar14 & uVar6;
              src0 = src0 + 1;
              *puVar14 = uVar12 + ((uVar9 >> 0x18) * ((uVar9 & uVar6) - uVar12) >> 8) & uVar6 |
                         uVar13 + ((uVar9 >> 0x18) * ((uVar9 & 0xff00) - uVar13) >> 8) & 0xff00;
              puVar14 = puVar14 + 1;
            } while (uVar7 != uVar8);
            iVar15 = uVar7 + iVar15;
          }
          if (iVar21 <= iVar15) break;
          uVar3 = (ushort)*src0;
        }
        uVar17 = uVar17 + 1;
        if (uVar17 == uVar2) break;
        iVar18 = iVar18 + (uint)dst->pitch;
      }
    }
  }
  else {
                    /* Unresolved local var: SDL_PixelFormat * df@[???] */
    pSVar22 = dst->format;
LAB_0892d3c0:
    if (pSVar22->BytesPerPixel == '\x02') {
      if (pSVar22->Gmask == 0x7e0) {
        uVar17 = (uint)srcrect->w;
      }
      else if (pSVar22->Rmask == 0x7e0) {
        uVar17 = (uint)srcrect->w;
      }
      else {
        if (pSVar22->Bmask != 0x7e0) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar2 = srcrect->h;
          iVar18 = iVar18 + iVar15 * -2;
          iVar23 = iVar15 + (uint)srcrect->w;
          uVar17 = 0;
          while( true ) {
            iVar20 = 0;
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
            bVar1 = (byte)*src0;
            while( true ) {
              uVar6 = (uint)*(byte *)((int)src0 + 1);
              src0 = (uint *)((int)src0 + 2);
              iVar20 = iVar20 + (uint)bVar1;
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
              if (uVar6 == 0) {
                if (iVar20 == 0) {
                  iVar21 = dst->offset;
                  goto LAB_0892d3dc;
                }
              }
              else {
                uVar7 = uVar6;
                iVar19 = iVar20;
                if (0 < iVar15 - iVar20) {
                  uVar7 = uVar6 - (iVar15 - iVar20);
                  iVar19 = iVar15;
                }
                iVar10 = iVar19 - iVar20;
                iVar5 = uVar7 + (iVar23 - iVar19);
                iVar20 = iVar20 + uVar6;
                if (0 < iVar5) {
                  memcpy((void *)(iVar18 + iVar19 * 2),(ushort *)((int)src0 + iVar10 * 2),iVar5 * 2)
                  ;
                }
                src0 = (uint *)((int)src0 + uVar6 * 2);
              }
              uVar6 = DAT_089e14a0;
              if (iVar21 <= iVar20) break;
              bVar1 = (byte)*src0;
            }
            src0 = (uint *)((int)src0 + ((uint)src0 & 2));
            iVar20 = 0;
                    /* Unresolved local var: uint run@[???] */
            uVar3 = (ushort)*src0;
            while( true ) {
              uVar7 = (uint)*(ushort *)((int)src0 + 2);
              src0 = src0 + 1;
              iVar20 = iVar20 + (uint)uVar3;
              if (uVar7 != 0) {
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
                iVar19 = iVar20;
                uVar8 = uVar7;
                if (0 < iVar15 - iVar20) {
                  iVar19 = iVar15;
                  uVar8 = uVar7 - (iVar15 - iVar20);
                }
                iVar5 = uVar8 + (iVar23 - iVar19);
                if (0 < iVar5) {
                  puVar14 = src0 + (iVar19 - iVar20);
                  puVar11 = (ushort *)(iVar19 * 2 + iVar18);
                  iVar19 = 0;
                  do {
                    /* Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???] */
                    uVar9 = *puVar14;
                    iVar19 = iVar19 + 1;
                    uVar8 = CONCAT22(*puVar11,*puVar11) & uVar6;
                    puVar14 = puVar14 + 1;
                    uVar8 = uVar8 + (((uVar9 & 0x3ff) >> 5) * ((uVar9 & uVar6) - uVar8) >> 5) &
                            uVar6;
                    *puVar11 = (ushort)(uVar8 >> 0x10) | (ushort)uVar8;
                    puVar11 = puVar11 + 1;
                  } while (iVar19 != iVar5);
                }
                src0 = src0 + uVar7;
                iVar20 = iVar20 + uVar7;
              }
              if (iVar21 <= iVar20) break;
              uVar3 = (ushort)*src0;
            }
            uVar17 = uVar17 + 1;
            if (uVar17 == uVar2) break;
            iVar18 = iVar18 + (uint)dst->pitch;
          }
          goto LAB_0892d3d8;
        }
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
        uVar17 = (uint)srcrect->w;
      }
      uVar2 = srcrect->h;
      iVar18 = iVar18 + iVar15 * -2;
      uVar6 = 0;
      while( true ) {
        iVar23 = 0;
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
        bVar1 = (byte)*src0;
        while( true ) {
          uVar7 = (uint)*(byte *)((int)src0 + 1);
          src0 = (uint *)((int)src0 + 2);
          iVar23 = iVar23 + (uint)bVar1;
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
          if (uVar7 == 0) {
            if (iVar23 == 0) {
              iVar21 = dst->offset;
              goto LAB_0892d3dc;
            }
          }
          else {
            uVar8 = uVar7;
            iVar20 = iVar23;
            if (0 < iVar15 - iVar23) {
              uVar8 = uVar7 - (iVar15 - iVar23);
              iVar20 = iVar15;
            }
            iVar5 = iVar20 - iVar23;
            iVar19 = uVar8 + ((iVar15 + uVar17) - iVar20);
            iVar23 = iVar23 + uVar7;
            if (0 < iVar19) {
              memcpy((void *)(iVar18 + iVar20 * 2),(ushort *)((int)src0 + iVar5 * 2),iVar19 * 2);
            }
            src0 = (uint *)((int)src0 + uVar7 * 2);
          }
          uVar7 = DAT_089e149c;
          if (iVar21 <= iVar23) break;
          bVar1 = (byte)*src0;
        }
        src0 = (uint *)((int)src0 + ((uint)src0 & 2));
        iVar23 = 0;
                    /* Unresolved local var: uint run@[???] */
        uVar3 = (ushort)*src0;
        while( true ) {
          uVar8 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar23 = iVar23 + (uint)uVar3;
          if (uVar8 != 0) {
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
            iVar20 = iVar23;
            uVar9 = uVar8;
            if (0 < iVar15 - iVar23) {
              iVar20 = iVar15;
              uVar9 = uVar8 - (iVar15 - iVar23);
            }
            iVar19 = uVar9 + ((iVar15 + uVar17) - iVar20);
            if (0 < iVar19) {
              puVar14 = src0 + (iVar20 - iVar23);
              puVar11 = (ushort *)(iVar20 * 2 + iVar18);
              iVar20 = 0;
              do {
                    /* Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???] */
                uVar12 = *puVar14;
                iVar20 = iVar20 + 1;
                uVar9 = CONCAT22(*puVar11,*puVar11) & uVar7;
                puVar14 = puVar14 + 1;
                uVar9 = uVar9 + (((uVar12 & 0x3ff) >> 5) * ((uVar12 & uVar7) - uVar9) >> 5) & uVar7;
                *puVar11 = (ushort)(uVar9 >> 0x10) | (ushort)uVar9;
                puVar11 = puVar11 + 1;
              } while (iVar20 != iVar19);
            }
            src0 = src0 + uVar8;
            iVar23 = iVar23 + uVar8;
          }
          if (iVar21 <= iVar23) break;
          uVar3 = (ushort)*src0;
        }
        uVar6 = uVar6 + 1;
        if (uVar2 == uVar6) break;
        iVar18 = iVar18 + (uint)dst->pitch;
      }
    }
    else if (pSVar22->BytesPerPixel == '\x04') {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
      uVar2 = srcrect->h;
      iVar18 = iVar18 + iVar15 * -4;
      iVar23 = iVar15 + (uint)srcrect->w;
      uVar17 = 0;
      while( true ) {
        iVar20 = 0;
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
        uVar3 = (ushort)*src0;
        while( true ) {
          uVar6 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar20 = iVar20 + (uint)uVar3;
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
          if (uVar6 == 0) {
            if (iVar20 == 0) {
              iVar21 = dst->offset;
              goto LAB_0892d3dc;
            }
          }
          else {
            uVar7 = uVar6;
            iVar19 = iVar20;
            if (0 < iVar15 - iVar20) {
              uVar7 = uVar6 - (iVar15 - iVar20);
              iVar19 = iVar15;
            }
            iVar10 = iVar19 - iVar20;
            iVar5 = uVar7 + (iVar23 - iVar19);
            iVar20 = iVar20 + uVar6;
            if (0 < iVar5) {
              memcpy((void *)(iVar18 + iVar19 * 4),src0 + iVar10,iVar5 * 4);
            }
            src0 = src0 + uVar6;
          }
          uVar6 = DAT_089e14a4;
          if (iVar21 <= iVar20) break;
          uVar3 = (ushort)*src0;
        }
        iVar20 = 0;
                    /* Unresolved local var: uint run@[???] */
        uVar3 = (ushort)*src0;
        while( true ) {
          uVar7 = (uint)*(ushort *)((int)src0 + 2);
          src0 = src0 + 1;
          iVar20 = iVar20 + (uint)uVar3;
          if (uVar7 != 0) {
                    /* Unresolved local var: int cofs@[???]
                       Unresolved local var: int crun@[???] */
            iVar19 = iVar20;
            uVar8 = uVar7;
            if (0 < iVar15 - iVar20) {
              iVar19 = iVar15;
              uVar8 = uVar7 - (iVar15 - iVar20);
            }
            iVar5 = uVar8 + (iVar23 - iVar19);
            if (0 < iVar5) {
              puVar16 = src0 + (iVar19 - iVar20);
              puVar14 = (uint *)(iVar19 * 4 + iVar18);
              iVar19 = 0;
              do {
                    /* Unresolved local var: Uint32 * dst@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???] */
                uVar8 = *puVar16;
                iVar19 = iVar19 + 1;
                uVar12 = *puVar14 & 0xff00;
                uVar9 = *puVar14 & uVar6;
                puVar16 = puVar16 + 1;
                *puVar14 = uVar9 + ((uVar8 >> 0x18) * ((uVar8 & uVar6) - uVar9) >> 8) & uVar6 |
                           uVar12 + ((uVar8 >> 0x18) * ((uVar8 & 0xff00) - uVar12) >> 8) & 0xff00;
                puVar14 = puVar14 + 1;
              } while (iVar5 != iVar19);
            }
            src0 = src0 + uVar7;
            iVar20 = iVar20 + uVar7;
          }
          if (iVar21 <= iVar20) break;
          uVar3 = (ushort)*src0;
        }
        uVar17 = uVar17 + 1;
        if (uVar17 == uVar2) break;
        iVar18 = iVar18 + (uint)dst->pitch;
      }
    }
  }
LAB_0892d3d8:
  iVar21 = dst->offset;
LAB_0892d3dc:
  if ((iVar21 != 0) || ((dst->flags & 0x4005) != 0)) {
    SDL_UnlockSurface(dst);
  }
  return 0;
}



----------------------------------------

// Function: SDL_RLEBlit @ 0892dd10

/* WARNING: Control flow encountered bad instruction data */

int SDL_RLEBlit(SDL_Surface *src,SDL_Rect *srcrect,SDL_Surface *dst,SDL_Rect *dstrect)

{
  Uint8 UVar1;
  byte bVar2;
  byte bVar3;
  ushort uVar4;
  ushort uVar5;
  undefined2 uVar6;
  uint *puVar7;
  SDL_BlitMap *pSVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  uint uVar12;
  int iVar13;
  void *dst0;
  int iVar14;
  uint uVar15;
  int iVar16;
  uint uVar17;
  uint *puVar18;
  int iVar19;
  uint uVar20;
  uint *puVar21;
  uint uVar22;
  uint uVar23;
  byte *pbVar24;
  uint uVar25;
  uint uVar26;
  uint uVar27;
  uint uVar28;
  uint uVar29;
  uint uVar30;
  ushort *puVar31;
  ushort *puVar32;
  uint *src0;
  uint uVar33;
  uint uVar34;
  int iVar35;
  SDL_PixelFormat *pSVar36;
  uint uVar37;
  byte *pbVar38;
  uint uVar39;
  int local_50;
  uint local_4c;
  int local_3c;
  
                    /* Unresolved local var: Uint8 * dstbuf@[???]
                       Unresolved local var: Uint8 * srcbuf@[???]
                       Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: uint alpha@[???] */
  uVar39 = src->w;
  if ((dst->offset == 0) && ((dst->flags & 0x4005) == 0)) {
    pSVar8 = src->map;
  }
  else {
    iVar14 = SDL_LockSurface(dst);
    if (iVar14 < 0) {
      return -1;
    }
    pSVar8 = src->map;
  }
  pSVar36 = src->format;
                    /* Unresolved local var: int vskip@[???]
                       Unresolved local var: int ofs@[???] */
  iVar14 = (int)srcrect->y;
  src0 = pSVar8->sw_data->aux_data;
  uVar10 = (uint)dst->pitch;
  uVar22 = (uint)pSVar36->BytesPerPixel;
  if (iVar14 == 0) {
LAB_0892ddc8:
    uVar15 = src->flags;
  }
  else {
    if (uVar22 == 2) {
      uVar15 = 0;
                    /* Unresolved local var: int run@[???] */
      bVar3 = *(byte *)((int)src0 + 1);
LAB_0892e200:
      uVar37 = (uint)bVar3;
      uVar34 = *src0;
      src0 = (uint *)((int)src0 + 2);
      uVar15 = uVar15 + (byte)uVar34;
      if (uVar37 == 0) goto LAB_0892e248;
      do {
        src0 = (uint *)((int)src0 + uVar37 * 2);
        uVar15 = uVar15 + uVar37;
        while( true ) {
          if (uVar15 != uVar39) {
            bVar3 = *(byte *)((int)src0 + 1);
            goto LAB_0892e200;
          }
          iVar14 = iVar14 + -1;
          if (iVar14 == 0) goto LAB_0892ddc8;
          uVar37 = (uint)*(byte *)((int)src0 + 1);
          uVar15 = (uint)(byte)*src0;
          src0 = (uint *)((int)src0 + 2);
          if (uVar37 != 0) break;
LAB_0892e248:
          if (uVar15 == 0) goto LAB_0892de54;
        }
      } while( true );
    }
    if (2 < uVar22) {
      if (uVar22 == 3) {
        uVar15 = 0;
                    /* Unresolved local var: int run@[???] */
        bVar3 = (byte)*src0;
        do {
          uVar15 = uVar15 + bVar3;
          puVar18 = src0;
          if (*(byte *)((int)src0 + 1) != 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
            halt_baddata();
          }
          while( true ) {
            src0 = (uint *)((int)puVar18 + 2);
            if (uVar15 == 0) goto LAB_0892de54;
            if (uVar15 != uVar39) break;
            iVar14 = iVar14 + -1;
            if (iVar14 == 0) goto LAB_0892ddc8;
            uVar15 = (uint)*(byte *)src0;
            pbVar24 = (byte *)((int)puVar18 + 3);
            puVar18 = src0;
            if (*pbVar24 != 0) {
              halt_baddata();
            }
          }
          bVar3 = *(byte *)src0;
        } while( true );
      }
      uVar15 = 0;
      if (uVar22 == 4) {
                    /* Unresolved local var: int run@[???] */
        uVar4 = *(ushort *)((int)src0 + 2);
LAB_0892e984:
        uVar37 = (uint)uVar4;
        uVar34 = *src0;
        src0 = src0 + 1;
        uVar15 = uVar15 + (ushort)uVar34;
        if (uVar37 == 0) goto LAB_0892e9cc;
        do {
          src0 = src0 + uVar37;
          uVar15 = uVar15 + uVar37;
          while( true ) {
            if (uVar15 != uVar39) {
              uVar4 = *(ushort *)((int)src0 + 2);
              goto LAB_0892e984;
            }
            iVar14 = iVar14 + -1;
            if (iVar14 == 0) goto LAB_0892ddc8;
            uVar37 = (uint)*(ushort *)((int)src0 + 2);
            uVar15 = (uint)(ushort)*src0;
            src0 = src0 + 1;
            if (uVar37 != 0) break;
LAB_0892e9cc:
            if (uVar15 == 0) goto LAB_0892de54;
          }
        } while( true );
      }
      goto LAB_0892ddc8;
    }
    if (uVar22 == 1) {
      uVar15 = 0;
                    /* Unresolved local var: int run@[???] */
      bVar3 = (byte)*src0;
LAB_0892ded4:
      uVar34 = (uint)*(byte *)((int)src0 + 1);
      src0 = (uint *)((int)src0 + 2);
      uVar15 = uVar15 + bVar3;
      if (uVar34 == 0) goto LAB_0892df14;
      do {
        uVar15 = uVar15 + uVar34;
        src0 = (uint *)((int)src0 + uVar34);
        while( true ) {
          if (uVar15 != uVar39) {
            bVar3 = (byte)*src0;
            goto LAB_0892ded4;
          }
          iVar14 = iVar14 + -1;
          if (iVar14 == 0) goto LAB_0892ddc8;
          uVar15 = (uint)(byte)*src0;
          uVar34 = (uint)*(byte *)((int)src0 + 1);
          src0 = (uint *)((int)src0 + 2);
          if (uVar34 != 0) break;
LAB_0892df14:
          if (uVar15 == 0) goto LAB_0892de54;
        }
      } while( true );
    }
    uVar15 = src->flags;
  }
  if ((uVar15 & 0x10000) == 0) {
    uVar15 = 0xff;
  }
  else {
    uVar15 = (uint)pSVar36->alpha;
  }
  iVar14 = (int)srcrect->x;
  local_3c = (int)dst->pixels + (int)dstrect->x * uVar22 + (int)dstrect->y * uVar10;
  if ((iVar14 == 0) && ((uint)srcrect->w == src->w)) {
                    /* Unresolved local var: SDL_PixelFormat * fmt@[???] */
    if (uVar15 == 0xff) {
      if (uVar22 == 2) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
        uVar10 = (uint)srcrect->h;
        do {
          uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
          bVar3 = (byte)*src0;
          while( true ) {
            uVar15 = (uint)*(byte *)((int)src0 + 1);
            puVar18 = (uint *)((int)src0 + 2);
            uVar22 = uVar22 + bVar3;
            if (uVar15 == 0) {
              src0 = puVar18;
              if (uVar22 == 0) goto LAB_0892de54;
            }
            else {
              src0 = (uint *)((int)puVar18 + uVar15 * 2);
              memcpy((void *)(local_3c + uVar22 * 2),puVar18,uVar15 * 2);
              uVar22 = uVar22 + uVar15;
            }
            if (uVar22 == uVar39) break;
            bVar3 = (byte)*src0;
          }
          uVar10 = uVar10 - 1;
          local_3c = local_3c + (uint)dst->pitch;
        } while (uVar10 != 0);
      }
      else if (uVar22 < 3) {
        if (uVar22 == 1) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
          uVar10 = (uint)srcrect->h;
          do {
            uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
            bVar3 = (byte)*src0;
            while( true ) {
              uVar15 = (uint)*(byte *)((int)src0 + 1);
              src0 = (uint *)((int)src0 + 2);
              uVar22 = uVar22 + bVar3;
              dst0 = (void *)(local_3c + uVar22);
              if (uVar15 == 0) {
                if (uVar22 == 0) goto LAB_0892de54;
              }
              else {
                uVar22 = uVar15 + uVar22;
                memcpy(dst0,src0,uVar15);
                src0 = (uint *)((int)src0 + uVar15);
              }
              if (uVar22 == uVar39) break;
              bVar3 = (byte)*src0;
            }
            uVar10 = uVar10 - 1;
            local_3c = local_3c + (uint)dst->pitch;
          } while (uVar10 != 0);
        }
      }
      else if (uVar22 == 3) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
        uVar10 = (uint)srcrect->h;
        while( true ) {
          uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
          bVar3 = (byte)*src0;
          while( true ) {
            uVar15 = (uint)*(byte *)((int)src0 + 1);
            puVar18 = (uint *)((int)src0 + 2);
            uVar22 = uVar22 + bVar3;
            if (uVar15 == 0) {
              src0 = puVar18;
              if (uVar22 == 0) goto LAB_0892de54;
            }
            else {
              src0 = (uint *)((int)puVar18 + uVar15 * 3);
              iVar14 = uVar22 * 3;
              uVar22 = uVar22 + uVar15;
              memcpy((void *)(local_3c + iVar14),puVar18,uVar15 * 3);
            }
            if (uVar22 == uVar39) break;
            bVar3 = (byte)*src0;
          }
          uVar10 = uVar10 - 1;
          if (uVar10 == 0) break;
          local_3c = local_3c + (uint)dst->pitch;
        }
      }
      else if (uVar22 == 4) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
        uVar10 = (uint)srcrect->h;
        do {
          uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
          uVar4 = (ushort)*src0;
          while( true ) {
            uVar15 = (uint)*(ushort *)((int)src0 + 2);
            puVar18 = src0 + 1;
            uVar22 = uVar22 + uVar4;
            if (uVar15 == 0) {
              src0 = puVar18;
              if (uVar22 == 0) goto LAB_0892de54;
            }
            else {
              src0 = puVar18 + uVar15;
              memcpy((void *)(local_3c + uVar22 * 4),puVar18,uVar15 * 4);
              uVar22 = uVar22 + uVar15;
            }
            if (uVar22 == uVar39) break;
            uVar4 = (ushort)*src0;
          }
          uVar10 = uVar10 - 1;
          local_3c = local_3c + (uint)dst->pitch;
        } while (uVar10 != 0);
      }
    }
    else {
      if (uVar22 == 3) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
        uVar22 = (uint)srcrect->h;
        uVar10 = 0;
                    /* Unresolved local var: uint run@[???] */
        bVar3 = (byte)*src0;
        do {
          bVar2 = *(byte *)((int)src0 + 1);
          uVar10 = uVar10 + bVar3;
          puVar18 = src0;
          while( true ) {
            uVar34 = (uint)bVar2;
            src0 = (uint *)((int)puVar18 + 2);
            if (uVar34 != 0) {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
              if (uVar34 != 0) {
                uVar39 = 0;
                pbVar24 = (byte *)(local_3c + uVar10 * 3);
                do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                  uVar17 = (uint)pSVar36->Rshift;
                  uVar37 = (uint)pSVar36->Rloss;
                  uVar10 = (uint)pbVar24[1] << 8 | (uint)pbVar24[2] << 0x10 | (uint)*pbVar24;
                  uVar22 = (uint)*(byte *)((int)src0 + 1) << 8 |
                           (uint)*(byte *)((int)src0 + 2) << 0x10 | (uint)(byte)*src0;
                  iVar11 = ((uVar10 & pSVar36->Rmask) >> (uVar17 & 0x1f)) << (uVar37 & 0x1f);
                  uVar23 = (uint)pSVar36->Gshift;
                  uVar33 = (uint)pSVar36->Gloss;
                  iVar9 = ((uVar10 & pSVar36->Gmask) >> (uVar23 & 0x1f)) << (uVar33 & 0x1f);
                  uVar20 = (uint)pSVar36->Bshift;
                  uVar12 = (uint)pSVar36->Bloss;
                  iVar14 = ((uVar10 & pSVar36->Bmask) >> (uVar20 & 0x1f)) << (uVar12 & 0x1f);
                  uVar39 = uVar39 + 1;
                  src0 = (uint *)((int)src0 + 3);
                  uVar10 = (iVar11 + (uVar15 * ((((uVar22 & pSVar36->Rmask) >> (uVar17 & 0x1f)) <<
                                                (uVar37 & 0x1f)) - iVar11) >> 8) >> (uVar37 & 0x1f))
                           << (uVar17 & 0x1f) |
                           (iVar9 + (uVar15 * ((((uVar22 & pSVar36->Gmask) >> (uVar23 & 0x1f)) <<
                                               (uVar33 & 0x1f)) - iVar9) >> 8) >> (uVar33 & 0x1f))
                           << (uVar23 & 0x1f) |
                           (iVar14 + (uVar15 * ((((uVar22 & pSVar36->Bmask) >> (uVar20 & 0x1f)) <<
                                                (uVar12 & 0x1f)) - iVar14) >> 8) >> (uVar12 & 0x1f))
                           << (uVar20 & 0x1f);
                  pbVar24[1] = (byte)(uVar10 >> 8);
                  pbVar24[2] = (byte)(uVar10 >> 0x10);
                  *pbVar24 = (byte)uVar10;
                  pbVar24 = pbVar24 + 3;
                } while (uVar39 != uVar34);
              }
                    /* WARNING: Bad instruction - Truncating control flow here */
              halt_baddata();
            }
            if (uVar10 == 0) {
              iVar14 = dst->offset;
              goto LAB_0892de58;
            }
            if (uVar10 != uVar39) break;
            uVar22 = uVar22 - 1;
            if (uVar22 == 0) goto LAB_0892de54;
            local_3c = local_3c + (uint)dst->pitch;
            uVar10 = (uint)*(byte *)src0;
            bVar2 = *(byte *)((int)puVar18 + 3);
            puVar18 = src0;
          }
          bVar3 = *(byte *)src0;
        } while( true );
      }
      if (uVar22 == 4) {
        if ((pSVar36->Rmask | pSVar36->Gmask | pSVar36->Bmask) == 0xffffff) {
          if (((pSVar36->Gmask == 0xff00) || (pSVar36->Rmask == 0xff00)) ||
             (pSVar36->Bmask == 0xff00)) {
            if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar22 = (uint)srcrect->h;
              while( true ) {
                uVar15 = 0;
                    /* Unresolved local var: uint run@[???] */
                uVar4 = (ushort)*src0;
                while( true ) {
                  uVar34 = (uint)*(ushort *)((int)src0 + 2);
                  src0 = src0 + 1;
                  uVar15 = uVar15 + uVar4;
                  if (uVar34 == 0) {
                    if (uVar15 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: Uint32 * dst@[???] */
                    if (uVar34 != 0) {
                      puVar21 = (uint *)(local_3c + uVar15 * 4);
                      uVar37 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar37 = uVar37 + 1;
                        *puVar21 = ((*puVar18 & 0xfefefe) + (*puVar21 & 0xfefefe) >> 1) +
                                   (*puVar21 & *puVar18 & 0x10101);
                        puVar18 = puVar18 + 1;
                        puVar21 = puVar21 + 1;
                      } while (uVar34 != uVar37);
                    }
                    src0 = src0 + uVar34;
                    uVar15 = uVar15 + uVar34;
                  }
                  if (uVar15 == uVar39) break;
                  uVar4 = (ushort)*src0;
                }
                uVar22 = uVar22 - 1;
                if (uVar22 == 0) break;
                local_3c = local_3c + uVar10;
              }
            }
            else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar22 = (uint)srcrect->h;
              while( true ) {
                uVar34 = 0;
                    /* Unresolved local var: uint run@[???] */
                uVar4 = (ushort)*src0;
                while( true ) {
                  uVar37 = (uint)*(ushort *)((int)src0 + 2);
                  src0 = src0 + 1;
                  uVar34 = uVar34 + uVar4;
                  if (uVar37 == 0) {
                    if (uVar34 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: Uint32 * dst@[???] */
                    if (uVar37 != 0) {
                      puVar21 = (uint *)(local_3c + uVar34 * 4);
                      uVar33 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???] */
                        uVar12 = *puVar18;
                        uVar33 = uVar33 + 1;
                        uVar20 = *puVar21 & 0xff00;
                        uVar17 = *puVar21 & 0xff00ff;
                        puVar18 = puVar18 + 1;
                        *puVar21 = uVar17 + (uVar15 * ((uVar12 & 0xff00ff) - uVar17) >> 8) &
                                   0xff00ff |
                                   uVar20 + (uVar15 * ((uVar12 & 0xff00) - uVar20) >> 8) & 0xff00;
                        puVar21 = puVar21 + 1;
                      } while (uVar37 != uVar33);
                    }
                    src0 = src0 + uVar37;
                    uVar34 = uVar34 + uVar37;
                  }
                  if (uVar34 == uVar39) break;
                  uVar4 = (ushort)*src0;
                }
                uVar22 = uVar22 - 1;
                if (uVar22 == 0) break;
                local_3c = local_3c + uVar10;
              }
            }
            goto LAB_0892de54;
          }
          uVar4 = srcrect->h;
        }
        else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
          uVar4 = srcrect->h;
        }
        uVar22 = (uint)uVar4;
        while( true ) {
          uVar34 = 0;
                    /* Unresolved local var: uint run@[???] */
          uVar4 = (ushort)*src0;
          while( true ) {
            uVar37 = (uint)*(ushort *)((int)src0 + 2);
            src0 = src0 + 1;
            uVar34 = uVar34 + uVar4;
            if (uVar37 == 0) {
              if (uVar34 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
            }
            else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
              if (uVar37 != 0) {
                puVar21 = (uint *)(local_3c + uVar34 * 4);
                uVar33 = 0;
                puVar18 = src0;
                do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                  uVar17 = *puVar18;
                  uVar12 = *puVar21;
                  uVar23 = (uint)pSVar36->Rshift;
                  uVar20 = (uint)pSVar36->Rloss;
                  iVar14 = ((uVar12 & pSVar36->Rmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
                  uVar27 = (uint)pSVar36->Gshift;
                  uVar25 = (uint)pSVar36->Gloss;
                  iVar11 = ((uVar12 & pSVar36->Gmask) >> (uVar27 & 0x1f)) << (uVar25 & 0x1f);
                  uVar29 = (uint)pSVar36->Bshift;
                  uVar26 = (uint)pSVar36->Bloss;
                  iVar9 = ((uVar12 & pSVar36->Bmask) >> (uVar29 & 0x1f)) << (uVar26 & 0x1f);
                  uVar33 = uVar33 + 1;
                  puVar18 = puVar18 + 1;
                  *puVar21 = (iVar14 + (uVar15 * ((((uVar17 & pSVar36->Rmask) >> (uVar23 & 0x1f)) <<
                                                  (uVar20 & 0x1f)) - iVar14) >> 8) >>
                             (uVar20 & 0x1f)) << (uVar23 & 0x1f) |
                             (iVar11 + (uVar15 * ((((uVar17 & pSVar36->Gmask) >> (uVar27 & 0x1f)) <<
                                                  (uVar25 & 0x1f)) - iVar11) >> 8) >>
                             (uVar25 & 0x1f)) << (uVar27 & 0x1f) |
                             (iVar9 + (uVar15 * ((((uVar17 & pSVar36->Bmask) >> (uVar29 & 0x1f)) <<
                                                 (uVar26 & 0x1f)) - iVar9) >> 8) >> (uVar26 & 0x1f))
                             << (uVar29 & 0x1f);
                  puVar21 = puVar21 + 1;
                } while (uVar33 != uVar37);
              }
              src0 = src0 + uVar37;
              uVar34 = uVar34 + uVar37;
            }
            if (uVar34 == uVar39) break;
            uVar4 = (ushort)*src0;
          }
          uVar22 = uVar22 - 1;
          if (uVar22 == 0) break;
          local_3c = local_3c + uVar10;
        }
      }
      else if (uVar22 == 2) {
        uVar34 = pSVar36->Rmask;
        uVar37 = pSVar36->Gmask;
        uVar22 = pSVar36->Bmask;
        uVar10 = uVar34 | uVar37 | uVar22;
        if (uVar10 == 0x7fff) {
          if (((uVar37 == 0x3e0) || (uVar34 == 0x3e0)) || (uVar22 == 0x3e0)) {
            if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar10 = (uint)srcrect->h;
              while( true ) {
                uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
                bVar3 = (byte)*src0;
                puVar18 = src0;
                while( true ) {
                  uVar15 = (uint)*(byte *)((int)puVar18 + 1);
                  src0 = (uint *)((int)puVar18 + 2);
                  uVar22 = uVar22 + bVar3;
                  if (uVar15 == 0) {
                    if (uVar22 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: uint n@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???] */
                    puVar21 = (uint *)(local_3c + uVar22 * 2);
                    if ((((uint)src0 ^ (uint)puVar21) & 3) == 0) {
                      puVar7 = src0;
                      uVar34 = uVar15;
                      if (((uint)src0 & 3) != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *(ushort *)puVar21 =
                             (short)((*(ushort *)src0 & 0xfbde) + ((ushort)*puVar21 & 0xfbde) >> 1)
                             + ((ushort)*puVar21 & *(ushort *)src0 & 0x421);
                        puVar21 = (uint *)((int)puVar21 + 2);
                        puVar7 = puVar18 + 1;
                        uVar34 = uVar15 - 1;
                      }
                      for (; 1 < uVar34; uVar34 = uVar34 - 2) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *puVar21 = ((*puVar7 & 0xfbdefbde) >> 1) + ((*puVar21 & 0xfbdefbde) >> 1) +
                                   (*puVar21 & *puVar7 & 0x4210421);
                        puVar21 = puVar21 + 1;
                        puVar7 = puVar7 + 1;
                      }
                      if (uVar34 != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *(ushort *)puVar21 =
                             (short)(((ushort)*puVar7 & 0xfbde) + ((ushort)*puVar21 & 0xfbde) >> 1)
                             + ((ushort)*puVar21 & (ushort)*puVar7 & 0x421);
                      }
                    }
                    else if (uVar15 != 0) {
                      uVar34 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar34 = uVar34 + 1;
                        *(ushort *)puVar21 =
                             (short)(((ushort)*puVar18 & 0xfbde) + ((ushort)*puVar21 & 0xfbde) >> 1)
                             + ((ushort)*puVar21 & (ushort)*puVar18 & 0x421);
                        puVar18 = (uint *)((int)puVar18 + 2);
                        puVar21 = (uint *)((int)puVar21 + 2);
                      } while (uVar34 != uVar15);
                    }
                    src0 = (uint *)((int)src0 + uVar15 * 2);
                    uVar22 = uVar22 + uVar15;
                  }
                  if (uVar22 == uVar39) break;
                  bVar3 = (byte)*src0;
                  puVar18 = src0;
                }
                uVar10 = uVar10 - 1;
                if (uVar10 == 0) break;
                local_3c = local_3c + (uint)dst->pitch;
              }
            }
            else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar10 = (uint)srcrect->h;
              while( true ) {
                uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
                bVar3 = (byte)*src0;
                while( true ) {
                  uVar34 = (uint)*(byte *)((int)src0 + 1);
                  src0 = (uint *)((int)src0 + 2);
                  uVar22 = uVar22 + bVar3;
                  if (uVar34 == 0) {
                    if (uVar22 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 ALPHA@[???] */
                    if (uVar34 != 0) {
                      puVar31 = (ushort *)(local_3c + uVar22 * 2);
                      uVar37 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar33 = *puVar18;
                        uVar37 = uVar37 + 1;
                        uVar12 = CONCAT22(*puVar31,*puVar31) & 0x3e07c1f;
                        puVar18 = (uint *)((int)puVar18 + 2);
                        uVar33 = uVar12 + ((uVar15 >> 3) *
                                           ((CONCAT22((ushort)uVar33,(ushort)uVar33) & 0x3e07c1f) -
                                           uVar12) >> 5) & 0x3e07c1f;
                        *puVar31 = (ushort)(uVar33 >> 0x10) | (ushort)uVar33;
                        puVar31 = puVar31 + 1;
                      } while (uVar34 != uVar37);
                    }
                    src0 = (uint *)((int)src0 + uVar34 * 2);
                    uVar22 = uVar22 + uVar34;
                  }
                  if (uVar22 == uVar39) break;
                  bVar3 = (byte)*src0;
                }
                uVar10 = uVar10 - 1;
                if (uVar10 == 0) break;
                local_3c = local_3c + (uint)dst->pitch;
              }
            }
            goto LAB_0892de54;
          }
          uVar10 = (uint)srcrect->h;
        }
        else if (uVar10 == 0xffff) {
          if (((uVar37 == 0x7e0) || (uVar34 == 0x7e0)) || (uVar22 == 0x7e0)) {
            if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar10 = (uint)srcrect->h;
              while( true ) {
                uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
                bVar3 = (byte)*src0;
                puVar18 = src0;
                while( true ) {
                  uVar15 = (uint)*(byte *)((int)puVar18 + 1);
                  src0 = (uint *)((int)puVar18 + 2);
                  uVar22 = uVar22 + bVar3;
                  if (uVar15 == 0) {
                    if (uVar22 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: uint n@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???] */
                    puVar21 = (uint *)(local_3c + uVar22 * 2);
                    if ((((uint)src0 ^ (uint)puVar21) & 3) == 0) {
                      puVar7 = src0;
                      uVar34 = uVar15;
                      if (((uint)src0 & 3) != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *(ushort *)puVar21 =
                             (short)((*(ushort *)src0 & 0xf7de) + ((ushort)*puVar21 & 0xf7de) >> 1)
                             + ((ushort)*puVar21 & *(ushort *)src0 & 0x821);
                        puVar21 = (uint *)((int)puVar21 + 2);
                        puVar7 = puVar18 + 1;
                        uVar34 = uVar15 - 1;
                      }
                      for (; 1 < uVar34; uVar34 = uVar34 - 2) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *puVar21 = ((*puVar7 & 0xf7def7de) >> 1) + ((*puVar21 & 0xf7def7de) >> 1) +
                                   (*puVar21 & *puVar7 & 0x8210821);
                        puVar21 = puVar21 + 1;
                        puVar7 = puVar7 + 1;
                      }
                      if (uVar34 != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *(ushort *)puVar21 =
                             (short)(((ushort)*puVar7 & 0xf7de) + ((ushort)*puVar21 & 0xf7de) >> 1)
                             + ((ushort)*puVar21 & (ushort)*puVar7 & 0x821);
                      }
                    }
                    else if (uVar15 != 0) {
                      uVar34 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar34 = uVar34 + 1;
                        *(ushort *)puVar21 =
                             (short)(((ushort)*puVar18 & 0xf7de) + ((ushort)*puVar21 & 0xf7de) >> 1)
                             + ((ushort)*puVar21 & (ushort)*puVar18 & 0x821);
                        puVar18 = (uint *)((int)puVar18 + 2);
                        puVar21 = (uint *)((int)puVar21 + 2);
                      } while (uVar34 != uVar15);
                    }
                    src0 = (uint *)((int)src0 + uVar15 * 2);
                    uVar22 = uVar22 + uVar15;
                  }
                  if (uVar22 == uVar39) break;
                  bVar3 = (byte)*src0;
                  puVar18 = src0;
                }
                uVar10 = uVar10 - 1;
                if (uVar10 == 0) break;
                local_3c = local_3c + (uint)dst->pitch;
              }
            }
            else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
              uVar10 = (uint)srcrect->h;
              while( true ) {
                uVar22 = 0;
                    /* Unresolved local var: uint run@[???] */
                bVar3 = (byte)*src0;
                while( true ) {
                  uVar34 = (uint)*(byte *)((int)src0 + 1);
                  src0 = (uint *)((int)src0 + 2);
                  uVar22 = uVar22 + bVar3;
                  if (uVar34 == 0) {
                    if (uVar22 == 0) {
                      iVar14 = dst->offset;
                      goto LAB_0892de58;
                    }
                  }
                  else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 ALPHA@[???] */
                    if (uVar34 != 0) {
                      puVar31 = (ushort *)(local_3c + uVar22 * 2);
                      uVar37 = 0;
                      puVar18 = src0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar33 = *puVar18;
                        uVar37 = uVar37 + 1;
                        uVar12 = CONCAT22(*puVar31,*puVar31) & 0x7e0f81f;
                        puVar18 = (uint *)((int)puVar18 + 2);
                        uVar33 = uVar12 + ((uVar15 >> 3) *
                                           ((CONCAT22((ushort)uVar33,(ushort)uVar33) & 0x7e0f81f) -
                                           uVar12) >> 5) & 0x7e0f81f;
                        *puVar31 = (ushort)(uVar33 >> 0x10) | (ushort)uVar33;
                        puVar31 = puVar31 + 1;
                      } while (uVar37 != uVar34);
                    }
                    src0 = (uint *)((int)src0 + uVar34 * 2);
                    uVar22 = uVar22 + uVar34;
                  }
                  if (uVar22 == uVar39) break;
                  bVar3 = (byte)*src0;
                }
                uVar10 = uVar10 - 1;
                if (uVar10 == 0) break;
                local_3c = local_3c + (uint)dst->pitch;
              }
            }
            goto LAB_0892de54;
          }
          uVar10 = (uint)srcrect->h;
        }
        else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???] */
          uVar10 = (uint)srcrect->h;
        }
        while( true ) {
          uVar33 = 0;
                    /* Unresolved local var: uint run@[???] */
          bVar3 = (byte)*src0;
          while( true ) {
            uVar12 = (uint)*(byte *)((int)src0 + 1);
            src0 = (uint *)((int)src0 + 2);
            uVar33 = uVar33 + bVar3;
            if (uVar12 == 0) {
              if (uVar33 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
            }
            else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
              if (uVar12 != 0) {
                puVar31 = (ushort *)(local_3c + uVar33 * 2);
                uVar17 = 0;
                puVar18 = src0;
                do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                  uVar23 = (uint)(ushort)*puVar18;
                  uVar20 = (uint)*puVar31;
                  uVar26 = (uint)pSVar36->Rshift;
                  uVar25 = (uint)pSVar36->Rloss;
                  iVar14 = ((uVar20 & uVar34) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f);
                  uVar29 = (uint)pSVar36->Gshift;
                  uVar27 = (uint)pSVar36->Gloss;
                  iVar9 = ((uVar20 & uVar37) >> (uVar29 & 0x1f)) << (uVar27 & 0x1f);
                  uVar30 = (uint)pSVar36->Bshift;
                  uVar28 = (uint)pSVar36->Bloss;
                  iVar11 = ((uVar20 & uVar22) >> (uVar30 & 0x1f)) << (uVar28 & 0x1f);
                  uVar17 = uVar17 + 1;
                  puVar18 = (uint *)((int)puVar18 + 2);
                  *puVar31 = (ushort)((iVar14 + (uVar15 * ((((uVar23 & uVar34) >> (uVar26 & 0x1f))
                                                           << (uVar25 & 0x1f)) - iVar14) >> 8) >>
                                      (uVar25 & 0x1f)) << (uVar26 & 0x1f)) |
                             (ushort)((iVar9 + (uVar15 * ((((uVar23 & uVar37) >> (uVar29 & 0x1f)) <<
                                                          (uVar27 & 0x1f)) - iVar9) >> 8) >>
                                      (uVar27 & 0x1f)) << (uVar29 & 0x1f)) |
                             (ushort)((iVar11 + (uVar15 * ((((uVar23 & uVar22) >> (uVar30 & 0x1f))
                                                           << (uVar28 & 0x1f)) - iVar11) >> 8) >>
                                      (uVar28 & 0x1f)) << (uVar30 & 0x1f));
                  puVar31 = puVar31 + 1;
                } while (uVar12 != uVar17);
              }
              src0 = (uint *)((int)src0 + uVar12 * 2);
              uVar33 = uVar33 + uVar12;
            }
            if (uVar33 == uVar39) break;
            bVar3 = (byte)*src0;
          }
          uVar10 = uVar10 - 1;
          if (uVar10 == 0) break;
          local_3c = local_3c + (uint)dst->pitch;
        }
      }
    }
  }
  else {
                    /* Unresolved local var: SDL_PixelFormat * fmt@[???] */
    pSVar36 = dst->format;
    if (uVar15 == 0xff) {
      bVar3 = pSVar36->BytesPerPixel;
      if (bVar3 == 2) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
        uVar22 = (uint)srcrect->h;
        local_3c = local_3c + iVar14 * -2;
        iVar11 = iVar14 + (uint)srcrect->w;
        uVar10 = 0;
                    /* Unresolved local var: int run@[???] */
        bVar3 = (byte)*src0;
LAB_0892e8d8:
        uVar15 = (uint)*(byte *)((int)src0 + 1);
        src0 = (uint *)((int)src0 + 2);
        uVar10 = uVar10 + bVar3;
        if (uVar15 == 0) goto LAB_0892e970;
        do {
          if ((int)uVar10 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
            iVar9 = iVar14 - uVar10;
            if (iVar9 < 1) {
              iVar9 = 0;
              iVar16 = 0;
              uVar34 = uVar15;
            }
            else {
              iVar16 = iVar9 * 2;
              uVar34 = uVar15 - iVar9;
              if ((int)(uVar15 - iVar9) < 1) goto LAB_0892e934;
            }
            memcpy((void *)(local_3c + (iVar9 + uVar10) * 2),(byte *)((int)src0 + iVar16),
                   (uVar34 + (iVar11 - (iVar9 + uVar10))) * 2);
          }
LAB_0892e934:
          src0 = (uint *)((int)src0 + uVar15 * 2);
          uVar10 = uVar10 + uVar15;
          while( true ) {
            if (uVar10 != uVar39) {
              bVar3 = (byte)*src0;
              goto LAB_0892e8d8;
            }
            uVar22 = uVar22 - 1;
            if (uVar22 == 0) goto LAB_0892de54;
            local_3c = local_3c + (uint)dst->pitch;
            uVar15 = (uint)*(byte *)((int)src0 + 1);
            uVar10 = (uint)(byte)*src0;
            src0 = (uint *)((int)src0 + 2);
            if (uVar15 != 0) break;
LAB_0892e970:
            if (uVar10 == 0) {
              iVar14 = dst->offset;
              goto LAB_0892de58;
            }
          }
        } while( true );
      }
      if (bVar3 < 3) {
        if (bVar3 == 1) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar22 = (uint)srcrect->h;
          iVar11 = iVar14 + (uint)srcrect->w;
          local_3c = local_3c - iVar14;
          uVar10 = 0;
                    /* Unresolved local var: int run@[???] */
          bVar3 = (byte)*src0;
LAB_0892e15c:
          uVar15 = (uint)*(byte *)((int)src0 + 1);
          src0 = (uint *)((int)src0 + 2);
          uVar10 = uVar10 + bVar3;
          if (uVar15 == 0) goto LAB_0892e1e8;
          do {
            if ((int)uVar10 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
              iVar9 = iVar14 - uVar10;
              if (iVar9 < 1) {
                iVar9 = 0;
                uVar34 = uVar15;
              }
              else {
                uVar34 = uVar15 - iVar9;
                if ((int)(uVar15 - iVar9) < 1) goto LAB_0892e1b0;
              }
              memcpy((void *)(local_3c + iVar9 + uVar10),(byte *)((int)src0 + iVar9),
                     uVar34 + (iVar11 - (iVar9 + uVar10)));
            }
LAB_0892e1b0:
            uVar10 = uVar10 + uVar15;
            src0 = (uint *)((int)src0 + uVar15);
            while( true ) {
              if (uVar10 != uVar39) {
                bVar3 = (byte)*src0;
                goto LAB_0892e15c;
              }
              uVar22 = uVar22 - 1;
              if (uVar22 == 0) goto LAB_0892de54;
              local_3c = local_3c + (uint)dst->pitch;
              uVar15 = (uint)*(byte *)((int)src0 + 1);
              uVar10 = (uint)(byte)*src0;
              src0 = (uint *)((int)src0 + 2);
              if (uVar15 != 0) break;
LAB_0892e1e8:
              if (uVar10 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
            }
          } while( true );
        }
      }
      else {
        if (bVar3 == 3) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar22 = (uint)srcrect->h;
          uVar10 = 0;
          iVar11 = iVar14 + (uint)srcrect->w;
          local_3c = local_3c + iVar14 * -3;
                    /* Unresolved local var: int run@[???] */
          bVar3 = (byte)*src0;
          do {
            bVar2 = *(byte *)((int)src0 + 1);
            uVar10 = uVar10 + bVar3;
            puVar18 = src0;
            while( true ) {
              uVar15 = (uint)bVar2;
              src0 = (uint *)((int)puVar18 + 2);
              if (uVar15 != 0) {
                if ((int)uVar10 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                  iVar14 = iVar14 - uVar10;
                  if (iVar14 < 1) {
                    iVar14 = 0;
                    iVar9 = 0;
                  }
                  else {
                    uVar15 = uVar15 - iVar14;
                    iVar9 = iVar14 * 3;
                    if ((int)uVar15 < 1) {
                      halt_baddata();
                    }
                  }
                  memcpy((void *)(local_3c + (iVar14 + uVar10) * 3),(byte *)((int)src0 + iVar9),
                         (uVar15 + (iVar11 - (iVar14 + uVar10))) * 3);
                }
                    /* WARNING: Bad instruction - Truncating control flow here */
                halt_baddata();
              }
              if (uVar10 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
              if (uVar10 != uVar39) break;
              uVar22 = uVar22 - 1;
              if (uVar22 == 0) goto LAB_0892de54;
              local_3c = local_3c + (uint)dst->pitch;
              bVar2 = *(byte *)((int)puVar18 + 3);
              uVar10 = (uint)*(byte *)src0;
              puVar18 = src0;
            }
            bVar3 = *(byte *)src0;
          } while( true );
        }
        if (bVar3 == 4) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar10 = (uint)srcrect->h;
          local_3c = local_3c + iVar14 * -4;
          iVar11 = iVar14 + (uint)srcrect->w;
LAB_0892e828:
          uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
          uVar4 = (ushort)*src0;
          do {
            uVar15 = (uint)*(ushort *)((int)src0 + 2);
            src0 = src0 + 1;
            uVar22 = uVar22 + uVar4;
            if (uVar15 == 0) {
              if (uVar22 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
            }
            else {
              if ((int)uVar22 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                iVar9 = iVar14 - uVar22;
                if (iVar9 < 1) {
                  iVar9 = 0;
                  iVar16 = 0;
                  uVar34 = uVar15;
                }
                else {
                  iVar16 = iVar9 * 4;
                  uVar34 = uVar15 - iVar9;
                  if ((int)(uVar15 - iVar9) < 1) goto LAB_0892e888;
                }
                memcpy((void *)(local_3c + (iVar9 + uVar22) * 4),(byte *)(iVar16 + (int)src0),
                       (uVar34 + (iVar11 - (iVar9 + uVar22))) * 4);
              }
LAB_0892e888:
              src0 = src0 + uVar15;
              uVar22 = uVar22 + uVar15;
            }
            if (uVar22 == uVar39) goto code_r0x0892e898;
            uVar4 = (ushort)*src0;
          } while( true );
        }
      }
    }
    else {
      UVar1 = pSVar36->BytesPerPixel;
      if (UVar1 == '\x03') {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
        uVar22 = (uint)srcrect->h;
        iVar11 = iVar14 + (uint)srcrect->w;
        uVar10 = 0;
        local_3c = local_3c + iVar14 * -3;
                    /* Unresolved local var: int run@[???] */
        bVar3 = (byte)*src0;
        do {
          bVar2 = *(byte *)((int)src0 + 1);
          uVar10 = uVar10 + bVar3;
          puVar18 = src0;
          while( true ) {
            uVar34 = (uint)bVar2;
            src0 = (uint *)((int)puVar18 + 2);
            if (uVar34 != 0) {
              if (iVar11 <= (int)uVar10) {
                halt_baddata();
              }
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
              iVar14 = iVar14 - uVar10;
              if (iVar14 < 1) {
                iVar14 = 0;
                iVar9 = 0;
              }
              else {
                uVar34 = uVar34 - iVar14;
                if ((int)uVar34 < 1) {
                  halt_baddata();
                }
                iVar9 = iVar14 * 3;
              }
              iVar11 = uVar34 + (iVar11 - (iVar14 + uVar10));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
              if (0 < iVar11) {
                pbVar38 = (byte *)((int)src0 + iVar9);
                iVar9 = 0;
                pbVar24 = (byte *)(local_3c + (iVar14 + uVar10) * 3);
                do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                  uVar33 = (uint)pSVar36->Rshift;
                  uVar22 = (uint)pSVar36->Rloss;
                  uVar39 = (uint)pbVar24[1] << 8 | (uint)pbVar24[2] << 0x10 | (uint)*pbVar24;
                  uVar10 = (uint)pbVar38[1] << 8 | (uint)pbVar38[2] << 0x10 | (uint)*pbVar38;
                  iVar16 = ((uVar39 & pSVar36->Rmask) >> (uVar33 & 0x1f)) << (uVar22 & 0x1f);
                  uVar17 = (uint)pSVar36->Gshift;
                  uVar34 = (uint)pSVar36->Gloss;
                  iVar35 = ((uVar39 & pSVar36->Gmask) >> (uVar17 & 0x1f)) << (uVar34 & 0x1f);
                  uVar12 = (uint)pSVar36->Bshift;
                  uVar37 = (uint)pSVar36->Bloss;
                  iVar14 = ((uVar39 & pSVar36->Bmask) >> (uVar12 & 0x1f)) << (uVar37 & 0x1f);
                  iVar9 = iVar9 + 1;
                  pbVar38 = pbVar38 + 3;
                  uVar39 = (iVar16 + (uVar15 * ((((uVar10 & pSVar36->Rmask) >> (uVar33 & 0x1f)) <<
                                                (uVar22 & 0x1f)) - iVar16) >> 8) >> (uVar22 & 0x1f))
                           << (uVar33 & 0x1f) |
                           (iVar35 + (uVar15 * ((((uVar10 & pSVar36->Gmask) >> (uVar17 & 0x1f)) <<
                                                (uVar34 & 0x1f)) - iVar35) >> 8) >> (uVar34 & 0x1f))
                           << (uVar17 & 0x1f) |
                           (iVar14 + (uVar15 * ((((uVar10 & pSVar36->Bmask) >> (uVar12 & 0x1f)) <<
                                                (uVar37 & 0x1f)) - iVar14) >> 8) >> (uVar37 & 0x1f))
                           << (uVar12 & 0x1f);
                  pbVar24[1] = (byte)(uVar39 >> 8);
                  pbVar24[2] = (byte)(uVar39 >> 0x10);
                  *pbVar24 = (byte)uVar39;
                  pbVar24 = pbVar24 + 3;
                } while (iVar9 != iVar11);
              }
                    /* WARNING: Bad instruction - Truncating control flow here */
              halt_baddata();
            }
            if (uVar10 == 0) {
              iVar14 = dst->offset;
              goto LAB_0892de58;
            }
            if (uVar10 != uVar39) break;
            uVar22 = uVar22 - 1;
            if (uVar22 == 0) goto LAB_0892de54;
            local_3c = local_3c + (uint)dst->pitch;
            bVar2 = *(byte *)((int)puVar18 + 3);
            uVar10 = (uint)*(byte *)src0;
            puVar18 = src0;
          }
          bVar3 = *(byte *)src0;
        } while( true );
      }
      if (UVar1 == '\x04') {
        if ((pSVar36->Rmask | pSVar36->Gmask | pSVar36->Bmask) == 0xffffff) {
          if (((pSVar36->Gmask == 0xff00) || (pSVar36->Rmask == 0xff00)) ||
             (pSVar36->Bmask == 0xff00)) {
            if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
              iVar11 = iVar14 + (uint)srcrect->w;
              local_3c = local_3c + iVar14 * -4;
              uVar22 = (uint)srcrect->h;
LAB_0892f67c:
              uVar15 = 0;
                    /* Unresolved local var: int run@[???] */
              uVar4 = (ushort)*src0;
              do {
                uVar34 = (uint)*(ushort *)((int)src0 + 2);
                src0 = src0 + 1;
                uVar15 = uVar15 + uVar4;
                if (uVar34 == 0) {
                  if (uVar15 == 0) {
                    iVar14 = dst->offset;
                    goto LAB_0892de58;
                  }
                }
                else {
                  if ((int)uVar15 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                    iVar9 = iVar14 - uVar15;
                    if (iVar9 < 1) {
                      iVar9 = 0;
                      iVar16 = 0;
                      uVar37 = uVar34;
                    }
                    else {
                      iVar16 = iVar9 * 4;
                      uVar37 = uVar34 - iVar9;
                      if ((int)(uVar34 - iVar9) < 1) goto LAB_0892f71c;
                    }
                    iVar35 = uVar37 + (iVar11 - (iVar9 + uVar15));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: Uint32 * dst@[???] */
                    if (0 < iVar35) {
                      puVar21 = (uint *)((int)src0 + iVar16);
                      puVar18 = (uint *)(local_3c + (iVar9 + uVar15) * 4);
                      iVar9 = 0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        iVar9 = iVar9 + 1;
                        *puVar18 = ((*puVar21 & 0xfefefe) + (*puVar18 & 0xfefefe) >> 1) +
                                   (*puVar18 & *puVar21 & 0x10101);
                        puVar21 = puVar21 + 1;
                        puVar18 = puVar18 + 1;
                      } while (iVar9 != iVar35);
                    }
                  }
LAB_0892f71c:
                  src0 = src0 + uVar34;
                  uVar15 = uVar15 + uVar34;
                }
                if (uVar15 == uVar39) goto code_r0x0892f72c;
                uVar4 = (ushort)*src0;
              } while( true );
            }
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
            uVar22 = (uint)srcrect->h;
            local_3c = local_3c + iVar14 * -4;
            iVar11 = iVar14 + (uint)srcrect->w;
LAB_0892f0d8:
            uVar34 = 0;
                    /* Unresolved local var: int run@[???] */
            uVar4 = (ushort)*src0;
            do {
              uVar37 = (uint)*(ushort *)((int)src0 + 2);
              src0 = src0 + 1;
              uVar34 = uVar34 + uVar4;
              if (uVar37 == 0) {
                if (uVar34 == 0) {
                  iVar14 = dst->offset;
                  goto LAB_0892de58;
                }
              }
              else {
                if ((int)uVar34 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                  iVar9 = iVar14 - uVar34;
                  if (iVar9 < 1) {
                    iVar9 = 0;
                    iVar16 = 0;
                    uVar33 = uVar37;
                  }
                  else {
                    iVar16 = iVar9 * 4;
                    uVar33 = uVar37 - iVar9;
                    if ((int)(uVar37 - iVar9) < 1) goto LAB_0892f19c;
                  }
                  iVar35 = uVar33 + (iVar11 - (iVar9 + uVar34));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: Uint32 * dst@[???] */
                  if (0 < iVar35) {
                    puVar21 = (uint *)((int)src0 + iVar16);
                    puVar18 = (uint *)(local_3c + (iVar9 + uVar34) * 4);
                    iVar9 = 0;
                    do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???] */
                      uVar33 = *puVar21;
                      iVar9 = iVar9 + 1;
                      uVar17 = *puVar18 & 0xff00;
                      uVar12 = *puVar18 & 0xff00ff;
                      puVar21 = puVar21 + 1;
                      *puVar18 = uVar12 + (uVar15 * ((uVar33 & 0xff00ff) - uVar12) >> 8) & 0xff00ff
                                 | uVar17 + (uVar15 * ((uVar33 & 0xff00) - uVar17) >> 8) & 0xff00;
                      puVar18 = puVar18 + 1;
                    } while (iVar9 != iVar35);
                  }
                }
LAB_0892f19c:
                src0 = src0 + uVar37;
                uVar34 = uVar34 + uVar37;
              }
              if (uVar34 == uVar39) goto code_r0x0892f1ac;
              uVar4 = (ushort)*src0;
            } while( true );
          }
          uVar4 = srcrect->w;
        }
        else {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar4 = srcrect->w;
        }
        uVar34 = (uint)srcrect->h;
        local_3c = local_3c + iVar14 * -4;
        uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
        uVar5 = (ushort)*src0;
LAB_0892e65c:
        uVar37 = (uint)*(ushort *)((int)src0 + 2);
        src0 = src0 + 1;
        uVar22 = uVar22 + uVar5;
        if (uVar37 == 0) goto LAB_0892e7dc;
        do {
          if ((int)uVar22 < (int)(iVar14 + (uint)uVar4)) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
            iVar11 = iVar14 - uVar22;
            if (iVar11 < 1) {
              iVar11 = 0;
              iVar9 = 0;
              uVar33 = uVar37;
            }
            else {
              iVar9 = iVar11 * 4;
              uVar33 = uVar37 - iVar11;
              if ((int)(uVar37 - iVar11) < 1) goto LAB_0892e7a4;
            }
            iVar16 = uVar33 + ((iVar14 + (uint)uVar4) - (iVar11 + uVar22));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
            if (0 < iVar16) {
              puVar21 = (uint *)((int)src0 + iVar9);
              puVar18 = (uint *)(local_3c + (iVar11 + uVar22) * 4);
              iVar11 = 0;
              do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                uVar12 = *puVar21;
                uVar33 = *puVar18;
                uVar20 = (uint)pSVar36->Rshift;
                uVar17 = (uint)pSVar36->Rloss;
                iVar9 = ((uVar33 & pSVar36->Rmask) >> (uVar20 & 0x1f)) << (uVar17 & 0x1f);
                uVar26 = (uint)pSVar36->Gshift;
                uVar23 = (uint)pSVar36->Gloss;
                iVar35 = ((uVar33 & pSVar36->Gmask) >> (uVar26 & 0x1f)) << (uVar23 & 0x1f);
                uVar27 = (uint)pSVar36->Bshift;
                uVar25 = (uint)pSVar36->Bloss;
                iVar13 = ((uVar33 & pSVar36->Bmask) >> (uVar27 & 0x1f)) << (uVar25 & 0x1f);
                iVar11 = iVar11 + 1;
                puVar21 = puVar21 + 1;
                *puVar18 = (iVar9 + (uVar15 * ((((uVar12 & pSVar36->Rmask) >> (uVar20 & 0x1f)) <<
                                               (uVar17 & 0x1f)) - iVar9) >> 8) >> (uVar17 & 0x1f))
                           << (uVar20 & 0x1f) |
                           (iVar35 + (uVar15 * ((((uVar12 & pSVar36->Gmask) >> (uVar26 & 0x1f)) <<
                                                (uVar23 & 0x1f)) - iVar35) >> 8) >> (uVar23 & 0x1f))
                           << (uVar26 & 0x1f) |
                           (iVar13 + (uVar15 * ((((uVar12 & pSVar36->Bmask) >> (uVar27 & 0x1f)) <<
                                                (uVar25 & 0x1f)) - iVar13) >> 8) >> (uVar25 & 0x1f))
                           << (uVar27 & 0x1f);
                puVar18 = puVar18 + 1;
              } while (iVar11 != iVar16);
            }
          }
LAB_0892e7a4:
          src0 = src0 + uVar37;
          uVar22 = uVar22 + uVar37;
          while( true ) {
            if (uVar22 != uVar39) {
              uVar5 = (ushort)*src0;
              goto LAB_0892e65c;
            }
            uVar34 = uVar34 - 1;
            if (uVar34 == 0) goto LAB_0892de54;
            uVar37 = (uint)*(ushort *)((int)src0 + 2);
            local_3c = local_3c + uVar10;
            uVar22 = (uint)(ushort)*src0;
            src0 = src0 + 1;
            if (uVar37 != 0) break;
LAB_0892e7dc:
            if (uVar22 == 0) {
              iVar14 = dst->offset;
              goto LAB_0892de58;
            }
          }
        } while( true );
      }
      if (UVar1 == '\x02') {
        uVar34 = pSVar36->Rmask;
        uVar37 = pSVar36->Gmask;
        uVar22 = pSVar36->Bmask;
        uVar10 = uVar34 | uVar37 | uVar22;
        if (uVar10 == 0x7fff) {
          if (((uVar37 == 0x3e0) || (uVar34 == 0x3e0)) || (uVar22 == 0x3e0)) {
            if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
              iVar11 = iVar14 + (uint)srcrect->w;
              local_3c = local_3c + iVar14 * -2;
              uVar10 = (uint)srcrect->h;
LAB_0892f790:
              uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
              bVar3 = (byte)*src0;
              do {
                uVar15 = (uint)*(byte *)((int)src0 + 1);
                src0 = (uint *)((int)src0 + 2);
                uVar22 = uVar22 + bVar3;
                if (uVar15 == 0) {
                  if (uVar22 == 0) {
                    iVar14 = dst->offset;
                    goto LAB_0892de58;
                  }
                }
                else {
                  if ((int)uVar22 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                    iVar9 = iVar14 - uVar22;
                    if (iVar9 < 1) {
                      iVar9 = 0;
                      iVar16 = 0;
                      uVar34 = uVar15;
                    }
                    else {
                      iVar16 = iVar9 * 2;
                      uVar34 = uVar15 - iVar9;
                      if ((int)(uVar15 - iVar9) < 1) goto LAB_0892f83c;
                    }
                    /* Unresolved local var: uint n@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???] */
                    puVar21 = (uint *)((int)src0 + iVar16);
                    puVar18 = (uint *)(local_3c + (iVar9 + uVar22) * 2);
                    uVar34 = uVar34 + (iVar11 - (iVar9 + uVar22));
                    if ((((uint)puVar21 ^ (uint)puVar18) & 3) == 0) {
                      if (((uint)puVar21 & 3) != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar37 = *puVar21;
                        puVar21 = (uint *)((int)puVar21 + 2);
                        *(ushort *)puVar18 =
                             (short)(((ushort)uVar37 & 0xfbde) + ((ushort)*puVar18 & 0xfbde) >> 1) +
                             ((ushort)uVar37 & (ushort)*puVar18 & 0x421);
                        uVar34 = uVar34 - 1;
                        puVar18 = (uint *)((int)puVar18 + 2);
                      }
                      for (; 1 < uVar34; uVar34 = uVar34 - 2) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *puVar18 = ((*puVar21 & 0xfbdefbde) >> 1) + ((*puVar18 & 0xfbdefbde) >> 1) +
                                   (*puVar18 & *puVar21 & 0x4210421);
                        puVar21 = puVar21 + 1;
                        puVar18 = puVar18 + 1;
                      }
                      if (uVar34 != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        *(ushort *)puVar18 =
                             (short)(((ushort)*puVar21 & 0xfbde) + ((ushort)*puVar18 & 0xfbde) >> 1)
                             + ((ushort)*puVar18 & (ushort)*puVar21 & 0x421);
                      }
                    }
                    else if (uVar34 != 0) {
                      uVar37 = 0;
                      do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                        uVar37 = uVar37 + 1;
                        *(ushort *)puVar18 =
                             (short)(((ushort)*puVar21 & 0xfbde) + ((ushort)*puVar18 & 0xfbde) >> 1)
                             + ((ushort)*puVar18 & (ushort)*puVar21 & 0x421);
                        puVar21 = (uint *)((int)puVar21 + 2);
                        puVar18 = (uint *)((int)puVar18 + 2);
                      } while (uVar37 != uVar34);
                    }
                  }
LAB_0892f83c:
                  src0 = (uint *)((int)src0 + uVar15 * 2);
                  uVar22 = uVar22 + uVar15;
                }
                if (uVar22 == uVar39) goto code_r0x0892f84c;
                bVar3 = (byte)*src0;
              } while( true );
            }
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
            uVar10 = (uint)srcrect->h;
            iVar11 = iVar14 + (uint)srcrect->w;
            local_3c = local_3c + iVar14 * -2;
LAB_0892eb18:
            uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
            bVar3 = (byte)*src0;
            do {
              uVar34 = (uint)*(byte *)((int)src0 + 1);
              src0 = (uint *)((int)src0 + 2);
              uVar22 = uVar22 + bVar3;
              if (uVar34 == 0) {
                if (uVar22 == 0) {
                  iVar14 = dst->offset;
                  goto LAB_0892de58;
                }
              }
              else {
                if ((int)uVar22 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                  iVar9 = iVar14 - uVar22;
                  if (iVar9 < 1) {
                    iVar9 = 0;
                    iVar16 = 0;
                    uVar37 = uVar34;
                  }
                  else {
                    iVar16 = iVar9 * 2;
                    uVar37 = uVar34 - iVar9;
                    if ((int)(uVar34 - iVar9) < 1) goto LAB_0892ebd0;
                  }
                  iVar35 = uVar37 + (iVar11 - (iVar9 + uVar22));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 ALPHA@[???] */
                  if (0 < iVar35) {
                    pbVar24 = (byte *)((int)src0 + iVar16);
                    puVar31 = (ushort *)(local_3c + (iVar9 + uVar22) * 2);
                    iVar9 = 0;
                    do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                      uVar6 = *(undefined2 *)pbVar24;
                      iVar9 = iVar9 + 1;
                      uVar37 = CONCAT22(*puVar31,*puVar31) & 0x3e07c1f;
                      pbVar24 = pbVar24 + 2;
                      uVar37 = uVar37 + ((uVar15 >> 3) *
                                         ((CONCAT22(uVar6,uVar6) & 0x3e07c1f) - uVar37) >> 5) &
                               0x3e07c1f;
                      *puVar31 = (ushort)(uVar37 >> 0x10) | (ushort)uVar37;
                      puVar31 = puVar31 + 1;
                    } while (iVar9 != iVar35);
                  }
                }
LAB_0892ebd0:
                src0 = (uint *)((int)src0 + uVar34 * 2);
                uVar22 = uVar22 + uVar34;
              }
              if (uVar22 == uVar39) goto code_r0x0892ebe0;
              bVar3 = (byte)*src0;
            } while( true );
          }
        }
        else if ((uVar10 == 0xffff) &&
                (((uVar37 == 0x7e0 || (uVar34 == 0x7e0)) || (uVar22 == 0x7e0)))) {
          if (uVar15 == 0x80) {
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
            iVar11 = iVar14 + (uint)srcrect->w;
            local_3c = local_3c + iVar14 * -2;
            uVar10 = (uint)srcrect->h;
LAB_0892fb08:
            uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
            bVar3 = (byte)*src0;
            do {
              uVar15 = (uint)*(byte *)((int)src0 + 1);
              src0 = (uint *)((int)src0 + 2);
              uVar22 = uVar22 + bVar3;
              if (uVar15 == 0) {
                if (uVar22 == 0) {
                  iVar14 = dst->offset;
                  goto LAB_0892de58;
                }
              }
              else {
                if ((int)uVar22 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                  iVar9 = iVar14 - uVar22;
                  if (iVar9 < 1) {
                    iVar9 = 0;
                    iVar16 = 0;
                    uVar34 = uVar15;
                  }
                  else {
                    iVar16 = iVar9 * 2;
                    uVar34 = uVar15 - iVar9;
                    if ((int)(uVar15 - iVar9) < 1) goto LAB_0892fbb4;
                  }
                    /* Unresolved local var: uint n@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???] */
                  puVar21 = (uint *)((int)src0 + iVar16);
                  puVar18 = (uint *)(local_3c + (iVar9 + uVar22) * 2);
                  uVar34 = uVar34 + (iVar11 - (iVar9 + uVar22));
                  if ((((uint)puVar21 ^ (uint)puVar18) & 3) == 0) {
                    if (((uint)puVar21 & 3) != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                      uVar37 = *puVar21;
                      puVar21 = (uint *)((int)puVar21 + 2);
                      *(ushort *)puVar18 =
                           (short)(((ushort)uVar37 & 0xf7de) + ((ushort)*puVar18 & 0xf7de) >> 1) +
                           ((ushort)uVar37 & (ushort)*puVar18 & 0x821);
                      uVar34 = uVar34 - 1;
                      puVar18 = (uint *)((int)puVar18 + 2);
                    }
                    for (; 1 < uVar34; uVar34 = uVar34 - 2) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                      *puVar18 = ((*puVar21 & 0xf7def7de) >> 1) + ((*puVar18 & 0xf7def7de) >> 1) +
                                 (*puVar18 & *puVar21 & 0x8210821);
                      puVar21 = puVar21 + 1;
                      puVar18 = puVar18 + 1;
                    }
                    if (uVar34 != 0) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                      *(ushort *)puVar18 =
                           (short)(((ushort)*puVar21 & 0xf7de) + ((ushort)*puVar18 & 0xf7de) >> 1) +
                           ((ushort)*puVar18 & (ushort)*puVar21 & 0x821);
                    }
                  }
                  else if (uVar34 != 0) {
                    uVar37 = 0;
                    do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                      uVar37 = uVar37 + 1;
                      *(ushort *)puVar18 =
                           (short)(((ushort)*puVar21 & 0xf7de) + ((ushort)*puVar18 & 0xf7de) >> 1) +
                           ((ushort)*puVar18 & (ushort)*puVar21 & 0x821);
                      puVar21 = (uint *)((int)puVar21 + 2);
                      puVar18 = (uint *)((int)puVar18 + 2);
                    } while (uVar34 != uVar37);
                  }
                }
LAB_0892fbb4:
                src0 = (uint *)((int)src0 + uVar15 * 2);
                uVar22 = uVar22 + uVar15;
              }
              if (uVar22 == uVar39) goto code_r0x0892fbc4;
              bVar3 = (byte)*src0;
            } while( true );
          }
                    /* Unresolved local var: int linecount@[???]
                       Unresolved local var: int ofs@[???]
                       Unresolved local var: int left@[???]
                       Unresolved local var: int right@[???] */
          uVar10 = (uint)srcrect->h;
          iVar11 = iVar14 + (uint)srcrect->w;
          local_3c = local_3c + iVar14 * -2;
LAB_0892f408:
          uVar22 = 0;
                    /* Unresolved local var: int run@[???] */
          bVar3 = (byte)*src0;
          do {
            uVar34 = (uint)*(byte *)((int)src0 + 1);
            src0 = (uint *)((int)src0 + 2);
            uVar22 = uVar22 + bVar3;
            if (uVar34 == 0) {
              if (uVar22 == 0) {
                iVar14 = dst->offset;
                goto LAB_0892de58;
              }
            }
            else {
              if ((int)uVar22 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
                iVar9 = iVar14 - uVar22;
                if (iVar9 < 1) {
                  iVar9 = 0;
                  iVar16 = 0;
                  uVar37 = uVar34;
                }
                else {
                  iVar16 = iVar9 * 2;
                  uVar37 = uVar34 - iVar9;
                  if ((int)(uVar34 - iVar9) < 1) goto LAB_0892f4c0;
                }
                iVar35 = uVar37 + (iVar11 - (iVar9 + uVar22));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint16 * src@[???]
                       Unresolved local var: Uint16 * dst@[???]
                       Unresolved local var: Uint32 ALPHA@[???] */
                if (0 < iVar35) {
                  pbVar24 = (byte *)((int)src0 + iVar16);
                  puVar31 = (ushort *)(local_3c + (iVar9 + uVar22) * 2);
                  iVar9 = 0;
                  do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
                    uVar6 = *(undefined2 *)pbVar24;
                    iVar9 = iVar9 + 1;
                    uVar37 = CONCAT22(*puVar31,*puVar31) & 0x7e0f81f;
                    pbVar24 = pbVar24 + 2;
                    uVar37 = uVar37 + ((uVar15 >> 3) *
                                       ((CONCAT22(uVar6,uVar6) & 0x7e0f81f) - uVar37) >> 5) &
                             0x7e0f81f;
                    *puVar31 = (ushort)(uVar37 >> 0x10) | (ushort)uVar37;
                    puVar31 = puVar31 + 1;
                  } while (iVar9 != iVar35);
                }
              }
LAB_0892f4c0:
              src0 = (uint *)((int)src0 + uVar34 * 2);
              uVar22 = uVar22 + uVar34;
            }
            if (uVar22 == uVar39) goto code_r0x0892f4d0;
            bVar3 = (byte)*src0;
          } while( true );
        }
        local_4c = (uint)srcrect->h;
        local_50 = local_3c + iVar14 * -2;
        iVar11 = iVar14 + (uint)srcrect->w;
        uVar10 = 0;
                    /* Unresolved local var: int run@[???] */
        bVar3 = (byte)*src0;
LAB_0892df78:
        uVar33 = (uint)*(byte *)((int)src0 + 1);
        src0 = (uint *)((int)src0 + 2);
        uVar10 = uVar10 + bVar3;
        if (uVar33 == 0) goto LAB_0892e108;
        do {
          if ((int)uVar10 < iVar11) {
                    /* Unresolved local var: int start@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int startcol@[???] */
            iVar9 = iVar14 - uVar10;
            if (iVar9 < 1) {
              iVar9 = 0;
              iVar16 = 0;
              uVar12 = uVar33;
            }
            else {
              iVar16 = iVar9 * 2;
              uVar12 = uVar33 - iVar9;
              if ((int)(uVar33 - iVar9) < 1) goto LAB_0892e0b8;
            }
            iVar35 = uVar12 + (iVar11 - (iVar9 + uVar10));
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
            if (0 < iVar35) {
              puVar32 = (ushort *)((int)src0 + iVar16);
              puVar31 = (ushort *)(local_50 + (iVar9 + uVar10) * 2);
              iVar9 = 0;
              do {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: uint rs@[???]
                       Unresolved local var: uint gs@[???]
                       Unresolved local var: uint bs@[???]
                       Unresolved local var: uint rd@[???]
                       Unresolved local var: uint gd@[???]
                       Unresolved local var: uint bd@[???] */
                uVar17 = (uint)*puVar32;
                uVar12 = (uint)*puVar31;
                uVar23 = (uint)pSVar36->Rshift;
                uVar20 = (uint)pSVar36->Rloss;
                iVar16 = ((uVar12 & uVar34) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
                uVar26 = (uint)pSVar36->Gshift;
                uVar25 = (uint)pSVar36->Gloss;
                iVar19 = ((uVar12 & uVar37) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f);
                uVar29 = (uint)pSVar36->Bshift;
                uVar27 = (uint)pSVar36->Bloss;
                iVar13 = ((uVar12 & uVar22) >> (uVar29 & 0x1f)) << (uVar27 & 0x1f);
                iVar9 = iVar9 + 1;
                puVar32 = puVar32 + 1;
                *puVar31 = (ushort)((iVar16 + (uVar15 * ((((uVar17 & uVar34) >> (uVar23 & 0x1f)) <<
                                                         (uVar20 & 0x1f)) - iVar16) >> 8) >>
                                    (uVar20 & 0x1f)) << (uVar23 & 0x1f)) |
                           (ushort)((iVar19 + (uVar15 * ((((uVar17 & uVar37) >> (uVar26 & 0x1f)) <<
                                                         (uVar25 & 0x1f)) - iVar19) >> 8) >>
                                    (uVar25 & 0x1f)) << (uVar26 & 0x1f)) |
                           (ushort)((iVar13 + (uVar15 * ((((uVar17 & uVar22) >> (uVar29 & 0x1f)) <<
                                                         (uVar27 & 0x1f)) - iVar13) >> 8) >>
                                    (uVar27 & 0x1f)) << (uVar29 & 0x1f));
                puVar31 = puVar31 + 1;
              } while (iVar9 != iVar35);
            }
          }
LAB_0892e0b8:
          src0 = (uint *)((int)src0 + uVar33 * 2);
          uVar10 = uVar10 + uVar33;
          while( true ) {
            if (uVar10 != uVar39) {
              bVar3 = (byte)*src0;
              goto LAB_0892df78;
            }
            local_4c = local_4c - 1;
            if (local_4c == 0) goto LAB_0892de54;
            local_50 = local_50 + (uint)dst->pitch;
            uVar10 = (uint)(byte)*src0;
            uVar33 = (uint)*(byte *)((int)src0 + 1);
            src0 = (uint *)((int)src0 + 2);
            if (uVar33 != 0) break;
LAB_0892e108:
            if (uVar10 == 0) {
              iVar14 = dst->offset;
              goto LAB_0892de58;
            }
          }
        } while( true );
      }
    }
  }
LAB_0892de54:
  iVar14 = dst->offset;
LAB_0892de58:
  if ((iVar14 != 0) || ((dst->flags & 0x4005) != 0)) {
    SDL_UnlockSurface(dst);
  }
  return 0;
code_r0x0892e898:
  uVar10 = uVar10 - 1;
  if (uVar10 == 0) goto LAB_0892de54;
  local_3c = local_3c + (uint)dst->pitch;
  goto LAB_0892e828;
code_r0x0892f72c:
  uVar22 = uVar22 - 1;
  if (uVar22 == 0) goto LAB_0892de54;
  local_3c = local_3c + uVar10;
  goto LAB_0892f67c;
code_r0x0892f1ac:
  uVar22 = uVar22 - 1;
  if (uVar22 == 0) goto LAB_0892de54;
  local_3c = local_3c + uVar10;
  goto LAB_0892f0d8;
code_r0x0892f84c:
  uVar10 = uVar10 - 1;
  if (uVar10 == 0) goto LAB_0892de54;
  local_3c = local_3c + (uint)dst->pitch;
  goto LAB_0892f790;
code_r0x0892ebe0:
  uVar10 = uVar10 - 1;
  if (uVar10 == 0) goto LAB_0892de54;
  local_3c = local_3c + (uint)dst->pitch;
  goto LAB_0892eb18;
code_r0x0892fbc4:
  uVar10 = uVar10 - 1;
  if (uVar10 == 0) goto LAB_0892de54;
  local_3c = local_3c + (uint)dst->pitch;
  goto LAB_0892fb08;
code_r0x0892f4d0:
  uVar10 = uVar10 - 1;
  if (uVar10 == 0) goto LAB_0892de54;
  local_3c = local_3c + (uint)dst->pitch;
  goto LAB_0892f408;
}



----------------------------------------

// Function: SDL_UnRLESurface @ 089300dc

void SDL_UnRLESurface(SDL_Surface *surface,int recode)

{
  char cVar1;
  ushort uVar2;
  SDL_BlitMap *pSVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  void *pvVar7;
  ushort *puVar8;
  int iVar9;
  char *pcVar10;
  int iVar11;
  SDL_Rect local_38;
  code *local_30;
  code *local_2c;
  
  uVar5 = surface->flags;
  if ((uVar5 & 0x4000) == 0) {
    return;
  }
  surface->flags = uVar5 & 0xffffbfff;
  if (recode != 0) {
    if ((uVar5 & 0x1000001) != 0) {
      pSVar3 = surface->map;
      goto LAB_0893012c;
    }
    if ((uVar5 & 0x1000) == 0) {
                    /* Unresolved local var: Uint8 * srcbuf@[???]
                       Unresolved local var: Uint32 * dst@[???]
                       Unresolved local var: SDL_PixelFormat * sf@[???]
                       Unresolved local var: RLEDestFormat * df@[???]
                       Unresolved local var:
                       _func_int_Uint32_ptr_void_ptr_int_RLEDestFormat_ptr_SDL_PixelFormat_ptr *
                       uncopy_opaque@[???]
                       Unresolved local var:
                       _func_int_Uint32_ptr_void_ptr_int_RLEDestFormat_ptr_SDL_PixelFormat_ptr *
                       uncopy_transl@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int bpp@[???] */
      pcVar10 = surface->map->sw_data->aux_data;
      cVar1 = *pcVar10;
      iVar11 = surface->w;
      if (cVar1 == '\x02') {
        local_2c = uncopy_opaque_16;
        local_30 = uncopy_transl_16;
      }
      else {
        local_30 = uncopy_32;
        local_2c = uncopy_32;
      }
      pvVar7 = malloc((uint)surface->pitch * surface->h);
      surface->pixels = pvVar7;
      if (pvVar7 != (void *)0x0) {
        puVar8 = (ushort *)(pcVar10 + 0x18);
        memset(pvVar7,0,(uint)surface->pitch * surface->h);
        pvVar7 = surface->pixels;
        do {
          iVar9 = 0;
          do {
            while( true ) {
              if (cVar1 == '\x02') {
                uVar5 = (uint)(byte)*puVar8;
                uVar6 = (uint)*(byte *)((int)puVar8 + 1);
                puVar8 = puVar8 + 1;
              }
              else {
                uVar5 = (uint)*puVar8;
                uVar6 = (uint)puVar8[1];
                puVar8 = puVar8 + 2;
              }
              iVar9 = iVar9 + uVar5;
              iVar4 = iVar9 * 4;
              if (uVar6 == 0) break;
              iVar9 = uVar6 + iVar9;
              iVar4 = (*local_2c)((void *)((int)pvVar7 + iVar4),puVar8,uVar6,pcVar10);
              puVar8 = (ushort *)((int)puVar8 + iVar4);
              if (iVar11 <= iVar9) goto LAB_08930284;
            }
                    /* Unresolved local var: int ofs@[???]
                       Unresolved local var: uint run@[???] */
            if (iVar9 == 0) goto LAB_08930128;
          } while (iVar9 < iVar11);
LAB_08930284:
          if (cVar1 == '\x02') {
            puVar8 = (ushort *)((int)puVar8 + ((uint)puVar8 & 2));
          }
          iVar9 = 0;
          do {
                    /* Unresolved local var: uint run@[???] */
            uVar2 = *puVar8;
            while( true ) {
              uVar5 = (uint)puVar8[1];
              puVar8 = puVar8 + 2;
              iVar9 = iVar9 + (uint)uVar2;
              iVar4 = iVar9 * 4;
              if (uVar5 == 0) break;
              iVar9 = uVar5 + iVar9;
              iVar4 = (*local_30)((void *)((int)pvVar7 + iVar4),puVar8,uVar5,pcVar10);
              puVar8 = (ushort *)((int)puVar8 + iVar4);
              if (iVar11 <= iVar9) {
                uVar2 = surface->pitch;
                goto LAB_089302ec;
              }
              uVar2 = *puVar8;
            }
          } while (iVar9 < iVar11);
          uVar2 = surface->pitch;
LAB_089302ec:
          pvVar7 = (void *)((int)pvVar7 + (uVar2 & 0xfffc));
        } while( true );
      }
LAB_08930328:
      surface->flags = surface->flags | 0x4000;
      return;
    }
                    /* Unresolved local var: SDL_Rect full@[???]
                       Unresolved local var: uint alpha_flag@[???] */
    pvVar7 = malloc((uint)surface->pitch * surface->h);
    surface->pixels = pvVar7;
    if (pvVar7 == (void *)0x0) goto LAB_08930328;
    SDL_FillRect(surface,(SDL_Rect *)0x0,surface->format->colorkey);
    uVar5 = surface->flags;
    surface->flags = uVar5 & 0xfffeffff;
    local_38.w = (Uint16)surface->w;
    local_38.h = (Uint16)surface->h;
    local_38.y = 0;
    local_38.x = 0;
    SDL_RLEBlit(surface,&local_38,surface,&local_38);
    surface->flags = surface->flags | uVar5 & 0x10000;
  }
LAB_08930128:
  pSVar3 = surface->map;
LAB_0893012c:
  if ((pSVar3 != (SDL_BlitMap *)0x0) && (pvVar7 = pSVar3->sw_data->aux_data, pvVar7 != (void *)0x0))
  {
    free(pvVar7);
    surface->map->sw_data->aux_data = (void *)0x0;
  }
  return;
}



----------------------------------------

// Function: SDL_RLESurface @ 089303c0

/* WARNING: Removing unreachable block (ram,0x08930c4c) */
/* WARNING: Removing unreachable block (ram,0x08930a5c) */
/* WARNING: Removing unreachable block (ram,0x08930eb8) */
/* WARNING: Removing unreachable block (ram,0x08930efc) */
/* WARNING: Removing unreachable block (ram,0x08930d7c) */
/* WARNING: Removing unreachable block (ram,0x08930a20) */

int SDL_RLESurface(SDL_Surface *surface)

{
  uint *puVar1;
  bool bVar2;
  bool bVar3;
  int iVar4;
  int iVar5;
  undefined2 *ap;
  SDL_Surface *pSVar6;
  Uint8 *ap_00;
  uint uVar7;
  size_t nbytes;
  code *pcVar8;
  void *pvVar9;
  uint *puVar10;
  int iVar11;
  uint uVar12;
  Uint8 *pUVar13;
  int iVar14;
  uint uVar15;
  int iVar16;
  uint uVar17;
  int iVar18;
  int iVar19;
  undefined2 *puVar20;
  int iVar21;
  Uint8 *pUVar22;
  SDL_PixelFormat *pSVar23;
  SDL_PixelFormat *pSVar24;
  undefined2 *puVar25;
  Uint8 *local_90;
  code *local_84;
  code *local_80;
  int local_7c;
  int local_68;
  void *local_64;
  undefined2 *local_48;
  int local_40;
  
                    /* Unresolved local var: int retcode@[???] */
  if ((surface->flags & 0x4000) != 0) {
    SDL_UnRLESurface(surface,1);
  }
  if (surface->format->BitsPerPixel < 8) {
    return -1;
  }
  if ((surface->offset != 0) || (uVar7 = surface->flags, (uVar7 & 0x4005) != 0)) {
    iVar4 = SDL_LockSurface(surface);
    if (iVar4 < 0) {
      return -1;
    }
    uVar7 = surface->flags;
  }
  if ((uVar7 & 0x1000) == 0) {
    if ((uVar7 & 0x10000) == 0) {
                    /* Unresolved local var: SDL_Surface * dest@[???]
                       Unresolved local var: SDL_PixelFormat * df@[???]
                       Unresolved local var: int maxsize@[???]
                       Unresolved local var: int max_opaque_run@[???]
                       Unresolved local var: int max_transl_run@[???]
                       Unresolved local var: uint masksum@[???]
                       Unresolved local var: Uint8 * rlebuf@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var:
                       _func_int_void_ptr_Uint32_ptr_int_SDL_PixelFormat_ptr_SDL_PixelFormat_ptr *
                       copy_opaque@[???]
                       Unresolved local var:
                       _func_int_void_ptr_Uint32_ptr_int_SDL_PixelFormat_ptr_SDL_PixelFormat_ptr *
                       copy_transl@[???]
                       Unresolved local var: Uint8 * p@[???] */
      iVar4 = -1;
    }
    else {
      iVar4 = -1;
      if ((surface->format->Amask != 0) &&
         (pSVar6 = surface->map->dst, pSVar6 != (SDL_Surface *)0x0)) {
        pSVar23 = pSVar6->format;
        if (surface->format->BitsPerPixel != ' ') {
          iVar5 = surface->offset;
          goto LAB_0893046c;
        }
        uVar15 = pSVar23->Rmask;
        uVar12 = pSVar23->Gmask;
        uVar17 = pSVar23->Bmask;
        uVar7 = uVar15 | uVar12 | uVar17;
        if (pSVar23->BytesPerPixel == '\x02') {
          if (uVar7 == 0x7fff) {
            if (((uVar12 == 0x3e0) || (uVar15 == 0x3e0)) || (uVar17 == 0x3e0)) {
              local_80 = copy_transl_555;
              goto LAB_089310a8;
            }
            iVar4 = -1;
          }
          else {
            iVar4 = -1;
            if ((uVar7 == 0xffff) && (((uVar12 == 0x7e0 || (uVar15 == 0x7e0)) || (uVar17 == 0x7e0)))
               ) {
              local_80 = copy_transl_565;
LAB_089310a8:
              local_84 = copy_opaque_16;
              iVar4 = (surface->w * 6 + 8) * surface->h + 2;
              goto LAB_089308bc;
            }
          }
        }
        else {
          if (pSVar23->BytesPerPixel != '\x04') goto LAB_08930468;
          if (uVar7 != 0xffffff) {
            iVar5 = surface->offset;
            goto LAB_0893046c;
          }
          local_80 = copy_32;
          local_84 = copy_32;
          iVar4 = (surface->w + 1) * surface->h * 8 + 4;
LAB_089308bc:
          ap_00 = malloc(iVar4 + 0x18);
          if (ap_00 == (Uint8 *)0x0) goto LAB_08930fd4;
                    /* Unresolved local var: RLEDestFormat * r@[???] */
          pUVar13 = ap_00 + 0x18;
          *ap_00 = pSVar23->BytesPerPixel;
          ap_00[1] = pSVar23->Rloss;
          ap_00[2] = pSVar23->Gloss;
          ap_00[3] = pSVar23->Bloss;
          ap_00[4] = pSVar23->Rshift;
          ap_00[5] = pSVar23->Gshift;
          ap_00[6] = pSVar23->Bshift;
          ap_00[7] = pSVar23->Ashift;
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int h@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: SDL_PixelFormat * sf@[???]
                       Unresolved local var: Uint32 * src@[???]
                       Unresolved local var: Uint8 * lastline@[???] */
          *(Uint32 *)(ap_00 + 8) = pSVar23->Rmask;
          pSVar24 = surface->format;
          pvVar9 = surface->pixels;
          *(Uint32 *)(ap_00 + 0xc) = pSVar23->Gmask;
          *(Uint32 *)(ap_00 + 0x10) = pSVar23->Bmask;
          *(Uint32 *)(ap_00 + 0x14) = pSVar23->Amask;
          iVar5 = surface->h;
          iVar4 = surface->w;
          local_90 = pUVar13;
          if (0 < iVar5) {
            local_7c = 0;
            do {
              bVar3 = false;
                    /* Unresolved local var: int runstart@[???]
                       Unresolved local var: int skipstart@[???]
                       Unresolved local var: int blankline@[???]
                       Unresolved local var: int run@[???]
                       Unresolved local var: int skip@[???]
                       Unresolved local var: int len@[???] */
              iVar19 = 0;
              do {
                iVar18 = iVar19;
                if (iVar19 < iVar4) {
                  puVar10 = (uint *)(iVar19 * 4 + (int)pvVar9);
                  uVar15 = pSVar24->Amask;
                  uVar12 = (uint)pSVar24->Ashift;
                  uVar7 = (uVar15 & *puVar10) >> (uVar12 & 0x1f);
                  while (uVar7 != 0xff) {
                    iVar18 = iVar18 + 1;
                    if (iVar18 == iVar4) {
                      iVar14 = iVar18 - iVar19;
                      iVar19 = iVar18;
                      goto LAB_089309d4;
                    }
                    puVar1 = puVar10 + 1;
                    puVar10 = puVar10 + 1;
                    uVar7 = (uVar15 & *puVar1) >> (uVar12 & 0x1f);
                  }
                  puVar10 = (uint *)((int)pvVar9 + iVar18 * 4);
                  uVar7 = *puVar10;
                  iVar11 = iVar18;
                  while ((puVar10 = puVar10 + 1, (uVar15 & uVar7) >> (uVar12 & 0x1f) == 0xff &&
                         (iVar11 = iVar11 + 1, iVar11 < iVar4))) {
                    uVar7 = *puVar10;
                  }
                  iVar14 = iVar18 - iVar19;
                  iVar19 = iVar18;
                  iVar18 = iVar11;
                }
                else {
                  iVar14 = 0;
                }
LAB_089309d4:
                if (iVar4 == iVar14) {
                  bVar3 = true;
                }
                iVar11 = iVar14;
                if (0xff < iVar14) {
                  do {
                    while (iVar11 = iVar11 + -0xff, pSVar23->BytesPerPixel != '\x04') {
                      *pUVar13 = 0xff;
                      pUVar13[1] = '\0';
                      pUVar13 = pUVar13 + 2;
                      if (iVar11 == iVar14 + ((iVar14 - 0x100U) / 0xff) * -0xff + -0xff)
                      goto LAB_08930a88;
                    }
                    pUVar13[0] = 0xff;
                    pUVar13[1] = '\0';
                    pUVar13[2] = '\0';
                    pUVar13[3] = '\0';
                    pUVar13 = pUVar13 + 4;
                  } while (iVar11 != iVar14 + ((iVar14 - 0x100U) / 0xff) * -0xff + -0xff);
                }
LAB_08930a88:
                iVar14 = (iVar18 - iVar19) + 0xff;
                if (pSVar23->BytesPerPixel == '\x04') {
                  pUVar22 = pUVar13 + 4;
                  *(short *)pUVar13 = (short)iVar11;
                  *(short *)(pUVar13 + 2) = (short)iVar14;
                }
                else {
                  *pUVar13 = (Uint8)iVar11;
                  pUVar13[1] = (Uint8)iVar14;
                  pUVar22 = pUVar13 + 2;
                }
                iVar11 = (*local_84)(pUVar22,(void *)(iVar19 * 4 + (int)pvVar9),iVar14,pSVar24);
                iVar21 = (iVar18 - iVar19) - iVar14;
                pUVar13 = pUVar22 + iVar11;
                if (iVar21 != 0) {
                  iVar14 = iVar14 + iVar19;
                  do {
                    while( true ) {
                      iVar19 = iVar21 + 0xff;
                      if (pSVar23->BytesPerPixel != '\x04') break;
                      pUVar13[0] = '\0';
                      pUVar13[1] = '\0';
                      *(short *)(pUVar13 + 2) = (short)iVar19;
                      iVar11 = (*local_84)(pUVar13 + 4,(void *)(iVar14 * 4 + (int)pvVar9),iVar19,
                                           pSVar24);
                      iVar21 = iVar21 - iVar19;
                      iVar14 = iVar14 + iVar19;
                      pUVar13 = pUVar13 + 4 + iVar11;
                      if (iVar21 == 0) goto LAB_08930b68;
                    }
                    pUVar13[1] = (Uint8)iVar19;
                    *pUVar13 = '\0';
                    iVar11 = (*local_84)(pUVar13 + 2,(void *)(iVar14 * 4 + (int)pvVar9),iVar19,
                                         pSVar24);
                    iVar21 = iVar21 - iVar19;
                    iVar14 = iVar14 + iVar19;
                    pUVar13 = pUVar13 + 2 + iVar11;
                  } while (iVar21 != 0);
                }
LAB_08930b68:
                iVar19 = iVar18;
              } while (iVar18 < iVar4);
              pUVar13 = pUVar13 + ((uint)pUVar13 & 2);
              iVar19 = 0;
              do {
                    /* Unresolved local var: int run@[???]
                       Unresolved local var: int skip@[???]
                       Unresolved local var: int len@[???] */
                if (iVar19 < iVar4) {
                  puVar10 = (uint *)(iVar19 * 4 + (int)pvVar9);
                  uVar12 = pSVar24->Amask;
                  uVar15 = (uint)pSVar24->Ashift;
                  uVar7 = (uVar12 & *puVar10) >> (uVar15 & 0x1f);
                  iVar11 = iVar19;
                  while (0xfd < uVar7 - 1) {
                    iVar11 = iVar11 + 1;
                    if (iVar11 == iVar4) {
                      iVar14 = iVar11 - iVar19;
                      iVar18 = iVar11;
                      goto LAB_08930bf0;
                    }
                    puVar1 = puVar10 + 1;
                    puVar10 = puVar10 + 1;
                    uVar7 = (uVar12 & *puVar1) >> (uVar15 & 0x1f);
                  }
                  puVar10 = (uint *)((int)pvVar9 + iVar11 * 4);
                  iVar18 = iVar11;
                  do {
                    uVar7 = *puVar10;
                    puVar10 = puVar10 + 1;
                    if (0xfd < ((uVar12 & uVar7) >> (uVar15 & 0x1f)) - 1) {
                      iVar14 = iVar11 - iVar19;
                      bVar2 = iVar18 < iVar4;
                      goto LAB_08930c04;
                    }
                    iVar18 = iVar18 + 1;
                  } while (iVar18 < iVar4);
                  iVar14 = iVar11 - iVar19;
                  bVar2 = false;
                }
                else {
                  iVar14 = 0;
                  iVar18 = iVar19;
LAB_08930bf0:
                  bVar2 = iVar18 < iVar4;
                  iVar11 = iVar18;
                }
LAB_08930c04:
                bVar3 = (bool)(bVar3 & iVar4 == iVar14);
                iVar19 = iVar14;
                if (0xffff < iVar14) {
                  do {
                    iVar19 = iVar19 + -0xffff;
                    pUVar13[0] = 0xff;
                    pUVar13[1] = 0xff;
                    pUVar13[2] = '\0';
                    pUVar13[3] = '\0';
                    pUVar13 = pUVar13 + 4;
                  } while (iVar19 != ((iVar14 - 0x10000U) / 0xffff) * -0xffff + iVar14 + -0xffff);
                }
                iVar21 = (iVar18 - iVar11) + 0xffff;
                *(short *)pUVar13 = (short)iVar19;
                *(short *)(pUVar13 + 2) = (short)iVar21;
                iVar19 = (*local_80)(pUVar13 + 4,(void *)(iVar11 * 4 + (int)pvVar9),iVar21,pSVar24);
                iVar14 = (iVar18 - iVar11) - iVar21;
                pUVar13 = pUVar13 + 4 + iVar19;
                if (iVar14 != 0) {
                  iVar21 = iVar21 + iVar11;
                  do {
                    iVar11 = iVar14 + 0xffff;
                    pUVar13[0] = '\0';
                    pUVar13[1] = '\0';
                    *(short *)(pUVar13 + 2) = (short)iVar11;
                    iVar19 = (*local_80)(pUVar13 + 4,(void *)(iVar21 * 4 + (int)pvVar9),iVar11,
                                         pSVar24);
                    iVar14 = iVar14 - iVar11;
                    pUVar13 = pUVar13 + 4 + iVar19;
                    iVar21 = iVar21 + iVar11;
                  } while (iVar14 != 0);
                }
                if (!bVar3) {
                  local_90 = pUVar13;
                }
                iVar19 = iVar18;
              } while (bVar2);
              local_7c = local_7c + 1;
              if (iVar5 == local_7c) break;
              pvVar9 = (void *)((int)pvVar9 + (surface->pitch & 0xfffc));
            } while( true );
          }
          if (pSVar23->BytesPerPixel == '\x04') {
            pUVar13 = local_90 + 4;
            local_90[0] = '\0';
            local_90[1] = '\0';
            local_90[2] = '\0';
            local_90[3] = '\0';
          }
          else {
            *local_90 = '\0';
            local_90[1] = '\0';
            pUVar13 = local_90 + 2;
          }
          if ((surface->flags & 0x1000001) == 0) {
            free(surface->pixels);
            surface->pixels = (void *)0x0;
          }
          pUVar13 = realloc(ap_00,(int)pUVar13 - (int)ap_00);
          if (pUVar13 != (Uint8 *)0x0) {
            ap_00 = pUVar13;
          }
          iVar4 = 0;
          surface->map->sw_data->aux_data = ap_00;
        }
      }
    }
  }
  else {
                    /* Unresolved local var: Uint8 * rlebuf@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int maxn@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: Uint8 * srcbuf@[???]
                       Unresolved local var: Uint8 * curbuf@[???]
                       Unresolved local var: Uint8 * lastline@[???]
                       Unresolved local var: int maxsize@[???]
                       Unresolved local var: int skip@[???]
                       Unresolved local var: int run@[???]
                       Unresolved local var: int bpp@[???]
                       Unresolved local var: getpix_func getpix@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: Uint32 rgbmask@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int h@[???] */
    uVar7 = (uint)surface->format->BytesPerPixel;
    if (uVar7 < 4) {
      if (uVar7 < 2) {
        if (uVar7 == 1) {
          nbytes = (surface->w / 2 + 1) * surface->h * 3 + 2;
        }
        else {
          nbytes = 0;
        }
      }
      else {
        nbytes = (uVar7 * surface->w + (surface->w / 0xff) * 2 + 2) * surface->h + 2;
      }
    }
    else if (uVar7 == 4) {
      nbytes = ((surface->w + surface->w / 0xffff) * 4 + 4) * surface->h + 4;
    }
    else {
      nbytes = 0;
    }
    ap = malloc(nbytes);
    if (ap == (undefined2 *)0x0) {
LAB_08930fd4:
      SDL_Error(SDL_ENOMEM);
      iVar4 = -1;
    }
    else {
      iVar5 = 0xff;
      iVar4 = surface->h;
      uVar12 = ~surface->format->Amask;
      pcVar8 = (code *)(&DAT_089e14a4)[uVar7];
      uVar15 = uVar12 & surface->format->colorkey;
      if (uVar7 == 4) {
        iVar5 = 0xffff;
      }
      iVar19 = surface->w;
      local_64 = surface->pixels;
      local_48 = ap;
      if (0 < iVar4) {
        local_68 = 0;
        puVar20 = ap;
LAB_089305a8:
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: int blankline@[???]
                       Unresolved local var: int run@[???]
                       Unresolved local var: int skip@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: int runstart@[???]
                       Unresolved local var: int skipstart@[???] */
        iVar18 = 0;
        bVar3 = false;
        iVar14 = iVar18;
        if (iVar19 < 1) goto LAB_08930604;
        iVar11 = 0;
LAB_089305c0:
        iVar11 = (int)local_64 + iVar11;
        iVar18 = iVar14;
        do {
          uVar17 = (*pcVar8)(iVar11);
          if (uVar15 != (uVar12 & uVar17)) goto LAB_08930604;
          iVar18 = iVar18 + 1;
          local_40 = uVar7 * iVar18;
          iVar11 = iVar11 + uVar7;
        } while (iVar18 != iVar19);
        do {
          iVar16 = 0;
          iVar11 = iVar18;
          iVar21 = iVar18;
LAB_08930660:
          iVar18 = iVar21;
          iVar14 = iVar11 - iVar14;
          if (iVar19 == iVar14) {
            bVar3 = true;
          }
          if (iVar5 < iVar14) {
            iVar21 = iVar14 - iVar5;
            do {
              if (uVar7 == 4) {
                *puVar20 = (short)iVar5;
                puVar20[1] = 0;
                puVar20 = puVar20 + 2;
              }
              else {
                *(char *)puVar20 = (char)iVar5;
                *(undefined1 *)((int)puVar20 + 1) = 0;
                puVar20 = puVar20 + 1;
              }
              iVar21 = iVar21 - iVar5;
              iVar14 = iVar21 + iVar5;
            } while (iVar5 < iVar14);
          }
          iVar21 = iVar5 + iVar16;
          if (uVar7 == 4) {
            puVar25 = puVar20 + 2;
            *puVar20 = (short)iVar14;
            puVar20[1] = (short)iVar21;
          }
          else {
            *(char *)puVar20 = (char)iVar14;
            *(char *)((int)puVar20 + 1) = (char)iVar21;
            puVar25 = puVar20 + 1;
          }
          iVar16 = iVar16 - iVar21;
          memcpy(puVar25,(void *)(local_40 + (int)local_64),uVar7 * iVar21);
          puVar20 = (undefined2 *)((int)puVar25 + uVar7 * iVar21);
          if (iVar16 != 0) {
            iVar21 = iVar21 + iVar11;
            do {
              while( true ) {
                puVar25 = puVar20 + 2;
                iVar14 = iVar5 + iVar16;
                if (uVar7 != 4) break;
                *puVar20 = 0;
                puVar20[1] = (short)iVar14;
                iVar16 = iVar16 - iVar14;
                puVar20 = puVar25 + iVar14 * 2;
                iVar11 = iVar21 * 4;
                iVar21 = iVar21 + iVar14;
                memcpy(puVar25,(void *)(iVar11 + (int)local_64),iVar14 * 4);
                if (iVar16 == 0) goto LAB_089307a0;
              }
              *(char *)((int)puVar20 + 1) = (char)iVar14;
              puVar25 = puVar20 + 1;
              *(undefined1 *)puVar20 = 0;
              iVar16 = iVar16 - iVar14;
              puVar20 = (undefined2 *)((int)puVar25 + uVar7 * iVar14);
              iVar11 = uVar7 * iVar21;
              iVar21 = iVar21 + iVar14;
              memcpy(puVar25,(void *)(iVar11 + (int)local_64),uVar7 * iVar14);
            } while (iVar16 != 0);
          }
LAB_089307a0:
          if (!bVar3) {
            local_48 = puVar20;
          }
          if (iVar19 <= iVar18) {
            local_68 = local_68 + 1;
            if (iVar4 == local_68) goto LAB_08930e04;
            local_64 = (void *)((int)local_64 + (uint)surface->pitch);
            goto LAB_089305a8;
          }
          iVar11 = iVar18 * uVar7;
          iVar14 = iVar18;
          if (iVar18 < iVar19) goto LAB_089305c0;
LAB_08930604:
          local_40 = uVar7 * iVar18;
        } while (iVar19 <= iVar18);
        pvVar9 = (void *)(local_40 + (int)local_64);
        iVar21 = iVar18;
        do {
          uVar17 = (*pcVar8)(pvVar9);
          iVar11 = iVar18;
          if (uVar15 == (uVar12 & uVar17)) {
            iVar16 = iVar21 - iVar18;
            break;
          }
          iVar21 = iVar21 + 1;
          iVar16 = iVar21 - iVar18;
          pvVar9 = (void *)((int)pvVar9 + uVar7);
        } while (iVar21 != iVar19);
        goto LAB_08930660;
      }
LAB_08930e04:
      if (uVar7 == 4) {
        *local_48 = 0;
        local_48[1] = 0;
        uVar7 = surface->flags;
        local_48 = local_48 + 2;
      }
      else {
        *(undefined1 *)local_48 = 0;
        *(undefined1 *)((int)local_48 + 1) = 0;
        uVar7 = surface->flags;
        local_48 = local_48 + 1;
      }
      if ((uVar7 & 0x1000001) == 0) {
        free(surface->pixels);
        surface->pixels = (void *)0x0;
      }
      puVar20 = realloc(ap,(int)local_48 - (int)ap);
                    /* Unresolved local var: Uint8 * p@[???] */
      iVar4 = 0;
      if (puVar20 != (undefined2 *)0x0) {
        ap = puVar20;
      }
      surface->map->sw_data->aux_data = ap;
    }
  }
LAB_08930468:
  iVar5 = surface->offset;
LAB_0893046c:
  if ((iVar5 != 0) || ((surface->flags & 0x4005) != 0)) {
    SDL_UnlockSurface(surface);
  }
  if (iVar4 < 0) {
    return -1;
  }
  surface->flags = surface->flags | 0x4000;
  return 0;
}



----------------------------------------

// Function: Blit_RGB888_index8 @ 08931138

/* WARNING: Removing unreachable block (ram,0x0893118c) */
/* WARNING: Removing unreachable block (ram,0x0893114c) */
/* WARNING: Removing unreachable block (ram,0x089313e0) */

void Blit_RGB888_index8(SDL_BlitInfo *info)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  byte *pbVar6;
  uint *puVar7;
  Uint8 *pUVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: Uint8 * map@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg6(a2)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)] */
  pUVar8 = info->table;
  iVar11 = info->s_skip / 4;
  uVar3 = info->d_width;
  iVar1 = info->d_height;
  puVar7 = (uint *)info->s_pixels;
  iVar10 = info->d_skip;
  pbVar6 = info->d_pixels;
  if (pUVar8 == (Uint8 *)0x0) {
    if (iVar1 != 0) {
      iVar12 = (int)(uVar3 + 7) / 8;
      iVar9 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???] */
        iVar4 = iVar12;
        switch(uVar3 & 7) {
        case 0:
          do {
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_08931448:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_08931470:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_08931498:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_089314c0:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_089314e8:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
LAB_08931510:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
            iVar5 = iVar4;
LAB_08931538:
            uVar2 = *puVar7;
            *pbVar6 = (byte)(uVar2 >> 0x10) & 0xe0 | (byte)((uVar2 & 0xe000) >> 0xb) |
                      (byte)uVar2 >> 6;
            pbVar6 = pbVar6 + 1;
            iVar4 = iVar5 + -1;
          } while (0 < iVar5 + -1);
          break;
        case 1:
          iVar5 = iVar12;
          goto LAB_08931538;
        case 2:
          goto LAB_08931510;
        case 3:
          goto LAB_089314e8;
        case 4:
          goto LAB_089314c0;
        case 5:
          goto LAB_08931498;
        case 6:
          goto LAB_08931470;
        case 7:
          goto LAB_08931448;
        }
        puVar7 = puVar7 + iVar11;
        if (iVar1 + -1 == iVar9) break;
        pbVar6 = pbVar6 + iVar10;
        iVar9 = iVar9 + 1;
      }
    }
  }
  else {
                    /* Unresolved local var: int pixel@[???] */
    if (iVar1 != 0) {
      iVar12 = (int)(uVar3 + 7) / 8;
      iVar9 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???] */
        iVar4 = iVar12;
        switch(uVar3 & 7) {
        case 0:
          do {
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_08931200:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_08931234:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_08931268:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_0893129c:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_089312d0:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
LAB_08931304:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
            iVar5 = iVar4;
LAB_08931338:
            uVar2 = *puVar7;
            puVar7 = puVar7 + 1;
            *pbVar6 = pUVar8[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
            pbVar6 = pbVar6 + 1;
            iVar4 = iVar5 + -1;
          } while (0 < iVar5 + -1);
          break;
        case 1:
          iVar5 = iVar12;
          goto LAB_08931338;
        case 2:
          goto LAB_08931304;
        case 3:
          goto LAB_089312d0;
        case 4:
          goto LAB_0893129c;
        case 5:
          goto LAB_08931268;
        case 6:
          goto LAB_08931234;
        case 7:
          goto LAB_08931200;
        }
        puVar7 = puVar7 + iVar11;
        if (iVar1 + -1 == iVar9) break;
        pbVar6 = pbVar6 + iVar10;
        iVar9 = iVar9 + 1;
      }
    }
  }
  return;
}



----------------------------------------

// Function: Blit_RGB888_RGB555 @ 089315b4

/* WARNING: Removing unreachable block (ram,0x089315f4) */
/* WARNING: Removing unreachable block (ram,0x089315c8) */
/* WARNING: Removing unreachable block (ram,0x08931618) */

void Blit_RGB888_RGB555(SDL_BlitInfo *info)

{
  uint uVar1;
  int iVar2;
  ushort *puVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  uint *puVar9;
  int iVar10;
  int iVar11;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: Uint16 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar2 = info->s_skip;
  iVar4 = info->d_skip;
  iVar5 = info->d_height;
  puVar9 = (uint *)info->s_pixels;
  uVar6 = info->d_width;
  puVar3 = (ushort *)info->d_pixels;
  if (iVar5 != 0) {
    iVar11 = (int)(uVar6 + 7) / 8;
    iVar10 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg8(t0)] */
      iVar7 = iVar11;
      switch(uVar6 & 7) {
      case 0:
        do {
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931694:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_089316c0:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_089316ec:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931718:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931744:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931770:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
          iVar8 = iVar7;
LAB_0893179c:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 9) & 0x7c00 | (ushort)((uVar1 & 0xf800) >> 6) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
          iVar7 = iVar8 + -1;
        } while (0 < iVar8 + -1);
        break;
      case 1:
        iVar8 = iVar11;
        goto LAB_0893179c;
      case 2:
        goto LAB_08931770;
      case 3:
        goto LAB_08931744;
      case 4:
        goto LAB_08931718;
      case 5:
        goto LAB_089316ec;
      case 6:
        goto LAB_089316c0;
      case 7:
        goto LAB_08931694;
      }
      puVar9 = puVar9 + iVar2 / 4;
      if (iVar5 + -1 == iVar10) break;
      puVar3 = puVar3 + iVar4 / 2;
      iVar10 = iVar10 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit_RGB888_RGB565 @ 08931824

/* WARNING: Removing unreachable block (ram,0x08931864) */
/* WARNING: Removing unreachable block (ram,0x08931838) */
/* WARNING: Removing unreachable block (ram,0x08931888) */

void Blit_RGB888_RGB565(SDL_BlitInfo *info)

{
  uint uVar1;
  int iVar2;
  ushort *puVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  uint *puVar9;
  int iVar10;
  int iVar11;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: Uint16 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar2 = info->s_skip;
  iVar4 = info->d_skip;
  iVar5 = info->d_height;
  puVar9 = (uint *)info->s_pixels;
  uVar6 = info->d_width;
  puVar3 = (ushort *)info->d_pixels;
  if (iVar5 != 0) {
    iVar11 = (int)(uVar6 + 7) / 8;
    iVar10 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg8(t0)] */
      iVar7 = iVar11;
      switch(uVar6 & 7) {
      case 0:
        do {
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931904:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931930:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_0893195c:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_08931988:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_089319b4:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
LAB_089319e0:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
          iVar8 = iVar7;
LAB_08931a0c:
          uVar1 = *puVar9;
          puVar9 = puVar9 + 1;
          *puVar3 = (ushort)(uVar1 >> 8) & 0xf800 | (ushort)((uVar1 & 0xfc00) >> 5) |
                    (ushort)((uVar1 << 0x18) >> 0x1b);
          puVar3 = puVar3 + 1;
          iVar7 = iVar8 + -1;
        } while (0 < iVar8 + -1);
        break;
      case 1:
        iVar8 = iVar11;
        goto LAB_08931a0c;
      case 2:
        goto LAB_089319e0;
      case 3:
        goto LAB_089319b4;
      case 4:
        goto LAB_08931988;
      case 5:
        goto LAB_0893195c;
      case 6:
        goto LAB_08931930;
      case 7:
        goto LAB_08931904;
      }
      puVar9 = puVar9 + iVar2 / 4;
      if (iVar5 + -1 == iVar10) break;
      puVar3 = puVar3 + iVar4 / 2;
      iVar10 = iVar10 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit_RGB565_32 @ 08931a94

/* WARNING: Removing unreachable block (ram,0x08931aa8) */
/* WARNING: Removing unreachable block (ram,0x08931ae4) */

void Blit_RGB565_32(SDL_BlitInfo *info,Uint32 *map)

{
  byte *pbVar1;
  byte bVar2;
  int iVar3;
  int *piVar4;
  uint uVar5;
  int iVar6;
  byte *pbVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: Uint32 * dst@[DW_OP_reg6(a2)]
                       Unresolved local var: int srcskip@[DW_OP_reg24(t8)]
                       Unresolved local var: int dstskip@[???] */
  iVar3 = info->d_skip;
  iVar6 = info->d_height;
  iVar11 = info->s_skip;
  uVar5 = info->d_width;
  pbVar7 = info->s_pixels;
  piVar4 = (int *)info->d_pixels;
  if (iVar6 != 0) {
    iVar12 = (int)(uVar5 + 7) / 8;
    iVar10 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg9(t1)] */
      iVar8 = iVar12;
      switch(uVar5 & 7) {
      case 0:
        do {
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931b58:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931b88:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931bb8:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931be8:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931c18:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
LAB_08931c48:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
          iVar9 = iVar8;
LAB_08931c78:
          bVar2 = *pbVar7;
          pbVar1 = pbVar7 + 1;
          pbVar7 = pbVar7 + 2;
          *piVar4 = map[(uint)bVar2 * 2] + map[(uint)*pbVar1 * 2 + 1];
          piVar4 = piVar4 + 1;
          iVar8 = iVar9 + -1;
        } while (0 < iVar9 + -1);
        break;
      case 1:
        iVar9 = iVar12;
        goto LAB_08931c78;
      case 2:
        goto LAB_08931c48;
      case 3:
        goto LAB_08931c18;
      case 4:
        goto LAB_08931be8;
      case 5:
        goto LAB_08931bb8;
      case 6:
        goto LAB_08931b88;
      case 7:
        goto LAB_08931b58;
      }
      pbVar7 = pbVar7 + iVar11;
      if (iVar10 == iVar6 + -1) break;
      piVar4 = piVar4 + iVar3 / 4;
      iVar10 = iVar10 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit_RGB565_ARGB8888 @ 08931d04

void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)

{
  Blit_RGB565_32(info,RGB565_ARGB8888_LUT);
  return;
}



----------------------------------------

// Function: Blit_RGB565_ABGR8888 @ 08931d10

void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)

{
  Blit_RGB565_32(info,RGB565_ABGR8888_LUT);
  return;
}



----------------------------------------

// Function: Blit_RGB565_RGBA8888 @ 08931d1c

void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)

{
  Blit_RGB565_32(info,RGB565_RGBA8888_LUT);
  return;
}



----------------------------------------

// Function: Blit_RGB565_BGRA8888 @ 08931d28

void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)

{
  Blit_RGB565_32(info,RGB565_BGRA8888_LUT);
  return;
}



----------------------------------------

// Function: Blit_RGB888_index8_map @ 08931d34

/* WARNING: Removing unreachable block (ram,0x08931d48) */
/* WARNING: Removing unreachable block (ram,0x08931d84) */

void Blit_RGB888_index8_map(SDL_BlitInfo *info)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  Uint8 *pUVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  uint *puVar8;
  int iVar9;
  Uint8 *pUVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int pixel@[???]
                       Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * src@[DW_OP_reg5(a1)]
                       Unresolved local var: Uint8 * map@[DW_OP_reg9(t1)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg6(a2)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)] */
  iVar1 = info->s_skip;
  iVar3 = info->d_height;
  pUVar10 = info->table;
  uVar5 = info->d_width;
  puVar8 = (uint *)info->s_pixels;
  iVar11 = info->d_skip;
  pUVar4 = info->d_pixels;
  if (iVar3 != 0) {
    iVar12 = (int)(uVar5 + 7) / 8;
    iVar9 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg7(a3)] */
      iVar6 = iVar12;
      switch(uVar5 & 7) {
      case 0:
        do {
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931dfc:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931e30:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931e64:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931e98:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931ecc:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
LAB_08931f00:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
          iVar7 = iVar6;
LAB_08931f34:
          uVar2 = *puVar8;
          puVar8 = puVar8 + 1;
          *pUVar4 = pUVar10[uVar2 >> 0x10 & 0xe0 | (uVar2 & 0xe000) >> 0xb | (uVar2 & 0xff) >> 6];
          pUVar4 = pUVar4 + 1;
          iVar6 = iVar7 + -1;
        } while (0 < iVar7 + -1);
        break;
      case 1:
        iVar7 = iVar12;
        goto LAB_08931f34;
      case 2:
        goto LAB_08931f00;
      case 3:
        goto LAB_08931ecc;
      case 4:
        goto LAB_08931e98;
      case 5:
        goto LAB_08931e64;
      case 6:
        goto LAB_08931e30;
      case 7:
        goto LAB_08931dfc;
      }
      puVar8 = puVar8 + iVar1 / 4;
      if (iVar3 + -1 == iVar9) break;
      pUVar4 = pUVar4 + iVar11;
      iVar9 = iVar9 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitNto1 @ 08931fc4

/* WARNING: Removing unreachable block (ram,0x08932024) */
/* WARNING: Removing unreachable block (ram,0x089325cc) */

void BlitNto1(SDL_BlitInfo *info)

{
  int iVar1;
  uint uVar2;
  SDL_PixelFormat *pSVar3;
  uint uVar4;
  uint *puVar5;
  uint uVar6;
  byte *pbVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  Uint8 *pUVar13;
  int iVar14;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg13(t5)]
                       Unresolved local var: Uint8 * map@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg15(t7)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: int sR@[???]
                       Unresolved local var: int sG@[???]
                       Unresolved local var: int sB@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg11(t3)] */
  pSVar3 = info->src;
  pUVar13 = info->table;
  uVar2 = info->d_width;
  iVar1 = info->d_height;
  puVar5 = (uint *)info->s_pixels;
  iVar12 = info->s_skip;
  pbVar7 = info->d_pixels;
  iVar11 = info->d_skip;
  uVar6 = (uint)pSVar3->BytesPerPixel;
  if (pUVar13 == (Uint8 *)0x0) {
    if (iVar1 != 0) {
      iVar14 = (int)(uVar2 + 7) / 8;
      iVar10 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???] */
        iVar8 = iVar14;
        switch(uVar2 & 7) {
        case 0:
          do {
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_08932828:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_089328b8:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_08932948:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_089329d8:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_08932a68:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
LAB_08932af8:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
            iVar9 = iVar8;
LAB_08932b88:
            if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
            }
            else if (uVar6 == 4) {
              uVar4 = *puVar5;
            }
            else if (uVar6 == 2) {
              uVar4 = (uint)(ushort)*puVar5;
            }
            else {
              uVar4 = 0;
            }
            *pbVar7 = (byte)(((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                   (pSVar3->Gloss & 0x1f)) >> 5) << 2) |
                      (byte)(((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f)) & 0xe0 |
                      (byte)((int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                  (pSVar3->Bloss & 0x1f)) >> 6);
            puVar5 = (uint *)((int)puVar5 + uVar6);
            pbVar7 = pbVar7 + 1;
            iVar8 = iVar9 + -1;
          } while (0 < iVar9 + -1);
          break;
        case 1:
          iVar9 = iVar14;
          goto LAB_08932b88;
        case 2:
          goto LAB_08932af8;
        case 3:
          goto LAB_08932a68;
        case 4:
          goto LAB_089329d8;
        case 5:
          goto LAB_08932948;
        case 6:
          goto LAB_089328b8;
        case 7:
          goto LAB_08932828;
        }
        puVar5 = (uint *)((int)puVar5 + iVar12);
        if (iVar10 == iVar1 + -1) break;
        pbVar7 = pbVar7 + iVar11;
        iVar10 = iVar10 + 1;
      }
    }
  }
  else if (iVar1 != 0) {
    iVar14 = (int)(uVar2 + 7) / 8;
    iVar10 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar8 = iVar14;
      switch(uVar2 & 7) {
      case 0:
        do {
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_089324c8:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_0893205c:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_089320f4:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_0893218c:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_08932224:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
LAB_089322bc:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
          iVar9 = iVar8;
LAB_08932354:
          if (uVar6 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar4 = (uint)(byte)*puVar5 + (uint)*(byte *)((int)puVar5 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar5 + 2) * 0x10000;
          }
          else if (uVar6 == 4) {
            uVar4 = *puVar5;
          }
          else if (uVar6 == 2) {
            uVar4 = (uint)(ushort)*puVar5;
          }
          else {
            uVar4 = 0;
          }
          puVar5 = (uint *)((int)puVar5 + uVar6);
          *pbVar7 = pUVar13[((int)(((uVar4 & pSVar3->Gmask) >> (pSVar3->Gshift & 0x1f)) <<
                                  (pSVar3->Gloss & 0x1f)) >> 5) << 2 |
                            ((uVar4 & pSVar3->Rmask) >> (pSVar3->Rshift & 0x1f)) <<
                            (pSVar3->Rloss & 0x1f) & 0xffffffe0 |
                            (int)(((uVar4 & pSVar3->Bmask) >> (pSVar3->Bshift & 0x1f)) <<
                                 (pSVar3->Bloss & 0x1f)) >> 6];
          pbVar7 = pbVar7 + 1;
          iVar8 = iVar9 + -1;
        } while (0 < iVar9 + -1);
        break;
      case 1:
        iVar9 = iVar14;
        goto LAB_08932354;
      case 2:
        goto LAB_089322bc;
      case 3:
        goto LAB_08932224;
      case 4:
        goto LAB_0893218c;
      case 5:
        goto LAB_089320f4;
      case 6:
        goto LAB_0893205c;
      case 7:
        goto LAB_089324c8;
      }
      puVar5 = (uint *)((int)puVar5 + iVar12);
      if (iVar10 == iVar1 + -1) break;
      pbVar7 = pbVar7 + iVar11;
      iVar10 = iVar10 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitNtoN @ 08932d3c

/* WARNING: Removing unreachable block (ram,0x08932dbc) */

void BlitNtoN(SDL_BlitInfo *info)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  byte bVar4;
  byte bVar5;
  byte bVar6;
  uint uVar7;
  int iVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  SDL_PixelFormat *pSVar16;
  SDL_PixelFormat *pSVar17;
  uint uVar18;
  uint *puVar19;
  uint *puVar20;
  uint uVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  int iVar27;
  int iVar28;
  uint uVar29;
  uint uVar30;
  int iVar31;
  int iVar32;
  int local_40;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg14(t6)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg13(t5)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg10(t2)]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg11(t3)]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: uint alpha@[???] */
  pSVar17 = info->dst;
  pSVar16 = info->src;
  iVar11 = info->s_skip;
  uVar9 = info->d_width;
  puVar20 = (uint *)info->s_pixels;
  puVar19 = (uint *)info->d_pixels;
  iVar8 = info->d_skip;
  uVar22 = (uint)pSVar16->BytesPerPixel;
  uVar30 = (uint)pSVar17->BytesPerPixel;
  if (pSVar17->Amask == 0) {
    uVar29 = 0;
  }
  else {
    uVar29 = (uint)pSVar16->alpha;
  }
  if (info->d_height == 0) {
    return;
  }
  local_40 = info->d_height + -1;
  iVar32 = (int)(uVar9 + 7) / 8;
  iVar31 = 0;
  do {
                    /* Unresolved local var: int n@[???] */
    iVar27 = iVar32;
    switch(uVar9 & 7) {
    case 0:
      do {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar22 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
        }
        else if (uVar22 == 4) {
          uVar7 = *puVar20;
        }
        else if (uVar22 == 2) {
          uVar7 = (uint)(ushort)*puVar20;
        }
        else {
          uVar7 = 0;
        }
        uVar26 = pSVar16->Rmask;
        uVar25 = pSVar16->Gmask;
        uVar24 = pSVar16->Bmask;
        uVar21 = (uint)pSVar16->Rshift;
        uVar14 = (uint)pSVar16->Gshift;
        uVar12 = (uint)pSVar16->Bshift;
        uVar15 = (uint)pSVar16->Rloss;
        uVar13 = (uint)pSVar16->Gloss;
        uVar10 = (uint)pSVar16->Bloss;
        uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
        uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
        uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
        if (uVar30 == 3) {
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08933834:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
        }
        else {
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08933834;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
          }
        }
        puVar19 = (uint *)((int)puVar19 + uVar30);
        puVar20 = (uint *)((int)puVar20 + uVar22);
LAB_08932fbc:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar22 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
        }
        else if (uVar22 == 4) {
          uVar7 = *puVar20;
        }
        else if (uVar22 == 2) {
          uVar7 = (uint)(ushort)*puVar20;
        }
        else {
          uVar7 = 0;
        }
        uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
        uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
        uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
        if (uVar30 == 3) {
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08933d00:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
          puVar19 = (uint *)((int)puVar19 + uVar30);
          puVar20 = (uint *)((int)puVar20 + uVar22);
        }
        else {
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08933d00;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
            puVar19 = (uint *)((int)puVar19 + 2);
            puVar20 = (uint *)((int)puVar20 + uVar22);
          }
          else {
            puVar19 = (uint *)((int)puVar19 + uVar30);
            puVar20 = (uint *)((int)puVar20 + uVar22);
          }
        }
LAB_089332e4:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar22 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
        }
        else if (uVar22 == 4) {
          uVar7 = *puVar20;
        }
        else if (uVar22 == 2) {
          uVar7 = (uint)(ushort)*puVar20;
        }
        else {
          uVar7 = 0;
        }
        uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
        uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
        uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
        if (uVar30 == 3) {
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08933b24:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
        }
        else {
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08933b24;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
          }
        }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        puVar20 = (uint *)((int)puVar20 + uVar22);
        puVar19 = (uint *)((int)puVar19 + uVar30);
        if (uVar22 == 3) {
LAB_08933358:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 == 3) goto LAB_089333a0;
LAB_0893351c:
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_089333d0;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
          }
        }
        else {
LAB_089334dc:
          if (uVar22 == 4) {
            uVar7 = *puVar20;
          }
          else if (uVar22 == 2) {
            uVar7 = (uint)(ushort)*puVar20;
          }
          else {
            uVar7 = 0;
          }
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 != 3) goto LAB_0893351c;
LAB_089333a0:
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_089333d0:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
        }
        puVar20 = (uint *)((int)puVar20 + uVar22);
        puVar19 = (uint *)((int)puVar19 + uVar30);
        if (uVar22 == 3) {
LAB_08933408:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 == 3) goto LAB_08933450;
LAB_0893309c:
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08933480;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
          }
        }
        else {
LAB_0893305c:
          if (uVar22 == 4) {
            uVar7 = *puVar20;
          }
          else if (uVar22 == 2) {
            uVar7 = (uint)(ushort)*puVar20;
          }
          else {
            uVar7 = 0;
          }
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 != 3) goto LAB_0893309c;
LAB_08933450:
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08933480:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
        }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        puVar19 = (uint *)((int)puVar19 + uVar30);
        puVar20 = (uint *)((int)puVar20 + uVar22);
        if (uVar22 == 3) {
LAB_0893321c:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 == 3) goto LAB_08933264;
LAB_08933104:
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08933294;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            uVar21 = (uint)pSVar16->Rshift;
            uVar15 = (uint)pSVar16->Rloss;
            uVar14 = (uint)pSVar16->Gshift;
            uVar13 = (uint)pSVar16->Gloss;
            uVar12 = (uint)pSVar16->Bshift;
            uVar10 = (uint)pSVar16->Bloss;
          }
        }
        else {
LAB_089330c0:
          if (uVar22 == 4) {
            uVar7 = *puVar20;
          }
          else if (uVar22 == 2) {
            uVar7 = (uint)(ushort)*puVar20;
          }
          else {
            uVar7 = 0;
          }
          uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 != 3) goto LAB_08933104;
LAB_08933264:
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08933294:
          uVar26 = pSVar16->Rmask;
          uVar21 = (uint)pSVar16->Rshift;
          uVar15 = (uint)pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          uVar14 = (uint)pSVar16->Gshift;
          uVar13 = (uint)pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          uVar12 = (uint)pSVar16->Bshift;
          uVar10 = (uint)pSVar16->Bloss;
        }
        puVar19 = (uint *)((int)puVar19 + uVar30);
        puVar20 = (uint *)((int)puVar20 + uVar22);
        if (uVar22 == 3) {
LAB_08933600:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
        }
        else {
LAB_08933128:
          if (uVar22 == 4) {
            uVar7 = *puVar20;
          }
          else if (uVar22 == 2) {
            uVar7 = (uint)(ushort)*puVar20;
          }
          else {
            uVar7 = 0;
          }
        }
        uVar18 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
        uVar23 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
        uVar7 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
        if (uVar30 == 3) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar18;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar23;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar7;
LAB_08932e34:
          uVar26 = pSVar16->Rmask;
          bVar1 = pSVar16->Rshift;
          bVar2 = pSVar16->Rloss;
          uVar25 = pSVar16->Gmask;
          bVar3 = pSVar16->Gshift;
          bVar4 = pSVar16->Gloss;
          uVar24 = pSVar16->Bmask;
          bVar5 = pSVar16->Bshift;
          bVar6 = pSVar16->Bloss;
LAB_08932e58:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
          uVar21 = (uint)bVar1;
          uVar15 = (uint)bVar2;
          uVar14 = (uint)bVar3;
          uVar13 = (uint)bVar4;
          uVar12 = (uint)bVar5;
          uVar10 = (uint)bVar6;
        }
        else {
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
            goto LAB_08932e34;
          }
          if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar18 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar23 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
            bVar1 = pSVar16->Rshift;
            bVar2 = pSVar16->Rloss;
            bVar3 = pSVar16->Gshift;
            bVar4 = pSVar16->Gloss;
            bVar5 = pSVar16->Bshift;
            bVar6 = pSVar16->Bloss;
            goto LAB_08932e58;
          }
        }
        puVar19 = (uint *)((int)puVar19 + uVar30);
        puVar20 = (uint *)((int)puVar20 + uVar22);
        iVar28 = iVar27;
        if (uVar22 == 3) {
LAB_08933650:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar7 = (uint)(byte)*puVar20 + (uint)*(byte *)((int)puVar20 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar20 + 2) * 0x10000;
          uVar15 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar13 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar10 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 == 3) goto LAB_08933698;
LAB_08932eac:
          if (uVar30 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = (uVar15 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f) |
                       (uVar13 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f) |
                       (uVar10 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f) |
                       (uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f);
          }
          else if (uVar30 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)((uVar15 >> (pSVar17->Rloss & 0x1f)) << (pSVar17->Rshift & 0x1f)) |
                 (ushort)((uVar13 >> (pSVar17->Gloss & 0x1f)) << (pSVar17->Gshift & 0x1f)) |
                 (ushort)((uVar10 >> (pSVar17->Bloss & 0x1f)) << (pSVar17->Bshift & 0x1f)) |
                 (ushort)((uVar29 >> (pSVar17->Aloss & 0x1f)) << (pSVar17->Ashift & 0x1f));
          }
        }
        else {
LAB_08932e68:
          if (uVar22 == 4) {
            uVar7 = *puVar20;
          }
          else if (uVar22 == 2) {
            uVar7 = (uint)(ushort)*puVar20;
          }
          else {
            uVar7 = 0;
          }
          uVar15 = ((uVar7 & uVar26) >> (uVar21 & 0x1f)) << (uVar15 & 0x1f);
          uVar13 = ((uVar7 & uVar25) >> (uVar14 & 0x1f)) << (uVar13 & 0x1f);
          uVar10 = ((uVar7 & uVar24) >> (uVar12 & 0x1f)) << (uVar10 & 0x1f);
          if (uVar30 != 3) goto LAB_08932eac;
LAB_08933698:
          *(char *)((int)puVar19 + (uint)(pSVar17->Rshift >> 3)) = (char)uVar15;
          *(char *)((int)puVar19 + (uint)(pSVar17->Gshift >> 3)) = (char)uVar13;
          *(char *)((int)puVar19 + (uint)(pSVar17->Bshift >> 3)) = (char)uVar10;
        }
        puVar19 = (uint *)((int)puVar19 + uVar30);
        puVar20 = (uint *)((int)puVar20 + uVar22);
        iVar27 = iVar28 + -1;
      } while (0 < iVar28 + -1);
      break;
    case 1:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      iVar28 = iVar32;
      if (uVar22 != 3) goto LAB_08932e68;
      goto LAB_08933650;
    case 2:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      if (uVar22 != 3) goto LAB_08933128;
      goto LAB_08933600;
    case 3:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      if (uVar22 != 3) goto LAB_089330c0;
      goto LAB_0893321c;
    case 4:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      if (uVar22 == 3) goto LAB_08933408;
      goto LAB_0893305c;
    case 5:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      if (uVar22 == 3) goto LAB_08933358;
      goto LAB_089334dc;
    case 6:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      goto LAB_089332e4;
    case 7:
      uVar26 = pSVar16->Rmask;
      uVar21 = (uint)pSVar16->Rshift;
      uVar15 = (uint)pSVar16->Rloss;
      uVar25 = pSVar16->Gmask;
      uVar14 = (uint)pSVar16->Gshift;
      uVar13 = (uint)pSVar16->Gloss;
      uVar24 = pSVar16->Bmask;
      uVar12 = (uint)pSVar16->Bshift;
      uVar10 = (uint)pSVar16->Bloss;
      goto LAB_08932fbc;
    }
    if (iVar31 == local_40) {
      return;
    }
    iVar31 = iVar31 + 1;
    puVar20 = (uint *)((int)puVar20 + iVar11);
    puVar19 = (uint *)((int)puVar19 + iVar8);
  } while( true );
}



----------------------------------------

// Function: BlitNtoNCopyAlpha @ 08933d8c

void BlitNtoNCopyAlpha(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  SDL_PixelFormat *pSVar7;
  uint *puVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  SDL_PixelFormat *pSVar14;
  uint *puVar15;
  int iVar16;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg25(t9)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg15(t7)]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg24(t8)]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: int c@[???] */
  pSVar14 = info->dst;
  iVar2 = info->d_height;
  pSVar7 = info->src;
  iVar12 = info->d_width;
  puVar8 = (uint *)info->s_pixels;
  iVar16 = info->s_skip;
  puVar15 = (uint *)info->d_pixels;
  iVar13 = info->d_skip;
  uVar10 = (uint)pSVar7->BytesPerPixel;
  uVar9 = (uint)pSVar14->BytesPerPixel;
  if (iVar2 != 0) {
    iVar11 = 0;
    iVar1 = iVar12;
    while( true ) {
      while (iVar1 != 0) {
        if (uVar10 == 3) {
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar6 = (uint)(byte)*puVar8 + (uint)*(byte *)((int)puVar8 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar8 + 2) * 0x10000;
        }
        else {
                    /* Unresolved local var: Uint32 pixel@[DW_OP_reg14(t6)]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint sA@[???] */
          if (uVar10 == 4) {
            uVar6 = *puVar8;
          }
          else if (uVar10 == 2) {
            uVar6 = (uint)(ushort)*puVar8;
          }
          else {
            uVar6 = 0;
          }
        }
        uVar3 = ((uVar6 & pSVar7->Rmask) >> (pSVar7->Rshift & 0x1f)) << (pSVar7->Rloss & 0x1f);
        uVar4 = ((uVar6 & pSVar7->Gmask) >> (pSVar7->Gshift & 0x1f)) << (pSVar7->Gloss & 0x1f);
        uVar5 = ((uVar6 & pSVar7->Bmask) >> (pSVar7->Bshift & 0x1f)) << (pSVar7->Bloss & 0x1f);
        uVar6 = ((uVar6 & pSVar7->Amask) >> (pSVar7->Ashift & 0x1f)) << (pSVar7->Aloss & 0x1f);
        if (uVar9 == 3) {
          puVar8 = (uint *)((int)puVar8 + uVar10);
          *(char *)((uint)(pSVar14->Rshift >> 3) + (int)puVar15) = (char)uVar3;
          *(char *)((uint)(pSVar14->Gshift >> 3) + (int)puVar15) = (char)uVar4;
          *(char *)((uint)(pSVar14->Bshift >> 3) + (int)puVar15) = (char)uVar5;
          puVar15 = (uint *)((int)puVar15 + 3);
          iVar1 = iVar1 + -1;
        }
        else {
          if (uVar9 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar15 = (uVar3 >> (pSVar14->Rloss & 0x1f)) << (pSVar14->Rshift & 0x1f) |
                       (uVar4 >> (pSVar14->Gloss & 0x1f)) << (pSVar14->Gshift & 0x1f) |
                       (uVar5 >> (pSVar14->Bloss & 0x1f)) << (pSVar14->Bshift & 0x1f) |
                       (uVar6 >> (pSVar14->Aloss & 0x1f)) << (pSVar14->Ashift & 0x1f);
          }
          else if (uVar9 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar15 =
                 (ushort)((uVar3 >> (pSVar14->Rloss & 0x1f)) << (pSVar14->Rshift & 0x1f)) |
                 (ushort)((uVar4 >> (pSVar14->Gloss & 0x1f)) << (pSVar14->Gshift & 0x1f)) |
                 (ushort)((uVar5 >> (pSVar14->Bloss & 0x1f)) << (pSVar14->Bshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar14->Aloss & 0x1f)) << (pSVar14->Ashift & 0x1f));
          }
          puVar15 = (uint *)((int)puVar15 + uVar9);
          puVar8 = (uint *)((int)puVar8 + uVar10);
          iVar1 = iVar1 + -1;
        }
      }
      puVar8 = (uint *)((int)puVar8 + iVar16);
      if (iVar11 == iVar2 + -1) break;
      puVar15 = (uint *)((int)puVar15 + iVar13);
      iVar11 = iVar11 + 1;
      iVar1 = iVar12;
    }
  }
  return;
}



----------------------------------------

// Function: BlitNto1Key @ 08933ff0

/* WARNING: Removing unreachable block (ram,0x08934070) */
/* WARNING: Removing unreachable block (ram,0x08934784) */

void BlitNto1Key(SDL_BlitInfo *info)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  SDL_PixelFormat *pSVar7;
  uint uVar8;
  uint uVar9;
  uint *puVar10;
  uint uVar11;
  byte *pbVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  Uint8 *pUVar18;
  int iVar19;
  int iVar20;
  uint uVar21;
  uint uVar22;
  int iVar23;
  uint uVar24;
  uint uVar25;
  int iVar26;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg8(t0)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg10(t2)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: Uint32 rgbmask@[???]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: Uint8 sR@[???]
                       Unresolved local var: Uint8 sG@[???]
                       Unresolved local var: Uint8 sB@[???] */
  pSVar7 = info->src;
  pUVar18 = info->table;
  uVar8 = info->d_width;
  iVar5 = info->d_height;
  puVar10 = (uint *)info->s_pixels;
  uVar21 = ~pSVar7->Amask;
  pbVar12 = info->d_pixels;
  iVar1 = info->s_skip;
  iVar4 = info->d_skip;
  uVar22 = pSVar7->colorkey & uVar21;
  uVar11 = (uint)pSVar7->BytesPerPixel;
  if (pUVar18 == (Uint8 *)0x0) {
    if (iVar5 != 0) {
      iVar26 = (int)(uVar8 + 7) / 8;
      iVar23 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???] */
        iVar20 = iVar26;
        switch(uVar8 & 7) {
        case 0:
          do {
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934a58:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934e40:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934d78:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934cb0:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934be8:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934b20:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
              uVar17 = pSVar7->Rmask;
              uVar24 = (uint)pSVar7->Rshift;
              uVar25 = (uint)pSVar7->Rloss;
              uVar14 = pSVar7->Gmask;
              uVar15 = (uint)pSVar7->Gshift;
              uVar16 = (uint)pSVar7->Gloss;
              uVar6 = pSVar7->Bmask;
              uVar9 = (uint)pSVar7->Bshift;
              uVar13 = (uint)pSVar7->Bloss;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
            iVar19 = iVar20;
LAB_089347e0:
            if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                      (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 4) {
              uVar3 = *puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else if (uVar11 == 2) {
              uVar3 = (uint)(ushort)*puVar10;
              uVar2 = uVar21 & uVar3;
            }
            else {
              uVar3 = 0;
              uVar2 = 0;
            }
            if (uVar22 != uVar2) {
              *pbVar12 = (byte)(((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff)
                                >> 5) << 2) |
                         (byte)(((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f)) & 0xe0 |
                         (byte)(((uVar3 & uVar6) >> (uVar9 & 0x1f)) << (uVar13 & 0x1f)) >> 6;
            }
            pbVar12 = pbVar12 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
            iVar20 = iVar19 + -1;
          } while (0 < iVar19 + -1);
          break;
        case 1:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          iVar19 = iVar26;
          goto LAB_089347e0;
        case 2:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934b20;
        case 3:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934be8;
        case 4:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934cb0;
        case 5:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934d78;
        case 6:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934e40;
        case 7:
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          goto LAB_08934a58;
        }
        if (iVar23 == iVar5 + -1) break;
        iVar23 = iVar23 + 1;
        puVar10 = (uint *)((int)puVar10 + iVar1);
        pbVar12 = pbVar12 + iVar4;
      }
    }
  }
  else if (iVar5 != 0) {
    iVar26 = (int)(uVar8 + 7) / 8;
    iVar23 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar20 = iVar26;
      switch(uVar8 & 7) {
      case 0:
        do {
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          uVar17 = pSVar7->Rmask;
          uVar24 = (uint)pSVar7->Rshift;
          uVar25 = (uint)pSVar7->Rloss;
          uVar14 = pSVar7->Gmask;
          uVar15 = (uint)pSVar7->Gshift;
          uVar16 = (uint)pSVar7->Gloss;
          uVar6 = pSVar7->Bmask;
          uVar9 = (uint)pSVar7->Bshift;
          uVar13 = (uint)pSVar7->Bloss;
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_089344f8:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_089345f4:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_089340cc:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934170:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_08934214:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar2 != uVar22) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
LAB_089342b8:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar2 != uVar22) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
            uVar17 = pSVar7->Rmask;
            uVar24 = (uint)pSVar7->Rshift;
            uVar25 = (uint)pSVar7->Rloss;
            uVar14 = pSVar7->Gmask;
            uVar15 = (uint)pSVar7->Gshift;
            uVar16 = (uint)pSVar7->Gloss;
            uVar6 = pSVar7->Bmask;
            uVar9 = (uint)pSVar7->Bshift;
            uVar13 = (uint)pSVar7->Bloss;
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
          iVar19 = iVar20;
LAB_0893435c:
          if (uVar11 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar3 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 4) {
            uVar3 = *puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else if (uVar11 == 2) {
            uVar3 = (uint)(ushort)*puVar10;
            uVar2 = uVar21 & uVar3;
          }
          else {
            uVar3 = 0;
            uVar2 = 0;
          }
          if (uVar22 != uVar2) {
            *pbVar12 = pUVar18[((((uVar3 & uVar14) >> (uVar15 & 0x1f)) << (uVar16 & 0x1f) & 0xff) >>
                               5) << 2 | ((uVar3 & uVar17) >> (uVar24 & 0x1f)) << (uVar25 & 0x1f) &
                                         0xe0 | (((uVar3 & uVar6) >> (uVar9 & 0x1f)) <<
                                                 (uVar13 & 0x1f) & 0xff) >> 6];
          }
          pbVar12 = pbVar12 + 1;
          puVar10 = (uint *)((int)puVar10 + uVar11);
          iVar20 = iVar19 + -1;
        } while (0 < iVar19 + -1);
        break;
      case 1:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        iVar19 = iVar26;
        goto LAB_0893435c;
      case 2:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_089342b8;
      case 3:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_08934214;
      case 4:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_08934170;
      case 5:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_089340cc;
      case 6:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_089345f4;
      case 7:
        uVar17 = pSVar7->Rmask;
        uVar24 = (uint)pSVar7->Rshift;
        uVar25 = (uint)pSVar7->Rloss;
        uVar14 = pSVar7->Gmask;
        uVar15 = (uint)pSVar7->Gshift;
        uVar16 = (uint)pSVar7->Gloss;
        uVar6 = pSVar7->Bmask;
        uVar9 = (uint)pSVar7->Bshift;
        uVar13 = (uint)pSVar7->Bloss;
        goto LAB_089344f8;
      }
      if (iVar23 == iVar5 + -1) break;
      iVar23 = iVar23 + 1;
      puVar10 = (uint *)((int)puVar10 + iVar1);
      pbVar12 = pbVar12 + iVar4;
    }
  }
  return;
}



----------------------------------------

// Function: Blit2to2Key @ 089350d4

/* WARNING: Removing unreachable block (ram,0x08935124) */
/* WARNING: Removing unreachable block (ram,0x089350f4) */
/* WARNING: Removing unreachable block (ram,0x08935148) */

void Blit2to2Key(SDL_BlitInfo *info)

{
  int iVar1;
  ushort *puVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  uint uVar9;
  ushort *puVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint16 * srcp@[DW_OP_reg8(t0)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg9(t1)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: Uint32 rgbmask@[DW_OP_reg5(a1)] */
  iVar1 = info->d_skip;
  iVar7 = info->s_skip;
  iVar8 = info->d_height;
  uVar5 = ~info->src->Amask;
  puVar10 = (ushort *)info->s_pixels;
  uVar6 = info->src->colorkey & uVar5;
  uVar9 = info->d_width;
  puVar2 = (ushort *)info->d_pixels;
  if (iVar8 != 0) {
    iVar12 = (int)(uVar9 + 7) / 8;
    iVar11 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar4 = iVar12;
      switch(uVar9 & 7) {
      case 0:
        do {
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_08935268:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_08935198:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_089351b0:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_089351c8:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_089351e0:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
LAB_089351f8:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
          iVar3 = iVar4;
LAB_08935210:
          if (uVar6 != (uVar5 & *puVar10)) {
            *puVar2 = *puVar10;
          }
          puVar2 = puVar2 + 1;
          puVar10 = puVar10 + 1;
          iVar4 = iVar3 + -1;
        } while (0 < iVar3 + -1);
        break;
      case 1:
        iVar3 = iVar12;
        goto LAB_08935210;
      case 2:
        goto LAB_089351f8;
      case 3:
        goto LAB_089351e0;
      case 4:
        goto LAB_089351c8;
      case 5:
        goto LAB_089351b0;
      case 6:
        goto LAB_08935198;
      case 7:
        goto LAB_08935268;
      }
      puVar10 = puVar10 + iVar7 / 2;
      if (iVar8 + -1 == iVar11) break;
      puVar2 = puVar2 + iVar1 / 2;
      iVar11 = iVar11 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: BlitNtoNKey @ 089352b4

/* WARNING: Removing unreachable block (ram,0x08935330) */

void BlitNtoNKey(SDL_BlitInfo *info)

{
  undefined1 *puVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  SDL_PixelFormat *pSVar8;
  SDL_PixelFormat *pSVar9;
  uint *puVar10;
  uint *puVar11;
  Uint32 UVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg14(t6)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg15(t7)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg13(t5)]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: uint alpha@[???] */
  pSVar9 = info->dst;
  iVar4 = info->s_skip;
  pSVar8 = info->src;
  uVar3 = info->d_width;
  iVar2 = info->d_height;
  puVar10 = (uint *)info->s_pixels;
  puVar11 = (uint *)info->d_pixels;
  iVar19 = info->d_skip;
  UVar12 = pSVar8->colorkey;
  uVar17 = (uint)pSVar8->BytesPerPixel;
  uVar18 = (uint)pSVar9->BytesPerPixel;
  if (pSVar9->Amask == 0) {
    uVar16 = 0;
  }
  else {
    uVar16 = (uint)pSVar8->alpha;
  }
  if (iVar2 == 0) {
    return;
  }
  iVar20 = (int)(uVar3 + 7) / 8;
  iVar15 = 0;
  do {
                    /* Unresolved local var: int n@[???] */
    iVar13 = iVar20;
    switch(uVar3 & 7) {
    case 0:
      do {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar17 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else if (uVar17 == 4) {
          uVar6 = *puVar10;
        }
        else if (uVar17 == 2) {
          uVar6 = (uint)(ushort)*puVar10;
        }
        else {
          uVar6 = 0;
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
        puVar10 = (uint *)((int)puVar10 + uVar17);
LAB_08935540:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar17 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else if (uVar17 == 4) {
          uVar6 = *puVar10;
        }
        else if (uVar17 == 2) {
          uVar6 = (uint)(ushort)*puVar10;
        }
        else {
          uVar6 = 0;
        }
        if (uVar6 == UVar12) {
LAB_089355d0:
          puVar11 = (uint *)((int)puVar11 + uVar18);
          puVar10 = (uint *)((int)puVar10 + uVar17);
        }
        else {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            puVar10 = (uint *)((int)puVar10 + uVar17);
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            puVar1 = (undefined1 *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3));
            puVar11 = (uint *)((int)puVar11 + 3);
            *puVar1 = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
            puVar10 = (uint *)((int)puVar10 + uVar17);
            puVar11 = puVar11 + 1;
          }
          else {
            if (uVar18 != 2) goto LAB_089355d0;
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
            puVar10 = (uint *)((int)puVar10 + uVar17);
            puVar11 = (uint *)((int)puVar11 + 2);
          }
        }
LAB_089355e4:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        if (uVar17 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else if (uVar17 == 4) {
          uVar6 = *puVar10;
        }
        else if (uVar17 == 2) {
          uVar6 = (uint)(ushort)*puVar10;
        }
        else {
          uVar6 = 0;
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        puVar10 = (uint *)((int)puVar10 + uVar17);
        if (uVar17 == 3) {
LAB_08935684:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else {
LAB_08935934:
          if (uVar17 == 4) {
            uVar6 = *puVar10;
          }
          else if (uVar17 == 2) {
            uVar6 = (uint)(ushort)*puVar10;
          }
          else {
            uVar6 = 0;
          }
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
        puVar10 = (uint *)((int)puVar10 + uVar17);
        if (uVar17 == 3) {
LAB_08935720:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else {
LAB_0893595c:
          if (uVar17 == 4) {
            uVar6 = *puVar10;
          }
          else if (uVar17 == 2) {
            uVar6 = (uint)(ushort)*puVar10;
          }
          else {
            uVar6 = 0;
          }
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
        puVar10 = (uint *)((int)puVar10 + uVar17);
        if (uVar17 == 3) {
LAB_089359d8:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else {
LAB_089357b8:
          if (uVar17 == 4) {
            uVar6 = *puVar10;
          }
          else if (uVar17 == 2) {
            uVar6 = (uint)(ushort)*puVar10;
          }
          else {
            uVar6 = 0;
          }
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
        puVar10 = (uint *)((int)puVar10 + uVar17);
        if (uVar17 == 3) {
LAB_08935980:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else {
LAB_0893584c:
          if (uVar17 == 4) {
            uVar6 = *puVar10;
          }
          else if (uVar17 == 2) {
            uVar6 = (uint)(ushort)*puVar10;
          }
          else {
            uVar6 = 0;
          }
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
        puVar10 = (uint *)((int)puVar10 + uVar17);
        iVar14 = iVar13;
        if (uVar17 == 3) {
LAB_089359ac:
                    /* Unresolved local var: Uint8 * B@[???] */
          uVar6 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
        }
        else {
LAB_089353c4:
          if (uVar17 == 4) {
            uVar6 = *puVar10;
          }
          else if (uVar17 == 2) {
            uVar6 = (uint)(ushort)*puVar10;
          }
          else {
            uVar6 = 0;
          }
        }
        if (uVar6 != UVar12) {
          uVar5 = ((uVar6 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) << (pSVar8->Rloss & 0x1f);
          uVar7 = ((uVar6 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) << (pSVar8->Gloss & 0x1f);
          uVar6 = ((uVar6 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) << (pSVar8->Bloss & 0x1f);
          if (uVar18 == 3) {
            *(char *)((int)puVar11 + (uint)(pSVar9->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar11 + (uint)(pSVar9->Gshift >> 3)) = (char)uVar7;
            *(char *)((int)puVar11 + (uint)(pSVar9->Bshift >> 3)) = (char)uVar6;
          }
          else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar11 = (uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f) |
                       (uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f) |
                       (uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f) |
                       (uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f);
          }
          else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar11 =
                 (ushort)((uVar5 >> (pSVar9->Rloss & 0x1f)) << (pSVar9->Rshift & 0x1f)) |
                 (ushort)((uVar7 >> (pSVar9->Gloss & 0x1f)) << (pSVar9->Gshift & 0x1f)) |
                 (ushort)((uVar6 >> (pSVar9->Bloss & 0x1f)) << (pSVar9->Bshift & 0x1f)) |
                 (ushort)((uVar16 >> (pSVar9->Aloss & 0x1f)) << (pSVar9->Ashift & 0x1f));
          }
        }
        puVar11 = (uint *)((int)puVar11 + uVar18);
        puVar10 = (uint *)((int)puVar10 + uVar17);
        iVar13 = iVar14 + -1;
      } while (0 < iVar14 + -1);
      break;
    case 1:
      iVar14 = iVar20;
      if (uVar17 != 3) goto LAB_089353c4;
      goto LAB_089359ac;
    case 2:
      if (uVar17 != 3) goto LAB_0893584c;
      goto LAB_08935980;
    case 3:
      if (uVar17 != 3) goto LAB_089357b8;
      goto LAB_089359d8;
    case 4:
      if (uVar17 == 3) goto LAB_08935720;
      goto LAB_0893595c;
    case 5:
      if (uVar17 == 3) goto LAB_08935684;
      goto LAB_08935934;
    case 6:
      goto LAB_089355e4;
    case 7:
      goto LAB_08935540;
    }
    if (iVar15 == iVar2 + -1) {
      return;
    }
    puVar11 = (uint *)((int)puVar11 + iVar19);
    iVar15 = iVar15 + 1;
    puVar10 = (uint *)((int)puVar10 + iVar4);
  } while( true );
}



----------------------------------------

// Function: BlitNtoNKeyCopyAlpha @ 089360fc

/* WARNING: Removing unreachable block (ram,0x08936188) */

void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  SDL_PixelFormat *pSVar14;
  SDL_PixelFormat *pSVar15;
  uint uVar16;
  uint uVar17;
  uint *puVar18;
  uint *puVar19;
  uint uVar20;
  uint uVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  uint uVar27;
  uint uVar28;
  uint uVar29;
  uint uVar30;
  uint uVar31;
  int iVar32;
  int local_4c;
  int local_44;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg13(t5)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg14(t6)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg11(t3)]
                       Unresolved local var: Uint32 rgbmask@[???]
                       Unresolved local var: Uint8 srcbpp@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint8 dstbpp@[???]
                       Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: Uint8 sR@[???]
                       Unresolved local var: Uint8 sG@[???]
                       Unresolved local var: Uint8 sB@[???]
                       Unresolved local var: Uint8 sA@[???] */
  pSVar14 = info->src;
  pSVar15 = info->dst;
  iVar4 = info->d_height;
  uVar9 = info->d_width;
  uVar16 = ~pSVar14->Amask;
  uVar1 = pSVar14->colorkey & uVar16;
  puVar18 = (uint *)info->s_pixels;
  iVar2 = info->s_skip;
  puVar19 = (uint *)info->d_pixels;
  iVar6 = info->d_skip;
  uVar20 = (uint)pSVar14->BytesPerPixel;
  uVar23 = (uint)pSVar15->BytesPerPixel;
  if (iVar4 == 0) {
    return;
  }
  iVar32 = (int)(uVar9 + 7) / 8;
  local_4c = 0;
  do {
                    /* Unresolved local var: int n@[???] */
    local_44 = iVar32;
    switch(uVar9 & 7) {
    case 0:
      do {
        if (uVar20 == 3) {
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else if (uVar20 == 4) {
          uVar7 = *puVar18;
        }
        else if (uVar20 == 2) {
          uVar7 = (uint)(ushort)*puVar18;
        }
        else {
          uVar7 = 0;
        }
        uVar17 = pSVar14->Amask;
        uVar31 = pSVar14->Rmask;
        uVar25 = (uint)pSVar14->Rshift;
        uVar24 = (uint)pSVar14->Rloss;
        uVar28 = pSVar14->Gmask;
        uVar21 = (uint)pSVar14->Gshift;
        uVar30 = (uint)pSVar14->Gloss;
        uVar27 = pSVar14->Bmask;
        uVar13 = (uint)pSVar14->Bshift;
        uVar12 = (uint)pSVar14->Bloss;
        uVar11 = (uint)pSVar14->Ashift;
        uVar10 = (uint)pSVar14->Aloss;
        if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
          uVar3 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar5 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar8 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar29 = uVar3 & 0xff;
          uVar7 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar22 = uVar5 & 0xff;
          uVar26 = uVar8 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar3;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar8;
          }
          else {
            if (uVar23 != 4) {
              if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar19 =
                     (ushort)(((int)uVar29 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f))
                     | (ushort)(((int)uVar22 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)
                               ) |
                     (ushort)(((int)uVar26 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f))
                     | (ushort)(((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f))
                ;
                uVar25 = (uint)pSVar14->Rshift;
                uVar24 = (uint)pSVar14->Rloss;
                uVar21 = (uint)pSVar14->Gshift;
                uVar30 = (uint)pSVar14->Gloss;
                uVar13 = (uint)pSVar14->Bshift;
                uVar12 = (uint)pSVar14->Bloss;
                uVar11 = (uint)pSVar14->Ashift;
                uVar10 = (uint)pSVar14->Aloss;
              }
              goto LAB_0893640c;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar29 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar22 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar26 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          uVar17 = pSVar14->Amask;
          uVar31 = pSVar14->Rmask;
          uVar25 = (uint)pSVar14->Rshift;
          uVar24 = (uint)pSVar14->Rloss;
          uVar28 = pSVar14->Gmask;
          uVar21 = (uint)pSVar14->Gshift;
          uVar30 = (uint)pSVar14->Gloss;
          uVar27 = pSVar14->Bmask;
          uVar13 = (uint)pSVar14->Bshift;
          uVar12 = (uint)pSVar14->Bloss;
          uVar11 = (uint)pSVar14->Ashift;
          uVar10 = (uint)pSVar14->Aloss;
        }
LAB_0893640c:
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
LAB_08936414:
        if (uVar20 == 3) {
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else if (uVar20 == 4) {
          uVar7 = *puVar18;
        }
        else if (uVar20 == 2) {
          uVar7 = (uint)(ushort)*puVar18;
        }
        else {
          uVar7 = 0;
        }
        if (uVar1 == (uVar7 & uVar16 & ~uVar17)) {
LAB_089364ac:
          puVar19 = (uint *)((int)puVar19 + uVar23);
          puVar18 = (uint *)((int)puVar18 + uVar20);
        }
        else {
          uVar3 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar5 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar8 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar22 = uVar3 & 0xff;
          uVar7 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar26 = uVar5 & 0xff;
          uVar29 = uVar8 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar3;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar8;
          }
          else {
            if (uVar23 != 4) {
              if (uVar23 != 2) goto LAB_089364ac;
                    /* Unresolved local var: Uint16 pixel@[???] */
              *(ushort *)puVar19 =
                   (ushort)(((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f)) |
                   (ushort)(((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)) |
                   (ushort)(((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f)) |
                   (ushort)(((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f));
              uVar25 = (uint)pSVar14->Rshift;
              uVar24 = (uint)pSVar14->Rloss;
              uVar21 = (uint)pSVar14->Gshift;
              uVar30 = (uint)pSVar14->Gloss;
              uVar13 = (uint)pSVar14->Bshift;
              uVar12 = (uint)pSVar14->Bloss;
              uVar11 = (uint)pSVar14->Ashift;
              uVar10 = (uint)pSVar14->Aloss;
              puVar19 = (uint *)((int)puVar19 + 2);
              puVar18 = (uint *)((int)puVar18 + uVar20);
              goto LAB_089364f0;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          uVar17 = pSVar14->Amask;
          uVar31 = pSVar14->Rmask;
          uVar25 = (uint)pSVar14->Rshift;
          uVar24 = (uint)pSVar14->Rloss;
          uVar28 = pSVar14->Gmask;
          uVar21 = (uint)pSVar14->Gshift;
          uVar30 = (uint)pSVar14->Gloss;
          uVar27 = pSVar14->Bmask;
          uVar13 = (uint)pSVar14->Bshift;
          uVar12 = (uint)pSVar14->Bloss;
          uVar11 = (uint)pSVar14->Ashift;
          uVar10 = (uint)pSVar14->Aloss;
          puVar19 = (uint *)((int)puVar19 + uVar23);
          puVar18 = (uint *)((int)puVar18 + uVar20);
        }
LAB_089364f0:
        if (uVar20 == 3) {
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else if (uVar20 == 4) {
          uVar7 = *puVar18;
        }
        else if (uVar20 == 2) {
          uVar7 = (uint)(ushort)*puVar18;
        }
        else {
          uVar7 = 0;
        }
        if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
          uVar3 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar5 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar8 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar22 = uVar3 & 0xff;
          uVar7 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar26 = uVar5 & 0xff;
          uVar29 = uVar8 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar3;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar8;
          }
          else {
            if (uVar23 != 4) {
              if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar19 =
                     (ushort)(((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f))
                     | (ushort)(((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)
                               ) |
                     (ushort)(((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f))
                     | (ushort)(((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f))
                ;
                uVar25 = (uint)pSVar14->Rshift;
                uVar24 = (uint)pSVar14->Rloss;
                uVar21 = (uint)pSVar14->Gshift;
                uVar30 = (uint)pSVar14->Gloss;
                uVar13 = (uint)pSVar14->Bshift;
                uVar12 = (uint)pSVar14->Bloss;
                uVar11 = (uint)pSVar14->Ashift;
                uVar10 = (uint)pSVar14->Aloss;
              }
              goto LAB_08936590;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          uVar17 = pSVar14->Amask;
          uVar31 = pSVar14->Rmask;
          uVar25 = (uint)pSVar14->Rshift;
          uVar24 = (uint)pSVar14->Rloss;
          uVar28 = pSVar14->Gmask;
          uVar21 = (uint)pSVar14->Gshift;
          uVar30 = (uint)pSVar14->Gloss;
          uVar27 = pSVar14->Bmask;
          uVar13 = (uint)pSVar14->Bshift;
          uVar12 = (uint)pSVar14->Bloss;
          uVar11 = (uint)pSVar14->Ashift;
          uVar10 = (uint)pSVar14->Aloss;
        }
LAB_08936590:
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
        if (uVar20 == 3) {
LAB_0893659c:
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
          if (uVar1 == (uVar7 & uVar16 & ~uVar17)) {
            puVar19 = (uint *)((int)puVar19 + uVar23);
            goto LAB_089365d8;
          }
          uVar3 = uVar7 & uVar17;
LAB_08936850:
          uVar5 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar8 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar7 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar22 = uVar5 & 0xff;
          uVar3 = (uVar3 >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar26 = uVar8 & 0xff;
          uVar29 = uVar7 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar8;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar7;
LAB_08937048:
            uVar17 = pSVar14->Amask;
            uVar31 = pSVar14->Rmask;
            uVar25 = (uint)pSVar14->Rshift;
            uVar24 = (uint)pSVar14->Rloss;
            uVar28 = pSVar14->Gmask;
            uVar21 = (uint)pSVar14->Gshift;
            uVar30 = (uint)pSVar14->Gloss;
            uVar27 = pSVar14->Bmask;
            uVar13 = (uint)pSVar14->Bshift;
            uVar12 = (uint)pSVar14->Bloss;
            uVar11 = (uint)pSVar14->Ashift;
            uVar10 = (uint)pSVar14->Aloss;
            puVar19 = (uint *)((int)puVar19 + uVar23);
            puVar18 = (uint *)((int)puVar18 + uVar20);
          }
          else {
            if (uVar23 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
              *puVar19 = ((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                         ((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                         ((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                         ((int)uVar3 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
              goto LAB_08937048;
            }
            if (uVar23 != 2) {
              puVar19 = (uint *)((int)puVar19 + uVar23);
              goto LAB_089365d8;
            }
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)(((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f)) |
                 (ushort)(((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)) |
                 (ushort)(((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f)) |
                 (ushort)(((int)uVar3 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f));
            uVar25 = (uint)pSVar14->Rshift;
            uVar24 = (uint)pSVar14->Rloss;
            uVar21 = (uint)pSVar14->Gshift;
            uVar30 = (uint)pSVar14->Gloss;
            uVar13 = (uint)pSVar14->Bshift;
            uVar12 = (uint)pSVar14->Bloss;
            uVar11 = (uint)pSVar14->Ashift;
            uVar10 = (uint)pSVar14->Aloss;
            puVar19 = (uint *)((int)puVar19 + 2);
            puVar18 = (uint *)((int)puVar18 + uVar20);
          }
        }
        else {
LAB_0893681c:
          if (uVar20 == 4) {
            uVar7 = *puVar18;
          }
          else if (uVar20 == 2) {
            uVar7 = (uint)(ushort)*puVar18;
          }
          else {
            uVar7 = 0;
          }
          if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
            uVar3 = uVar7 & uVar17;
            goto LAB_08936850;
          }
          puVar19 = (uint *)((int)puVar19 + uVar23);
LAB_089365d8:
          puVar18 = (uint *)((int)puVar18 + uVar20);
        }
        if (uVar20 == 3) {
LAB_089365e8:
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
          if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
            uVar3 = uVar7 & uVar17;
LAB_089369a4:
            uVar5 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
            uVar8 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
            uVar7 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
            uVar22 = uVar5 & 0xff;
            uVar3 = (uVar3 >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
            uVar26 = uVar8 & 0xff;
            uVar29 = uVar7 & 0xff;
            if (uVar23 == 3) {
              *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar5;
              *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar8;
              *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar7;
            }
            else {
              if (uVar23 != 4) {
                if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                  *(ushort *)puVar19 =
                       (ushort)(((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f)
                               ) |
                       (ushort)(((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)
                               ) |
                       (ushort)(((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f)
                               ) |
                       (ushort)(((int)uVar3 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f))
                  ;
                  uVar25 = (uint)pSVar14->Rshift;
                  uVar24 = (uint)pSVar14->Rloss;
                  uVar21 = (uint)pSVar14->Gshift;
                  uVar30 = (uint)pSVar14->Gloss;
                  uVar13 = (uint)pSVar14->Bshift;
                  uVar12 = (uint)pSVar14->Bloss;
                  uVar11 = (uint)pSVar14->Ashift;
                  uVar10 = (uint)pSVar14->Aloss;
                }
                goto LAB_08936624;
              }
                    /* Unresolved local var: Uint32 pixel@[???] */
              *puVar19 = ((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                         ((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                         ((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                         ((int)uVar3 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
            }
            uVar17 = pSVar14->Amask;
            uVar31 = pSVar14->Rmask;
            uVar25 = (uint)pSVar14->Rshift;
            uVar24 = (uint)pSVar14->Rloss;
            uVar28 = pSVar14->Gmask;
            uVar21 = (uint)pSVar14->Gshift;
            uVar30 = (uint)pSVar14->Gloss;
            uVar27 = pSVar14->Bmask;
            uVar13 = (uint)pSVar14->Bshift;
            uVar12 = (uint)pSVar14->Bloss;
            uVar11 = (uint)pSVar14->Ashift;
            uVar10 = (uint)pSVar14->Aloss;
          }
        }
        else {
LAB_08936970:
          if (uVar20 == 4) {
            uVar7 = *puVar18;
          }
          else if (uVar20 == 2) {
            uVar7 = (uint)(ushort)*puVar18;
          }
          else {
            uVar7 = 0;
          }
          if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
            uVar3 = uVar7 & uVar17;
            goto LAB_089369a4;
          }
        }
LAB_08936624:
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
        if (uVar20 == 3) {
LAB_08936bb4:
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else {
LAB_08936630:
          if (uVar20 == 4) {
            uVar7 = *puVar18;
          }
          else if (uVar20 == 2) {
            uVar7 = (uint)(ushort)*puVar18;
          }
          else {
            uVar7 = 0;
          }
        }
        if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
          uVar3 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar5 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar8 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar22 = uVar3 & 0xff;
          uVar7 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar26 = uVar5 & 0xff;
          uVar29 = uVar8 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar3;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar8;
          }
          else {
            if (uVar23 != 4) {
              if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar19 =
                     (ushort)(((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f))
                     | (ushort)(((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)
                               ) |
                     (ushort)(((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f))
                     | (ushort)(((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f))
                ;
                uVar25 = (uint)pSVar14->Rshift;
                uVar24 = (uint)pSVar14->Rloss;
                uVar21 = (uint)pSVar14->Gshift;
                uVar30 = (uint)pSVar14->Gloss;
                uVar13 = (uint)pSVar14->Bshift;
                uVar12 = (uint)pSVar14->Bloss;
                uVar11 = (uint)pSVar14->Ashift;
                uVar10 = (uint)pSVar14->Aloss;
              }
              goto LAB_089366c0;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar22 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar26 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar29 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          uVar17 = pSVar14->Amask;
          uVar31 = pSVar14->Rmask;
          uVar25 = (uint)pSVar14->Rshift;
          uVar24 = (uint)pSVar14->Rloss;
          uVar28 = pSVar14->Gmask;
          uVar21 = (uint)pSVar14->Gshift;
          uVar30 = (uint)pSVar14->Gloss;
          uVar27 = pSVar14->Bmask;
          uVar13 = (uint)pSVar14->Bshift;
          uVar12 = (uint)pSVar14->Bloss;
          uVar11 = (uint)pSVar14->Ashift;
          uVar10 = (uint)pSVar14->Aloss;
        }
LAB_089366c0:
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
        if (uVar20 == 3) {
LAB_08936af4:
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else {
LAB_089366d0:
          if (uVar20 == 4) {
            uVar7 = *puVar18;
          }
          else if (uVar20 == 2) {
            uVar7 = (uint)(ushort)*puVar18;
          }
          else {
            uVar7 = 0;
          }
        }
        if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
          uVar3 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar5 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar8 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar29 = uVar3 & 0xff;
          uVar7 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          uVar22 = uVar5 & 0xff;
          uVar26 = uVar8 & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar3;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar5;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar8;
          }
          else {
            if (uVar23 != 4) {
              if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar19 =
                     (ushort)(((int)uVar29 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f))
                     | (ushort)(((int)uVar22 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)
                               ) |
                     (ushort)(((int)uVar26 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f))
                     | (ushort)(((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f))
                ;
                uVar25 = (uint)pSVar14->Rshift;
                uVar24 = (uint)pSVar14->Rloss;
                uVar21 = (uint)pSVar14->Gshift;
                uVar30 = (uint)pSVar14->Gloss;
                uVar13 = (uint)pSVar14->Bshift;
                uVar12 = (uint)pSVar14->Bloss;
                uVar11 = (uint)pSVar14->Ashift;
                uVar10 = (uint)pSVar14->Aloss;
              }
              goto LAB_08936238;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar29 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar22 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar26 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar7 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          uVar17 = pSVar14->Amask;
          uVar31 = pSVar14->Rmask;
          uVar25 = (uint)pSVar14->Rshift;
          uVar24 = (uint)pSVar14->Rloss;
          uVar28 = pSVar14->Gmask;
          uVar21 = (uint)pSVar14->Gshift;
          uVar30 = (uint)pSVar14->Gloss;
          uVar27 = pSVar14->Bmask;
          uVar13 = (uint)pSVar14->Bshift;
          uVar12 = (uint)pSVar14->Bloss;
          uVar11 = (uint)pSVar14->Ashift;
          uVar10 = (uint)pSVar14->Aloss;
        }
LAB_08936238:
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
        if (uVar20 == 3) {
LAB_08936b54:
                    /* Unresolved local var: Uint8 * sB@[???] */
          uVar7 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                  (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else {
LAB_08936244:
          if (uVar20 == 4) {
            uVar7 = *puVar18;
          }
          else if (uVar20 == 2) {
            uVar7 = (uint)(ushort)*puVar18;
          }
          else {
            uVar7 = 0;
          }
        }
        if (uVar1 != (uVar7 & uVar16 & ~uVar17)) {
          uVar24 = ((uVar7 & uVar31) >> (uVar25 & 0x1f)) << (uVar24 & 0x1f);
          uVar21 = ((uVar7 & uVar28) >> (uVar21 & 0x1f)) << (uVar30 & 0x1f);
          uVar12 = ((uVar7 & uVar27) >> (uVar13 & 0x1f)) << (uVar12 & 0x1f);
          uVar13 = uVar24 & 0xff;
          uVar27 = uVar21 & 0xff;
          uVar25 = uVar12 & 0xff;
          uVar10 = ((uVar7 & uVar17) >> (uVar11 & 0x1f)) << (uVar10 & 0x1f) & 0xff;
          if (uVar23 == 3) {
            *(char *)((int)puVar19 + (uint)(pSVar15->Rshift >> 3)) = (char)uVar24;
            *(char *)((int)puVar19 + (uint)(pSVar15->Gshift >> 3)) = (char)uVar21;
            *(char *)((int)puVar19 + (uint)(pSVar15->Bshift >> 3)) = (char)uVar12;
          }
          else if (uVar23 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar19 = ((int)uVar13 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f) |
                       ((int)uVar27 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f) |
                       ((int)uVar25 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f) |
                       ((int)uVar10 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f);
          }
          else if (uVar23 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar19 =
                 (ushort)(((int)uVar13 >> (pSVar15->Rloss & 0x1f)) << (pSVar15->Rshift & 0x1f)) |
                 (ushort)(((int)uVar27 >> (pSVar15->Gloss & 0x1f)) << (pSVar15->Gshift & 0x1f)) |
                 (ushort)(((int)uVar25 >> (pSVar15->Bloss & 0x1f)) << (pSVar15->Bshift & 0x1f)) |
                 (ushort)(((int)uVar10 >> (pSVar15->Aloss & 0x1f)) << (pSVar15->Ashift & 0x1f));
          }
        }
        puVar19 = (uint *)((int)puVar19 + uVar23);
        puVar18 = (uint *)((int)puVar18 + uVar20);
        local_44 = local_44 + -1;
      } while (0 < local_44);
      break;
    case 1:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      if (uVar20 != 3) goto LAB_08936244;
      goto LAB_08936b54;
    case 2:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      if (uVar20 != 3) goto LAB_089366d0;
      goto LAB_08936af4;
    case 3:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      if (uVar20 != 3) goto LAB_08936630;
      goto LAB_08936bb4;
    case 4:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      if (uVar20 == 3) goto LAB_089365e8;
      goto LAB_08936970;
    case 5:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      if (uVar20 == 3) goto LAB_0893659c;
      goto LAB_0893681c;
    case 6:
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      goto LAB_089364f0;
    case 7:
      uVar25 = (uint)pSVar14->Rshift;
      uVar24 = (uint)pSVar14->Rloss;
      uVar21 = (uint)pSVar14->Gshift;
      uVar30 = (uint)pSVar14->Gloss;
      uVar13 = (uint)pSVar14->Bshift;
      uVar12 = (uint)pSVar14->Bloss;
      uVar11 = (uint)pSVar14->Ashift;
      uVar10 = (uint)pSVar14->Aloss;
      uVar17 = pSVar14->Amask;
      uVar31 = pSVar14->Rmask;
      uVar28 = pSVar14->Gmask;
      uVar27 = pSVar14->Bmask;
      goto LAB_08936414;
    }
    if (local_4c == iVar4 + -1) {
      return;
    }
    local_4c = local_4c + 1;
    puVar18 = (uint *)((int)puVar18 + iVar2);
    puVar19 = (uint *)((int)puVar19 + iVar6);
  } while( true );
}



----------------------------------------

// Function: SDL_CalculateBlitN @ 08937404

SDL_loblit SDL_CalculateBlitN(SDL_Surface *surface,int blit_index)

{
  byte bVar1;
  Uint8 UVar2;
  SDL_loblit p_Var3;
  SDL_bool SVar4;
  void *pvVar5;
  Uint32 UVar6;
  uint uVar7;
  code *pcVar8;
  SDL_BlitMap *pSVar9;
  Uint32 *pUVar10;
  Uint32 *pUVar11;
  SDL_PixelFormat *pSVar12;
  SDL_PixelFormat *pSVar13;
  private_swaccel *ppVar14;
  uint uVar15;
  
                    /* Unresolved local var: private_swaccel * sdata@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???]
                       Unresolved local var: blit_table * table@[???]
                       Unresolved local var: int which@[???]
                       Unresolved local var: SDL_loblit blitfun@[???] */
  pSVar9 = surface->map;
  pSVar12 = surface->format;
  ppVar14 = pSVar9->sw_data;
  pSVar13 = pSVar9->dst->format;
  if ((blit_index & 2U) != 0) {
    p_Var3 = SDL_CalculateAlphaBlit(surface,blit_index);
    return p_Var3;
  }
  if (pSVar13->BitsPerPixel < 8) {
    pcVar8 = (SDL_loblit)0x0;
  }
  else if (blit_index == 1) {
    if (pSVar12->BytesPerPixel == '\x02') {
      if (pSVar9->identity != 0) {
        return Blit2to2Key;
      }
      UVar2 = pSVar13->BytesPerPixel;
    }
    else {
      UVar2 = pSVar13->BytesPerPixel;
    }
    if (UVar2 == '\x01') {
      pcVar8 = BlitNto1Key;
    }
    else if ((pSVar12->Amask == 0) || (pSVar13->Amask == 0)) {
      pcVar8 = BlitNtoNKey;
    }
    else {
      pcVar8 = BlitNtoNKeyCopyAlpha;
    }
  }
  else if (pSVar13->BitsPerPixel == 8) {
    if ((((pSVar12->BytesPerPixel == '\x04') && (pSVar12->Rmask == 0xff0000)) &&
        (pSVar12->Gmask == 0xff00)) && (pSVar12->Bmask == 0xff)) {
      if (pSVar9->table == (Uint8 *)0x0) {
        pcVar8 = Blit_RGB888_index8;
      }
      else {
        pcVar8 = Blit_RGB888_index8_map;
      }
    }
    else {
      pcVar8 = BlitNto1;
    }
  }
  else {
                    /* Unresolved local var: int a_need@[???] */
    if (pSVar13->Amask == 0) {
      uVar15 = 0;
    }
    else {
      uVar15 = 4;
      if (pSVar12->Amask == 0) {
        uVar15 = 2;
      }
    }
    pUVar10 = (Uint32 *)(&PTR_caseD_7_089e1674)[pSVar12->BytesPerPixel];
    uVar7 = pUVar10[3];
    if (uVar7 == 0) {
      pvVar5 = (void *)pUVar10[8];
      pUVar11 = pUVar10;
    }
    else {
      do {
        pUVar11 = pUVar10;
        if (pSVar12->Rmask == *pUVar11) {
          UVar6 = pUVar11[1];
LAB_089374e0:
          if (pSVar12->Gmask == UVar6) {
            UVar6 = pUVar11[2];
          }
          else {
            if (UVar6 != 0) {
              uVar7 = pUVar11[0xe];
              goto LAB_08937564;
            }
            UVar6 = pUVar11[2];
          }
          if (pSVar12->Bmask == UVar6) {
            UVar6 = pUVar11[4];
          }
          else {
            if (UVar6 != 0) {
              uVar7 = pUVar11[0xe];
              goto LAB_08937564;
            }
            UVar6 = pUVar11[4];
          }
          if (pSVar13->Rmask == UVar6) {
            UVar6 = pUVar11[5];
          }
          else {
            if (UVar6 != 0) {
              uVar7 = pUVar11[0xe];
              goto LAB_08937564;
            }
            UVar6 = pUVar11[5];
          }
          if (pSVar13->Gmask == UVar6) {
            UVar6 = pUVar11[6];
          }
          else {
            if (UVar6 != 0) {
              uVar7 = pUVar11[0xe];
              goto LAB_08937564;
            }
            UVar6 = pUVar11[6];
          }
          if (pSVar13->Bmask == UVar6) {
            bVar1 = pSVar13->BytesPerPixel;
          }
          else {
            if (UVar6 != 0) {
              uVar7 = pUVar11[0xe];
              goto LAB_08937564;
            }
            bVar1 = pSVar13->BytesPerPixel;
          }
          if (bVar1 == uVar7) {
            if (uVar15 == (uVar15 & pUVar11[10])) {
              uVar7 = pUVar11[7];
              SVar4 = SDL_HasMMX();
              if ((uVar7 & SVar4 != SDL_FALSE) == pUVar11[7]) {
                pvVar5 = (void *)pUVar11[8];
                goto LAB_08937574;
              }
              uVar7 = pUVar11[0xe];
            }
            else {
              uVar7 = pUVar11[0xe];
            }
          }
          else {
            uVar7 = pUVar11[0xe];
          }
        }
        else {
          if (*pUVar11 == 0) {
            UVar6 = pUVar11[1];
            goto LAB_089374e0;
          }
          uVar7 = pUVar11[0xe];
        }
LAB_08937564:
        pUVar10 = pUVar11 + 0xb;
      } while (uVar7 != 0);
      pvVar5 = (void *)pUVar11[0x13];
      pUVar11 = pUVar11 + 0xb;
    }
LAB_08937574:
    pcVar8 = (code *)pUVar11[9];
    ppVar14->aux_data = pvVar5;
    if ((uVar15 == 4) && (pcVar8 == BlitNtoN)) {
      pcVar8 = BlitNtoNCopyAlpha;
    }
  }
  return pcVar8;
}



----------------------------------------

// Function: Blit1to1 @ 089376dc

/* WARNING: Removing unreachable block (ram,0x08937710) */

void Blit1to1(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  Uint8 *pUVar5;
  byte *pbVar6;
  uint uVar7;
  int iVar8;
  Uint8 *pUVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 * map@[DW_OP_reg8(t0)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[DW_OP_reg14(t6)]
                       Unresolved local var: int dstskip@[DW_OP_reg13(t5)] */
  iVar2 = info->d_height;
  pUVar9 = info->table;
  uVar7 = info->d_width;
  pbVar6 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar5 = info->d_pixels;
  iVar10 = info->d_skip;
  if (iVar2 != 0) {
    iVar12 = (int)(uVar7 + 7) / 8;
    iVar8 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar3 = iVar12;
      switch(uVar7 & 7) {
      case 0:
        do {
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_08937760:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_08937778:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_08937790:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_089377a8:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_089377c0:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
LAB_089377d8:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
          iVar4 = iVar3;
LAB_089377f0:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *pUVar5 = pUVar9[bVar1];
          pUVar5 = pUVar5 + 1;
          iVar3 = iVar4 + -1;
        } while (0 < iVar4 + -1);
        break;
      case 1:
        iVar4 = iVar12;
        goto LAB_089377f0;
      case 2:
        goto LAB_089377d8;
      case 3:
        goto LAB_089377c0;
      case 4:
        goto LAB_089377a8;
      case 5:
        goto LAB_08937790;
      case 6:
        goto LAB_08937778;
      case 7:
        goto LAB_08937760;
      }
      pbVar6 = pbVar6 + iVar11;
      if (iVar8 == iVar2 + -1) break;
      pUVar5 = pUVar5 + iVar10;
      iVar8 = iVar8 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to2 @ 08937864

/* WARNING: Removing unreachable block (ram,0x08937898) */

void Blit1to2(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  Uint8 *pUVar5;
  byte *pbVar6;
  uint uVar7;
  int iVar8;
  Uint8 *pUVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: Uint16 * map@[DW_OP_reg8(t0)]
                       Unresolved local var: int srcskip@[DW_OP_reg14(t6)]
                       Unresolved local var: int dstskip@[DW_OP_reg13(t5)] */
  iVar2 = info->d_height;
  pUVar9 = info->table;
  uVar7 = info->d_width;
  pbVar6 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar5 = info->d_pixels;
  iVar10 = info->d_skip;
  if (iVar2 != 0) {
    iVar12 = (int)(uVar7 + 7) / 8;
    iVar8 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar3 = iVar12;
      switch(uVar7 & 7) {
      case 0:
        do {
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_089378ec:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_08937908:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_08937924:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_08937940:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_0893795c:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
LAB_08937978:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
          iVar4 = iVar3;
LAB_08937994:
          bVar1 = *pbVar6;
          pbVar6 = pbVar6 + 1;
          *(undefined2 *)pUVar5 = *(undefined2 *)(pUVar9 + (uint)bVar1 * 2);
          pUVar5 = pUVar5 + 2;
          iVar3 = iVar4 + -1;
        } while (0 < iVar4 + -1);
        break;
      case 1:
        iVar4 = iVar12;
        goto LAB_08937994;
      case 2:
        goto LAB_08937978;
      case 3:
        goto LAB_0893795c;
      case 4:
        goto LAB_08937940;
      case 5:
        goto LAB_08937924;
      case 6:
        goto LAB_08937908;
      case 7:
        goto LAB_089378ec;
      }
      pbVar6 = pbVar6 + iVar11;
      if (iVar8 == iVar2 + -1) break;
      pUVar5 = pUVar5 + iVar10;
      iVar8 = iVar8 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to3 @ 08937a0c

/* WARNING: Removing unreachable block (ram,0x08937a40) */

void Blit1to3(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  Uint8 *pUVar3;
  byte *pbVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  Uint8 *pUVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int o@[???]
                       Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint8 * map@[DW_OP_reg8(t0)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[DW_OP_reg15(t7)]
                       Unresolved local var: int dstskip@[DW_OP_reg14(t6)] */
  iVar2 = info->d_height;
  pUVar8 = info->table;
  uVar5 = info->d_width;
  pbVar4 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar3 = info->d_pixels;
  iVar10 = info->d_skip;
  if (iVar2 != 0) {
    iVar12 = (int)(uVar5 + 7) / 8;
    iVar9 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg7(a3)] */
      iVar6 = iVar12;
      switch(uVar5 & 7) {
      case 0:
        do {
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937aac:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937ae0:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937b14:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937b48:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937b7c:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
LAB_08937bb0:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
          iVar7 = iVar6;
LAB_08937be4:
          bVar1 = *pbVar4;
          pbVar4 = pbVar4 + 1;
          *pUVar3 = pUVar8[(uint)bVar1 * 4];
          pUVar3[1] = pUVar8[(uint)bVar1 * 4 + 1];
          pUVar3[2] = (pUVar8 + (uint)bVar1 * 4 + 1)[1];
          pUVar3 = pUVar3 + 3;
          iVar6 = iVar7 + -1;
        } while (0 < iVar7 + -1);
        break;
      case 1:
        iVar7 = iVar12;
        goto LAB_08937be4;
      case 2:
        goto LAB_08937bb0;
      case 3:
        goto LAB_08937b7c;
      case 4:
        goto LAB_08937b48;
      case 5:
        goto LAB_08937b14;
      case 6:
        goto LAB_08937ae0;
      case 7:
        goto LAB_08937aac;
      }
      pbVar4 = pbVar4 + iVar11;
      if (iVar9 == iVar2 + -1) break;
      pUVar3 = pUVar3 + iVar10;
      iVar9 = iVar9 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to4 @ 08937c74

/* WARNING: Removing unreachable block (ram,0x08937c88) */
/* WARNING: Removing unreachable block (ram,0x08937cc4) */

void Blit1to4(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  Uint8 *pUVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  byte *pbVar7;
  uint uVar8;
  int iVar9;
  Uint8 *pUVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg6(a2)]
                       Unresolved local var: Uint32 * map@[DW_OP_reg8(t0)]
                       Unresolved local var: Uint32 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[DW_OP_reg14(t6)]
                       Unresolved local var: int dstskip@[???] */
  iVar2 = info->d_skip;
  iVar6 = info->d_height;
  pUVar10 = info->table;
  uVar8 = info->d_width;
  iVar11 = info->s_skip;
  pbVar7 = info->s_pixels;
  pUVar3 = info->d_pixels;
  if (iVar6 != 0) {
    iVar12 = (int)(uVar8 + 7) / 8;
    iVar9 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar4 = iVar12;
      switch(uVar8 & 7) {
      case 0:
        do {
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937d24:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937d40:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937d5c:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937d78:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937d94:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
LAB_08937db0:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
          iVar5 = iVar4;
LAB_08937dcc:
          bVar1 = *pbVar7;
          pbVar7 = pbVar7 + 1;
          *(undefined4 *)pUVar3 = *(undefined4 *)(pUVar10 + (uint)bVar1 * 4);
          pUVar3 = pUVar3 + 4;
          iVar4 = iVar5 + -1;
        } while (0 < iVar5 + -1);
        break;
      case 1:
        iVar5 = iVar12;
        goto LAB_08937dcc;
      case 2:
        goto LAB_08937db0;
      case 3:
        goto LAB_08937d94;
      case 4:
        goto LAB_08937d78;
      case 5:
        goto LAB_08937d5c;
      case 6:
        goto LAB_08937d40;
      case 7:
        goto LAB_08937d24;
      }
      pbVar7 = pbVar7 + iVar11;
      if (iVar9 == iVar6 + -1) break;
      pUVar3 = pUVar3 + (iVar2 / 4) * 4;
      iVar9 = iVar9 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to1Key @ 08937e44

/* WARNING: Removing unreachable block (ram,0x08937e84) */
/* WARNING: Removing unreachable block (ram,0x08938008) */

void Blit1to1Key(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  int iVar3;
  byte *pbVar4;
  byte *pbVar5;
  uint uVar6;
  int iVar7;
  Uint8 *pUVar8;
  uint uVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg5(a1)]
                       Unresolved local var: int srcskip@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg6(a2)]
                       Unresolved local var: int dstskip@[DW_OP_reg14(t6)]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg9(t1)] */
  pUVar8 = info->table;
  uVar6 = info->d_width;
  uVar9 = info->src->colorkey;
  pbVar4 = info->s_pixels;
  iVar1 = info->d_height;
  iVar11 = info->s_skip;
  pbVar5 = info->d_pixels;
  iVar10 = info->d_skip;
  if (pUVar8 == (Uint8 *)0x0) {
    if (iVar1 != 0) {
      iVar12 = (int)(uVar6 + 7) / 8;
      iVar7 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???] */
        iVar3 = iVar12;
        switch(uVar6 & 7) {
        case 0:
          do {
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_0893808c:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_08938100:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_089380a8:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_089380bc:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_089380d0:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
LAB_089380e4:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
            iVar2 = iVar3;
LAB_08938044:
            if (uVar9 != *pbVar4) {
              *pbVar5 = *pbVar4;
            }
            pbVar5 = pbVar5 + 1;
            pbVar4 = pbVar4 + 1;
            iVar3 = iVar2 + -1;
          } while (0 < iVar2 + -1);
          break;
        case 1:
          iVar2 = iVar12;
          goto LAB_08938044;
        case 2:
          goto LAB_089380e4;
        case 3:
          goto LAB_089380d0;
        case 4:
          goto LAB_089380bc;
        case 5:
          goto LAB_089380a8;
        case 6:
          goto LAB_08938100;
        case 7:
          goto LAB_0893808c;
        }
        pbVar4 = pbVar4 + iVar11;
        if (iVar1 + -1 == iVar7) break;
        pbVar5 = pbVar5 + iVar10;
        iVar7 = iVar7 + 1;
      }
    }
  }
  else if (iVar1 != 0) {
    iVar12 = (int)(uVar6 + 7) / 8;
    iVar7 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar3 = iVar12;
      switch(uVar6 & 7) {
      case 0:
        do {
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937f68:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937fac:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937fc8:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937ebc:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937ed8:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
LAB_08937ef4:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
          iVar2 = iVar3;
LAB_08937f10:
          if (uVar9 != *pbVar4) {
            *pbVar5 = pUVar8[*pbVar4];
          }
          pbVar5 = pbVar5 + 1;
          pbVar4 = pbVar4 + 1;
          iVar3 = iVar2 + -1;
        } while (0 < iVar2 + -1);
        break;
      case 1:
        iVar2 = iVar12;
        goto LAB_08937f10;
      case 2:
        goto LAB_08937ef4;
      case 3:
        goto LAB_08937ed8;
      case 4:
        goto LAB_08937ebc;
      case 5:
        goto LAB_08937fc8;
      case 6:
        goto LAB_08937fac;
      case 7:
        goto LAB_08937f68;
      }
      pbVar4 = pbVar4 + iVar11;
      if (iVar1 + -1 == iVar7) break;
      pbVar5 = pbVar5 + iVar10;
      iVar7 = iVar7 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to2Key @ 08938140

/* WARNING: Removing unreachable block (ram,0x08938154) */
/* WARNING: Removing unreachable block (ram,0x08938198) */

void Blit1to2Key(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  byte *pbVar6;
  Uint8 *pUVar7;
  int iVar8;
  uint uVar9;
  Uint8 *pUVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: int srcskip@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg5(a1)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint16 * palmap@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg9(t1)] */
  iVar1 = info->d_skip;
  iVar5 = info->d_height;
  uVar9 = info->src->colorkey;
  pbVar6 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar7 = info->d_pixels;
  pUVar10 = info->table;
  uVar4 = info->d_width;
  if (iVar5 != 0) {
    iVar12 = (int)(uVar4 + 7) / 8;
    iVar8 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar3 = iVar12;
      switch(uVar4 & 7) {
      case 0:
        do {
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_089382e4:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_089381dc:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_089381fc:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_0893821c:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_0893823c:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
LAB_0893825c:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
          iVar2 = iVar3;
LAB_0893827c:
          if (uVar9 != *pbVar6) {
            *(undefined2 *)pUVar7 = *(undefined2 *)(pUVar10 + (uint)*pbVar6 * 2);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 2;
          iVar3 = iVar2 + -1;
        } while (0 < iVar2 + -1);
        break;
      case 1:
        iVar2 = iVar12;
        goto LAB_0893827c;
      case 2:
        goto LAB_0893825c;
      case 3:
        goto LAB_0893823c;
      case 4:
        goto LAB_0893821c;
      case 5:
        goto LAB_089381fc;
      case 6:
        goto LAB_089381dc;
      case 7:
        goto LAB_089382e4;
      }
      pbVar6 = pbVar6 + iVar11;
      if (iVar5 + -1 == iVar8) break;
      pUVar7 = pUVar7 + (iVar1 / 2) * 2;
      iVar8 = iVar8 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to3Key @ 08938338

/* WARNING: Removing unreachable block (ram,0x08938374) */

void Blit1to3Key(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  int iVar3;
  Uint8 *pUVar4;
  byte *pbVar5;
  uint uVar6;
  Uint8 *pUVar7;
  uint uVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg6(a2)]
                       Unresolved local var: int srcskip@[DW_OP_reg24(t8)]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg5(a1)]
                       Unresolved local var: int dstskip@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint8 * palmap@[DW_OP_reg8(t0)]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg9(t1)]
                       Unresolved local var: int o@[???] */
  iVar3 = info->d_height;
  uVar6 = info->d_width;
  uVar8 = info->src->colorkey;
  pbVar5 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar4 = info->d_pixels;
  iVar10 = info->d_skip;
  pUVar7 = info->table;
  if (iVar3 != 0) {
    iVar12 = (int)(uVar6 + 7) / 8;
    iVar9 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg7(a3)] */
      iVar1 = iVar12;
      switch(uVar6 & 7) {
      case 0:
        do {
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_0893855c:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_089383ac:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_089383e4:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_0893841c:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_08938454:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
LAB_0893848c:
          iVar2 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar2];
            pUVar4[1] = pUVar7[iVar2 + 1];
            pUVar4[2] = (pUVar7 + iVar2 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
          iVar2 = iVar1;
LAB_089384c4:
          iVar1 = (uint)*pbVar5 * 4;
          if (uVar8 != *pbVar5) {
            *pUVar4 = pUVar7[iVar1];
            pUVar4[1] = pUVar7[iVar1 + 1];
            pUVar4[2] = (pUVar7 + iVar1 + 1)[1];
          }
          pbVar5 = pbVar5 + 1;
          pUVar4 = pUVar4 + 3;
          iVar1 = iVar2 + -1;
        } while (0 < iVar2 + -1);
        break;
      case 1:
        iVar2 = iVar12;
        goto LAB_089384c4;
      case 2:
        goto LAB_0893848c;
      case 3:
        goto LAB_08938454;
      case 4:
        goto LAB_0893841c;
      case 5:
        goto LAB_089383e4;
      case 6:
        goto LAB_089383ac;
      case 7:
        goto LAB_0893855c;
      }
      pbVar5 = pbVar5 + iVar11;
      if (iVar3 + -1 == iVar9) break;
      pUVar4 = pUVar4 + iVar10;
      iVar9 = iVar9 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1to4Key @ 089385c8

/* WARNING: Removing unreachable block (ram,0x089385dc) */
/* WARNING: Removing unreachable block (ram,0x08938620) */

void Blit1to4Key(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  byte *pbVar6;
  Uint8 *pUVar7;
  int iVar8;
  uint uVar9;
  Uint8 *pUVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg7(a3)]
                       Unresolved local var: int srcskip@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint32 * dstp@[DW_OP_reg5(a1)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 * palmap@[DW_OP_reg10(t2)]
                       Unresolved local var: Uint32 ckey@[DW_OP_reg9(t1)] */
  iVar1 = info->d_skip;
  iVar5 = info->d_height;
  uVar9 = info->src->colorkey;
  pbVar6 = info->s_pixels;
  iVar11 = info->s_skip;
  pUVar7 = info->d_pixels;
  pUVar10 = info->table;
  uVar4 = info->d_width;
  if (iVar5 != 0) {
    iVar12 = (int)(uVar4 + 7) / 8;
    iVar8 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar3 = iVar12;
      switch(uVar4 & 7) {
      case 0:
        do {
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_0893876c:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_08938664:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_08938684:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_089386a4:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_089386c4:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
LAB_089386e4:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
          iVar2 = iVar3;
LAB_08938704:
          if (uVar9 != *pbVar6) {
            *(undefined4 *)pUVar7 = *(undefined4 *)(pUVar10 + (uint)*pbVar6 * 4);
          }
          pbVar6 = pbVar6 + 1;
          pUVar7 = pUVar7 + 4;
          iVar3 = iVar2 + -1;
        } while (0 < iVar2 + -1);
        break;
      case 1:
        iVar2 = iVar12;
        goto LAB_08938704;
      case 2:
        goto LAB_089386e4;
      case 3:
        goto LAB_089386c4;
      case 4:
        goto LAB_089386a4;
      case 5:
        goto LAB_08938684;
      case 6:
        goto LAB_08938664;
      case 7:
        goto LAB_0893876c;
      }
      pbVar6 = pbVar6 + iVar11;
      if (iVar8 == iVar5 + -1) break;
      pUVar7 = pUVar7 + (iVar1 / 4) * 4;
      iVar8 = iVar8 + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Blit1toNAlpha @ 089387c0

/* WARNING: Removing unreachable block (ram,0x08938840) */

void Blit1toNAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  int iVar4;
  SDL_Color *pSVar5;
  SDL_Color *pSVar6;
  int iVar7;
  uint uVar8;
  uint uVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  SDL_PixelFormat *pSVar14;
  uint *puVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  uint uVar19;
  uint uVar20;
  uint uVar21;
  uint uVar22;
  byte *pbVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  uint uVar27;
  uint uVar28;
  uint uVar29;
  uint uVar30;
  int iVar31;
  int local_48;
  int local_40;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg9(t1)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: SDL_Color * srcpal@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: int A@[???] */
  iVar10 = info->d_height;
  pSVar14 = info->dst;
  uVar26 = (uint)info->src->alpha;
  pSVar6 = info->src->palette->colors;
  iVar4 = info->s_skip;
  pbVar23 = info->s_pixels;
  puVar15 = (uint *)info->d_pixels;
  iVar7 = info->d_skip;
  uVar16 = (uint)pSVar14->BytesPerPixel;
  if (iVar10 == 0) {
    return;
  }
  iVar31 = (int)(info->d_width + 3U) / 4;
  uVar28 = info->d_width & 3;
                    /* Unresolved local var: int sR@[???]
                       Unresolved local var: int sG@[???]
                       Unresolved local var: int sB@[???]
                       Unresolved local var: int dR@[???]
                       Unresolved local var: int dG@[???]
                       Unresolved local var: int dB@[???]
                       Unresolved local var: int n@[???] */
  local_40 = 0;
  if (uVar28 == 1) goto LAB_089388ac;
LAB_08938860:
  if (uVar28 < 2) {
    if (uVar28 != 0) goto LAB_08938880;
    pSVar5 = pSVar6 + *pbVar23;
    uVar25 = (uint)pSVar5->b;
    uVar9 = (uint)pSVar5->r;
    uVar22 = (uint)pSVar5->g;
    local_48 = iVar31;
    if (uVar16 != 3) goto LAB_089389c0;
    goto LAB_08938c88;
  }
  if (uVar28 != 2) {
    if (uVar28 != 3) goto LAB_08938880;
    uVar21 = (uint)pSVar14->Rshift;
    uVar20 = (uint)pSVar14->Rloss;
    uVar29 = (uint)pSVar14->Gshift;
    uVar18 = (uint)pSVar14->Gloss;
    uVar19 = (uint)pSVar14->Bshift;
    uVar17 = (uint)pSVar14->Bloss;
    uVar27 = pSVar14->Rmask;
    pSVar5 = pSVar6 + *pbVar23;
    uVar24 = pSVar14->Gmask;
    uVar30 = pSVar14->Bmask;
    uVar25 = (uint)pSVar5->b;
    uVar9 = (uint)pSVar5->r;
    uVar22 = (uint)pSVar5->g;
    local_48 = iVar31;
    if (uVar16 == 3) goto LAB_08938a9c;
    goto LAB_08938cf0;
  }
  uVar27 = pSVar14->Rmask;
  uVar24 = pSVar14->Gmask;
  uVar30 = pSVar14->Bmask;
  uVar21 = (uint)pSVar14->Rshift;
  uVar20 = (uint)pSVar14->Rloss;
  uVar29 = (uint)pSVar14->Gshift;
  uVar18 = (uint)pSVar14->Gloss;
  uVar19 = (uint)pSVar14->Bshift;
  uVar17 = (uint)pSVar14->Bloss;
  local_48 = iVar31;
LAB_08938ae4:
  do {
                    /* Unresolved local var: Uint32 pixel@[???] */
    pSVar5 = pSVar6 + *pbVar23;
    if (uVar16 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar9 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else if (uVar16 == 4) {
      uVar9 = *puVar15;
    }
    else if (uVar16 == 2) {
      uVar9 = (uint)(ushort)*puVar15;
    }
    else {
      uVar9 = 0;
    }
    iVar11 = ((uVar9 & uVar27) >> (uVar21 & 0x1f)) << (uVar20 & 0x1f);
    iVar12 = ((uVar9 & uVar24) >> (uVar29 & 0x1f)) << (uVar18 & 0x1f);
    iVar13 = ((uVar9 & uVar30) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    iVar11 = iVar11 + ((int)(uVar26 * ((uint)pSVar5->r - iVar11)) >> 8);
    iVar12 = iVar12 + ((int)(uVar26 * ((uint)pSVar5->g - iVar12)) >> 8);
    iVar13 = iVar13 + ((int)(uVar26 * ((uint)pSVar5->b - iVar13)) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uVar21 >> 3)) = (byte)iVar11;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Gshift >> 3)) = (byte)iVar12;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Bshift >> 3)) = (byte)iVar13;
LAB_08938c08:
      uVar21 = (uint)pSVar14->Rshift;
      uVar20 = (uint)pSVar14->Rloss;
      uVar27 = pSVar14->Rmask;
      uVar29 = (uint)pSVar14->Gshift;
      uVar18 = (uint)pSVar14->Gloss;
      uVar24 = pSVar14->Gmask;
      uVar19 = (uint)pSVar14->Bshift;
      uVar17 = (uint)pSVar14->Bloss;
      uVar30 = pSVar14->Bmask;
    }
    else {
      if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar15 = (iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f) |
                   (iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f) |
                   (iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f);
        goto LAB_08938c08;
      }
      if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar15 =
             (ushort)((iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f)) |
             (ushort)((iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f)) |
             (ushort)((iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f));
        uVar21 = (uint)pSVar14->Rshift;
        uVar20 = (uint)pSVar14->Rloss;
        uVar29 = (uint)pSVar14->Gshift;
        uVar18 = (uint)pSVar14->Gloss;
        uVar19 = (uint)pSVar14->Bshift;
        uVar17 = (uint)pSVar14->Bloss;
      }
    }
    pbVar23 = pbVar23 + 1;
    puVar15 = (uint *)((int)puVar15 + uVar16);
    pSVar5 = pSVar6 + *pbVar23;
    bVar1 = pSVar5->b;
    bVar2 = pSVar5->r;
    bVar3 = pSVar5->g;
    while( true ) {
      if (uVar16 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
        uVar9 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
                (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
      }
      else if (uVar16 == 4) {
        uVar9 = *puVar15;
      }
      else if (uVar16 == 2) {
        uVar9 = (uint)(ushort)*puVar15;
      }
      else {
        uVar9 = 0;
      }
      iVar11 = ((uVar9 & uVar27) >> (uVar21 & 0x1f)) << (uVar20 & 0x1f);
      iVar12 = ((uVar9 & uVar24) >> (uVar29 & 0x1f)) << (uVar18 & 0x1f);
      iVar13 = ((uVar9 & uVar30) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
      iVar11 = iVar11 + ((int)(uVar26 * ((uint)bVar2 - iVar11)) >> 8);
      iVar12 = iVar12 + ((int)(uVar26 * ((uint)bVar3 - iVar12)) >> 8);
      iVar13 = iVar13 + ((int)(uVar26 * ((uint)bVar1 - iVar13)) >> 8);
      if (uVar16 == 3) {
        *(byte *)((int)puVar15 + (uVar21 >> 3)) = (byte)iVar11;
        *(byte *)((int)puVar15 + (uint)(pSVar14->Gshift >> 3)) = (byte)iVar12;
        *(byte *)((int)puVar15 + (uint)(pSVar14->Bshift >> 3)) = (byte)iVar13;
      }
      else if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar15 = (iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f) |
                   (iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f) |
                   (iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f);
      }
      else if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar15 =
             (ushort)((iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f)) |
             (ushort)((iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f)) |
             (ushort)((iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f));
      }
      pbVar23 = pbVar23 + 1;
      puVar15 = (uint *)((int)puVar15 + uVar16);
      local_48 = local_48 + -1;
      if (0 < local_48) break;
LAB_08938880:
      if (local_40 == iVar10 + -1) {
        return;
      }
      puVar15 = (uint *)((int)puVar15 + iVar7);
      local_40 = local_40 + 1;
      pbVar23 = pbVar23 + iVar4;
      if (uVar28 != 1) goto LAB_08938860;
LAB_089388ac:
      uVar21 = (uint)pSVar14->Rshift;
      uVar20 = (uint)pSVar14->Rloss;
      uVar29 = (uint)pSVar14->Gshift;
      uVar18 = (uint)pSVar14->Gloss;
      uVar19 = (uint)pSVar14->Bshift;
      uVar17 = (uint)pSVar14->Bloss;
                    /* Unresolved local var: Uint32 pixel@[???] */
      uVar27 = pSVar14->Rmask;
      pSVar5 = pSVar6 + *pbVar23;
      uVar24 = pSVar14->Gmask;
      uVar30 = pSVar14->Bmask;
      bVar1 = pSVar5->b;
      bVar2 = pSVar5->r;
      bVar3 = pSVar5->g;
      local_48 = iVar31;
    }
                    /* Unresolved local var: Uint32 pixel@[???] */
    pSVar5 = pSVar6 + *pbVar23;
    uVar25 = (uint)pSVar5->b;
    uVar9 = (uint)pSVar5->r;
    uVar22 = (uint)pSVar5->g;
    if (uVar16 == 3) {
LAB_08938c88:
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar8 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else {
LAB_089389c0:
      if (uVar16 == 4) {
        uVar8 = *puVar15;
      }
      else if (uVar16 == 2) {
        uVar8 = (uint)(ushort)*puVar15;
      }
      else {
        uVar8 = 0;
      }
    }
    uVar27 = pSVar14->Rmask;
    uVar21 = (uint)pSVar14->Rshift;
    uVar20 = (uint)pSVar14->Rloss;
    iVar11 = ((uVar8 & uVar27) >> (uVar21 & 0x1f)) << (uVar20 & 0x1f);
    uVar24 = pSVar14->Gmask;
    uVar29 = (uint)pSVar14->Gshift;
    uVar18 = (uint)pSVar14->Gloss;
    iVar12 = ((uVar8 & uVar24) >> (uVar29 & 0x1f)) << (uVar18 & 0x1f);
    uVar30 = pSVar14->Bmask;
    uVar19 = (uint)pSVar14->Bshift;
    uVar17 = (uint)pSVar14->Bloss;
    iVar13 = ((uVar8 & uVar30) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    iVar11 = iVar11 + ((int)(uVar26 * (uVar9 - iVar11)) >> 8);
    iVar12 = iVar12 + ((int)(uVar26 * (uVar22 - iVar12)) >> 8);
    iVar13 = iVar13 + ((int)(uVar26 * (uVar25 - iVar13)) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uint)(pSVar14->Rshift >> 3)) = (byte)iVar11;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Gshift >> 3)) = (byte)iVar12;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Bshift >> 3)) = (byte)iVar13;
LAB_08938f3c:
      uVar21 = (uint)pSVar14->Rshift;
      uVar20 = (uint)pSVar14->Rloss;
      uVar27 = pSVar14->Rmask;
      uVar29 = (uint)pSVar14->Gshift;
      uVar18 = (uint)pSVar14->Gloss;
      uVar24 = pSVar14->Gmask;
      uVar19 = (uint)pSVar14->Bshift;
      uVar17 = (uint)pSVar14->Bloss;
      uVar30 = pSVar14->Bmask;
    }
    else {
      if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar15 = (iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f) |
                   (iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f) |
                   (iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f);
        goto LAB_08938f3c;
      }
      if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar15 =
             (ushort)((iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f)) |
             (ushort)((iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f)) |
             (ushort)((iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f));
        uVar21 = (uint)pSVar14->Rshift;
        uVar20 = (uint)pSVar14->Rloss;
        uVar29 = (uint)pSVar14->Gshift;
        uVar18 = (uint)pSVar14->Gloss;
        uVar19 = (uint)pSVar14->Bshift;
        uVar17 = (uint)pSVar14->Bloss;
      }
    }
    pbVar23 = pbVar23 + 1;
    puVar15 = (uint *)((int)puVar15 + uVar16);
                    /* Unresolved local var: Uint32 pixel@[???] */
    pSVar5 = pSVar6 + *pbVar23;
    uVar25 = (uint)pSVar5->b;
    uVar9 = (uint)pSVar5->r;
    uVar22 = (uint)pSVar5->g;
    if (uVar16 == 3) {
LAB_08938a9c:
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar8 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else {
LAB_08938cf0:
      if (uVar16 == 4) {
        uVar8 = *puVar15;
      }
      else if (uVar16 == 2) {
        uVar8 = (uint)(ushort)*puVar15;
      }
      else {
        uVar8 = 0;
      }
    }
    iVar11 = ((uVar8 & uVar27) >> (uVar21 & 0x1f)) << (uVar20 & 0x1f);
    iVar12 = ((uVar8 & uVar24) >> (uVar29 & 0x1f)) << (uVar18 & 0x1f);
    iVar13 = ((uVar8 & uVar30) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    iVar11 = iVar11 + ((int)(uVar26 * (uVar9 - iVar11)) >> 8);
    iVar12 = iVar12 + ((int)(uVar26 * (uVar22 - iVar12)) >> 8);
    iVar13 = iVar13 + ((int)(uVar26 * (uVar25 - iVar13)) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uVar21 >> 3)) = (byte)iVar11;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Gshift >> 3)) = (byte)iVar12;
      *(byte *)((int)puVar15 + (uint)(pSVar14->Bshift >> 3)) = (byte)iVar13;
    }
    else {
      if (uVar16 != 4) {
        if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
          *(ushort *)puVar15 =
               (ushort)((iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f)) |
               (ushort)((iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f)) |
               (ushort)((iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f));
          uVar21 = (uint)pSVar14->Rshift;
          uVar20 = (uint)pSVar14->Rloss;
          uVar29 = (uint)pSVar14->Gshift;
          uVar18 = (uint)pSVar14->Gloss;
          uVar19 = (uint)pSVar14->Bshift;
          uVar17 = (uint)pSVar14->Bloss;
          pbVar23 = pbVar23 + 1;
          puVar15 = (uint *)((int)puVar15 + 2);
        }
        else {
          pbVar23 = pbVar23 + 1;
          puVar15 = (uint *)((int)puVar15 + uVar16);
        }
        goto LAB_08938ae4;
      }
                    /* Unresolved local var: Uint32 pixel@[???] */
      *puVar15 = (iVar11 >> (uVar20 & 0x1f)) << (uVar21 & 0x1f) |
                 (iVar12 >> (uVar18 & 0x1f)) << (uVar29 & 0x1f) |
                 (iVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f);
    }
    uVar21 = (uint)pSVar14->Rshift;
    uVar20 = (uint)pSVar14->Rloss;
    uVar27 = pSVar14->Rmask;
    uVar29 = (uint)pSVar14->Gshift;
    uVar18 = (uint)pSVar14->Gloss;
    uVar24 = pSVar14->Gmask;
    uVar19 = (uint)pSVar14->Bshift;
    uVar17 = (uint)pSVar14->Bloss;
    uVar30 = pSVar14->Bmask;
    pbVar23 = pbVar23 + 1;
    puVar15 = (uint *)((int)puVar15 + uVar16);
  } while( true );
}



----------------------------------------

// Function: Blit1toNAlphaKey @ 08939050

/* WARNING: Removing unreachable block (ram,0x089390d0) */

void Blit1toNAlphaKey(SDL_BlitInfo *info)

{
  SDL_PixelFormat *pSVar1;
  SDL_Color *pSVar2;
  byte *pbVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  SDL_PixelFormat *pSVar13;
  uint *puVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  byte *pbVar19;
  uint uVar20;
  uint uVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  SDL_Color *pSVar25;
  int iVar26;
  int iVar27;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg14(t6)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg9(t1)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: SDL_Color * srcpal@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: int A@[???] */
  pSVar1 = info->src;
  pSVar13 = info->dst;
  iVar7 = info->d_height;
  uVar10 = info->d_width;
  pbVar19 = info->s_pixels;
  pSVar25 = pSVar1->palette->colors;
  puVar14 = (uint *)info->d_pixels;
  iVar4 = info->s_skip;
  iVar5 = info->d_skip;
  uVar21 = (uint)pSVar1->alpha;
  uVar24 = pSVar1->colorkey;
  uVar15 = (uint)pSVar13->BytesPerPixel;
  if (iVar7 == 0) {
    return;
  }
  iVar27 = (int)(uVar10 + 7) / 8;
  iVar26 = 0;
  do {
                    /* Unresolved local var: int sR@[???]
                       Unresolved local var: int sG@[???]
                       Unresolved local var: int sB@[???]
                       Unresolved local var: int dR@[???]
                       Unresolved local var: int dG@[???]
                       Unresolved local var: int dB@[???]
                       Unresolved local var: int n@[???] */
    iVar8 = iVar27;
    switch(uVar10 & 7) {
    case 0:
      do {
        if (uVar24 != *pbVar19) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
LAB_08939364:
        if (uVar24 == *pbVar19) {
LAB_08939468:
          pbVar19 = pbVar19 + 1;
          puVar14 = (uint *)((int)puVar14 + uVar15);
        }
        else {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            pbVar19 = pbVar19 + 1;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            pbVar3 = (byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3));
            puVar14 = (uint *)((int)puVar14 + 3);
            *pbVar3 = (byte)iVar12;
          }
          else {
            if (uVar15 != 4) {
              if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar14 =
                     (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                     (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                     (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
              }
              goto LAB_08939468;
            }
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
            pbVar19 = pbVar19 + 1;
            puVar14 = puVar14 + 1;
          }
        }
LAB_0893974c:
        if (uVar24 != *pbVar19) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
        uVar6 = (uint)*pbVar19;
        if (uVar24 == uVar6) {
LAB_0893983c:
          pbVar19 = pbVar19 + 1;
LAB_08939840:
          puVar14 = (uint *)((int)puVar14 + uVar15);
        }
        else {
LAB_08939858:
          pSVar2 = pSVar25 + uVar6;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            pbVar19 = pbVar19 + 1;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            pbVar3 = (byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3));
            puVar14 = (uint *)((int)puVar14 + 3);
            *pbVar3 = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
            pbVar19 = pbVar19 + 1;
            puVar14 = puVar14 + 1;
          }
          else {
            pbVar19 = pbVar19 + 1;
            if (uVar15 != 2) goto LAB_08939840;
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
            puVar14 = (uint *)((int)puVar14 + 2);
          }
        }
LAB_0893947c:
        if (uVar24 != *pbVar19) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
LAB_08939560:
        if (uVar24 != *pbVar19) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
LAB_08939644:
        if (uVar24 != *pbVar19) {
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar9 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar9 = iVar9 + ((int)(uVar21 * ((uint)pSVar2->r - iVar9)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar9;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar9 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
        iVar9 = iVar8;
LAB_08939144:
        if (uVar24 != *pbVar19) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          pSVar2 = pSVar25 + *pbVar19;
          if (uVar15 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar6 = (uint)(byte)*puVar14 + (uint)*(byte *)((int)puVar14 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar14 + 2) * 0x10000;
          }
          else if (uVar15 == 4) {
            uVar6 = *puVar14;
          }
          else if (uVar15 == 2) {
            uVar6 = (uint)(ushort)*puVar14;
          }
          else {
            uVar6 = 0;
          }
          uVar18 = (uint)pSVar13->Rshift;
          uVar16 = (uint)pSVar13->Rloss;
          iVar8 = ((uVar6 & pSVar13->Rmask) >> (uVar18 & 0x1f)) << (uVar16 & 0x1f);
          uVar22 = (uint)pSVar13->Gshift;
          uVar17 = (uint)pSVar13->Gloss;
          iVar11 = ((uVar6 & pSVar13->Gmask) >> (uVar22 & 0x1f)) << (uVar17 & 0x1f);
          uVar23 = (uint)pSVar13->Bshift;
          uVar20 = (uint)pSVar13->Bloss;
          iVar12 = ((uVar6 & pSVar13->Bmask) >> (uVar23 & 0x1f)) << (uVar20 & 0x1f);
          iVar8 = iVar8 + ((int)(uVar21 * ((uint)pSVar2->r - iVar8)) >> 8);
          iVar11 = iVar11 + ((int)(uVar21 * ((uint)pSVar2->g - iVar11)) >> 8);
          iVar12 = iVar12 + ((int)(uVar21 * ((uint)pSVar2->b - iVar12)) >> 8);
          if (uVar15 == 3) {
            *(byte *)((int)puVar14 + (uint)(pSVar13->Rshift >> 3)) = (byte)iVar8;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Gshift >> 3)) = (byte)iVar11;
            *(byte *)((int)puVar14 + (uint)(pSVar13->Bshift >> 3)) = (byte)iVar12;
          }
          else if (uVar15 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
            *puVar14 = (iVar8 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f) |
                       (iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f) |
                       (iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f);
          }
          else if (uVar15 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
            *(ushort *)puVar14 =
                 (ushort)((iVar8 >> (uVar16 & 0x1f)) << (uVar18 & 0x1f)) |
                 (ushort)((iVar11 >> (uVar17 & 0x1f)) << (uVar22 & 0x1f)) |
                 (ushort)((iVar12 >> (uVar20 & 0x1f)) << (uVar23 & 0x1f));
          }
        }
        pbVar19 = pbVar19 + 1;
        puVar14 = (uint *)((int)puVar14 + uVar15);
        iVar8 = iVar9 + -1;
      } while (0 < iVar9 + -1);
      break;
    case 1:
      iVar9 = iVar27;
      goto LAB_08939144;
    case 2:
      goto LAB_08939644;
    case 3:
      goto LAB_08939560;
    case 4:
      goto LAB_0893947c;
    case 5:
      uVar6 = (uint)*pbVar19;
      if (uVar24 == uVar6) goto LAB_0893983c;
      goto LAB_08939858;
    case 6:
      goto LAB_0893974c;
    case 7:
      goto LAB_08939364;
    }
    if (iVar26 == iVar7 + -1) {
      return;
    }
    iVar26 = iVar26 + 1;
    pbVar19 = pbVar19 + iVar4;
    puVar14 = (uint *)((int)puVar14 + iVar5);
  } while( true );
}



----------------------------------------

// Function: SDL_CalculateBlit1 @ 08939e30

SDL_loblit SDL_CalculateBlit1(SDL_Surface *surface,int blit_index)

{
  SDL_PixelFormat *pSVar1;
  uint uVar2;
  
                    /* Unresolved local var: int which@[???]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???] */
  pSVar1 = surface->map->dst->format;
  if (pSVar1->BitsPerPixel < 8) {
    uVar2 = 0;
  }
  else {
    uVar2 = (uint)pSVar1->BytesPerPixel;
  }
  if (blit_index != 1) {
    if (blit_index < 2) {
      if (blit_index == 0) {
        return one_blit[uVar2];
      }
    }
    else if (blit_index == 2) {
      if (1 < uVar2) {
        return Blit1toNAlpha;
      }
    }
    else if ((blit_index == 3) && (1 < uVar2)) {
      return Blit1toNAlphaKey;
    }
    return (SDL_loblit)0x0;
  }
  return one_blitkey[uVar2];
}



----------------------------------------

// Function: SDL_PrivateQuit @ 08939ee0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateQuit(void)

{
  int iVar1;
  SDL_Event local_20;
  
                    /* Unresolved local var: int posted@[???] */
  if ((SDL_ProcessEvents[0xc] == '\x01') &&
     ((local_20.type = '\f', SDL_EventOK == (SDL_EventFilter)0x0 ||
      (iVar1 = (*SDL_EventOK)(&local_20), iVar1 != 0)))) {
    SDL_PushEvent(&local_20);
    return 1;
  }
                    /* Unresolved local var: SDL_Event event@[???] */
  return 0;
}



----------------------------------------

// Function: SDL_QuitInit @ 08939f48

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_QuitInit(void)

{
  _sig_func_ptr p_Var1;
  
                    /* Unresolved local var: _func_void_int * ohandler@[???] */
  p_Var1 = signal(2,SDL_HandleSIG);
  if (p_Var1 != (_sig_func_ptr)0x0) {
    signal(2,p_Var1);
  }
  p_Var1 = signal(0xf,SDL_HandleSIG);
  if (p_Var1 != (_sig_func_ptr)0x0) {
    signal(0xf,p_Var1);
  }
  return 0;
}



----------------------------------------

// Function: SDL_HandleSIG @ 08939fac

void SDL_HandleSIG(int sig)

{
  signal(sig,SDL_HandleSIG);
  SDL_PrivateQuit();
  return;
}



----------------------------------------

// Function: SDL_AppActiveInit @ 08939fcc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_AppActiveInit(void)

{
  SDL_appstate = '\a';
  return 0;
}



----------------------------------------

// Function: SDL_GetAppState @ 08939fe0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint8 SDL_GetAppState(void)

{
  return SDL_appstate;
}



----------------------------------------

// Function: SDL_PrivateAppActive @ 08939fec

/* WARNING: Enum "SDLKey": Some values do not have unique names */

int SDL_PrivateAppActive(Uint8 gain,Uint8 state)

{
  byte bVar1;
  int iVar2;
  SDL_Event local_28;
  
                    /* Unresolved local var: int posted@[???]
                       Unresolved local var: Uint8 new_state@[???] */
  if (gain == '\0') {
    bVar1 = ~state & SDL_appstate;
  }
  else {
    bVar1 = state | SDL_appstate;
  }
  if (SDL_appstate == bVar1) {
    return 0;
  }
  SDL_appstate = bVar1;
  if (SDL_ProcessEvents[1] == '\x01') {
    local_28.resize.w = 0;
    local_28.key.keysym.sym = SDLK_FIRST;
    local_28.key.keysym.mod = KMOD_NONE;
    local_28._16_4_ = 0;
    local_28.active.gain = gain;
    local_28.type = 1;
    local_28.active.state = state;
    local_28.button.state = 0;
    if ((SDL_EventOK == (SDL_EventFilter)0x0) || (iVar2 = (*SDL_EventOK)(&local_28), iVar2 != 0)) {
      SDL_PushEvent(&local_28);
      iVar2 = 1;
    }
    else {
      iVar2 = 0;
    }
  }
  else {
                    /* Unresolved local var: SDL_Event event@[???] */
    iVar2 = 0;
  }
  if (((state & 2) != 0) && (gain == '\0')) {
    SDL_ResetKeyboard();
    return iVar2;
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_SYS_JoystickOpen @ 0893a118

int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)

{
  joystick->nbuttons = 0xe;
  joystick->naxes = 2;
  joystick->nhats = 0;
  return 0;
}



----------------------------------------

// Function: SDL_SYS_JoystickClose @ 0893a134

void SDL_SYS_JoystickClose(SDL_Joystick *joystick)

{
  return;
}



----------------------------------------

// Function: SDL_SYS_JoystickQuit @ 0893a13c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDL_SYS_JoystickQuit(void)

{
  running = 0;
  SDL_WaitThread(thread,(int *)0x0);
  SDL_DestroySemaphore(pad_sem);
  return;
}



----------------------------------------

// Function: SDL_SYS_JoystickUpdate @ 0893a170

void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)

{
  uint uVar1;
  uchar uVar2;
  uchar uVar3;
  PspCtrlButtons PVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  uint uVar8;
  PspCtrlButtons *pPVar9;
  PspCtrlButtons PVar10;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: PspCtrlButtons buttons@[???]
                       Unresolved local var: PspCtrlButtons changed@[???]
                       Unresolved local var: uchar x@[???]
                       Unresolved local var: uchar y@[???] */
  SDL_SemWait(pad_sem);
  uVar3 = pad.Ly;
  uVar2 = pad.Lx;
  uVar1 = pad.Buttons;
  uVar8 = (uint)pad.Ly;
  uVar5 = (uint)pad.Lx;
  SDL_SemPost(pad_sem);
  if (SDL_SYS_JoystickUpdate::old_x != uVar5) {
    SDL_PrivateJoystickAxis(joystick,'\0',(Sint16)analog_map[uVar5]);
    SDL_SYS_JoystickUpdate::old_x = uVar2;
  }
  if (SDL_SYS_JoystickUpdate::old_y != uVar8) {
    SDL_PrivateJoystickAxis(joystick,'\x01',(Sint16)analog_map[uVar8]);
    SDL_SYS_JoystickUpdate::old_y = uVar3;
  }
  PVar10 = uVar1 ^ SDL_SYS_JoystickUpdate::old_buttons;
  SDL_SYS_JoystickUpdate::old_buttons = uVar1;
  if (PVar10 != 0) {
    pPVar9 = button_map;
    PVar4 = button_map[0];
    iVar6 = 0;
    while( true ) {
      while( true ) {
        pPVar9 = pPVar9 + 1;
        iVar7 = iVar6 + 1;
        if ((PVar10 & PVar4) == 0) break;
        SDL_PrivateJoystickButton(joystick,(Uint8)iVar6,(uVar1 & PVar4) != 0);
        if (iVar7 == 0xe) goto LAB_0893a270;
        PVar4 = *pPVar9;
        iVar6 = iVar7;
      }
      if (iVar7 == 0xe) break;
      PVar4 = *pPVar9;
      iVar6 = iVar7;
    }
  }
LAB_0893a270:
  sceKernelDelayThread(0);
  return;
}



----------------------------------------

// Function: SDL_SYS_JoystickName @ 0893a2ac

char * SDL_SYS_JoystickName(int index)

{
  char *pcVar1;
  
  pcVar1 = "PSP controller";
  if (index != 0) {
    SDL_SetError("No joystick available with that index");
    pcVar1 = (char *)0x0;
  }
  return pcVar1;
}



----------------------------------------

// Function: JoystickUpdate @ 0893a2e0

int JoystickUpdate(void *data)

{
  while (running != 0) {
    SDL_SemWait(pad_sem);
    sceCtrlPeekBufferPositive(&pad,1);
    SDL_SemPost(pad_sem);
    sceKernelDelayThread(0x411a);
  }
  return 0;
}



----------------------------------------

// Function: SDL_SYS_JoystickInit @ 0893a354

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int SDL_SYS_JoystickInit(void)

{
  float fVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  int *piVar7;
  float fVar8;
  int iVar9;
  int iVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  
                    /* Unresolved local var: int i@[???] */
  SDL_numjoysticks = '\x01';
  sceCtrlSetSamplingCycle(0);
  sceCtrlSetSamplingMode(1);
  pad_sem = SDL_CreateSemaphore(1);
  if (pad_sem == (SDL_sem *)0x0) {
    SDL_SetError("Can\'t create input semaphore\n");
    iVar10 = -1;
  }
  else {
    running = 1;
    thread = SDL_CreateThread(JoystickUpdate,(void *)0x0);
    fVar1 = DAT_089df684;
    if (thread == (SDL_Thread *)0x0) {
      SDL_SetError("Can\'t create input thread\n");
      iVar10 = -1;
    }
    else {
                    /* Unresolved local var: float t@[???]
                       Unresolved local var: point ab@[???]
                       Unresolved local var: point bc@[???]
                       Unresolved local var: point cd@[???]
                       Unresolved local var: point abbc@[???]
                       Unresolved local var: point bccd@[???]
                       Unresolved local var: point dest@[???] */
      iVar2 = b.y - a.y;
      iVar4 = d.y - c.y;
      fVar13 = (float)a.y;
      iVar3 = c.y - b.y;
      fVar12 = (float)b.y;
      piVar7 = analog_map + 0x80;
      piVar6 = analog_map + 0x7f;
      fVar11 = (float)c.y;
      iVar10 = 0;
      do {
        iVar5 = iVar10 + 1;
        fVar8 = (float)iVar10 / fVar1;
        iVar10 = (int)(fVar13 + fVar8 * (float)iVar2);
        iVar9 = (int)(fVar12 + fVar8 * (float)iVar3);
        iVar10 = (int)((float)iVar10 + fVar8 * (float)(iVar9 - iVar10));
        iVar10 = (int)((float)iVar10 +
                      fVar8 * (float)((int)((float)iVar9 +
                                           fVar8 * (float)((int)(fVar11 + fVar8 * (float)iVar4) -
                                                          iVar9)) - iVar10));
        *piVar7 = iVar10;
        *piVar6 = -iVar10;
        piVar7 = piVar7 + 1;
        piVar6 = piVar6 + -1;
        iVar10 = iVar5;
      } while (iVar5 != 0x80);
      iVar10 = 1;
    }
  }
  return iVar10;
}



----------------------------------------

// Function: SDL_SemPost @ 0893a528

int SDL_SemPost(SDL_sem *sem)

{
  int iVar1;
  char *fmt;
  
                    /* Unresolved local var: int res@[???] */
  fmt = "Passed a NULL sem";
  if (sem != (SDL_sem *)0x0) {
    iVar1 = sceKernelSignalSema(sem->semid,1);
    fmt = "sceKernelSignalSema() failed";
    if (-1 < iVar1) {
      return 0;
    }
  }
  SDL_SetError(fmt);
  return -1;
}



----------------------------------------

// Function: SDL_SemValue @ 0893a57c

Uint32 SDL_SemValue(SDL_sem *sem)

{
  int iVar1;
  Uint32 UVar2;
  undefined1 auStack_40 [44];
  Uint32 local_14;
  
                    /* Unresolved local var: SceKernelSemaInfo info@[???] */
  if (sem != (SDL_sem *)0x0) {
    iVar1 = sceKernelReferSemaStatus(sem->semid);
    UVar2 = 0;
    if (-1 < iVar1) {
      UVar2 = local_14;
    }
    return UVar2;
  }
  SDL_SetError("Passed a NULL sem",auStack_40);
  return 0;
}



----------------------------------------

// Function: SDL_SemWaitTimeout @ 0893a5d8

int SDL_SemWaitTimeout(SDL_sem *sem,Uint32 timeout)

{
  int iVar1;
  int iVar2;
  Uint32 *pUVar3;
  Uint32 local_10 [2];
  
                    /* Unresolved local var: Uint32 * pTimeout@[???]
                       Unresolved local var: uint res@[???] */
  pUVar3 = local_10;
  local_10[0] = timeout;
  if (sem == (SDL_sem *)0x0) {
    SDL_SetError("Passed a NULL sem");
    iVar2 = 0;
  }
  else {
    if (timeout == 0) {
      sceKernelPollSema(sem->semid,1);
      return 0;
    }
    if (timeout == 0xffffffff) {
      pUVar3 = (Uint32 *)0x0;
      local_10[0] = 0xffffffff;
    }
    else {
      local_10[0] = timeout * 1000;
    }
    iVar1 = sceKernelWaitSema(sem->semid,1,pUVar3);
    if (iVar1 == 0) {
      return 0;
    }
    iVar2 = 1;
    if (iVar1 != -0x7ffdfe58) {
      SDL_SetError("WaitForSingleObject() failed");
      iVar2 = -1;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_SemWait @ 0893a690

/* WARNING: Removing unreachable block (ram,0x0893a5f8) */
/* WARNING: Removing unreachable block (ram,0x0893a658) */

int SDL_SemWait(SDL_sem *sem)

{
  int iVar1;
  int iVar2;
  
  if (sem == (SDL_sem *)0x0) {
    SDL_SetError("Passed a NULL sem");
    iVar2 = 0;
  }
  else {
    iVar1 = sceKernelWaitSema(sem->semid,1,0);
    if (iVar1 == 0) {
      return 0;
    }
    iVar2 = 1;
    if (iVar1 != -0x7ffdfe58) {
      SDL_SetError("WaitForSingleObject() failed");
      iVar2 = -1;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: SDL_SemTryWait @ 0893a698

/* WARNING: Removing unreachable block (ram,0x0893a5f0) */
/* WARNING: Removing unreachable block (ram,0x0893a5f8) */
/* WARNING: Removing unreachable block (ram,0x0893a674) */
/* WARNING: Removing unreachable block (ram,0x0893a608) */
/* WARNING: Removing unreachable block (ram,0x0893a648) */
/* WARNING: Removing unreachable block (ram,0x0893a61c) */
/* WARNING: Removing unreachable block (ram,0x0893a62c) */

int SDL_SemTryWait(SDL_sem *sem)

{
  if (sem != (SDL_sem *)0x0) {
    sceKernelPollSema(sem->semid,1);
    return 0;
  }
  SDL_SetError("Passed a NULL sem");
  return 0;
}



----------------------------------------

// Function: SDL_DestroySemaphore @ 0893a6a0

void SDL_DestroySemaphore(SDL_sem *sem)

{
  if (sem != (SDL_sem *)0x0) {
    if (0 < sem->semid) {
      sceKernelDeleteSema(sem->semid);
      sem->semid = 0;
    }
    free(sem);
    return;
  }
  return;
}



----------------------------------------

// Function: SDL_CreateSemaphore @ 0893a6f0

SDL_sem * SDL_CreateSemaphore(Uint32 initial_value)

{
  SDL_sem *aptr;
  int iVar1;
  
                    /* Unresolved local var: SDL_sem * sem@[???] */
  aptr = malloc(4);
  if (aptr != (SDL_sem *)0x0) {
    iVar1 = sceKernelCreateSema("SDL sema",0,initial_value,0xff);
    aptr->semid = iVar1;
    if (iVar1 < 0) {
      SDL_SetError("Couldn\'t create semaphore");
      free(aptr);
      aptr = (SDL_sem *)0x0;
    }
    return aptr;
  }
  SDL_Error(SDL_ENOMEM);
  return (SDL_sem *)0x0;
}



----------------------------------------

// Function: SDL_GetCPUFeatures @ 0893a794

/* WARNING: Removing unreachable block (ram,0x0893a7c4) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Uint32 SDL_GetCPUFeatures(void)

{
  if (SDL_CPUFeatures == 0xffffffff) {
                    /* Unresolved local var: int altivec@[???] */
    SDL_CPUFeatures = 0;
  }
  return SDL_CPUFeatures;
}



----------------------------------------

// Function: SDL_HasAltiVec @ 0893a7d8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasAltiVec(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 0x1ff) >> 8;
}



----------------------------------------

// Function: SDL_HasSSE2 @ 0893a7f8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasSSE2(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 0xff) >> 7;
}



----------------------------------------

// Function: SDL_HasSSE @ 0893a818

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasSSE(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 0x7f) >> 6;
}



----------------------------------------

// Function: SDL_Has3DNowExt @ 0893a838

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_Has3DNowExt(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 0x3f) >> 5;
}



----------------------------------------

// Function: SDL_Has3DNow @ 0893a858

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_Has3DNow(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 0x1f) >> 4;
}



----------------------------------------

// Function: SDL_HasMMXExt @ 0893a878

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasMMXExt(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 7) >> 2;
}



----------------------------------------

// Function: SDL_HasMMX @ 0893a898

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasMMX(void)

{
  Uint32 UVar1;
  
  UVar1 = SDL_GetCPUFeatures();
  return (UVar1 & 3) >> 1;
}



----------------------------------------

// Function: SDL_HasRDTSC @ 0893a8b8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_bool SDL_HasRDTSC(void)

{
  SDL_bool SVar1;
  
  SVar1 = SDL_GetCPUFeatures();
  return SVar1 & SDL_TRUE;
}



----------------------------------------

// Function: BlitNto1SurfaceAlpha @ 0893a8d8

/* WARNING: Removing unreachable block (ram,0x0893a950) */

void BlitNto1SurfaceAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  SDL_Color *pSVar6;
  uint uVar7;
  SDL_PixelFormat *pSVar8;
  byte *pbVar9;
  uint uVar10;
  uint uVar11;
  Uint8 *pUVar12;
  uint uVar13;
  SDL_PixelFormat *pSVar14;
  int iVar15;
  uint uVar16;
  uint *puVar17;
  int iVar18;
  int local_34;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg25(t9)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg15(t7)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg14(t6)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: uint A@[???] */
  iVar4 = info->s_skip;
  iVar2 = info->d_height;
  pSVar8 = info->src;
  iVar5 = info->d_skip;
  pSVar14 = info->dst;
  uVar10 = (uint)pSVar8->BytesPerPixel;
  uVar11 = (uint)pSVar8->alpha;
  puVar17 = (uint *)info->s_pixels;
  pbVar9 = info->d_pixels;
  pUVar12 = info->table;
  if (iVar2 == 0) {
    return;
  }
  iVar18 = (int)(info->d_width + 3U) / 4;
  uVar13 = info->d_width & 3;
                    /* Unresolved local var: int n@[???] */
  local_34 = 0;
  do {
    iVar15 = iVar18;
    if (uVar13 == 1) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
      if (uVar10 == 3) goto LAB_0893adbc;
      goto LAB_0893a9c8;
    }
    if (uVar13 < 2) {
      if (uVar13 == 0) {
        if (uVar10 != 3) goto LAB_0893aac8;
                    /* Unresolved local var: Uint8 * B@[???] */
        bVar1 = *(byte *)((int)puVar17 + 1);
        goto LAB_0893ae18;
      }
    }
    else {
      if (uVar13 == 2) {
        if (uVar10 != 3) goto LAB_0893acc0;
                    /* Unresolved local var: Uint8 * B@[???] */
        bVar1 = *(byte *)((int)puVar17 + 1);
        goto LAB_0893ade8;
      }
      if (uVar13 == 3) {
        if (uVar10 != 3) goto LAB_0893abc4;
                    /* Unresolved local var: Uint8 * B@[???] */
        bVar1 = *(byte *)((int)puVar17 + 1);
        do {
          uVar16 = (uint)(byte)*puVar17 + (uint)bVar1 * 0x100 +
                   (uint)*(byte *)((int)puVar17 + 2) * 0x10000;
          while( true ) {
            pSVar6 = pSVar14->palette->colors + *pbVar9;
            uVar3 = (uint)pSVar6->g +
                    (uVar11 * ((((uVar16 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) <<
                               (pSVar8->Gloss & 0x1f)) - (uint)pSVar6->g) >> 8) & 0xff;
            uVar7 = (uint)pSVar6->b +
                    (uVar11 * ((((uVar16 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) <<
                               (pSVar8->Bloss & 0x1f)) - (uint)pSVar6->b) >> 8) & 0xff;
            uVar16 = (uint)pSVar6->r +
                     (uVar11 * ((((uVar16 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) <<
                                (pSVar8->Rloss & 0x1f)) - (uint)pSVar6->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar16 & 0xe0 | (byte)(uVar7 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar16 & 0xe0 | uVar7 >> 6];
            }
            puVar17 = (uint *)((int)puVar17 + uVar10);
            pbVar9 = pbVar9 + 1;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar10 == 3) {
              bVar1 = *(byte *)((int)puVar17 + 1);
LAB_0893ade8:
              uVar16 = (uint)(byte)*puVar17 + (uint)bVar1 * 0x100 +
                       (uint)*(byte *)((int)puVar17 + 2) * 0x10000;
            }
            else {
LAB_0893acc0:
              if (uVar10 == 4) {
                uVar16 = *puVar17;
              }
              else if (uVar10 == 2) {
                uVar16 = (uint)(ushort)*puVar17;
              }
              else {
                uVar16 = 0;
              }
            }
            pSVar6 = pSVar14->palette->colors + *pbVar9;
            uVar3 = (uint)pSVar6->g +
                    (uVar11 * ((((uVar16 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) <<
                               (pSVar8->Gloss & 0x1f)) - (uint)pSVar6->g) >> 8) & 0xff;
            uVar7 = (uint)pSVar6->b +
                    (uVar11 * ((((uVar16 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) <<
                               (pSVar8->Bloss & 0x1f)) - (uint)pSVar6->b) >> 8) & 0xff;
            uVar16 = (uint)pSVar6->r +
                     (uVar11 * ((((uVar16 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) <<
                                (pSVar8->Rloss & 0x1f)) - (uint)pSVar6->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar16 & 0xe0 | (byte)(uVar7 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar16 & 0xe0 | uVar7 >> 6];
            }
            puVar17 = (uint *)((int)puVar17 + uVar10);
            pbVar9 = pbVar9 + 1;
            if (uVar10 == 3) {
LAB_0893adbc:
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar16 = (uint)(byte)*puVar17 + (uint)*(byte *)((int)puVar17 + 1) * 0x100 +
                       (uint)*(byte *)((int)puVar17 + 2) * 0x10000;
            }
            else {
LAB_0893a9c8:
              if (uVar10 == 4) {
                uVar16 = *puVar17;
              }
              else if (uVar10 == 2) {
                uVar16 = (uint)(ushort)*puVar17;
              }
              else {
                uVar16 = 0;
              }
            }
            pSVar6 = pSVar14->palette->colors + *pbVar9;
            uVar3 = (uint)pSVar6->g +
                    (uVar11 * ((((uVar16 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) <<
                               (pSVar8->Gloss & 0x1f)) - (uint)pSVar6->g) >> 8) & 0xff;
            uVar7 = (uint)pSVar6->b +
                    (uVar11 * ((((uVar16 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) <<
                               (pSVar8->Bloss & 0x1f)) - (uint)pSVar6->b) >> 8) & 0xff;
            uVar16 = (uint)pSVar6->r +
                     (uVar11 * ((((uVar16 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) <<
                                (pSVar8->Rloss & 0x1f)) - (uint)pSVar6->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar16 & 0xe0 | (byte)(uVar7 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar16 & 0xe0 | uVar7 >> 6];
            }
            iVar15 = iVar15 + -1;
            pbVar9 = pbVar9 + 1;
            puVar17 = (uint *)((int)puVar17 + uVar10);
            if (iVar15 < 1) goto LAB_0893a990;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar10 == 3) {
              bVar1 = *(byte *)((int)puVar17 + 1);
LAB_0893ae18:
              uVar16 = (uint)(byte)*puVar17 + (uint)bVar1 * 0x100 +
                       (uint)*(byte *)((int)puVar17 + 2) * 0x10000;
            }
            else {
LAB_0893aac8:
              if (uVar10 == 4) {
                uVar16 = *puVar17;
              }
              else if (uVar10 == 2) {
                uVar16 = (uint)(ushort)*puVar17;
              }
              else {
                uVar16 = 0;
              }
            }
            pSVar6 = pSVar14->palette->colors + *pbVar9;
            uVar3 = (uint)pSVar6->g +
                    (uVar11 * ((((uVar16 & pSVar8->Gmask) >> (pSVar8->Gshift & 0x1f)) <<
                               (pSVar8->Gloss & 0x1f)) - (uint)pSVar6->g) >> 8) & 0xff;
            uVar7 = (uint)pSVar6->b +
                    (uVar11 * ((((uVar16 & pSVar8->Bmask) >> (pSVar8->Bshift & 0x1f)) <<
                               (pSVar8->Bloss & 0x1f)) - (uint)pSVar6->b) >> 8) & 0xff;
            uVar16 = (uint)pSVar6->r +
                     (uVar11 * ((((uVar16 & pSVar8->Rmask) >> (pSVar8->Rshift & 0x1f)) <<
                                (pSVar8->Rloss & 0x1f)) - (uint)pSVar6->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar16 & 0xe0 | (byte)(uVar7 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar16 & 0xe0 | uVar7 >> 6];
            }
            puVar17 = (uint *)((int)puVar17 + uVar10);
            pbVar9 = pbVar9 + 1;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar10 == 3) break;
LAB_0893abc4:
            if (uVar10 == 4) {
              uVar16 = *puVar17;
            }
            else if (uVar10 == 2) {
              uVar16 = (uint)(ushort)*puVar17;
            }
            else {
              uVar16 = 0;
            }
          }
          bVar1 = *(byte *)((int)puVar17 + 1);
        } while( true );
      }
    }
LAB_0893a990:
    if (iVar2 + -1 == local_34) {
      return;
    }
    puVar17 = (uint *)((int)puVar17 + iVar4);
    local_34 = local_34 + 1;
    pbVar9 = pbVar9 + iVar5;
  } while( true );
}



----------------------------------------

// Function: BlitNto1PixelAlpha @ 0893af20

/* WARNING: Removing unreachable block (ram,0x0893af94) */

void BlitNto1PixelAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  SDL_Color *pSVar7;
  uint uVar8;
  byte *pbVar9;
  uint *puVar10;
  uint uVar11;
  Uint8 *pUVar12;
  uint uVar13;
  SDL_PixelFormat *pSVar14;
  int iVar15;
  SDL_PixelFormat *pSVar16;
  uint uVar17;
  int iVar18;
  int local_3c;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg24(t8)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???]
                       Unresolved local var: int srcbpp@[???] */
  iVar4 = info->s_skip;
  iVar2 = info->d_height;
  pSVar16 = info->src;
  iVar5 = info->d_skip;
  pSVar14 = info->dst;
  puVar10 = (uint *)info->s_pixels;
  pbVar9 = info->d_pixels;
  pUVar12 = info->table;
  uVar11 = (uint)pSVar16->BytesPerPixel;
  if (iVar2 == 0) {
    return;
  }
  iVar18 = (int)(info->d_width + 3U) / 4;
  uVar13 = info->d_width & 3;
                    /* Unresolved local var: int n@[???] */
  local_3c = 0;
  do {
    iVar15 = iVar18;
    if (uVar13 == 1) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
      if (uVar11 == 3) goto LAB_0893b46c;
      goto LAB_0893b00c;
    }
    if (uVar13 < 2) {
      if (uVar13 == 0) {
        if (uVar11 != 3) goto LAB_0893b128;
                    /* Unresolved local var: Uint8 * sB@[???] */
        bVar1 = *(byte *)((int)puVar10 + 1);
        goto LAB_0893b4c8;
      }
    }
    else {
      if (uVar13 == 2) {
        if (uVar11 != 3) goto LAB_0893b354;
                    /* Unresolved local var: Uint8 * sB@[???] */
        bVar1 = *(byte *)((int)puVar10 + 1);
        goto LAB_0893b498;
      }
      if (uVar13 == 3) {
        if (uVar11 != 3) goto LAB_0893b23c;
                    /* Unresolved local var: Uint8 * sB@[???] */
        bVar1 = *(byte *)((int)puVar10 + 1);
        do {
          uVar17 = (uint)(byte)*puVar10 + (uint)bVar1 * 0x100 +
                   (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
          while( true ) {
            pSVar7 = pSVar14->palette->colors + *pbVar9;
            iVar6 = ((uVar17 & pSVar16->Amask) >> (pSVar16->Ashift & 0x1f)) <<
                    (pSVar16->Aloss & 0x1f);
            uVar8 = (uint)pSVar7->b +
                    (iVar6 * ((((uVar17 & pSVar16->Bmask) >> (pSVar16->Bshift & 0x1f)) <<
                              (pSVar16->Bloss & 0x1f)) - (uint)pSVar7->b) >> 8) & 0xff;
            uVar3 = (uint)pSVar7->g +
                    (iVar6 * ((((uVar17 & pSVar16->Gmask) >> (pSVar16->Gshift & 0x1f)) <<
                              (pSVar16->Gloss & 0x1f)) - (uint)pSVar7->g) >> 8) & 0xff;
            uVar17 = (uint)pSVar7->r +
                     (iVar6 * ((((uVar17 & pSVar16->Rmask) >> (pSVar16->Rshift & 0x1f)) <<
                               (pSVar16->Rloss & 0x1f)) - (uint)pSVar7->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar17 & 0xe0 | (byte)(uVar8 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar17 & 0xe0 | uVar8 >> 6];
            }
            puVar10 = (uint *)((int)puVar10 + uVar11);
            pbVar9 = pbVar9 + 1;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar11 == 3) {
              bVar1 = *(byte *)((int)puVar10 + 1);
LAB_0893b498:
              uVar17 = (uint)(byte)*puVar10 + (uint)bVar1 * 0x100 +
                       (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            }
            else {
LAB_0893b354:
              if (uVar11 == 4) {
                uVar17 = *puVar10;
              }
              else if (uVar11 == 2) {
                uVar17 = (uint)(ushort)*puVar10;
              }
              else {
                uVar17 = 0;
              }
            }
            pSVar7 = pSVar14->palette->colors + *pbVar9;
            iVar6 = ((uVar17 & pSVar16->Amask) >> (pSVar16->Ashift & 0x1f)) <<
                    (pSVar16->Aloss & 0x1f);
            uVar8 = (uint)pSVar7->b +
                    (iVar6 * ((((uVar17 & pSVar16->Bmask) >> (pSVar16->Bshift & 0x1f)) <<
                              (pSVar16->Bloss & 0x1f)) - (uint)pSVar7->b) >> 8) & 0xff;
            uVar3 = (uint)pSVar7->g +
                    (iVar6 * ((((uVar17 & pSVar16->Gmask) >> (pSVar16->Gshift & 0x1f)) <<
                              (pSVar16->Gloss & 0x1f)) - (uint)pSVar7->g) >> 8) & 0xff;
            uVar17 = (uint)pSVar7->r +
                     (iVar6 * ((((uVar17 & pSVar16->Rmask) >> (pSVar16->Rshift & 0x1f)) <<
                               (pSVar16->Rloss & 0x1f)) - (uint)pSVar7->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar17 & 0xe0 | (byte)(uVar8 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar17 & 0xe0 | uVar8 >> 6];
            }
            puVar10 = (uint *)((int)puVar10 + uVar11);
            pbVar9 = pbVar9 + 1;
            if (uVar11 == 3) {
LAB_0893b46c:
                    /* Unresolved local var: Uint8 * sB@[???] */
              uVar17 = (uint)(byte)*puVar10 + (uint)*(byte *)((int)puVar10 + 1) * 0x100 +
                       (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            }
            else {
LAB_0893b00c:
              if (uVar11 == 4) {
                uVar17 = *puVar10;
              }
              else if (uVar11 == 2) {
                uVar17 = (uint)(ushort)*puVar10;
              }
              else {
                uVar17 = 0;
              }
            }
            pSVar7 = pSVar14->palette->colors + *pbVar9;
            iVar6 = ((uVar17 & pSVar16->Amask) >> (pSVar16->Ashift & 0x1f)) <<
                    (pSVar16->Aloss & 0x1f);
            uVar8 = (uint)pSVar7->b +
                    (iVar6 * ((((uVar17 & pSVar16->Bmask) >> (pSVar16->Bshift & 0x1f)) <<
                              (pSVar16->Bloss & 0x1f)) - (uint)pSVar7->b) >> 8) & 0xff;
            uVar3 = (uint)pSVar7->g +
                    (iVar6 * ((((uVar17 & pSVar16->Gmask) >> (pSVar16->Gshift & 0x1f)) <<
                              (pSVar16->Gloss & 0x1f)) - (uint)pSVar7->g) >> 8) & 0xff;
            uVar17 = (uint)pSVar7->r +
                     (iVar6 * ((((uVar17 & pSVar16->Rmask) >> (pSVar16->Rshift & 0x1f)) <<
                               (pSVar16->Rloss & 0x1f)) - (uint)pSVar7->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar17 & 0xe0 | (byte)(uVar8 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar17 & 0xe0 | uVar8 >> 6];
            }
            iVar15 = iVar15 + -1;
            pbVar9 = pbVar9 + 1;
            puVar10 = (uint *)((int)puVar10 + uVar11);
            if (iVar15 < 1) goto LAB_0893afd4;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar11 == 3) {
              bVar1 = *(byte *)((int)puVar10 + 1);
LAB_0893b4c8:
              uVar17 = (uint)(byte)*puVar10 + (uint)bVar1 * 0x100 +
                       (uint)*(byte *)((int)puVar10 + 2) * 0x10000;
            }
            else {
LAB_0893b128:
              if (uVar11 == 4) {
                uVar17 = *puVar10;
              }
              else if (uVar11 == 2) {
                uVar17 = (uint)(ushort)*puVar10;
              }
              else {
                uVar17 = 0;
              }
            }
            pSVar7 = pSVar14->palette->colors + *pbVar9;
            iVar6 = ((uVar17 & pSVar16->Amask) >> (pSVar16->Ashift & 0x1f)) <<
                    (pSVar16->Aloss & 0x1f);
            uVar8 = (uint)pSVar7->b +
                    (iVar6 * ((((uVar17 & pSVar16->Bmask) >> (pSVar16->Bshift & 0x1f)) <<
                              (pSVar16->Bloss & 0x1f)) - (uint)pSVar7->b) >> 8) & 0xff;
            uVar3 = (uint)pSVar7->g +
                    (iVar6 * ((((uVar17 & pSVar16->Gmask) >> (pSVar16->Gshift & 0x1f)) <<
                              (pSVar16->Gloss & 0x1f)) - (uint)pSVar7->g) >> 8) & 0xff;
            uVar17 = (uint)pSVar7->r +
                     (iVar6 * ((((uVar17 & pSVar16->Rmask) >> (pSVar16->Rshift & 0x1f)) <<
                               (pSVar16->Rloss & 0x1f)) - (uint)pSVar7->r) >> 8);
            if (pUVar12 == (Uint8 *)0x0) {
              *pbVar9 = (byte)((uVar3 >> 5) << 2) | (byte)uVar17 & 0xe0 | (byte)(uVar8 >> 6);
            }
            else {
              *pbVar9 = pUVar12[(uVar3 >> 5) << 2 | uVar17 & 0xe0 | uVar8 >> 6];
            }
            puVar10 = (uint *)((int)puVar10 + uVar11);
            pbVar9 = pbVar9 + 1;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar11 == 3) break;
LAB_0893b23c:
            if (uVar11 == 4) {
              uVar17 = *puVar10;
            }
            else if (uVar11 == 2) {
              uVar17 = (uint)(ushort)*puVar10;
            }
            else {
              uVar17 = 0;
            }
          }
          bVar1 = *(byte *)((int)puVar10 + 1);
        } while( true );
      }
    }
LAB_0893afd4:
    if (local_3c == iVar2 + -1) {
      return;
    }
    pbVar9 = pbVar9 + iVar5;
    local_3c = local_3c + 1;
    puVar10 = (uint *)((int)puVar10 + iVar4);
  } while( true );
}



----------------------------------------

// Function: BlitNto1SurfaceAlphaKey @ 0893b5d8

/* WARNING: Removing unreachable block (ram,0x0893b654) */

void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info)

{
  int iVar1;
  SDL_Color *pSVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  SDL_PixelFormat *pSVar9;
  byte *pbVar10;
  uint *puVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  Uint8 *pUVar19;
  Uint32 UVar20;
  int iVar21;
  int iVar22;
  SDL_PixelFormat *pSVar23;
  uint uVar24;
  uint uVar25;
  int iVar26;
  int iVar27;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg11(t3)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg10(t2)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint8 * palmap@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg9(t1)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[???]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: int A@[???] */
  iVar3 = info->s_skip;
  iVar1 = info->d_height;
  pSVar9 = info->src;
  iVar4 = info->d_skip;
  pSVar23 = info->dst;
  uVar5 = info->d_width;
  uVar13 = (uint)pSVar9->BytesPerPixel;
  uVar18 = (uint)pSVar9->alpha;
  puVar11 = (uint *)info->s_pixels;
  pbVar10 = info->d_pixels;
  pUVar19 = info->table;
  UVar20 = pSVar9->colorkey;
  if (iVar1 != 0) {
    iVar27 = (int)(uVar5 + 7) / 8;
    iVar26 = 0;
    while( true ) {
                    /* Unresolved local var: int n@[???] */
      iVar21 = iVar27;
      switch(uVar5 & 7) {
      case 0:
        do {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          if (uVar13 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else if (uVar13 == 4) {
            uVar8 = *puVar11;
          }
          else if (uVar13 == 2) {
            uVar8 = (uint)(ushort)*puVar11;
          }
          else {
            uVar8 = 0;
          }
          uVar17 = pSVar9->Rmask;
          uVar25 = (uint)pSVar9->Rshift;
          uVar16 = (uint)pSVar9->Rloss;
          uVar7 = pSVar9->Gmask;
          uVar15 = (uint)pSVar9->Gshift;
          uVar24 = (uint)pSVar9->Gloss;
          uVar6 = pSVar9->Bmask;
          uVar12 = (uint)pSVar9->Bshift;
          uVar14 = (uint)pSVar9->Bloss;
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
LAB_0893bc1c:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          if (uVar13 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else if (uVar13 == 4) {
            uVar8 = *puVar11;
          }
          else if (uVar13 == 2) {
            uVar8 = (uint)(ushort)*puVar11;
          }
          else {
            uVar8 = 0;
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
LAB_0893be38:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          if (uVar13 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else if (uVar13 == 4) {
            uVar8 = *puVar11;
          }
          else if (uVar13 == 2) {
            uVar8 = (uint)(ushort)*puVar11;
          }
          else {
            uVar8 = 0;
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          if (uVar13 == 3) {
LAB_0893bf40:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else {
LAB_0893c094:
            if (uVar13 == 4) {
              uVar8 = *puVar11;
            }
            else if (uVar13 == 2) {
              uVar8 = (uint)(ushort)*puVar11;
            }
            else {
              uVar8 = 0;
            }
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          if (uVar13 == 3) {
LAB_0893c044:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else {
LAB_0893b6cc:
            if (uVar13 == 4) {
              uVar8 = *puVar11;
            }
            else if (uVar13 == 2) {
              uVar8 = (uint)(ushort)*puVar11;
            }
            else {
              uVar8 = 0;
            }
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          if (uVar13 == 3) {
LAB_0893bd50:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else {
LAB_0893b7cc:
            if (uVar13 == 4) {
              uVar8 = *puVar11;
            }
            else if (uVar13 == 2) {
              uVar8 = (uint)(ushort)*puVar11;
            }
            else {
              uVar8 = 0;
            }
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          if (uVar13 == 3) {
LAB_0893bda0:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else {
LAB_0893b8cc:
            if (uVar13 == 4) {
              uVar8 = *puVar11;
            }
            else if (uVar13 == 2) {
              uVar8 = (uint)(ushort)*puVar11;
            }
            else {
              uVar8 = 0;
            }
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
            uVar17 = pSVar9->Rmask;
            uVar25 = (uint)pSVar9->Rshift;
            uVar16 = (uint)pSVar9->Rloss;
            uVar7 = pSVar9->Gmask;
            uVar15 = (uint)pSVar9->Gshift;
            uVar24 = (uint)pSVar9->Gloss;
            uVar6 = pSVar9->Bmask;
            uVar12 = (uint)pSVar9->Bshift;
            uVar14 = (uint)pSVar9->Bloss;
          }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          iVar22 = iVar21;
          if (uVar13 == 3) {
LAB_0893bdf0:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar8 = (uint)(byte)*puVar11 + (uint)*(byte *)((int)puVar11 + 1) * 0x100 +
                    (uint)*(byte *)((int)puVar11 + 2) * 0x10000;
          }
          else {
LAB_0893b9cc:
            if (uVar13 == 4) {
              uVar8 = *puVar11;
            }
            else if (uVar13 == 2) {
              uVar8 = (uint)(ushort)*puVar11;
            }
            else {
              uVar8 = 0;
            }
          }
          if (uVar8 != UVar20) {
            pSVar2 = pSVar23->palette->colors + *pbVar10;
            uVar7 = (uint)pSVar2->g +
                    (uVar18 * ((((uVar8 & uVar7) >> (uVar15 & 0x1f)) << (uVar24 & 0x1f)) -
                              (uint)pSVar2->g) >> 8) & 0xff;
            uVar12 = (uint)pSVar2->b +
                     (uVar18 * ((((uVar8 & uVar6) >> (uVar12 & 0x1f)) << (uVar14 & 0x1f)) -
                               (uint)pSVar2->b) >> 8) & 0xff;
            uVar6 = (uint)pSVar2->r +
                    (((((uVar8 & uVar17) >> (uVar25 & 0x1f)) << (uVar16 & 0x1f)) - (uint)pSVar2->r)
                     * uVar18 >> 8);
            if (pUVar19 == (Uint8 *)0x0) {
              *pbVar10 = (byte)((uVar7 >> 5) << 2) | (byte)uVar6 & 0xe0 | (byte)(uVar12 >> 6);
            }
            else {
              *pbVar10 = pUVar19[(uVar7 >> 5) << 2 | uVar6 & 0xe0 | uVar12 >> 6];
            }
          }
          pbVar10 = pbVar10 + 1;
          puVar11 = (uint *)((int)puVar11 + uVar13);
          iVar21 = iVar22 + -1;
        } while (0 < iVar22 + -1);
        break;
      case 1:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        iVar22 = iVar27;
        if (uVar13 != 3) goto LAB_0893b9cc;
        goto LAB_0893bdf0;
      case 2:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        if (uVar13 != 3) goto LAB_0893b8cc;
        goto LAB_0893bda0;
      case 3:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        if (uVar13 != 3) goto LAB_0893b7cc;
        goto LAB_0893bd50;
      case 4:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        if (uVar13 == 3) goto LAB_0893c044;
        goto LAB_0893b6cc;
      case 5:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        if (uVar13 == 3) goto LAB_0893bf40;
        goto LAB_0893c094;
      case 6:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        goto LAB_0893be38;
      case 7:
        uVar17 = pSVar9->Rmask;
        uVar25 = (uint)pSVar9->Rshift;
        uVar16 = (uint)pSVar9->Rloss;
        uVar7 = pSVar9->Gmask;
        uVar15 = (uint)pSVar9->Gshift;
        uVar24 = (uint)pSVar9->Gloss;
        uVar6 = pSVar9->Bmask;
        uVar12 = (uint)pSVar9->Bshift;
        uVar14 = (uint)pSVar9->Bloss;
        goto LAB_0893bc1c;
      }
      if (iVar1 + -1 == iVar26) break;
      iVar26 = iVar26 + 1;
      puVar11 = (uint *)((int)puVar11 + iVar3);
      pbVar10 = pbVar10 + iVar4;
    }
  }
  return;
}



----------------------------------------

// Function: BlitRGBtoRGBSurfaceAlpha @ 0893c27c

/* WARNING: Removing unreachable block (ram,0x0893c544) */

void BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  uint *puVar3;
  int iVar4;
  uint uVar5;
  uint *puVar6;
  uint uVar7;
  uint uVar8;
  uint *puVar9;
  int iVar10;
  uint uVar11;
  int iVar12;
  uint uVar13;
  int iVar14;
  
                    /* Unresolved local var: uint alpha@[???] */
  uVar11 = (uint)info->src->alpha;
  if (uVar11 == 0x80) {
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * srcp@[DW_OP_reg7(a3)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint32 * dstp@[DW_OP_reg6(a2)]
                       Unresolved local var: int dstskip@[???] */
    iVar1 = info->d_skip;
    iVar2 = info->s_skip;
    iVar4 = info->d_height;
    puVar3 = (uint *)info->s_pixels;
    puVar6 = (uint *)info->d_pixels;
    if (iVar4 != 0) {
      iVar12 = (int)(info->d_width + 3U) / 4;
      uVar11 = info->d_width & 3;
      iVar14 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[DW_OP_reg9(t1)] */
        iVar10 = iVar12;
        if (uVar11 == 1) goto LAB_0893c60c;
        if (uVar11 < 2) {
          if (uVar11 == 0) {
            uVar13 = *puVar3;
            goto LAB_0893c64c;
          }
        }
        else {
          if (uVar11 == 2) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
            *puVar6 = ((*puVar3 & 0xfefefe) + (*puVar6 & 0xfefefe) >> 1) +
                      (*puVar6 & *puVar3 & 0x10101) | 0xff000000;
            puVar3 = puVar3 + 1;
            puVar6 = puVar6 + 1;
            goto LAB_0893c60c;
          }
          if (uVar11 == 3) {
            while( true ) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
              puVar9 = puVar3 + 1;
              *puVar6 = ((*puVar3 & 0xfefefe) + (*puVar6 & 0xfefefe) >> 1) +
                        (*puVar6 & *puVar3 & 0x10101) | 0xff000000;
              uVar13 = puVar6[1];
              puVar3 = puVar3 + 2;
              puVar6[1] = ((*puVar9 & 0xfefefe) + (uVar13 & 0xfefefe) >> 1) +
                          (uVar13 & *puVar9 & 0x10101) | 0xff000000;
              puVar6 = puVar6 + 2;
LAB_0893c60c:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
              *puVar6 = ((*puVar3 & 0xfefefe) + (*puVar6 & 0xfefefe) >> 1) +
                        (*puVar6 & *puVar3 & 0x10101) | 0xff000000;
              puVar3 = puVar3 + 1;
              puVar6 = puVar6 + 1;
              if (iVar10 + -1 < 1) break;
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
              uVar13 = *puVar3;
              iVar10 = iVar10 + -1;
LAB_0893c64c:
              puVar3 = puVar3 + 1;
              *puVar6 = ((uVar13 & 0xfefefe) + (*puVar6 & 0xfefefe) >> 1) +
                        (*puVar6 & uVar13 & 0x10101) | 0xff000000;
              puVar6 = puVar6 + 1;
            }
          }
        }
        puVar3 = puVar3 + (iVar2 >> 2);
        if (iVar4 + -1 == iVar14) break;
        puVar6 = puVar6 + (iVar1 >> 2);
        iVar14 = iVar14 + 1;
      }
      return;
    }
  }
  else {
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * srcp@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint32 * dstp@[???]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???] */
    iVar2 = info->s_skip;
    iVar1 = info->d_skip;
    iVar4 = info->d_height;
    uVar13 = info->d_width;
    puVar3 = (uint *)info->s_pixels;
    puVar6 = (uint *)info->d_pixels;
    if (iVar4 != 0) {
      iVar14 = 0;
      while( true ) {
                    /* Unresolved local var: int n@[???]
                       Unresolved local var: int w@[???] */
        uVar8 = uVar13;
        if ((uVar13 & 1) != 0) {
          uVar8 = *puVar3;
          puVar3 = puVar3 + 1;
          uVar7 = *puVar6 & 0xff00ff;
          uVar5 = *puVar6 & 0xff00;
          *puVar6 = uVar5 + (uVar11 * ((uVar8 & 0xff00) - uVar5) >> 8) & 0xff00 |
                    uVar7 + (uVar11 * ((uVar8 & 0xff00ff) - uVar7) >> 8) & 0xff00ff | 0xff000000;
          puVar6 = puVar6 + 1;
          uVar8 = uVar13 - 1;
        }
        if (0 < (int)uVar8) {
          iVar12 = (int)(uVar8 + 2) >> 2;
          if ((uVar8 & 2) == 0) goto LAB_0893c38c;
          if ((uVar8 & 2) != 0) {
            uVar8 = puVar6[1];
            puVar9 = puVar6;
            while( true ) {
              uVar7 = (*puVar9 & 0xffff) >> 8 | (uVar8 & 0xff00) << 8;
              uVar5 = *puVar9 & 0xff00ff;
              iVar12 = iVar12 + -1;
              uVar7 = uVar7 + (uVar11 * (((*puVar3 & 0xffff) >> 8 | (puVar3[1] & 0xff00) << 8) -
                                        uVar7) >> 8);
              *puVar9 = (uVar7 & 0xff) << 8 |
                        uVar5 + (uVar11 * ((*puVar3 & 0xff00ff) - uVar5) >> 8) & 0xff00ff |
                        0xff000000;
              puVar6 = puVar3 + 1;
              puVar3 = puVar3 + 2;
              puVar9[1] = (uVar7 & 0xff00ff) >> 8 |
                          (uVar8 & 0xff00ff) +
                          (uVar11 * ((*puVar6 & 0xff00ff) - (uVar8 & 0xff00ff)) >> 8) & 0xff00ff |
                          0xff000000;
              puVar6 = puVar9 + 2;
              if (iVar12 < 1) break;
LAB_0893c38c:
              uVar5 = (*puVar6 & 0xffff) >> 8 | (puVar6[1] & 0xff00) << 8;
              uVar8 = *puVar6 & 0xff00ff;
              uVar7 = puVar6[1] & 0xff00ff;
              uVar5 = uVar5 + (uVar11 * (((*puVar3 & 0xffff) >> 8 | (puVar3[1] & 0xff00) << 8) -
                                        uVar5) >> 8);
              *puVar6 = (uVar5 & 0xff) << 8 |
                        uVar8 + (uVar11 * ((*puVar3 & 0xff00ff) - uVar8) >> 8) & 0xff00ff |
                        0xff000000;
              puVar9 = puVar3 + 1;
              puVar3 = puVar3 + 2;
              puVar6[1] = (uVar5 & 0xff00ff) >> 8 |
                          uVar7 + (uVar11 * ((*puVar9 & 0xff00ff) - uVar7) >> 8) & 0xff00ff |
                          0xff000000;
              puVar9 = puVar6 + 2;
              uVar8 = puVar6[3];
            }
          }
        }
        puVar3 = puVar3 + (iVar2 >> 2);
        if (iVar4 + -1 == iVar14) break;
        puVar6 = puVar6 + (iVar1 >> 2);
        iVar14 = iVar14 + 1;
      }
    }
  }
  return;
}



----------------------------------------

// Function: BlitRGBtoRGBPixelAlpha @ 0893c6f8

/* WARNING: Removing unreachable block (ram,0x0893c740) */

void BlitRGBtoRGBPixelAlpha(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  uint *puVar6;
  uint uVar7;
  uint *puVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * srcp@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint32 * dstp@[DW_OP_reg8(t0)]
                       Unresolved local var: int dstskip@[???] */
  iVar1 = info->d_skip;
  iVar4 = info->d_height;
  iVar2 = info->s_skip;
  puVar8 = (uint *)info->s_pixels;
  puVar6 = (uint *)info->d_pixels;
  if (iVar4 == 0) {
    return;
  }
  iVar12 = (int)(info->d_width + 3U) / 4;
  uVar10 = info->d_width & 3;
                    /* Unresolved local var: int n@[DW_OP_reg10(t2)] */
  iVar11 = 0;
  iVar9 = iVar12;
  if (uVar10 == 1) goto LAB_0893c7b4;
  do {
    if (uVar10 < 2) {
      if (uVar10 == 0) {
        uVar3 = *puVar8;
        iVar9 = iVar12;
        goto LAB_0893c830;
      }
    }
    else {
      iVar9 = iVar12;
      if (uVar10 == 2) goto LAB_0893c90c;
      if (uVar10 == 3) goto LAB_0893c89c;
    }
    while( true ) {
      if (iVar11 == iVar4 + -1) {
        return;
      }
      puVar8 = puVar8 + (iVar2 >> 2);
      puVar6 = puVar6 + (iVar1 >> 2);
      iVar11 = iVar11 + 1;
      iVar9 = iVar12;
      if (uVar10 != 1) break;
LAB_0893c7b4:
      while( true ) {
                    /* Unresolved local var: Uint32 dalpha@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 alpha@[???] */
        uVar3 = *puVar8;
        uVar7 = uVar3 >> 0x18;
        if (uVar7 != 0) {
          if (uVar7 == 0xff) {
            *puVar6 = uVar3 & 0xffffff | *puVar6 & 0xff000000;
          }
          else {
            uVar5 = *puVar6;
            *puVar6 = (uVar5 & 0xff00) + (uVar7 * ((uVar3 & 0xff00) - (uVar5 & 0xff00)) >> 8) &
                      0xff00 | uVar5 & 0xff000000 |
                               (uVar5 & 0xff00ff) +
                               (uVar7 * ((uVar3 & 0xff00ff) - (uVar5 & 0xff00ff)) >> 8) & 0xff00ff;
          }
        }
        puVar8 = puVar8 + 1;
        puVar6 = puVar6 + 1;
        if (iVar9 + -1 < 1) break;
                    /* Unresolved local var: Uint32 dalpha@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 alpha@[???] */
        uVar3 = *puVar8;
        iVar9 = iVar9 + -1;
LAB_0893c830:
        uVar7 = uVar3 >> 0x18;
        if (uVar7 != 0) {
          if (uVar7 == 0xff) {
            *puVar6 = uVar3 & 0xffffff | *puVar6 & 0xff000000;
          }
          else {
            uVar5 = *puVar6;
            *puVar6 = (uVar5 & 0xff00) + (uVar7 * ((uVar3 & 0xff00) - (uVar5 & 0xff00)) >> 8) &
                      0xff00 | uVar5 & 0xff000000 |
                               (uVar5 & 0xff00ff) +
                               (uVar7 * ((uVar3 & 0xff00ff) - (uVar5 & 0xff00ff)) >> 8) & 0xff00ff;
          }
        }
        puVar8 = puVar8 + 1;
        puVar6 = puVar6 + 1;
LAB_0893c89c:
                    /* Unresolved local var: Uint32 dalpha@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 alpha@[???] */
        uVar3 = *puVar8;
        uVar7 = uVar3 >> 0x18;
        if (uVar7 != 0) {
          if (uVar7 == 0xff) {
            *puVar6 = uVar3 & 0xffffff | *puVar6 & 0xff000000;
          }
          else {
            uVar5 = *puVar6;
            *puVar6 = (uVar5 & 0xff00) + (uVar7 * ((uVar3 & 0xff00) - (uVar5 & 0xff00)) >> 8) &
                      0xff00 | uVar5 & 0xff000000 |
                               (uVar5 & 0xff00ff) +
                               (uVar7 * ((uVar3 & 0xff00ff) - (uVar5 & 0xff00ff)) >> 8) & 0xff00ff;
          }
        }
        puVar8 = puVar8 + 1;
        puVar6 = puVar6 + 1;
LAB_0893c90c:
                    /* Unresolved local var: Uint32 dalpha@[???]
                       Unresolved local var: Uint32 d@[???]
                       Unresolved local var: Uint32 s1@[???]
                       Unresolved local var: Uint32 d1@[???]
                       Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 alpha@[???] */
        uVar3 = *puVar8;
        uVar7 = uVar3 >> 0x18;
        if (uVar7 == 0) {
LAB_0893c978:
          puVar8 = puVar8 + 1;
          puVar6 = puVar6 + 1;
        }
        else {
          if (uVar7 != 0xff) {
            uVar5 = *puVar6;
            *puVar6 = (uVar5 & 0xff00) + (uVar7 * ((uVar3 & 0xff00) - (uVar5 & 0xff00)) >> 8) &
                      0xff00 | uVar5 & 0xff000000 |
                               (uVar5 & 0xff00ff) +
                               (uVar7 * ((uVar3 & 0xff00ff) - (uVar5 & 0xff00ff)) >> 8) & 0xff00ff;
            goto LAB_0893c978;
          }
          puVar8 = puVar8 + 1;
          *puVar6 = uVar3 & 0xffffff | *puVar6 & 0xff000000;
          puVar6 = puVar6 + 1;
        }
      }
    }
  } while( true );
}



----------------------------------------

// Function: Blit16to16SurfaceAlpha128 @ 0893ca14

void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info,Uint16 mask)

{
  ushort uVar1;
  uint uVar2;
  uint *puVar3;
  uint uVar4;
  uint *puVar5;
  uint *puVar6;
  int iVar7;
  uint uVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[DW_OP_reg25(t9)]
                       Unresolved local var: int height@[DW_OP_reg15(t7)]
                       Unresolved local var: Uint16 * srcp@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg8(t0)]
                       Unresolved local var: int dstskip@[???] */
                    /* Unresolved local var: int w@[???] */
  iVar12 = info->d_width;
  iVar9 = info->d_height;
  puVar3 = (uint *)info->s_pixels;
  puVar5 = (uint *)info->d_pixels;
  uVar8 = CONCAT22(mask,mask);
  iVar10 = (info->s_skip >> 1) * 2;
  iVar11 = (info->d_skip >> 1) * 2;
  uVar1 = ~mask;
  do {
    iVar9 = iVar9 + -1;
    if (iVar9 == -1) {
      return;
    }
    while ((((uint)puVar3 ^ (uint)puVar5) & 2) != 0) {
                    /* Unresolved local var: Uint32 prev_sw@[???]
                       Unresolved local var: int w@[DW_OP_reg10(t2)] */
      iVar7 = iVar12;
      if (((uint)puVar5 & 2) != 0) {
                    /* Unresolved local var: Uint16 d@[???]
                       Unresolved local var: Uint16 s@[???] */
        *(ushort *)puVar5 =
             (short)((int)((uint)(mask & (ushort)*puVar3) + (uint)(mask & (ushort)*puVar5)) >> 1) +
             ((ushort)*puVar5 & (ushort)*puVar3 & uVar1);
        puVar3 = (uint *)((int)puVar3 + 2);
        puVar5 = (uint *)((int)puVar5 + 2);
        iVar7 = iVar12 + -1;
      }
      puVar6 = (uint *)((int)puVar3 + 2);
      uVar4 = *(uint *)((int)puVar3 + -2);
      if (1 < iVar7) {
        uVar2 = uVar4;
        do {
                    /* Unresolved local var: Uint32 sw@[???]
                       Unresolved local var: Uint32 dw@[???]
                       Unresolved local var: Uint32 s@[???] */
          uVar4 = *puVar6;
          uVar2 = (uVar2 >> 0x10) + uVar4 * 0x10000;
          iVar7 = iVar7 + -2;
          *puVar5 = ((uVar8 & uVar2) >> 1) + ((uVar8 & *puVar5) >> 1) + (uVar2 & ~uVar8 & *puVar5);
          puVar6 = puVar6 + 1;
          puVar5 = puVar5 + 1;
          uVar2 = uVar4;
        } while (1 < iVar7);
      }
      if (iVar7 != 0) {
                    /* Unresolved local var: Uint16 d@[???]
                       Unresolved local var: Uint16 s@[???] */
        *(ushort *)puVar5 =
             (short)((int)(((uint)mask & uVar4 >> 0x10) + (uint)(mask & (ushort)*puVar5)) >> 1) +
             ((ushort)*puVar5 & (ushort)(uVar4 >> 0x10) & uVar1);
        puVar6 = (uint *)((int)puVar6 + 2);
        puVar5 = (uint *)((int)puVar5 + 2);
      }
      puVar3 = (uint *)((int)puVar6 + iVar10 + -2);
      iVar9 = iVar9 + -1;
      puVar5 = (uint *)((int)puVar5 + iVar11);
      if (iVar9 == -1) {
        return;
      }
    }
    iVar7 = iVar12;
    if (((uint)puVar3 & 2) != 0) {
                    /* Unresolved local var: Uint16 d@[???]
                       Unresolved local var: Uint16 s@[???] */
      *(ushort *)puVar5 =
           (short)((int)((uint)(mask & (ushort)*puVar3) + (uint)(mask & (ushort)*puVar5)) >> 1) +
           ((ushort)*puVar5 & (ushort)*puVar3 & uVar1);
      puVar3 = (uint *)((int)puVar3 + 2);
      puVar5 = (uint *)((int)puVar5 + 2);
      iVar7 = iVar12 + -1;
    }
    if (1 < iVar7) {
      do {
                    /* Unresolved local var: Uint32 sw@[???]
                       Unresolved local var: Uint32 dw@[???] */
        iVar7 = iVar7 + -2;
        *puVar5 = ((*puVar3 & uVar8) >> 1) + ((*puVar5 & uVar8) >> 1) + (*puVar5 & ~uVar8 & *puVar3)
        ;
        puVar3 = puVar3 + 1;
        puVar5 = puVar5 + 1;
      } while (1 < iVar7);
    }
    if (iVar7 != 0) {
                    /* Unresolved local var: Uint16 d@[???]
                       Unresolved local var: Uint16 s@[???] */
      uVar4 = *puVar3;
      puVar3 = (uint *)((int)puVar3 + 2);
      *(ushort *)puVar5 =
           (short)((int)((uint)((ushort)uVar4 & mask) + (uint)((ushort)*puVar5 & mask)) >> 1) +
           ((ushort)*puVar5 & (ushort)uVar4 & uVar1);
      puVar5 = (uint *)((int)puVar5 + 2);
    }
    puVar3 = (uint *)((int)puVar3 + iVar10);
    puVar5 = (uint *)((int)puVar5 + iVar11);
  } while( true );
}



----------------------------------------

// Function: Blit565to565SurfaceAlpha @ 0893cc58

/* WARNING: Removing unreachable block (ram,0x0893ccb8) */

void Blit565to565SurfaceAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  undefined2 uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  ushort *puVar7;
  Uint8 *pUVar8;
  int iVar9;
  int iVar10;
  uint uVar11;
  uint uVar12;
  int iVar13;
  int iVar14;
  
                    /* Unresolved local var: uint alpha@[???] */
  bVar1 = info->src->alpha;
  if (bVar1 == 0x80) {
    Blit16to16SurfaceAlpha128(info,0xf7de);
    return;
  }
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint16 * srcp@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar3 = info->d_skip;
  iVar4 = info->s_skip;
  iVar6 = info->d_height;
  uVar12 = (uint)(bVar1 >> 3);
  pUVar8 = info->s_pixels;
  puVar7 = (ushort *)info->d_pixels;
  if (iVar6 == 0) {
    return;
  }
  iVar14 = (int)(info->d_width + 3U) / 4;
  uVar11 = info->d_width & 3;
  iVar13 = 0;
                    /* Unresolved local var: int n@[???] */
  iVar10 = iVar14;
  if (uVar11 == 1) goto LAB_0893ce08;
LAB_0893ccf0:
  iVar9 = iVar14;
  if (uVar11 < 2) {
    if (uVar11 != 0) goto LAB_0893cd08;
    goto LAB_0893cd24;
  }
  if (uVar11 == 2) goto LAB_0893cdbc;
  if (uVar11 != 3) goto LAB_0893cd08;
  uVar2 = *(undefined2 *)pUVar8;
  do {
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x7e0f81f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x7e0f81f) - uVar5) >> 5) & 0x7e0f81f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
LAB_0893cdbc:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x7e0f81f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x7e0f81f) - uVar5) >> 5) & 0x7e0f81f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
    iVar10 = iVar9;
LAB_0893ce08:
    while( true ) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
      uVar2 = *(undefined2 *)pUVar8;
      uVar5 = CONCAT22(*puVar7,*puVar7) & 0x7e0f81f;
      pUVar8 = pUVar8 + 2;
      uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x7e0f81f) - uVar5) >> 5) & 0x7e0f81f;
      *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
      puVar7 = puVar7 + 1;
      iVar9 = iVar10 + -1;
      if (0 < iVar10 + -1) break;
LAB_0893cd08:
      pUVar8 = pUVar8 + (iVar4 >> 1) * 2;
      if (iVar13 == iVar6 + -1) {
        return;
      }
      puVar7 = puVar7 + (iVar3 >> 1);
      iVar13 = iVar13 + 1;
      iVar10 = iVar14;
      if (uVar11 != 1) goto LAB_0893ccf0;
    }
LAB_0893cd24:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x7e0f81f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x7e0f81f) - uVar5) >> 5) & 0x7e0f81f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
  } while( true );
}



----------------------------------------

// Function: Blit555to555SurfaceAlpha @ 0893cea0

/* WARNING: Removing unreachable block (ram,0x0893cf00) */

void Blit555to555SurfaceAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  undefined2 uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  ushort *puVar7;
  Uint8 *pUVar8;
  int iVar9;
  int iVar10;
  uint uVar11;
  uint uVar12;
  int iVar13;
  int iVar14;
  
                    /* Unresolved local var: uint alpha@[???] */
  bVar1 = info->src->alpha;
  if (bVar1 == 0x80) {
    Blit16to16SurfaceAlpha128(info,0xfbde);
    return;
  }
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint16 * srcp@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[???]
                       Unresolved local var: int dstskip@[???] */
  iVar3 = info->d_skip;
  iVar4 = info->s_skip;
  iVar6 = info->d_height;
  uVar12 = (uint)(bVar1 >> 3);
  pUVar8 = info->s_pixels;
  puVar7 = (ushort *)info->d_pixels;
  if (iVar6 == 0) {
    return;
  }
  iVar14 = (int)(info->d_width + 3U) / 4;
  uVar11 = info->d_width & 3;
  iVar13 = 0;
                    /* Unresolved local var: int n@[???] */
  iVar10 = iVar14;
  if (uVar11 == 1) goto LAB_0893d050;
LAB_0893cf38:
  iVar9 = iVar14;
  if (uVar11 < 2) {
    if (uVar11 != 0) goto LAB_0893cf50;
    goto LAB_0893cf6c;
  }
  if (uVar11 == 2) goto LAB_0893d004;
  if (uVar11 != 3) goto LAB_0893cf50;
  uVar2 = *(undefined2 *)pUVar8;
  do {
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x3e07c1f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x3e07c1f) - uVar5) >> 5) & 0x3e07c1f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
LAB_0893d004:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x3e07c1f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x3e07c1f) - uVar5) >> 5) & 0x3e07c1f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
    iVar10 = iVar9;
LAB_0893d050:
    while( true ) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
      uVar2 = *(undefined2 *)pUVar8;
      uVar5 = CONCAT22(*puVar7,*puVar7) & 0x3e07c1f;
      pUVar8 = pUVar8 + 2;
      uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x3e07c1f) - uVar5) >> 5) & 0x3e07c1f;
      *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
      puVar7 = puVar7 + 1;
      iVar9 = iVar10 + -1;
      if (0 < iVar10 + -1) break;
LAB_0893cf50:
      pUVar8 = pUVar8 + (iVar4 >> 1) * 2;
      if (iVar13 == iVar6 + -1) {
        return;
      }
      puVar7 = puVar7 + (iVar3 >> 1);
      iVar13 = iVar13 + 1;
      iVar10 = iVar14;
      if (uVar11 != 1) goto LAB_0893cf38;
    }
LAB_0893cf6c:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
    pUVar8 = pUVar8 + 2;
    uVar5 = CONCAT22(*puVar7,*puVar7) & 0x3e07c1f;
    uVar5 = uVar5 + (uVar12 * ((CONCAT22(uVar2,uVar2) & 0x3e07c1f) - uVar5) >> 5) & 0x3e07c1f;
    *puVar7 = (ushort)(uVar5 >> 0x10) | (ushort)uVar5;
    puVar7 = puVar7 + 1;
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: Uint32 d@[???] */
    uVar2 = *(undefined2 *)pUVar8;
  } while( true );
}



----------------------------------------

// Function: BlitARGBto565PixelAlpha @ 0893d0e8

/* WARNING: Removing unreachable block (ram,0x0893d12c) */

void BlitARGBto565PixelAlpha(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  ushort *puVar4;
  int iVar5;
  uint uVar6;
  uint *puVar7;
  uint uVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * srcp@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg8(t0)]
                       Unresolved local var: int dstskip@[???] */
  iVar1 = info->d_skip;
  iVar5 = info->d_height;
  iVar2 = info->s_skip;
  puVar7 = (uint *)info->s_pixels;
  puVar4 = (ushort *)info->d_pixels;
  if (iVar5 == 0) {
    return;
  }
  iVar12 = (int)(info->d_width + 3U) / 4;
  uVar10 = info->d_width & 3;
                    /* Unresolved local var: int n@[DW_OP_reg10(t2)] */
  iVar11 = 0;
  iVar9 = iVar12;
  if (uVar10 == 1) goto LAB_0893d19c;
  do {
    if (uVar10 < 2) {
      if (uVar10 == 0) {
        uVar6 = *puVar7;
        iVar9 = iVar12;
        goto LAB_0893d214;
      }
    }
    else {
      iVar9 = iVar12;
      if (uVar10 == 2) goto LAB_0893d2e8;
      if (uVar10 == 3) goto LAB_0893d27c;
    }
    while( true ) {
      if (iVar11 == iVar5 + -1) {
        return;
      }
      puVar7 = puVar7 + (iVar2 >> 2);
      puVar4 = puVar4 + (iVar1 >> 1);
      iVar11 = iVar11 + 1;
      iVar9 = iVar12;
      if (uVar10 != 1) break;
LAB_0893d19c:
      while( true ) {
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: uint alpha@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 8) & 0xf800) + ((ushort)(uVar6 >> 5) & 0x7e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x7e0f81f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xfc00) * 0x800 + (uVar6 >> 8 & 0xf800) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x7e0f81f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
        if (iVar9 + -1 < 1) break;
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: uint alpha@[???] */
        uVar6 = *puVar7;
        iVar9 = iVar9 + -1;
LAB_0893d214:
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 8) & 0xf800) + ((ushort)(uVar6 >> 5) & 0x7e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x7e0f81f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xfc00) * 0x800 + (uVar6 >> 8 & 0xf800) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x7e0f81f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
LAB_0893d27c:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: uint alpha@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 8) & 0xf800) + ((ushort)(uVar6 >> 5) & 0x7e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x7e0f81f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xfc00) * 0x800 + (uVar6 >> 8 & 0xf800) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x7e0f81f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
LAB_0893d2e8:
                    /* Unresolved local var: Uint32 s@[???]
                       Unresolved local var: uint alpha@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 == 0) {
LAB_0893d350:
          puVar7 = puVar7 + 1;
          puVar4 = puVar4 + 1;
        }
        else {
          if (uVar8 != 0x1f) {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x7e0f81f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xfc00) * 0x800 + (uVar6 >> 8 & 0xf800) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x7e0f81f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
            goto LAB_0893d350;
          }
          *puVar4 = ((ushort)(uVar6 >> 8) & 0xf800) + ((ushort)(uVar6 >> 5) & 0x7e0) +
                    (ushort)((uVar6 << 0x18) >> 0x1b);
          puVar7 = puVar7 + 1;
          puVar4 = puVar4 + 1;
        }
      }
    }
  } while( true );
}



----------------------------------------

// Function: BlitARGBto555PixelAlpha @ 0893d418

/* WARNING: Removing unreachable block (ram,0x0893d458) */

void BlitARGBto555PixelAlpha(SDL_BlitInfo *info)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  ushort *puVar4;
  int iVar5;
  uint uVar6;
  uint *puVar7;
  uint uVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint32 * srcp@[DW_OP_reg9(t1)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint16 * dstp@[DW_OP_reg8(t0)]
                       Unresolved local var: int dstskip@[???] */
  iVar1 = info->d_skip;
  iVar5 = info->d_height;
  iVar2 = info->s_skip;
  puVar7 = (uint *)info->s_pixels;
  puVar4 = (ushort *)info->d_pixels;
  if (iVar5 == 0) {
    return;
  }
  iVar12 = (int)(info->d_width + 3U) / 4;
  uVar10 = info->d_width & 3;
                    /* Unresolved local var: int n@[DW_OP_reg10(t2)] */
  iVar11 = 0;
  iVar9 = iVar12;
  if (uVar10 == 1) goto LAB_0893d4c4;
  do {
    if (uVar10 < 2) {
      if (uVar10 == 0) {
        uVar6 = *puVar7;
        iVar9 = iVar12;
        goto LAB_0893d53c;
      }
    }
    else {
      iVar9 = iVar12;
      if (uVar10 == 2) goto LAB_0893d610;
      if (uVar10 == 3) goto LAB_0893d5a4;
    }
    while( true ) {
      if (iVar11 == iVar5 + -1) {
        return;
      }
      puVar7 = puVar7 + (iVar2 >> 2);
      puVar4 = puVar4 + (iVar1 >> 1);
      iVar11 = iVar11 + 1;
      iVar9 = iVar12;
      if (uVar10 != 1) break;
LAB_0893d4c4:
      while( true ) {
                    /* Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 9) & 0x7c00) + ((ushort)(uVar6 >> 6) & 0x3e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x3e07c1f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xf800) * 0x400 + (uVar6 >> 9 & 0x7c00) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x3e07c1f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
        if (iVar9 + -1 < 1) break;
                    /* Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s@[???] */
        uVar6 = *puVar7;
        iVar9 = iVar9 + -1;
LAB_0893d53c:
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 9) & 0x7c00) + ((ushort)(uVar6 >> 6) & 0x3e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x3e07c1f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xf800) * 0x400 + (uVar6 >> 9 & 0x7c00) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x3e07c1f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
LAB_0893d5a4:
                    /* Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 != 0) {
          if (uVar8 == 0x1f) {
            *puVar4 = ((ushort)(uVar6 >> 9) & 0x7c00) + ((ushort)(uVar6 >> 6) & 0x3e0) +
                      (ushort)((uVar6 << 0x18) >> 0x1b);
          }
          else {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x3e07c1f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xf800) * 0x400 + (uVar6 >> 9 & 0x7c00) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x3e07c1f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
          }
        }
        puVar7 = puVar7 + 1;
        puVar4 = puVar4 + 1;
LAB_0893d610:
                    /* Unresolved local var: uint alpha@[???]
                       Unresolved local var: Uint32 s@[???] */
        uVar6 = *puVar7;
        uVar8 = uVar6 >> 0x1b;
        if (uVar8 == 0) {
LAB_0893d678:
          puVar7 = puVar7 + 1;
          puVar4 = puVar4 + 1;
        }
        else {
          if (uVar8 != 0x1f) {
                    /* Unresolved local var: Uint32 d@[???] */
            uVar3 = CONCAT22(*puVar4,*puVar4) & 0x3e07c1f;
            uVar6 = uVar3 + (uVar8 * (((uVar6 & 0xf800) * 0x400 + (uVar6 >> 9 & 0x7c00) +
                                      ((uVar6 & 0xff) >> 3)) - uVar3) >> 5) & 0x3e07c1f;
            *puVar4 = (ushort)(uVar6 >> 0x10) | (ushort)uVar6;
            goto LAB_0893d678;
          }
          *puVar4 = ((ushort)(uVar6 >> 9) & 0x7c00) + ((ushort)(uVar6 >> 6) & 0x3e0) +
                    (ushort)((uVar6 << 0x18) >> 0x1b);
          puVar7 = puVar7 + 1;
          puVar4 = puVar4 + 1;
        }
      }
    }
  } while( true );
}



----------------------------------------

// Function: BlitNtoNSurfaceAlpha @ 0893d73c

/* WARNING: Removing unreachable block (ram,0x0893d7d4) */

void BlitNtoNSurfaceAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  SDL_PixelFormat *pSVar10;
  SDL_PixelFormat *pSVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint *puVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  uint uVar19;
  uint uVar20;
  uint *puVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  uint uVar27;
  uint uVar28;
  uint uVar29;
  int iVar30;
  uint uVar31;
  int iVar32;
  int local_6c;
  int local_64;
  uint local_4c;
  uint local_48;
  uint local_44;
  uint local_40;
  uint local_3c;
  uint local_38;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg11(t3)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg9(t1)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dA@[???] */
  pSVar10 = info->dst;
  pSVar11 = info->src;
  uVar12 = 0xff;
  uVar3 = (uint)pSVar11->alpha;
  iVar30 = info->s_skip;
  if (pSVar10->Amask == 0) {
    uVar12 = 0;
  }
  iVar2 = info->d_height;
  puVar21 = (uint *)info->s_pixels;
  puVar15 = (uint *)info->d_pixels;
  iVar4 = info->d_skip;
  uVar23 = (uint)pSVar11->BytesPerPixel;
  uVar16 = (uint)pSVar10->BytesPerPixel;
  if ((uVar3 == 0) || (iVar2 == 0)) {
    return;
  }
  iVar32 = (int)(info->d_width + 3U) / 4;
  uVar5 = info->d_width & 3;
                    /* Unresolved local var: int n@[???] */
  local_6c = 0;
  if (uVar5 == 1) goto LAB_0893d848;
LAB_0893d7f8:
  if (uVar5 < 2) {
    local_64 = iVar32;
    if (uVar5 != 0) goto LAB_0893d81c;
    goto LAB_0893d9c8;
  }
  if (uVar5 == 2) {
    local_44 = pSVar11->Rmask;
    local_3c = pSVar11->Gmask;
    local_38 = pSVar11->Bmask;
    local_4c = (uint)pSVar11->Rshift;
    local_48 = pSVar10->Rmask;
    local_40 = pSVar10->Gmask;
    uVar27 = (uint)pSVar11->Rloss;
    uVar26 = (uint)pSVar11->Gshift;
    uVar25 = (uint)pSVar11->Gloss;
    uVar24 = (uint)pSVar11->Bshift;
    uVar22 = (uint)pSVar11->Bloss;
    uVar29 = (uint)pSVar10->Rshift;
    uVar28 = (uint)pSVar10->Rloss;
    uVar20 = (uint)pSVar10->Gshift;
    uVar18 = (uint)pSVar10->Gloss;
    uVar19 = (uint)pSVar10->Bshift;
    uVar17 = (uint)pSVar10->Bloss;
    uVar31 = pSVar10->Bmask;
    local_64 = iVar32;
    if (uVar23 == 3) goto LAB_0893dc58;
    goto LAB_0893dd3c;
  }
  if (uVar5 != 3) goto LAB_0893d81c;
  local_44 = pSVar11->Rmask;
  local_3c = pSVar11->Gmask;
  local_38 = pSVar11->Bmask;
  local_4c = (uint)pSVar11->Rshift;
  local_48 = pSVar10->Rmask;
  local_40 = pSVar10->Gmask;
  uVar27 = (uint)pSVar11->Rloss;
  uVar26 = (uint)pSVar11->Gshift;
  uVar25 = (uint)pSVar11->Gloss;
  uVar24 = (uint)pSVar11->Bshift;
  uVar22 = (uint)pSVar11->Bloss;
  uVar29 = (uint)pSVar10->Rshift;
  uVar28 = (uint)pSVar10->Rloss;
  uVar20 = (uint)pSVar10->Gshift;
  uVar18 = (uint)pSVar10->Gloss;
  uVar19 = (uint)pSVar10->Bshift;
  uVar17 = (uint)pSVar10->Bloss;
  uVar31 = pSVar10->Bmask;
  local_64 = iVar32;
  do {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
    if (uVar23 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar13 = (uint)(byte)*puVar21 + (uint)*(byte *)((int)puVar21 + 1) * 0x100 +
               (uint)*(byte *)((int)puVar21 + 2) * 0x10000;
    }
    else if (uVar23 == 4) {
      uVar13 = *puVar21;
    }
    else if (uVar23 == 2) {
      uVar13 = (uint)(ushort)*puVar21;
    }
    else {
      uVar13 = 0;
    }
    if (uVar16 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar7 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else if (uVar16 == 4) {
      uVar7 = *puVar15;
    }
    else if (uVar16 == 2) {
      uVar7 = (uint)(ushort)*puVar15;
    }
    else {
      uVar7 = 0;
    }
    iVar6 = ((uVar7 & local_48) >> (uVar29 & 0x1f)) << (uVar28 & 0x1f);
    iVar8 = ((uVar7 & local_40) >> (uVar20 & 0x1f)) << (uVar18 & 0x1f);
    iVar9 = ((uVar7 & uVar31) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    uVar14 = iVar6 + (uVar3 * ((((uVar13 & local_44) >> (local_4c & 0x1f)) << (uVar27 & 0x1f)) -
                              iVar6) >> 8);
    uVar7 = iVar8 + (uVar3 * ((((uVar13 & local_3c) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f)) - iVar8)
                    >> 8);
    uVar13 = iVar9 + (uVar3 * ((((uVar13 & local_38) >> (uVar24 & 0x1f)) << (uVar22 & 0x1f)) - iVar9
                              ) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uVar29 >> 3)) = (byte)uVar14;
      *(byte *)((int)puVar15 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar7;
      *(byte *)((int)puVar15 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar13;
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
    }
    else if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
      *puVar15 = (uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f) |
                 (uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f) |
                 (uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f) |
                 (uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
    }
    else if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
      *(ushort *)puVar15 =
           (ushort)((uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f)) |
           (ushort)((uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f)) |
           (ushort)((uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f)) |
           (ushort)((uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
      local_4c = (uint)pSVar11->Rshift;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
    }
    puVar21 = (uint *)((int)puVar21 + uVar23);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
    puVar15 = (uint *)((int)puVar15 + uVar16);
    if (uVar23 == 3) {
LAB_0893dc58:
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar13 = (uint)(byte)*puVar21 + (uint)*(byte *)((int)puVar21 + 1) * 0x100 +
               (uint)*(byte *)((int)puVar21 + 2) * 0x10000;
      if (uVar16 != 3) goto LAB_0893dd5c;
                    /* Unresolved local var: Uint8 * B@[???] */
      bVar1 = *(byte *)((int)puVar15 + 1);
LAB_0893dc80:
      uVar7 = (uint)(byte)*puVar15 + (uint)bVar1 * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else {
LAB_0893dd3c:
      if (uVar23 == 4) {
        uVar13 = *puVar21;
      }
      else if (uVar23 == 2) {
        uVar13 = (uint)(ushort)*puVar21;
      }
      else {
        uVar13 = 0;
      }
      if (uVar16 == 3) {
        bVar1 = *(byte *)((int)puVar15 + 1);
        goto LAB_0893dc80;
      }
LAB_0893dd5c:
      if (uVar16 == 4) {
        uVar7 = *puVar15;
      }
      else if (uVar16 == 2) {
        uVar7 = (uint)(ushort)*puVar15;
      }
      else {
        uVar7 = 0;
      }
    }
    iVar6 = ((uVar7 & local_48) >> (uVar29 & 0x1f)) << (uVar28 & 0x1f);
    iVar8 = ((uVar7 & local_40) >> (uVar20 & 0x1f)) << (uVar18 & 0x1f);
    iVar9 = ((uVar7 & uVar31) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    uVar14 = iVar6 + (uVar3 * ((((uVar13 & local_44) >> (local_4c & 0x1f)) << (uVar27 & 0x1f)) -
                              iVar6) >> 8);
    uVar7 = iVar8 + (uVar3 * ((((uVar13 & local_3c) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f)) - iVar8)
                    >> 8);
    uVar13 = iVar9 + (uVar3 * ((((uVar13 & local_38) >> (uVar24 & 0x1f)) << (uVar22 & 0x1f)) - iVar9
                              ) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uVar29 >> 3)) = (byte)uVar14;
      puVar21 = (uint *)((int)puVar21 + uVar23);
      *(byte *)((int)puVar15 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar7;
      *(byte *)((int)puVar15 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar13;
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
      puVar15 = (uint *)((int)puVar15 + 3);
    }
    else if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
      *puVar15 = (uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f) |
                 (uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f) |
                 (uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f) |
                 (uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
      puVar21 = (uint *)((int)puVar21 + uVar23);
      puVar15 = puVar15 + 1;
    }
    else if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
      *(ushort *)puVar15 =
           (ushort)((uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f)) |
           (ushort)((uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f)) |
           (ushort)((uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f)) |
           (ushort)((uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
      local_4c = (uint)pSVar11->Rshift;
      puVar21 = (uint *)((int)puVar21 + uVar23);
      puVar15 = (uint *)((int)puVar15 + 2);
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
    }
    else {
      puVar21 = (uint *)((int)puVar21 + uVar23);
      puVar15 = (uint *)((int)puVar15 + uVar16);
    }
    while( true ) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
      if (uVar23 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
        uVar13 = (uint)(byte)*puVar21 + (uint)*(byte *)((int)puVar21 + 1) * 0x100 +
                 (uint)*(byte *)((int)puVar21 + 2) * 0x10000;
      }
      else if (uVar23 == 4) {
        uVar13 = *puVar21;
      }
      else if (uVar23 == 2) {
        uVar13 = (uint)(ushort)*puVar21;
      }
      else {
        uVar13 = 0;
      }
      if (uVar16 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
        uVar7 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
                (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
      }
      else if (uVar16 == 4) {
        uVar7 = *puVar15;
      }
      else if (uVar16 == 2) {
        uVar7 = (uint)(ushort)*puVar15;
      }
      else {
        uVar7 = 0;
      }
      iVar6 = ((uVar7 & local_48) >> (uVar29 & 0x1f)) << (uVar28 & 0x1f);
      iVar8 = ((uVar7 & local_40) >> (uVar20 & 0x1f)) << (uVar18 & 0x1f);
      iVar9 = ((uVar7 & uVar31) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
      uVar27 = iVar6 + (uVar3 * ((((uVar13 & local_44) >> (local_4c & 0x1f)) << (uVar27 & 0x1f)) -
                                iVar6) >> 8);
      uVar25 = iVar8 + (uVar3 * ((((uVar13 & local_3c) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f)) -
                                iVar8) >> 8);
      uVar22 = iVar9 + (uVar3 * ((((uVar13 & local_38) >> (uVar24 & 0x1f)) << (uVar22 & 0x1f)) -
                                iVar9) >> 8);
      if (uVar16 == 3) {
        *(byte *)((int)puVar15 + (uVar29 >> 3)) = (byte)uVar27;
        *(byte *)((int)puVar15 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar25;
        *(byte *)((int)puVar15 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar22;
      }
      else if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar15 = (uVar27 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f) |
                   (uVar25 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f) |
                   (uVar22 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f) |
                   (uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
      }
      else if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar15 =
             (ushort)((uVar27 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f)) |
             (ushort)((uVar25 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f)) |
             (ushort)((uVar22 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f)) |
             (ushort)((uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
      }
      puVar21 = (uint *)((int)puVar21 + uVar23);
      puVar15 = (uint *)((int)puVar15 + uVar16);
      local_64 = local_64 + -1;
      if (0 < local_64) break;
LAB_0893d81c:
      if (iVar2 + -1 == local_6c) {
        return;
      }
      local_6c = local_6c + 1;
      puVar15 = (uint *)((int)puVar15 + iVar4);
      puVar21 = (uint *)((int)puVar21 + iVar30);
      if (uVar5 != 1) goto LAB_0893d7f8;
LAB_0893d848:
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar31 = pSVar10->Bmask;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      local_64 = iVar32;
    }
LAB_0893d9c8:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
    if (uVar23 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar13 = (uint)(byte)*puVar21 + (uint)*(byte *)((int)puVar21 + 1) * 0x100 +
               (uint)*(byte *)((int)puVar21 + 2) * 0x10000;
    }
    else if (uVar23 == 4) {
      uVar13 = *puVar21;
    }
    else if (uVar23 == 2) {
      uVar13 = (uint)(ushort)*puVar21;
    }
    else {
      uVar13 = 0;
    }
    local_44 = pSVar11->Rmask;
    local_3c = pSVar11->Gmask;
    local_38 = pSVar11->Bmask;
    local_4c = (uint)pSVar11->Rshift;
    uVar27 = (uint)pSVar11->Rloss;
    uVar26 = (uint)pSVar11->Gshift;
    uVar25 = (uint)pSVar11->Gloss;
    uVar24 = (uint)pSVar11->Bshift;
    uVar22 = (uint)pSVar11->Bloss;
    if (uVar16 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
      uVar7 = (uint)(byte)*puVar15 + (uint)*(byte *)((int)puVar15 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar15 + 2) * 0x10000;
    }
    else if (uVar16 == 4) {
      uVar7 = *puVar15;
    }
    else if (uVar16 == 2) {
      uVar7 = (uint)(ushort)*puVar15;
    }
    else {
      uVar7 = 0;
    }
    local_40 = pSVar10->Gmask;
    local_48 = pSVar10->Rmask;
    uVar29 = (uint)pSVar10->Rshift;
    uVar20 = (uint)pSVar10->Gshift;
    uVar19 = (uint)pSVar10->Bshift;
    uVar28 = (uint)pSVar10->Rloss;
    uVar18 = (uint)pSVar10->Gloss;
    uVar17 = (uint)pSVar10->Bloss;
    uVar31 = pSVar10->Bmask;
    iVar6 = ((uVar7 & local_48) >> (uVar29 & 0x1f)) << (uVar28 & 0x1f);
    iVar8 = ((uVar7 & local_40) >> (uVar20 & 0x1f)) << (uVar18 & 0x1f);
    iVar9 = ((uVar7 & uVar31) >> (uVar19 & 0x1f)) << (uVar17 & 0x1f);
    uVar14 = iVar6 + (uVar3 * ((((uVar13 & local_44) >> (local_4c & 0x1f)) << (uVar27 & 0x1f)) -
                              iVar6) >> 8);
    uVar7 = iVar8 + (uVar3 * ((((uVar13 & local_3c) >> (uVar26 & 0x1f)) << (uVar25 & 0x1f)) - iVar8)
                    >> 8);
    uVar13 = iVar9 + (uVar3 * ((((uVar13 & local_38) >> (uVar24 & 0x1f)) << (uVar22 & 0x1f)) - iVar9
                              ) >> 8);
    if (uVar16 == 3) {
      *(byte *)((int)puVar15 + (uint)(pSVar10->Rshift >> 3)) = (byte)uVar14;
      *(byte *)((int)puVar15 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar7;
      *(byte *)((int)puVar15 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar13;
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
    }
    else if (uVar16 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
      *puVar15 = (uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f) |
                 (uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f) |
                 (uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f) |
                 (uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
      local_44 = pSVar11->Rmask;
      local_3c = pSVar11->Gmask;
      local_38 = pSVar11->Bmask;
      local_4c = (uint)pSVar11->Rshift;
      local_48 = pSVar10->Rmask;
      local_40 = pSVar10->Gmask;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
      uVar31 = pSVar10->Bmask;
    }
    else if (uVar16 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
      *(ushort *)puVar15 =
           (ushort)((uVar14 >> (uVar28 & 0x1f)) << (uVar29 & 0x1f)) |
           (ushort)((uVar7 >> (uVar18 & 0x1f)) << (uVar20 & 0x1f)) |
           (ushort)((uVar13 >> (uVar17 & 0x1f)) << (uVar19 & 0x1f)) |
           (ushort)((uVar12 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
      local_4c = (uint)pSVar11->Rshift;
      uVar27 = (uint)pSVar11->Rloss;
      uVar26 = (uint)pSVar11->Gshift;
      uVar25 = (uint)pSVar11->Gloss;
      uVar24 = (uint)pSVar11->Bshift;
      uVar22 = (uint)pSVar11->Bloss;
      uVar29 = (uint)pSVar10->Rshift;
      uVar28 = (uint)pSVar10->Rloss;
      uVar20 = (uint)pSVar10->Gshift;
      uVar18 = (uint)pSVar10->Gloss;
      uVar19 = (uint)pSVar10->Bshift;
      uVar17 = (uint)pSVar10->Bloss;
    }
    puVar21 = (uint *)((int)puVar21 + uVar23);
    puVar15 = (uint *)((int)puVar15 + uVar16);
  } while( true );
}



----------------------------------------

// Function: BlitNtoNSurfaceAlphaKey @ 0893e584

/* WARNING: Removing unreachable block (ram,0x0893e61c) */

void BlitNtoNSurfaceAlphaKey(SDL_BlitInfo *info)

{
  byte bVar1;
  Uint32 UVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  SDL_PixelFormat *pSVar10;
  SDL_PixelFormat *pSVar11;
  uint *puVar12;
  uint *puVar13;
  int iVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  uint uVar18;
  uint uVar19;
  uint uVar20;
  uint uVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  int iVar27;
  int local_58;
  int local_54;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg11(t3)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg10(t2)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg9(t1)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg8(t0)]
                       Unresolved local var: Uint32 ckey@[???]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: int dstbpp@[???]
                       Unresolved local var: uint sA@[DW_OP_reg15(t7)]
                       Unresolved local var: uint dA@[???] */
  pSVar10 = info->dst;
  pSVar11 = info->src;
  uVar7 = 0xff;
  iVar4 = info->d_height;
  iVar14 = info->s_skip;
  if (pSVar10->Amask == 0) {
    uVar7 = 0;
  }
  puVar13 = (uint *)info->s_pixels;
  puVar12 = (uint *)info->d_pixels;
  UVar2 = pSVar11->colorkey;
  iVar5 = info->d_skip;
  uVar17 = (uint)pSVar11->BytesPerPixel;
  uVar18 = (uint)pSVar10->BytesPerPixel;
  uVar19 = (uint)pSVar11->alpha;
  if (iVar4 == 0) {
    return;
  }
  iVar27 = (int)(info->d_width + 3U) / 4;
  uVar24 = info->d_width & 3;
                    /* Unresolved local var: int n@[???] */
  local_58 = 0;
  do {
    local_54 = iVar27;
    if (uVar24 == 1) {
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
      if (uVar17 == 3) goto LAB_0893ec78;
      goto LAB_0893e694;
    }
    if (uVar24 < 2) {
      if (uVar24 == 0) {
        if (uVar17 != 3) goto LAB_0893e814;
                    /* Unresolved local var: Uint8 * B@[???] */
        bVar1 = *(byte *)((int)puVar13 + 1);
        goto LAB_0893ece4;
      }
    }
    else {
      if (uVar24 == 2) goto joined_r0x0893eca0;
      if (uVar24 == 3) {
        if (uVar17 == 3) goto LAB_0893e988;
        do {
          if (uVar17 == 4) {
            uVar15 = *puVar13;
          }
          else if (uVar17 == 2) {
            uVar15 = (uint)(ushort)*puVar13;
          }
          else {
            uVar15 = 0;
          }
          while( true ) {
            if ((uVar19 != 0) && (uVar15 != UVar2)) {
              if (uVar18 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
                uVar3 = (uint)(byte)*puVar12 + (uint)*(byte *)((int)puVar12 + 1) * 0x100 +
                        (uint)*(byte *)((int)puVar12 + 2) * 0x10000;
              }
              else if (uVar18 == 4) {
                uVar3 = *puVar12;
              }
              else if (uVar18 == 2) {
                uVar3 = (uint)(ushort)*puVar12;
              }
              else {
                uVar3 = 0;
              }
              uVar22 = (uint)pSVar10->Rshift;
              uVar20 = (uint)pSVar10->Rloss;
              iVar6 = ((uVar3 & pSVar10->Rmask) >> (uVar22 & 0x1f)) << (uVar20 & 0x1f);
              uVar26 = (uint)pSVar10->Gshift;
              uVar21 = (uint)pSVar10->Gloss;
              iVar8 = ((uVar3 & pSVar10->Gmask) >> (uVar26 & 0x1f)) << (uVar21 & 0x1f);
              uVar25 = (uint)pSVar10->Bshift;
              uVar23 = (uint)pSVar10->Bloss;
              iVar9 = ((uVar3 & pSVar10->Bmask) >> (uVar25 & 0x1f)) << (uVar23 & 0x1f);
              uVar16 = iVar6 + (uVar19 * ((((uVar15 & pSVar11->Rmask) >> (pSVar11->Rshift & 0x1f))
                                          << (pSVar11->Rloss & 0x1f)) - iVar6) >> 8);
              uVar3 = iVar8 + (uVar19 * ((((uVar15 & pSVar11->Gmask) >> (pSVar11->Gshift & 0x1f)) <<
                                         (pSVar11->Gloss & 0x1f)) - iVar8) >> 8);
              uVar15 = iVar9 + (uVar19 * ((((uVar15 & pSVar11->Bmask) >> (pSVar11->Bshift & 0x1f))
                                          << (pSVar11->Bloss & 0x1f)) - iVar9) >> 8);
              if (uVar18 == 3) {
                *(byte *)((int)puVar12 + (uint)(pSVar10->Rshift >> 3)) = (byte)uVar16;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar3;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar15;
              }
              else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
                *puVar12 = (uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f) |
                           (uVar3 >> (uVar21 & 0x1f)) << (uVar26 & 0x1f) |
                           (uVar15 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f) |
                           (uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
              }
              else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar12 =
                     (ushort)((uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f)) |
                     (ushort)((uVar3 >> (uVar21 & 0x1f)) << (uVar26 & 0x1f)) |
                     (ushort)((uVar15 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f)) |
                     (ushort)((uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
              }
            }
            puVar13 = (uint *)((int)puVar13 + uVar17);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            puVar12 = (uint *)((int)puVar12 + uVar18);
joined_r0x0893eca0:
            if (uVar17 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar15 = (uint)(byte)*puVar13 + (uint)*(byte *)((int)puVar13 + 1) * 0x100 +
                       (uint)*(byte *)((int)puVar13 + 2) * 0x10000;
            }
            else if (uVar17 == 4) {
              uVar15 = *puVar13;
            }
            else if (uVar17 == 2) {
              uVar15 = (uint)(ushort)*puVar13;
            }
            else {
              uVar15 = 0;
            }
            if ((uVar19 != 0) && (uVar15 != UVar2)) {
              if (uVar18 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
                uVar3 = (uint)(byte)*puVar12 + (uint)*(byte *)((int)puVar12 + 1) * 0x100 +
                        (uint)*(byte *)((int)puVar12 + 2) * 0x10000;
              }
              else if (uVar18 == 4) {
                uVar3 = *puVar12;
              }
              else if (uVar18 == 2) {
                uVar3 = (uint)(ushort)*puVar12;
              }
              else {
                uVar3 = 0;
              }
              uVar20 = (uint)pSVar10->Rshift;
              uVar25 = (uint)pSVar10->Rloss;
              iVar6 = ((uVar3 & pSVar10->Rmask) >> (uVar20 & 0x1f)) << (uVar25 & 0x1f);
              uVar22 = (uint)pSVar10->Gshift;
              uVar26 = (uint)pSVar10->Gloss;
              iVar8 = ((uVar3 & pSVar10->Gmask) >> (uVar22 & 0x1f)) << (uVar26 & 0x1f);
              uVar23 = (uint)pSVar10->Bshift;
              uVar21 = (uint)pSVar10->Bloss;
              iVar9 = ((uVar3 & pSVar10->Bmask) >> (uVar23 & 0x1f)) << (uVar21 & 0x1f);
              uVar16 = iVar6 + (uVar19 * ((((uVar15 & pSVar11->Rmask) >> (pSVar11->Rshift & 0x1f))
                                          << (pSVar11->Rloss & 0x1f)) - iVar6) >> 8);
              uVar3 = iVar8 + (uVar19 * ((((uVar15 & pSVar11->Gmask) >> (pSVar11->Gshift & 0x1f)) <<
                                         (pSVar11->Gloss & 0x1f)) - iVar8) >> 8);
              uVar15 = iVar9 + (uVar19 * ((((uVar15 & pSVar11->Bmask) >> (pSVar11->Bshift & 0x1f))
                                          << (pSVar11->Bloss & 0x1f)) - iVar9) >> 8);
              if (uVar18 == 3) {
                *(byte *)((int)puVar12 + (uint)(pSVar10->Rshift >> 3)) = (byte)uVar16;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar3;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar15;
              }
              else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
                *puVar12 = (uVar16 >> (uVar25 & 0x1f)) << (uVar20 & 0x1f) |
                           (uVar3 >> (uVar26 & 0x1f)) << (uVar22 & 0x1f) |
                           (uVar15 >> (uVar21 & 0x1f)) << (uVar23 & 0x1f) |
                           (uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
              }
              else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar12 =
                     (ushort)((uVar16 >> (uVar25 & 0x1f)) << (uVar20 & 0x1f)) |
                     (ushort)((uVar3 >> (uVar26 & 0x1f)) << (uVar22 & 0x1f)) |
                     (ushort)((uVar15 >> (uVar21 & 0x1f)) << (uVar23 & 0x1f)) |
                     (ushort)((uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
              }
            }
            puVar13 = (uint *)((int)puVar13 + uVar17);
            puVar12 = (uint *)((int)puVar12 + uVar18);
            if (uVar17 == 3) {
LAB_0893ec78:
                    /* Unresolved local var: Uint8 * B@[???] */
              uVar15 = (uint)(byte)*puVar13 + (uint)*(byte *)((int)puVar13 + 1) * 0x100 +
                       (uint)*(byte *)((int)puVar13 + 2) * 0x10000;
            }
            else {
LAB_0893e694:
              if (uVar17 == 4) {
                uVar15 = *puVar13;
              }
              else if (uVar17 == 2) {
                uVar15 = (uint)(ushort)*puVar13;
              }
              else {
                uVar15 = 0;
              }
            }
            if ((uVar19 != 0) && (uVar15 != UVar2)) {
              if (uVar18 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
                uVar3 = (uint)(byte)*puVar12 + (uint)*(byte *)((int)puVar12 + 1) * 0x100 +
                        (uint)*(byte *)((int)puVar12 + 2) * 0x10000;
              }
              else if (uVar18 == 4) {
                uVar3 = *puVar12;
              }
              else if (uVar18 == 2) {
                uVar3 = (uint)(ushort)*puVar12;
              }
              else {
                uVar3 = 0;
              }
              uVar22 = (uint)pSVar10->Rshift;
              uVar20 = (uint)pSVar10->Rloss;
              iVar6 = ((uVar3 & pSVar10->Rmask) >> (uVar22 & 0x1f)) << (uVar20 & 0x1f);
              uVar25 = (uint)pSVar10->Gshift;
              uVar21 = (uint)pSVar10->Gloss;
              iVar8 = ((uVar3 & pSVar10->Gmask) >> (uVar25 & 0x1f)) << (uVar21 & 0x1f);
              uVar26 = (uint)pSVar10->Bshift;
              uVar23 = (uint)pSVar10->Bloss;
              iVar9 = ((uVar3 & pSVar10->Bmask) >> (uVar26 & 0x1f)) << (uVar23 & 0x1f);
              uVar16 = iVar6 + (uVar19 * ((((uVar15 & pSVar11->Rmask) >> (pSVar11->Rshift & 0x1f))
                                          << (pSVar11->Rloss & 0x1f)) - iVar6) >> 8);
              uVar3 = iVar8 + (uVar19 * ((((uVar15 & pSVar11->Gmask) >> (pSVar11->Gshift & 0x1f)) <<
                                         (pSVar11->Gloss & 0x1f)) - iVar8) >> 8);
              uVar15 = iVar9 + (uVar19 * ((((uVar15 & pSVar11->Bmask) >> (pSVar11->Bshift & 0x1f))
                                          << (pSVar11->Bloss & 0x1f)) - iVar9) >> 8);
              if (uVar18 == 3) {
                *(byte *)((int)puVar12 + (uint)(pSVar10->Rshift >> 3)) = (byte)uVar16;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar3;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar15;
              }
              else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
                *puVar12 = (uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f) |
                           (uVar3 >> (uVar21 & 0x1f)) << (uVar25 & 0x1f) |
                           (uVar15 >> (uVar23 & 0x1f)) << (uVar26 & 0x1f) |
                           (uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
              }
              else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar12 =
                     (ushort)((uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f)) |
                     (ushort)((uVar3 >> (uVar21 & 0x1f)) << (uVar25 & 0x1f)) |
                     (ushort)((uVar15 >> (uVar23 & 0x1f)) << (uVar26 & 0x1f)) |
                     (ushort)((uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
              }
            }
            puVar13 = (uint *)((int)puVar13 + uVar17);
            puVar12 = (uint *)((int)puVar12 + uVar18);
            local_54 = local_54 + -1;
            if (local_54 < 1) goto LAB_0893e658;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            if (uVar17 == 3) {
              bVar1 = *(byte *)((int)puVar13 + 1);
LAB_0893ece4:
              uVar15 = (uint)(byte)*puVar13 + (uint)bVar1 * 0x100 +
                       (uint)*(byte *)((int)puVar13 + 2) * 0x10000;
            }
            else {
LAB_0893e814:
              if (uVar17 == 4) {
                uVar15 = *puVar13;
              }
              else if (uVar17 == 2) {
                uVar15 = (uint)(ushort)*puVar13;
              }
              else {
                uVar15 = 0;
              }
            }
            if ((uVar19 != 0) && (uVar15 != UVar2)) {
              if (uVar18 == 3) {
                    /* Unresolved local var: Uint8 * B@[???] */
                uVar3 = (uint)(byte)*puVar12 + (uint)*(byte *)((int)puVar12 + 1) * 0x100 +
                        (uint)*(byte *)((int)puVar12 + 2) * 0x10000;
              }
              else if (uVar18 == 4) {
                uVar3 = *puVar12;
              }
              else if (uVar18 == 2) {
                uVar3 = (uint)(ushort)*puVar12;
              }
              else {
                uVar3 = 0;
              }
              uVar22 = (uint)pSVar10->Rshift;
              uVar20 = (uint)pSVar10->Rloss;
              iVar6 = ((uVar3 & pSVar10->Rmask) >> (uVar22 & 0x1f)) << (uVar20 & 0x1f);
              uVar25 = (uint)pSVar10->Gshift;
              uVar21 = (uint)pSVar10->Gloss;
              iVar8 = ((uVar3 & pSVar10->Gmask) >> (uVar25 & 0x1f)) << (uVar21 & 0x1f);
              uVar26 = (uint)pSVar10->Bshift;
              uVar23 = (uint)pSVar10->Bloss;
              iVar9 = ((uVar3 & pSVar10->Bmask) >> (uVar26 & 0x1f)) << (uVar23 & 0x1f);
              uVar16 = iVar6 + (uVar19 * ((((uVar15 & pSVar11->Rmask) >> (pSVar11->Rshift & 0x1f))
                                          << (pSVar11->Rloss & 0x1f)) - iVar6) >> 8);
              uVar3 = iVar8 + (uVar19 * ((((uVar15 & pSVar11->Gmask) >> (pSVar11->Gshift & 0x1f)) <<
                                         (pSVar11->Gloss & 0x1f)) - iVar8) >> 8);
              uVar15 = iVar9 + (uVar19 * ((((uVar15 & pSVar11->Bmask) >> (pSVar11->Bshift & 0x1f))
                                          << (pSVar11->Bloss & 0x1f)) - iVar9) >> 8);
              if (uVar18 == 3) {
                *(byte *)((int)puVar12 + (uint)(pSVar10->Rshift >> 3)) = (byte)uVar16;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Gshift >> 3)) = (byte)uVar3;
                *(byte *)((int)puVar12 + (uint)(pSVar10->Bshift >> 3)) = (byte)uVar15;
              }
              else if (uVar18 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
                *puVar12 = (uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f) |
                           (uVar3 >> (uVar21 & 0x1f)) << (uVar25 & 0x1f) |
                           (uVar15 >> (uVar23 & 0x1f)) << (uVar26 & 0x1f) |
                           (uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f);
              }
              else if (uVar18 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
                *(ushort *)puVar12 =
                     (ushort)((uVar16 >> (uVar20 & 0x1f)) << (uVar22 & 0x1f)) |
                     (ushort)((uVar3 >> (uVar21 & 0x1f)) << (uVar25 & 0x1f)) |
                     (ushort)((uVar15 >> (uVar23 & 0x1f)) << (uVar26 & 0x1f)) |
                     (ushort)((uVar7 >> (pSVar10->Aloss & 0x1f)) << (pSVar10->Ashift & 0x1f));
              }
            }
            puVar13 = (uint *)((int)puVar13 + uVar17);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???] */
            puVar12 = (uint *)((int)puVar12 + uVar18);
            if (uVar17 != 3) break;
LAB_0893e988:
                    /* Unresolved local var: Uint8 * B@[???] */
            uVar15 = (uint)(byte)*puVar13 + (uint)*(byte *)((int)puVar13 + 1) * 0x100 +
                     (uint)*(byte *)((int)puVar13 + 2) * 0x10000;
          }
        } while( true );
      }
    }
LAB_0893e658:
    if (iVar4 + -1 == local_58) {
      return;
    }
    local_58 = local_58 + 1;
    puVar13 = (uint *)((int)puVar13 + iVar14);
    puVar12 = (uint *)((int)puVar12 + iVar5);
  } while( true );
}



----------------------------------------

// Function: BlitNtoNPixelAlpha @ 0893f0e8

/* WARNING: Removing unreachable block (ram,0x0893f15c) */

void BlitNtoNPixelAlpha(SDL_BlitInfo *info)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  SDL_PixelFormat *pSVar12;
  SDL_PixelFormat *pSVar13;
  int iVar14;
  uint uVar15;
  uint uVar16;
  uint uVar17;
  uint *puVar18;
  uint uVar19;
  uint uVar20;
  uint uVar21;
  uint uVar22;
  uint uVar23;
  uint uVar24;
  uint uVar25;
  uint uVar26;
  uint uVar27;
  uint uVar28;
  uint *puVar29;
  uint uVar30;
  int iVar31;
  int local_78;
  int local_64;
  uint local_50;
  uint local_4c;
  uint local_48;
  uint local_44;
  uint local_40;
  uint local_3c;
  uint local_38;
  uint local_34;
  uint local_30;
  
                    /* Unresolved local var: int width@[???]
                       Unresolved local var: int height@[???]
                       Unresolved local var: Uint8 * src@[DW_OP_reg25(t9)]
                       Unresolved local var: int srcskip@[???]
                       Unresolved local var: Uint8 * dst@[DW_OP_reg14(t6)]
                       Unresolved local var: int dstskip@[???]
                       Unresolved local var: SDL_PixelFormat * srcfmt@[DW_OP_reg9(t1)]
                       Unresolved local var: SDL_PixelFormat * dstfmt@[DW_OP_reg10(t2)]
                       Unresolved local var: int srcbpp@[???]
                       Unresolved local var: int dstbpp@[???] */
  pSVar13 = info->dst;
  iVar2 = info->d_height;
  pSVar12 = info->src;
  iVar4 = info->s_skip;
  puVar29 = (uint *)info->s_pixels;
  puVar18 = (uint *)info->d_pixels;
  iVar5 = info->d_skip;
  uVar22 = (uint)pSVar12->BytesPerPixel;
  uVar21 = (uint)pSVar13->BytesPerPixel;
  if (iVar2 == 0) {
    return;
  }
  iVar31 = (int)(info->d_width + 3U) / 4;
  uVar6 = info->d_width & 3;
                    /* Unresolved local var: int n@[???] */
  local_64 = 0;
  if (uVar6 == 1) goto LAB_0893f1d0;
LAB_0893f180:
  if (uVar6 < 2) {
    if (uVar6 != 0) goto LAB_0893f1a4;
    local_78 = iVar31;
    if (uVar22 != 3) goto LAB_0893f3a4;
                    /* Unresolved local var: Uint8 * sB@[???] */
    bVar1 = *(byte *)((int)puVar29 + 1);
    goto LAB_0893f850;
  }
  if (uVar6 == 2) {
    local_50 = pSVar12->Rmask;
    local_38 = (uint)pSVar12->Rshift;
    local_4c = pSVar12->Gmask;
    local_40 = (uint)pSVar12->Rloss;
    local_48 = pSVar12->Bmask;
    local_34 = (uint)pSVar12->Gshift;
    local_3c = (uint)pSVar12->Gloss;
    local_30 = (uint)pSVar12->Bshift;
    local_44 = pSVar12->Amask;
    uVar30 = (uint)pSVar12->Bloss;
    uVar20 = (uint)pSVar12->Ashift;
    uVar28 = (uint)pSVar12->Aloss;
    local_78 = iVar31;
    if (uVar22 == 3) goto LAB_0893f5a4;
    goto LAB_0893f674;
  }
  if (uVar6 != 3) goto LAB_0893f1a4;
  local_50 = pSVar12->Rmask;
  local_38 = (uint)pSVar12->Rshift;
  local_4c = pSVar12->Gmask;
  local_40 = (uint)pSVar12->Rloss;
  local_48 = pSVar12->Bmask;
  local_34 = (uint)pSVar12->Gshift;
  local_3c = (uint)pSVar12->Gloss;
  local_30 = (uint)pSVar12->Bshift;
  local_44 = pSVar12->Amask;
  uVar30 = (uint)pSVar12->Bloss;
  uVar20 = (uint)pSVar12->Ashift;
  uVar28 = (uint)pSVar12->Aloss;
  local_78 = iVar31;
  if (uVar22 == 3) goto LAB_0893f55c;
LAB_0893f8d0:
  if (uVar22 == 4) {
    uVar7 = *puVar29;
  }
  else if (uVar22 == 2) {
    uVar7 = (uint)(ushort)*puVar29;
  }
  else {
    uVar7 = 0;
  }
  iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
  if (iVar14 != 0) goto LAB_0893f900;
  puVar29 = (uint *)((int)puVar29 + uVar22);
LAB_0893f594:
  do {
    puVar18 = (uint *)((int)puVar18 + uVar21);
LAB_0893f598:
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dA@[???] */
    if (uVar22 == 3) {
LAB_0893f5a4:
                    /* Unresolved local var: Uint8 * sB@[???] */
      uVar7 = (uint)(byte)*puVar29 + (uint)*(byte *)((int)puVar29 + 1) * 0x100 +
              (uint)*(byte *)((int)puVar29 + 2) * 0x10000;
      iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
      if (iVar14 == 0) {
        puVar29 = (uint *)((int)puVar29 + uVar22);
        goto LAB_0893f5dc;
      }
LAB_0893f6a4:
      if (uVar21 == 3) {
                    /* Unresolved local var: Uint8 * dB@[???] */
        uVar16 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                 (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
      }
      else if (uVar21 == 4) {
        uVar16 = *puVar18;
      }
      else if (uVar21 == 2) {
        uVar16 = (uint)(ushort)*puVar18;
      }
      else {
        uVar16 = 0;
      }
      uVar3 = (uint)pSVar13->Bshift;
      uVar25 = (uint)pSVar13->Rshift;
      uVar26 = (uint)pSVar13->Gshift;
      uVar27 = (uint)pSVar13->Bloss;
      iVar8 = ((uVar16 & pSVar13->Bmask) >> (uVar3 & 0x1f)) << (uVar27 & 0x1f);
      uVar23 = (uint)pSVar13->Rloss;
      iVar9 = ((uVar16 & pSVar13->Rmask) >> (uVar25 & 0x1f)) << (uVar23 & 0x1f);
      uVar24 = (uint)pSVar13->Gloss;
      iVar11 = ((uVar16 & pSVar13->Gmask) >> (uVar26 & 0x1f)) << (uVar24 & 0x1f);
      uVar19 = (uint)pSVar13->Ashift;
      uVar15 = (uint)pSVar13->Aloss;
      uVar17 = ((uVar16 & pSVar13->Amask) >> (uVar19 & 0x1f)) << (uVar15 & 0x1f);
      uVar16 = iVar8 + (iVar14 * ((((uVar7 & local_48) >> (local_30 & 0x1f)) << (uVar30 & 0x1f)) -
                                 iVar8) >> 8);
      uVar10 = iVar9 + (iVar14 * ((((uVar7 & local_50) >> (local_38 & 0x1f)) << (local_40 & 0x1f)) -
                                 iVar9) >> 8);
      uVar7 = iVar11 + (iVar14 * ((((uVar7 & local_4c) >> (local_34 & 0x1f)) << (local_3c & 0x1f)) -
                                 iVar11) >> 8);
      if (uVar21 == 3) {
        *(byte *)((int)puVar18 + (uint)(pSVar13->Rshift >> 3)) = (byte)uVar10;
        puVar29 = (uint *)((int)puVar29 + uVar22);
        *(byte *)((int)puVar18 + (uint)(pSVar13->Gshift >> 3)) = (byte)uVar7;
        *(byte *)((int)puVar18 + (uint)(pSVar13->Bshift >> 3)) = (byte)uVar16;
        local_50 = pSVar12->Rmask;
        puVar18 = (uint *)((int)puVar18 + 3);
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else if (uVar21 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar18 = (uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f) |
                   (uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f) |
                   (uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f) |
                   (uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f);
        local_50 = pSVar12->Rmask;
        puVar29 = (uint *)((int)puVar29 + uVar22);
        puVar18 = puVar18 + 1;
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else {
        puVar29 = (uint *)((int)puVar29 + uVar22);
        if (uVar21 != 2) goto LAB_0893f5dc;
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar18 =
             (ushort)((uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f)) |
             (ushort)((uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f)) |
             (ushort)((uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f)) |
             (ushort)((uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f));
        local_38 = (uint)pSVar12->Rshift;
        puVar18 = (uint *)((int)puVar18 + 2);
        local_40 = (uint)pSVar12->Rloss;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
    }
    else {
LAB_0893f674:
      if (uVar22 == 4) {
        uVar7 = *puVar29;
      }
      else if (uVar22 == 2) {
        uVar7 = (uint)(ushort)*puVar29;
      }
      else {
        uVar7 = 0;
      }
      iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
      if (iVar14 != 0) goto LAB_0893f6a4;
      puVar29 = (uint *)((int)puVar29 + uVar22);
LAB_0893f5dc:
      puVar18 = (uint *)((int)puVar18 + uVar21);
    }
    while( true ) {
      if (uVar22 == 3) {
                    /* Unresolved local var: Uint8 * sB@[???] */
        uVar7 = (uint)(byte)*puVar29 + (uint)*(byte *)((int)puVar29 + 1) * 0x100 +
                (uint)*(byte *)((int)puVar29 + 2) * 0x10000;
      }
      else if (uVar22 == 4) {
        uVar7 = *puVar29;
      }
      else if (uVar22 == 2) {
        uVar7 = (uint)(ushort)*puVar29;
      }
      else {
        uVar7 = 0;
      }
      iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
      if (iVar14 != 0) {
        if (uVar21 == 3) {
                    /* Unresolved local var: Uint8 * dB@[???] */
          uVar20 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                   (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
        }
        else if (uVar21 == 4) {
          uVar20 = *puVar18;
        }
        else if (uVar21 == 2) {
          uVar20 = (uint)(ushort)*puVar18;
        }
        else {
          uVar20 = 0;
        }
        uVar25 = (uint)pSVar13->Bshift;
        uVar23 = (uint)pSVar13->Bloss;
        iVar8 = ((uVar20 & pSVar13->Bmask) >> (uVar25 & 0x1f)) << (uVar23 & 0x1f);
        uVar19 = (uint)pSVar13->Rshift;
        uVar15 = (uint)pSVar13->Rloss;
        iVar9 = ((uVar20 & pSVar13->Rmask) >> (uVar19 & 0x1f)) << (uVar15 & 0x1f);
        uVar24 = (uint)pSVar13->Gshift;
        uVar17 = (uint)pSVar13->Gloss;
        iVar11 = ((uVar20 & pSVar13->Gmask) >> (uVar24 & 0x1f)) << (uVar17 & 0x1f);
        uVar10 = (uint)pSVar13->Ashift;
        uVar16 = (uint)pSVar13->Aloss;
        uVar3 = ((uVar20 & pSVar13->Amask) >> (uVar10 & 0x1f)) << (uVar16 & 0x1f);
        uVar28 = iVar8 + (iVar14 * ((((uVar7 & local_48) >> (local_30 & 0x1f)) << (uVar30 & 0x1f)) -
                                   iVar8) >> 8);
        uVar30 = iVar9 + (iVar14 * ((((uVar7 & local_50) >> (local_38 & 0x1f)) << (local_40 & 0x1f))
                                   - iVar9) >> 8);
        uVar20 = iVar11 + (iVar14 * ((((uVar7 & local_4c) >> (local_34 & 0x1f)) << (local_3c & 0x1f)
                                     ) - iVar11) >> 8);
        if (uVar21 == 3) {
          *(byte *)((int)puVar18 + (uint)(pSVar13->Rshift >> 3)) = (byte)uVar30;
          *(byte *)((int)puVar18 + (uint)(pSVar13->Gshift >> 3)) = (byte)uVar20;
          *(byte *)((int)puVar18 + (uint)(pSVar13->Bshift >> 3)) = (byte)uVar28;
        }
        else if (uVar21 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
          *puVar18 = (uVar28 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f) |
                     (uVar30 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f) |
                     (uVar20 >> (uVar17 & 0x1f)) << (uVar24 & 0x1f) |
                     (uVar3 >> (uVar16 & 0x1f)) << (uVar10 & 0x1f);
        }
        else if (uVar21 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
          *(ushort *)puVar18 =
               (ushort)((uVar28 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f)) |
               (ushort)((uVar30 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f)) |
               (ushort)((uVar20 >> (uVar17 & 0x1f)) << (uVar24 & 0x1f)) |
               (ushort)((uVar3 >> (uVar16 & 0x1f)) << (uVar10 & 0x1f));
        }
      }
      puVar29 = (uint *)((int)puVar29 + uVar22);
      puVar18 = (uint *)((int)puVar18 + uVar21);
      local_78 = local_78 + -1;
      if (0 < local_78) break;
LAB_0893f1a4:
      if (iVar2 + -1 == local_64) {
        return;
      }
      local_64 = local_64 + 1;
      puVar29 = (uint *)((int)puVar29 + iVar4);
      puVar18 = (uint *)((int)puVar18 + iVar5);
      if (uVar6 != 1) goto LAB_0893f180;
LAB_0893f1d0:
      local_50 = pSVar12->Rmask;
      local_38 = (uint)pSVar12->Rshift;
      local_4c = pSVar12->Gmask;
      local_40 = (uint)pSVar12->Rloss;
      local_48 = pSVar12->Bmask;
      local_34 = (uint)pSVar12->Gshift;
      local_3c = (uint)pSVar12->Gloss;
      local_30 = (uint)pSVar12->Bshift;
      local_44 = pSVar12->Amask;
      uVar30 = (uint)pSVar12->Bloss;
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dA@[???] */
      uVar20 = (uint)pSVar12->Ashift;
      uVar28 = (uint)pSVar12->Aloss;
      local_78 = iVar31;
    }
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dA@[???] */
    if (uVar22 == 3) {
      bVar1 = *(byte *)((int)puVar29 + 1);
LAB_0893f850:
      uVar7 = (uint)(byte)*puVar29 + (uint)bVar1 * 0x100 +
              (uint)*(byte *)((int)puVar29 + 2) * 0x10000;
    }
    else {
LAB_0893f3a4:
      if (uVar22 == 4) {
        uVar7 = *puVar29;
      }
      else if (uVar22 == 2) {
        uVar7 = (uint)(ushort)*puVar29;
      }
      else {
        uVar7 = 0;
      }
    }
    local_44 = pSVar12->Amask;
    local_50 = pSVar12->Rmask;
    uVar20 = (uint)pSVar12->Ashift;
    uVar28 = (uint)pSVar12->Aloss;
    local_38 = (uint)pSVar12->Rshift;
    local_4c = pSVar12->Gmask;
    iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
    local_40 = (uint)pSVar12->Rloss;
    local_48 = pSVar12->Bmask;
    local_34 = (uint)pSVar12->Gshift;
    local_3c = (uint)pSVar12->Gloss;
    local_30 = (uint)pSVar12->Bshift;
    uVar30 = (uint)pSVar12->Bloss;
    if (iVar14 != 0) {
      if (uVar21 == 3) {
                    /* Unresolved local var: Uint8 * dB@[???] */
        uVar16 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                 (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
      }
      else if (uVar21 == 4) {
        uVar16 = *puVar18;
      }
      else if (uVar21 == 2) {
        uVar16 = (uint)(ushort)*puVar18;
      }
      else {
        uVar16 = 0;
      }
      uVar3 = (uint)pSVar13->Bshift;
      uVar25 = (uint)pSVar13->Rshift;
      uVar26 = (uint)pSVar13->Gshift;
      uVar27 = (uint)pSVar13->Bloss;
      uVar23 = (uint)pSVar13->Rloss;
      iVar8 = ((uVar16 & pSVar13->Bmask) >> (uVar3 & 0x1f)) << (uVar27 & 0x1f);
      iVar9 = ((uVar16 & pSVar13->Rmask) >> (uVar25 & 0x1f)) << (uVar23 & 0x1f);
      uVar24 = (uint)pSVar13->Gloss;
      iVar11 = ((uVar16 & pSVar13->Gmask) >> (uVar26 & 0x1f)) << (uVar24 & 0x1f);
      uVar19 = (uint)pSVar13->Ashift;
      uVar15 = (uint)pSVar13->Aloss;
      uVar17 = ((uVar16 & pSVar13->Amask) >> (uVar19 & 0x1f)) << (uVar15 & 0x1f);
      uVar16 = iVar8 + (iVar14 * ((((uVar7 & local_48) >> (local_30 & 0x1f)) << (uVar30 & 0x1f)) -
                                 iVar8) >> 8);
      uVar10 = iVar9 + (iVar14 * ((((uVar7 & local_50) >> (local_38 & 0x1f)) << (local_40 & 0x1f)) -
                                 iVar9) >> 8);
      uVar7 = iVar11 + (iVar14 * ((((uVar7 & local_4c) >> (local_34 & 0x1f)) << (local_3c & 0x1f)) -
                                 iVar11) >> 8);
      if (uVar21 == 3) {
        *(byte *)((int)puVar18 + (uint)(pSVar13->Rshift >> 3)) = (byte)uVar10;
        *(byte *)((int)puVar18 + (uint)(pSVar13->Gshift >> 3)) = (byte)uVar7;
        *(byte *)((int)puVar18 + (uint)(pSVar13->Bshift >> 3)) = (byte)uVar16;
        local_50 = pSVar12->Rmask;
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else if (uVar21 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar18 = (uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f) |
                   (uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f) |
                   (uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f) |
                   (uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f);
        local_50 = pSVar12->Rmask;
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else if (uVar21 == 2) {
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar18 =
             (ushort)((uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f)) |
             (ushort)((uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f)) |
             (ushort)((uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f)) |
             (ushort)((uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f));
        local_38 = (uint)pSVar12->Rshift;
        local_40 = (uint)pSVar12->Rloss;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
    }
    puVar29 = (uint *)((int)puVar29 + uVar22);
                    /* Unresolved local var: Uint32 pixel@[???]
                       Unresolved local var: uint sR@[???]
                       Unresolved local var: uint sG@[???]
                       Unresolved local var: uint sB@[???]
                       Unresolved local var: uint dR@[???]
                       Unresolved local var: uint dG@[???]
                       Unresolved local var: uint dB@[???]
                       Unresolved local var: uint sA@[???]
                       Unresolved local var: uint dA@[???] */
    puVar18 = (uint *)((int)puVar18 + uVar21);
    if (uVar22 != 3) goto LAB_0893f8d0;
LAB_0893f55c:
                    /* Unresolved local var: Uint8 * sB@[???] */
    uVar7 = (uint)(byte)*puVar29 + (uint)*(byte *)((int)puVar29 + 1) * 0x100 +
            (uint)*(byte *)((int)puVar29 + 2) * 0x10000;
    iVar14 = ((uVar7 & local_44) >> (uVar20 & 0x1f)) << (uVar28 & 0x1f);
    if (iVar14 != 0) {
LAB_0893f900:
      if (uVar21 == 3) {
                    /* Unresolved local var: Uint8 * dB@[???] */
        uVar16 = (uint)(byte)*puVar18 + (uint)*(byte *)((int)puVar18 + 1) * 0x100 +
                 (uint)*(byte *)((int)puVar18 + 2) * 0x10000;
      }
      else if (uVar21 == 4) {
        uVar16 = *puVar18;
      }
      else if (uVar21 == 2) {
        uVar16 = (uint)(ushort)*puVar18;
      }
      else {
        uVar16 = 0;
      }
      uVar3 = (uint)pSVar13->Bshift;
      uVar25 = (uint)pSVar13->Rshift;
      uVar26 = (uint)pSVar13->Gshift;
      uVar27 = (uint)pSVar13->Bloss;
      iVar8 = ((uVar16 & pSVar13->Bmask) >> (uVar3 & 0x1f)) << (uVar27 & 0x1f);
      uVar23 = (uint)pSVar13->Rloss;
      iVar9 = ((uVar16 & pSVar13->Rmask) >> (uVar25 & 0x1f)) << (uVar23 & 0x1f);
      uVar24 = (uint)pSVar13->Gloss;
      iVar11 = ((uVar16 & pSVar13->Gmask) >> (uVar26 & 0x1f)) << (uVar24 & 0x1f);
      uVar19 = (uint)pSVar13->Ashift;
      uVar15 = (uint)pSVar13->Aloss;
      uVar17 = ((uVar16 & pSVar13->Amask) >> (uVar19 & 0x1f)) << (uVar15 & 0x1f);
      uVar16 = iVar8 + (iVar14 * ((((uVar7 & local_48) >> (local_30 & 0x1f)) << (uVar30 & 0x1f)) -
                                 iVar8) >> 8);
      uVar10 = iVar9 + (iVar14 * ((((uVar7 & local_50) >> (local_38 & 0x1f)) << (local_40 & 0x1f)) -
                                 iVar9) >> 8);
      uVar7 = iVar11 + (iVar14 * ((((uVar7 & local_4c) >> (local_34 & 0x1f)) << (local_3c & 0x1f)) -
                                 iVar11) >> 8);
      if (uVar21 == 3) {
        *(byte *)((int)puVar18 + (uint)(pSVar13->Rshift >> 3)) = (byte)uVar10;
        puVar29 = (uint *)((int)puVar29 + uVar22);
        *(byte *)((int)puVar18 + (uint)(pSVar13->Gshift >> 3)) = (byte)uVar7;
        *(byte *)((int)puVar18 + (uint)(pSVar13->Bshift >> 3)) = (byte)uVar16;
        local_50 = pSVar12->Rmask;
        puVar18 = (uint *)((int)puVar18 + 3);
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else if (uVar21 == 4) {
                    /* Unresolved local var: Uint32 pixel@[???] */
        *puVar18 = (uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f) |
                   (uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f) |
                   (uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f) |
                   (uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f);
        local_50 = pSVar12->Rmask;
        puVar29 = (uint *)((int)puVar29 + uVar22);
        puVar18 = puVar18 + 1;
        local_38 = (uint)pSVar12->Rshift;
        local_4c = pSVar12->Gmask;
        local_40 = (uint)pSVar12->Rloss;
        local_48 = pSVar12->Bmask;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        local_44 = pSVar12->Amask;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      else {
        puVar29 = (uint *)((int)puVar29 + uVar22);
        if (uVar21 != 2) goto LAB_0893f594;
                    /* Unresolved local var: Uint16 pixel@[???] */
        *(ushort *)puVar18 =
             (ushort)((uVar16 >> (uVar27 & 0x1f)) << (uVar3 & 0x1f)) |
             (ushort)((uVar10 >> (uVar23 & 0x1f)) << (uVar25 & 0x1f)) |
             (ushort)((uVar7 >> (uVar24 & 0x1f)) << (uVar26 & 0x1f)) |
             (ushort)((uVar17 >> (uVar15 & 0x1f)) << (uVar19 & 0x1f));
        local_38 = (uint)pSVar12->Rshift;
        puVar18 = (uint *)((int)puVar18 + 2);
        local_40 = (uint)pSVar12->Rloss;
        local_34 = (uint)pSVar12->Gshift;
        local_3c = (uint)pSVar12->Gloss;
        local_30 = (uint)pSVar12->Bshift;
        uVar30 = (uint)pSVar12->Bloss;
        uVar20 = (uint)pSVar12->Ashift;
        uVar28 = (uint)pSVar12->Aloss;
      }
      goto LAB_0893f598;
    }
    puVar29 = (uint *)((int)puVar29 + uVar22);
  } while( true );
}



----------------------------------------

// Function: SDL_CalculateAlphaBlit @ 0893ffd8

SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface *surface,int blit_index)

{
  Uint8 UVar1;
  Uint32 UVar2;
  SDL_PixelFormat *pSVar3;
  SDL_PixelFormat *pSVar4;
  
                    /* Unresolved local var: SDL_PixelFormat * sf@[DW_OP_reg7(a3)]
                       Unresolved local var: SDL_PixelFormat * df@[???] */
  pSVar4 = surface->format;
  UVar2 = pSVar4->Amask;
  pSVar3 = surface->map->dst->format;
  if (UVar2 == 0) {
    if ((surface->flags & 0x1000) != 0) {
      if (pSVar3->BytesPerPixel != '\x01') {
        return BlitNtoNSurfaceAlphaKey;
      }
      return BlitNto1SurfaceAlphaKey;
    }
    UVar1 = pSVar3->BytesPerPixel;
    if (UVar1 == '\x02') {
      if (surface->map->identity != 0) {
        if (pSVar3->Gmask == 0x7e0) {
          return Blit565to565SurfaceAlpha;
        }
        if (pSVar3->Gmask == 0x3e0) {
          return Blit555to555SurfaceAlpha;
        }
      }
    }
    else if (UVar1 == '\x04') {
      if ((((pSVar4->Rmask == pSVar3->Rmask) && (pSVar4->Gmask == pSVar3->Gmask)) &&
          (pSVar4->Bmask == pSVar3->Bmask)) &&
         (((pSVar4->Bmask | pSVar4->Rmask | pSVar4->Gmask) == 0xffffff &&
          (pSVar4->BytesPerPixel == '\x04')))) {
        return BlitRGBtoRGBSurfaceAlpha;
      }
    }
    else if (UVar1 == '\x01') {
      return BlitNto1SurfaceAlpha;
    }
    return BlitNtoNSurfaceAlpha;
  }
  UVar1 = pSVar3->BytesPerPixel;
  if (UVar1 != '\x02') {
    if (UVar1 == '\x04') {
      if (((UVar2 == 0xff000000) && (pSVar4->Rmask == pSVar3->Rmask)) &&
         ((pSVar4->Gmask == pSVar3->Gmask &&
          ((pSVar4->Bmask == pSVar3->Bmask && (pSVar4->BytesPerPixel == '\x04')))))) {
        return BlitRGBtoRGBPixelAlpha;
      }
      return BlitNtoNPixelAlpha;
    }
    if (UVar1 == '\x01') {
      return BlitNto1PixelAlpha;
    }
    goto LAB_08940050;
  }
  if (((pSVar4->BytesPerPixel != '\x04') || (UVar2 != 0xff000000)) || (pSVar4->Gmask != 0xff00))
  goto LAB_08940050;
  if (pSVar4->Rmask == 0xff) {
    if (pSVar3->Rmask != 0x1f) {
      UVar2 = pSVar4->Bmask;
      goto LAB_089400ac;
    }
    UVar2 = pSVar3->Gmask;
  }
  else {
    UVar2 = pSVar4->Bmask;
LAB_089400ac:
    if ((UVar2 != 0xff) || (pSVar3->Bmask != 0x1f)) goto LAB_08940050;
    UVar2 = pSVar3->Gmask;
  }
  if (UVar2 == 0x7e0) {
    return BlitARGBto565PixelAlpha;
  }
  if (UVar2 == 0x3e0) {
    return BlitARGBto555PixelAlpha;
  }
LAB_08940050:
  return BlitNtoNPixelAlpha;
}



----------------------------------------

// Function: Mix_Linked_Version @ 08940218

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

SDL_version * Mix_Linked_Version(void)

{
  Mix_Linked_Version::linked_version.major = '\x01';
  Mix_Linked_Version::linked_version.minor = '\x02';
  Mix_Linked_Version::linked_version.patch = '\x06';
  return &Mix_Linked_Version::linked_version;
}



----------------------------------------

// Function: Mix_QuerySpec @ 0894023c

int Mix_QuerySpec(int *frequency,Uint16 *format,int *channels)

{
  int iVar1;
  
  iVar1 = audio_opened;
  if (audio_opened != 0) {
    if (frequency != (int *)0x0) {
      *frequency = mixer.freq;
    }
    if (format != (Uint16 *)0x0) {
      *format = mixer.format;
    }
    if (channels != (int *)0x0) {
      *channels = (uint)mixer.channels;
    }
  }
  return iVar1;
}



----------------------------------------

// Function: Mix_GetMusicHookData @ 08940288

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void * Mix_GetMusicHookData(void)

{
  return music_data;
}



----------------------------------------

// Function: Mix_ReserveChannels @ 08940294

int Mix_ReserveChannels(int num)

{
  reserved_channels = num + num_channels;
  return num + num_channels;
}



----------------------------------------

// Function: checkchunkintegral @ 089402ac

int checkchunkintegral(Mix_Chunk *chunk)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: int frame_width@[???] */
  iVar2 = 2;
  if ((char)mixer.format != '\x10') {
    iVar2 = 1;
  }
  uVar1 = iVar2 * (uint)mixer.channels;
  uVar3 = chunk->alen;
  if (uVar1 == 0) {
    trap(7);
  }
  if (uVar3 % uVar1 != 0) {
    do {
      uVar3 = uVar3 - 1;
      if (uVar1 == 0) {
        trap(7);
      }
    } while (uVar3 % uVar1 != 0);
    chunk->alen = uVar3;
  }
  return uVar3;
}



----------------------------------------

// Function: Mix_Volume @ 08940318

int Mix_Volume(int which,int volume)

{
  int iVar1;
  int iVar2;
  int which_00;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int prev_volume@[???] */
  iVar2 = num_channels;
  if (which != -1) {
    iVar2 = mix_channel[which].volume;
    if (-1 < volume) {
      mix_channel[which].volume = volume + 0x80;
    }
    return iVar2;
  }
  which_00 = 0;
  if (num_channels < 1) {
    iVar3 = 0;
  }
  else {
    iVar3 = 0;
    do {
      iVar1 = Mix_Volume(which_00,volume);
      which_00 = which_00 + 1;
      iVar3 = iVar3 + iVar1;
    } while (which_00 != iVar2);
  }
  if (iVar2 == 0) {
    trap(7);
  }
  return iVar3 / iVar2;
}



----------------------------------------

// Function: Mix_VolumeChunk @ 089403ec

int Mix_VolumeChunk(Mix_Chunk *chunk,int volume)

{
  byte bVar1;
  
                    /* Unresolved local var: int prev_volume@[???] */
  bVar1 = chunk->volume;
  if (-1 < volume) {
    chunk->volume = (char)volume + 0x80;
  }
  return (uint)bVar1;
}



----------------------------------------

// Function: Mix_FadingChannel @ 08940408

Mix_Fading Mix_FadingChannel(int which)

{
  return mix_channel[which].fading;
}



----------------------------------------

// Function: Mix_Playing @ 08940428

int Mix_Playing(int which)

{
  _Mix_Channel *p_Var1;
  _Mix_Channel *p_Var2;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: int status@[???] */
  if (which == -1) {
                    /* Unresolved local var: int i@[???] */
    if (0 < num_channels) {
      iVar3 = 0;
      iVar4 = 1;
      p_Var1 = mix_channel;
      if (mix_channel->playing < 1) goto LAB_0894049c;
      do {
        iVar3 = iVar3 + 1;
        p_Var2 = p_Var1;
        while( true ) {
          p_Var1 = p_Var2 + 1;
          if (num_channels == iVar4) {
            return iVar3;
          }
          iVar4 = iVar4 + 1;
          if (0 < p_Var2[1].playing) break;
LAB_0894049c:
          p_Var2 = p_Var1;
          if (0 < p_Var1->looping) {
            iVar3 = iVar3 + 1;
          }
        }
      } while( true );
    }
    iVar3 = 0;
  }
  else {
    iVar3 = 1;
    if (mix_channel[which].playing < 1) {
      return (uint)(0 < mix_channel[which].looping);
    }
  }
  return iVar3;
}



----------------------------------------

// Function: Mix_GetChunk @ 089404c8

Mix_Chunk * Mix_GetChunk(int channel)

{
                    /* Unresolved local var: Mix_Chunk * retval@[???] */
  if ((-1 < channel) && (channel < num_channels)) {
    return mix_channel[channel].chunk;
  }
  return (Mix_Chunk *)0x0;
}



----------------------------------------

// Function: Mix_Paused @ 08940504

int Mix_Paused(int which)

{
  int iVar1;
  int iVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  
  if (which <= num_channels) {
    if (-1 < which) {
      return (uint)(mix_channel[which].paused != 0);
    }
                    /* Unresolved local var: int status@[???]
                       Unresolved local var: int i@[DW_OP_reg6(a2)] */
    iVar2 = 0;
    if (0 < num_channels) {
      iVar4 = 0;
      iVar1 = mix_channel->paused;
      p_Var3 = mix_channel;
      while( true ) {
        iVar4 = iVar4 + 1;
        if (iVar1 != 0) {
          iVar2 = iVar2 + 1;
        }
        if (num_channels == iVar4) break;
        iVar1 = p_Var3[1].paused;
        p_Var3 = p_Var3 + 1;
      }
      return iVar2;
    }
  }
  return 0;
}



----------------------------------------

// Function: Mix_GroupAvailable @ 08940584

int Mix_GroupAvailable(int tag)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: int i@[DW_OP_reg6(a2)] */
  iVar3 = 0;
  if (0 < num_channels) {
    iVar2 = 0;
    do {
      if (tag == -1) {
        iVar1 = *(int *)((int)&mix_channel->playing + iVar2);
LAB_089405cc:
        if (iVar1 < 1) {
          return iVar3;
        }
      }
      else if (tag == *(int *)((int)&mix_channel->tag + iVar2)) {
        iVar1 = *(int *)((int)&mix_channel->playing + iVar2);
        goto LAB_089405cc;
      }
      iVar3 = iVar3 + 1;
      iVar2 = iVar2 + 0x38;
    } while (iVar3 != num_channels);
  }
  return -1;
}



----------------------------------------

// Function: Mix_GroupCount @ 089405e8

int Mix_GroupCount(int tag)

{
  int iVar1;
  _Mix_Channel *p_Var2;
  _Mix_Channel *p_Var3;
  int iVar4;
  int iVar5;
  
                    /* Unresolved local var: int count@[???]
                       Unresolved local var: int i@[???] */
  iVar5 = 0;
  if (num_channels < 1) {
    return 0;
  }
  iVar4 = 0;
  p_Var2 = mix_channel;
  do {
    iVar1 = p_Var2->tag;
    p_Var3 = p_Var2;
    while( true ) {
      iVar4 = iVar4 + 1;
      p_Var2 = p_Var3 + 1;
      if ((iVar1 == tag) || (tag == -1)) break;
      if (iVar4 == num_channels) {
        return iVar5;
      }
      iVar1 = p_Var3[1].tag;
      p_Var3 = p_Var2;
    }
    iVar5 = iVar5 + 1;
    if (iVar4 == num_channels) {
      return iVar5;
    }
  } while( true );
}



----------------------------------------

// Function: Mix_GroupNewer @ 08940648

int Mix_GroupNewer(int tag)

{
  uint uVar1;
  int iVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  uint uVar5;
  int iVar6;
  
                    /* Unresolved local var: int chan@[???]
                       Unresolved local var: Uint32 maxtime@[???]
                       Unresolved local var: int i@[???] */
  iVar6 = -1;
  if (num_channels < 1) {
    return -1;
  }
  uVar5 = 0;
  iVar4 = 0;
  p_Var3 = mix_channel;
  do {
    if (p_Var3->tag == tag) {
      iVar2 = p_Var3->playing;
LAB_08940694:
      if ((iVar2 < 1) || (uVar1 = p_Var3->start_time, iVar2 = iVar4, p_Var3->start_time < uVar5))
      goto LAB_0894067c;
    }
    else {
      if (tag == -1) {
        iVar2 = p_Var3->playing;
        goto LAB_08940694;
      }
LAB_0894067c:
      uVar1 = uVar5;
      iVar2 = iVar6;
    }
    iVar6 = iVar2;
    uVar5 = uVar1;
    iVar4 = iVar4 + 1;
    p_Var3 = p_Var3 + 1;
    if (iVar4 == num_channels) {
      return iVar6;
    }
  } while( true );
}



----------------------------------------

// Function: Mix_GroupChannel @ 089406d0

int Mix_GroupChannel(int which,int tag)

{
  if ((-1 < which) && (which <= num_channels)) {
    SDL_LockAudio();
    mix_channel[which].tag = tag;
    SDL_UnlockAudio();
    return 1;
  }
  return 0;
}



----------------------------------------

// Function: Mix_GroupChannels @ 08940758

int Mix_GroupChannels(int from,int to,int tag)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: int status@[???] */
  if (from <= to) {
    iVar3 = 0;
    do {
      iVar2 = from + 1;
      iVar1 = Mix_GroupChannel(from,tag);
      iVar3 = iVar3 + iVar1;
      from = iVar2;
    } while (iVar2 <= to);
    return iVar3;
  }
  return 0;
}



----------------------------------------

// Function: Mix_ChannelFinished @ 089407e8

void Mix_ChannelFinished(_func_void_int *channel_finished)

{
  SDL_LockAudio();
  channel_done_callback = channel_finished;
  SDL_UnlockAudio();
  return;
}



----------------------------------------

// Function: Mix_HookMusic @ 08940814

void Mix_HookMusic(_func_void_void_ptr_Uint8_ptr_int *mix_func,void *arg)

{
  SDL_LockAudio();
  if (mix_func != (_func_void_void_ptr_Uint8_ptr_int *)0x0) {
    mix_music = mix_func;
    music_data = arg;
    SDL_UnlockAudio();
    return;
  }
  music_data = (void *)0x0;
  mix_music = music_mixer;
  SDL_UnlockAudio();
  return;
}



----------------------------------------

// Function: Mix_SetPostMix @ 08940884

void Mix_SetPostMix(_func_void_void_ptr_Uint8_ptr_int *mix_func,void *arg)

{
  SDL_LockAudio();
  mix_postmix_data = arg;
  mix_postmix = mix_func;
  SDL_UnlockAudio();
  return;
}



----------------------------------------

// Function: _Mix_remove_all_effects @ 089408c4

int _Mix_remove_all_effects(int channel,effect_info **e)

{
  Mix_EffectDone_t p_Var1;
  int iVar2;
  effect_info *aptr;
  _Mix_effectinfo *p_Var3;
  
                    /* Unresolved local var: effect_info * cur@[???]
                       Unresolved local var: effect_info * next@[???] */
  if (e == (effect_info **)0x0) {
    SDL_SetError("Internal error");
    iVar2 = 0;
  }
  else {
    aptr = *e;
    if (aptr == (effect_info *)0x0) {
      *e = (effect_info *)0x0;
    }
    else {
      p_Var1 = aptr->done_callback;
      while( true ) {
        p_Var3 = aptr->next;
        if (p_Var1 != (Mix_EffectDone_t)0x0) {
          (*p_Var1)(channel,aptr->udata);
        }
        free(aptr);
        if (p_Var3 == (_Mix_effectinfo *)0x0) break;
        p_Var1 = p_Var3->done_callback;
        aptr = p_Var3;
      }
      *e = (effect_info *)0x0;
    }
    iVar2 = 1;
  }
  return iVar2;
}



----------------------------------------

// Function: Mix_UnregisterAllEffects @ 08940958

int Mix_UnregisterAllEffects(int channel)

{
  int iVar1;
  effect_info **e;
  
                    /* Unresolved local var: effect_info * * e@[???]
                       Unresolved local var: int retval@[???] */
  e = &posteffects;
  if (channel != -2) {
    if ((channel < 0) || (num_channels <= channel)) {
      SDL_SetError("Invalid channel number");
      return 0;
    }
    e = &mix_channel[channel].effects;
  }
  SDL_LockAudio();
  iVar1 = _Mix_remove_all_effects(channel,e);
  SDL_UnlockAudio();
  return iVar1;
}



----------------------------------------

// Function: _Mix_channel_done_playing @ 08940a0c

void _Mix_channel_done_playing(int channel)

{
  if (channel_done_callback != (_func_void_int *)0x0) {
    (*channel_done_callback)(channel);
  }
  _Mix_remove_all_effects(channel,&mix_channel[channel].effects);
  return;
}



----------------------------------------

// Function: Mix_HaltChannel @ 08940a60

int Mix_HaltChannel(int which)

{
  int iVar1;
  _Mix_Channel *p_Var2;
  
                    /* Unresolved local var: int i@[???] */
  if (which == -1) {
    iVar1 = 0;
    if (num_channels < 1) {
      return 0;
    }
    do {
      Mix_HaltChannel(iVar1);
      iVar1 = iVar1 + 1;
    } while (iVar1 < num_channels);
    return 0;
  }
  SDL_LockAudio();
  p_Var2 = mix_channel + which;
  if (mix_channel[which].playing == 0) {
    p_Var2->expire = 0;
    if (p_Var2->fading == MIX_NO_FADING) goto LAB_08940ab4;
    iVar1 = p_Var2->fade_volume;
  }
  else {
    _Mix_channel_done_playing(which);
    p_Var2 = mix_channel + which;
    mix_channel[which].playing = 0;
    p_Var2->expire = 0;
    if (p_Var2->fading == MIX_NO_FADING) goto LAB_08940ab4;
    iVar1 = p_Var2->fade_volume;
  }
  p_Var2->volume = iVar1;
LAB_08940ab4:
  p_Var2->fading = MIX_NO_FADING;
  SDL_UnlockAudio();
  return 0;
}



----------------------------------------

// Function: Mix_HaltGroup @ 08940b54

int Mix_HaltGroup(int tag)

{
  int which;
  int iVar1;
  
                    /* Unresolved local var: int i@[???] */
  if (0 < num_channels) {
    which = 0;
    do {
      while (iVar1 = which + 1, mix_channel[which].tag != tag) {
        which = iVar1;
        if (num_channels <= iVar1) {
          return 0;
        }
      }
      Mix_HaltChannel(which);
      which = iVar1;
    } while (iVar1 < num_channels);
  }
  return 0;
}



----------------------------------------

// Function: Mix_UnregisterEffect @ 08940bfc

int Mix_UnregisterEffect(int channel,Mix_EffectFunc_t f)

{
  Mix_EffectDone_t p_Var1;
  effect_info *aptr;
  int iVar2;
  effect_info *peVar3;
  _Mix_effectinfo *p_Var4;
  effect_info **ppeVar5;
  
                    /* Unresolved local var: effect_info * * e@[???]
                       Unresolved local var: int retval@[???] */
  if (channel == -2) {
    SDL_LockAudio();
    ppeVar5 = &posteffects;
  }
  else {
    if ((channel < 0) || (num_channels <= channel)) {
      SDL_SetError("Invalid channel number");
      return 0;
    }
    ppeVar5 = &mix_channel[channel].effects;
    SDL_LockAudio();
                    /* Unresolved local var: effect_info * cur@[???]
                       Unresolved local var: effect_info * prev@[???]
                       Unresolved local var: effect_info * next@[???] */
    if (ppeVar5 == (effect_info **)0x0) {
      SDL_SetError("Internal error");
      SDL_UnlockAudio();
      return 0;
    }
  }
  aptr = *ppeVar5;
  if (aptr == (effect_info *)0x0) {
LAB_08940cd4:
    SDL_SetError("No such effect registered");
    SDL_UnlockAudio();
    iVar2 = 0;
  }
  else {
    if (f == aptr->callback) {
      peVar3 = (effect_info *)0x0;
      p_Var1 = aptr->done_callback;
    }
    else {
      do {
        peVar3 = aptr;
        aptr = peVar3->next;
        if (aptr == (effect_info *)0x0) goto LAB_08940cd4;
      } while (f != aptr->callback);
      p_Var1 = aptr->done_callback;
    }
    p_Var4 = aptr->next;
    if (p_Var1 != (Mix_EffectDone_t)0x0) {
      (*p_Var1)(channel,aptr->udata);
    }
    free(aptr);
    if (peVar3 == (effect_info *)0x0) {
      *ppeVar5 = p_Var4;
      iVar2 = 1;
      SDL_UnlockAudio();
    }
    else {
      peVar3->next = p_Var4;
      SDL_UnlockAudio();
      iVar2 = 1;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: Mix_FreeChunk @ 08940d80

void Mix_FreeChunk(Mix_Chunk *chunk)

{
  int iVar1;
  Mix_Chunk *pMVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  
                    /* Unresolved local var: int i@[???] */
  if (chunk == (Mix_Chunk *)0x0) {
    return;
  }
  SDL_LockAudio();
  iVar1 = num_channels;
  if ((mix_channel != (_Mix_Channel *)0x0) && (iVar4 = 0, 0 < num_channels)) {
    pMVar2 = mix_channel->chunk;
    p_Var3 = mix_channel;
    while( true ) {
      iVar4 = iVar4 + 1;
      if (chunk == pMVar2) {
        p_Var3->playing = 0;
      }
      if (iVar4 == iVar1) break;
      p_Var3 = p_Var3 + 1;
      pMVar2 = p_Var3->chunk;
    }
  }
  SDL_UnlockAudio();
  if (chunk->allocated == 0) {
    free(chunk);
    return;
  }
  free(chunk->abuf);
  free(chunk);
  return;
}



----------------------------------------

// Function: Mix_RegisterEffect @ 08940e30

int Mix_RegisterEffect(int channel,Mix_EffectFunc_t f,Mix_EffectDone_t d,void *arg)

{
  _Mix_effectinfo *p_Var1;
  int iVar2;
  effect_info *peVar3;
  effect_info *peVar4;
  effect_info **ppeVar5;
  
                    /* Unresolved local var: effect_info * * e@[???]
                       Unresolved local var: int retval@[???] */
  if (channel == -2) {
    SDL_LockAudio();
    p_Var1 = malloc(0x10);
    ppeVar5 = &posteffects;
  }
  else {
    if ((channel < 0) || (num_channels <= channel)) {
      SDL_SetError("Invalid channel number");
      return 0;
    }
    ppeVar5 = &mix_channel[channel].effects;
    SDL_LockAudio();
    p_Var1 = malloc(0x10);
                    /* Unresolved local var: effect_info * new_e@[???] */
    if (ppeVar5 == (effect_info **)0x0) {
      SDL_SetError("Internal error");
      SDL_UnlockAudio();
      return 0;
    }
  }
  if (f == (Mix_EffectFunc_t)0x0) {
    SDL_SetError("NULL effect callback");
    SDL_UnlockAudio();
    iVar2 = 0;
  }
  else if (p_Var1 == (_Mix_effectinfo *)0x0) {
    SDL_SetError("Out of memory");
    SDL_UnlockAudio();
    iVar2 = 0;
  }
  else {
    p_Var1->next = (_Mix_effectinfo *)0x0;
    peVar3 = *ppeVar5;
    p_Var1->callback = f;
    p_Var1->done_callback = d;
    p_Var1->udata = arg;
    if (peVar3 == (effect_info *)0x0) {
      *ppeVar5 = p_Var1;
      SDL_UnlockAudio();
      iVar2 = 1;
    }
    else {
      do {
        peVar4 = peVar3;
                    /* Unresolved local var: effect_info * cur@[???] */
        peVar3 = peVar4->next;
      } while (peVar3 != (_Mix_effectinfo *)0x0);
      peVar4->next = p_Var1;
      SDL_UnlockAudio();
      iVar2 = 1;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: Mix_QuickLoad_RAW @ 08940fb4

Mix_Chunk * Mix_QuickLoad_RAW(Uint8 *mem,Uint32 len)

{
  Mix_Chunk *pMVar1;
  char *fmt;
  
                    /* Unresolved local var: Mix_Chunk * chunk@[???] */
  fmt = "Audio device hasn\'t been opened";
  if (audio_opened != 0) {
    pMVar1 = malloc(0x10);
    fmt = "Out of memory";
    if (pMVar1 != (Mix_Chunk *)0x0) {
      pMVar1->alen = len;
      pMVar1->abuf = mem;
      pMVar1->volume = 0x80;
      pMVar1->allocated = 0;
      return pMVar1;
    }
  }
  SDL_SetError(fmt);
  return (Mix_Chunk *)0x0;
}



----------------------------------------

// Function: Mix_GroupOldest @ 08941048

int Mix_GroupOldest(int tag)

{
  uint uVar1;
  uint uVar2;
  int iVar3;
  _Mix_Channel *p_Var4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int chan@[???]
                       Unresolved local var: Uint32 mintime@[???]
                       Unresolved local var: int i@[???] */
  uVar2 = SDL_GetTicks();
  if (num_channels < 1) {
    return -1;
  }
  iVar6 = -1;
  iVar5 = 0;
  p_Var4 = mix_channel;
  do {
    if (p_Var4->tag == tag) {
      iVar3 = p_Var4->playing;
LAB_089410a8:
      if ((iVar3 < 1) || (uVar1 = p_Var4->start_time, iVar3 = iVar5, uVar2 < p_Var4->start_time))
      goto LAB_08941090;
    }
    else {
      if (tag == -1) {
        iVar3 = p_Var4->playing;
        goto LAB_089410a8;
      }
LAB_08941090:
      uVar1 = uVar2;
      iVar3 = iVar6;
    }
    iVar6 = iVar3;
    uVar2 = uVar1;
    iVar5 = iVar5 + 1;
    p_Var4 = p_Var4 + 1;
    if (iVar5 == num_channels) {
      return iVar6;
    }
  } while( true );
}



----------------------------------------

// Function: Mix_Resume @ 08941100

void Mix_Resume(int which)

{
  int iVar1;
  Uint32 UVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  
                    /* Unresolved local var: Uint32 sdl_ticks@[???] */
  UVar2 = SDL_GetTicks();
  SDL_LockAudio();
  iVar1 = num_channels;
  p_Var3 = mix_channel;
  if (which == -1) {
                    /* Unresolved local var: int i@[???] */
    iVar4 = 0;
    if (0 < num_channels) {
      do {
        iVar4 = iVar4 + 1;
        if (0 < p_Var3->playing) {
          if (p_Var3->expire == 0) {
            p_Var3->paused = 0;
          }
          else {
            p_Var3->expire = p_Var3->expire + (UVar2 - p_Var3->paused);
            p_Var3->paused = 0;
          }
        }
        p_Var3 = p_Var3 + 1;
      } while (iVar1 != iVar4);
      SDL_UnlockAudio();
      return;
    }
  }
  else if (0 < mix_channel[which].playing) {
    if (mix_channel[which].expire != 0) {
      mix_channel[which].expire = mix_channel[which].expire + (UVar2 - mix_channel[which].paused);
    }
    p_Var3[which].paused = 0;
  }
  SDL_UnlockAudio();
  return;
}



----------------------------------------

// Function: Mix_Pause @ 089411e0

void Mix_Pause(int which)

{
  int iVar1;
  Uint32 UVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  
                    /* Unresolved local var: Uint32 sdl_ticks@[DW_OP_reg6(a2)] */
  UVar2 = SDL_GetTicks();
  iVar1 = num_channels;
  if (which == -1) {
                    /* Unresolved local var: int i@[DW_OP_reg4(a0)] */
    iVar4 = 0;
    p_Var3 = mix_channel;
    if (0 < num_channels) {
      do {
        iVar4 = iVar4 + 1;
        if (0 < p_Var3->playing) {
          p_Var3->paused = UVar2;
        }
        p_Var3 = p_Var3 + 1;
      } while (iVar1 != iVar4);
      return;
    }
  }
  else if (0 < mix_channel[which].playing) {
    mix_channel[which].paused = UVar2;
  }
  return;
}



----------------------------------------

// Function: Mix_FadeOutChannel @ 08941274

int Mix_FadeOutChannel(int which,int ms)

{
  _Mix_Channel *p_Var1;
  _Mix_Channel *p_Var2;
  Uint32 UVar3;
  int iVar4;
  int which_00;
  int iVar5;
  
                    /* Unresolved local var: int status@[???] */
  if (audio_opened != 0) {
    if (which != -1) {
      SDL_LockAudio();
      p_Var2 = mix_channel;
      if (((mix_channel[which].playing == 0) || (p_Var1 = mix_channel + which, p_Var1->volume < 1))
         || (mix_channel[which].fading == MIX_FADING_OUT)) {
        iVar5 = 0;
        SDL_UnlockAudio();
      }
      else {
        mix_channel[which].fading = MIX_FADING_OUT;
        p_Var2[which].fade_volume = p_Var1->volume;
        p_Var2[which].fade_length = ms;
        UVar3 = SDL_GetTicks();
        p_Var2[which].ticks_fade = UVar3;
        SDL_UnlockAudio();
        iVar5 = 1;
      }
      return iVar5;
    }
                    /* Unresolved local var: int i@[???] */
    iVar5 = 0;
    if (0 < num_channels) {
      which_00 = 0;
      do {
        iVar4 = Mix_FadeOutChannel(which_00,ms);
        which_00 = which_00 + 1;
        iVar5 = iVar5 + iVar4;
      } while (which_00 < num_channels);
      return iVar5;
    }
  }
  return 0;
}



----------------------------------------

// Function: Mix_FadeOutGroup @ 089413b0

int Mix_FadeOutGroup(int tag,int ms)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int status@[???] */
  if (num_channels < 1) {
    return 0;
  }
  iVar3 = 0;
  iVar1 = 0;
  do {
    while (iVar2 = iVar1 + 1, mix_channel[iVar1].tag != tag) {
      iVar1 = iVar2;
      if (num_channels <= iVar2) {
        return iVar3;
      }
    }
    iVar1 = Mix_FadeOutChannel(iVar1,ms);
    iVar3 = iVar3 + iVar1;
    iVar1 = iVar2;
  } while (iVar2 < num_channels);
  return iVar3;
}



----------------------------------------

// Function: Mix_FadeInChannelTimed @ 089414a8

int Mix_FadeInChannelTimed(int which,Mix_Chunk *chunk,int loops,int ms,int ticks)

{
  int iVar1;
  Uint32 UVar2;
  _Mix_Channel *p_Var3;
  int iVar4;
  Uint32 UVar5;
  int in_t0;
  
                    /* Unresolved local var: int i@[???] */
  if (chunk == (Mix_Chunk *)0x0) {
    return -1;
  }
  iVar1 = checkchunkintegral(chunk);
  if (iVar1 == 0) {
    SDL_SetError("Tried to play a chunk with a bad frame");
    return -1;
  }
  SDL_LockAudio();
  iVar1 = which;
  if (which == -1) {
    iVar1 = reserved_channels;
    if (reserved_channels < num_channels) {
      p_Var3 = mix_channel + reserved_channels;
      iVar4 = p_Var3->playing;
      while ((0 < iVar4 && (iVar1 = iVar1 + 1, num_channels != iVar1))) {
        iVar4 = p_Var3[1].playing;
        p_Var3 = p_Var3 + 1;
      }
    }
    if (iVar1 == num_channels) goto LAB_08941588;
  }
  which = iVar1;
  if (-1 < which) {
                    /* Unresolved local var: Uint32 sdl_ticks@[???] */
    UVar2 = SDL_GetTicks();
    iVar1 = Mix_Playing(which);
    if (iVar1 != 0) {
      _Mix_channel_done_playing(which);
    }
    UVar5 = chunk->alen;
    p_Var3 = mix_channel + which;
    p_Var3->samples = chunk->abuf;
    p_Var3->playing = UVar5;
    p_Var3->looping = loops;
    p_Var3->chunk = chunk;
    p_Var3->fading = MIX_FADING_IN;
    p_Var3->fade_volume = p_Var3->volume;
    p_Var3->fade_length = ms;
    p_Var3->paused = 0;
    p_Var3->volume = 0;
    p_Var3->ticks_fade = UVar2;
    p_Var3->start_time = UVar2;
    if (in_t0 < 1) {
      p_Var3->expire = 0;
    }
    else {
      p_Var3->expire = UVar2 + in_t0;
    }
  }
LAB_08941588:
  SDL_UnlockAudio();
  return which;
}



----------------------------------------

// Function: Mix_ExpireChannel @ 08941680

int Mix_ExpireChannel(int which,int ticks)

{
  _Mix_Channel *p_Var1;
  Uint32 UVar2;
  int iVar3;
  int which_00;
  int iVar4;
  
                    /* Unresolved local var: int status@[???] */
  if (which == -1) {
                    /* Unresolved local var: int i@[???] */
    iVar4 = 0;
    if (0 < num_channels) {
      which_00 = 0;
      do {
        iVar3 = Mix_ExpireChannel(which_00,ticks);
        which_00 = which_00 + 1;
        iVar4 = iVar4 + iVar3;
      } while (which_00 < num_channels);
      return iVar4;
    }
  }
  else if (which < num_channels) {
    SDL_LockAudio();
    p_Var1 = mix_channel;
    if (ticks < 1) {
      UVar2 = 0;
    }
    else {
      UVar2 = SDL_GetTicks();
      UVar2 = UVar2 + ticks;
    }
    p_Var1[which].expire = UVar2;
    SDL_UnlockAudio();
    return 1;
  }
  return 0;
}



----------------------------------------

// Function: Mix_PlayChannelTimed @ 08941798

int Mix_PlayChannelTimed(int which,Mix_Chunk *chunk,int loops,int ticks)

{
  int iVar1;
  Uint32 UVar2;
  int iVar3;
  _Mix_Channel *p_Var4;
  Uint32 UVar5;
  
                    /* Unresolved local var: int i@[???] */
  if (chunk == (Mix_Chunk *)0x0) {
    SDL_SetError("Tried to play a NULL chunk");
    return -1;
  }
  iVar1 = checkchunkintegral(chunk);
  if (iVar1 == 0) {
    SDL_SetError("Tried to play a chunk with a bad frame");
    return -1;
  }
  SDL_LockAudio();
  iVar1 = which;
  if (which == -1) {
    iVar1 = reserved_channels;
    if (reserved_channels < num_channels) {
      p_Var4 = mix_channel + reserved_channels;
      iVar3 = p_Var4->playing;
      while ((0 < iVar3 && (iVar1 = iVar1 + 1, num_channels != iVar1))) {
        iVar3 = p_Var4[1].playing;
        p_Var4 = p_Var4 + 1;
      }
    }
    if (num_channels == iVar1) {
      SDL_SetError("No free channels available");
      goto LAB_08941858;
    }
  }
  which = iVar1;
  if (-1 < iVar1) {
                    /* Unresolved local var: Uint32 sdl_ticks@[???] */
    UVar2 = SDL_GetTicks();
    iVar3 = Mix_Playing(iVar1);
    if (iVar3 != 0) {
      _Mix_channel_done_playing(iVar1);
    }
    UVar5 = chunk->alen;
    p_Var4 = mix_channel + iVar1;
    p_Var4->samples = chunk->abuf;
    p_Var4->playing = UVar5;
    p_Var4->looping = loops;
    p_Var4->chunk = chunk;
    p_Var4->paused = 0;
    p_Var4->fading = MIX_NO_FADING;
    p_Var4->start_time = UVar2;
    if (ticks < 1) {
      p_Var4->expire = 0;
    }
    else {
      p_Var4->expire = UVar2 + ticks;
    }
  }
LAB_08941858:
  SDL_UnlockAudio();
  return which;
}



----------------------------------------

// Function: Mix_CloseAudio @ 08941944

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Mix_CloseAudio(void)

{
  int channel;
  
                    /* Unresolved local var: int i@[???] */
  if (audio_opened != 0) {
    if (audio_opened == 1) {
      channel = 0;
      if (0 < num_channels) {
        do {
          Mix_UnregisterAllEffects(channel);
          channel = channel + 1;
        } while (channel < num_channels);
      }
      Mix_UnregisterAllEffects(-2);
      close_music();
      Mix_HaltChannel(-1);
      SDL_CloseAudio();
      free(mix_channel);
      mix_channel = (_Mix_Channel *)0x0;
    }
    audio_opened = audio_opened + -1;
  }
  return;
}



----------------------------------------

// Function: Mix_DoEffects @ 089419ec

void * Mix_DoEffects(int chan,void *snd,int len)

{
  Mix_EffectFunc_t p_Var1;
  void *dst0;
  effect_info *peVar2;
  
                    /* Unresolved local var: int posteffect@[???]
                       Unresolved local var: effect_info * e@[???]
                       Unresolved local var: void * buf@[???] */
  peVar2 = posteffects;
  if (chan != -2) {
    peVar2 = mix_channel[chan].effects;
  }
  if (peVar2 != (effect_info *)0x0) {
    if (chan != -2) {
      dst0 = malloc(len);
      if (dst0 == (void *)0x0) {
        return snd;
      }
      memcpy(dst0,snd,len);
      p_Var1 = peVar2->callback;
      snd = dst0;
    }
    else {
      p_Var1 = peVar2->callback;
    }
    while( true ) {
      if (p_Var1 != (Mix_EffectFunc_t)0x0) {
        (*p_Var1)(chan,snd,len,peVar2->udata);
      }
      peVar2 = peVar2->next;
      if (peVar2 == (_Mix_effectinfo *)0x0) break;
      p_Var1 = peVar2->callback;
    }
  }
  return snd;
}



----------------------------------------

// Function: Mix_QuickLoad_WAV @ 08941ad0

Mix_Chunk * Mix_QuickLoad_WAV(Uint8 *mem)

{
  Mix_Chunk *pMVar1;
  int iVar2;
  uint uVar3;
  Uint8 *pUVar4;
  undefined4 local_20 [2];
  
                    /* Unresolved local var: Mix_Chunk * chunk@[???]
                       Unresolved local var: Uint8[4] magic@[???] */
  if (audio_opened == 0) {
    SDL_SetError("Audio device hasn\'t been opened");
    return (Mix_Chunk *)0x0;
  }
  pMVar1 = malloc(0x10);
  if (pMVar1 == (Mix_Chunk *)0x0) {
    SDL_SetError("Out of memory");
    pMVar1 = (Mix_Chunk *)0x0;
  }
  else {
    pMVar1->allocated = 0;
    pUVar4 = mem + 0xc;
    do {
      local_20[0] = *(undefined4 *)pUVar4;
      uVar3 = (uint)pUVar4[5] << 8 |
              (uint)pUVar4[7] << 0x18 | (uint)pUVar4[6] << 0x10 | (uint)pUVar4[4];
      pMVar1->alen = uVar3;
      pMVar1->abuf = pUVar4 + 8;
      pUVar4 = pUVar4 + 8 + uVar3;
      iVar2 = memcmp(local_20,&DAT_089e3b90,4);
    } while (iVar2 != 0);
    pMVar1->volume = 0x80;
  }
  return pMVar1;
}



----------------------------------------

// Function: Mix_LoadWAV_RW @ 08941be4

/* WARNING: Removing unreachable block (ram,0x08941d34) */

Mix_Chunk * Mix_LoadWAV_RW(SDL_RWops *src,int freesrc)

{
  Mix_Chunk *aptr;
  Uint32 UVar1;
  int iVar2;
  Uint8 *dst0;
  SDL_AudioSpec *pSVar3;
  _func_int_SDL_RWops_ptr *p_Var4;
  int local_88;
  Uint16 local_84;
  byte local_82;
  Uint16 dst_format;
  _func_void_void_ptr_Uint8_ptr_int *in_stack_ffffff88;
  Uint8 in_stack_ffffff8c;
  int in_stack_ffffff90;
  Uint32 local_58;
  int local_54;
  
                    /* Unresolved local var: Uint32 magic@[???]
                       Unresolved local var: Mix_Chunk * chunk@[???]
                       Unresolved local var: SDL_AudioSpec wavespec@[???]
                       Unresolved local var: SDL_AudioSpec * loaded@[???]
                       Unresolved local var: SDL_AudioCVT wavecvt@[???]
                       Unresolved local var: int samplesize@[???] */
  if (src == (SDL_RWops *)0x0) {
    SDL_SetError("Mix_LoadWAV_RW with NULL src");
    return (Mix_Chunk *)0x0;
  }
  if (audio_opened == 0) {
    SDL_SetError("Audio device hasn\'t been opened");
    if (freesrc == 0) {
      return (Mix_Chunk *)0x0;
    }
    p_Var4 = src->close;
  }
  else {
    aptr = malloc(0x10);
    if (aptr != (Mix_Chunk *)0x0) {
      UVar1 = SDL_ReadLE32(src);
      (*src->seek)(src,-4,1);
      if (UVar1 == 0x4d524f46) {
        pSVar3 = Mix_LoadAIFF_RW(src,freesrc,(SDL_AudioSpec *)&local_88,&aptr->abuf,
                                 (Uint32 *)in_stack_ffffff88);
        dst_format = (Uint16)in_stack_ffffff88;
      }
      else if (UVar1 < 0x4d524f47) {
        if ((UVar1 != 0x45564157) && (UVar1 != 0x46464952)) {
LAB_08941c8c:
          SDL_SetError("Unrecognized sound file type");
          return (Mix_Chunk *)0x0;
        }
        pSVar3 = SDL_LoadWAV_RW(src,freesrc,(SDL_AudioSpec *)&local_88,&aptr->abuf,
                                (Uint32 *)in_stack_ffffff88);
        dst_format = (Uint16)in_stack_ffffff88;
      }
      else if (UVar1 == 0x5367674f) {
        pSVar3 = Mix_LoadOGG_RW(src,freesrc,(SDL_AudioSpec *)&local_88,&aptr->abuf,
                                (Uint32 *)in_stack_ffffff88);
        dst_format = (Uint16)in_stack_ffffff88;
      }
      else {
        if (UVar1 != 0x61657243) goto LAB_08941c8c;
        pSVar3 = Mix_LoadVOC_RW(src,freesrc,(SDL_AudioSpec *)&local_88,&aptr->abuf,
                                (Uint32 *)in_stack_ffffff88);
        dst_format = (Uint16)in_stack_ffffff88;
      }
      if (pSVar3 == (SDL_AudioSpec *)0x0) {
        free(aptr);
        return (Mix_Chunk *)0x0;
      }
      iVar2 = SDL_BuildAudioCVT((SDL_AudioCVT *)&stack0xffffff90,local_84,local_82,local_88,
                                dst_format,in_stack_ffffff8c,in_stack_ffffff90);
      if (-1 < iVar2) {
        dst0 = malloc((-(((byte)local_84 / 8) * (uint)local_82) & aptr->alen) * local_54);
        if (dst0 != (Uint8 *)0x0) {
          memcpy(dst0,aptr->abuf,aptr->alen);
          SDL_FreeWAV(aptr->abuf);
          iVar2 = SDL_ConvertAudio((SDL_AudioCVT *)&stack0xffffff90);
          if (iVar2 < 0) {
            free(dst0);
            free(aptr);
            return (Mix_Chunk *)0x0;
          }
          aptr->volume = 0x80;
          aptr->allocated = 1;
          aptr->abuf = dst0;
          aptr->alen = local_58;
          return aptr;
        }
        SDL_SetError("Out of memory");
      }
      SDL_FreeWAV(aptr->abuf);
      free(aptr);
      return (Mix_Chunk *)0x0;
    }
    SDL_SetError("Out of memory");
    if (freesrc == 0) {
      return (Mix_Chunk *)0x0;
    }
    p_Var4 = src->close;
  }
  (*p_Var4)(src);
  return (Mix_Chunk *)0x0;
}



----------------------------------------

// Function: Mix_AllocateChannels @ 08941ef4

int Mix_AllocateChannels(int numchans)

{
  _Mix_Channel *p_Var1;
  int iVar2;
  
  if (numchans < 0) {
    return num_channels;
  }
  if (numchans != num_channels) {
    iVar2 = numchans;
    if (numchans < num_channels) {
      do {
                    /* Unresolved local var: int i@[???] */
        Mix_HaltChannel(iVar2);
        iVar2 = iVar2 + 1;
      } while (iVar2 < num_channels);
    }
    SDL_LockAudio();
    mix_channel = realloc(mix_channel,numchans * 0x38);
    if (num_channels < numchans) {
      iVar2 = 0;
      p_Var1 = mix_channel + num_channels;
      do {
                    /* Unresolved local var: int i@[???] */
        iVar2 = iVar2 + 1;
        p_Var1->chunk = (Mix_Chunk *)0x0;
        p_Var1->playing = 0;
        p_Var1->looping = 0;
        p_Var1->volume = 0x80;
        p_Var1->fade_volume = 0x80;
        p_Var1->fading = MIX_NO_FADING;
        p_Var1->tag = -1;
        p_Var1->expire = 0;
        p_Var1->effects = (effect_info *)0x0;
        p_Var1->paused = 0;
        p_Var1 = p_Var1 + 1;
      } while (numchans - num_channels != iVar2);
    }
    num_channels = numchans;
    SDL_UnlockAudio();
  }
  return num_channels;
}



----------------------------------------

// Function: Mix_OpenAudio @ 0894201c

int Mix_OpenAudio(int frequency,Uint16 format,int nchannels,int chunksize)

{
  int iVar1;
  _Mix_Channel *p_Var2;
  int iVar3;
  SDL_AudioSpec local_28;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: SDL_AudioSpec desired@[???] */
  if (audio_opened == 0) {
    local_28.channels = (Uint8)nchannels;
    local_28.samples = (Uint16)chunksize;
    local_28.callback = mix_channels;
    local_28.userdata = (void *)0x0;
    local_28.freq = frequency;
    local_28.format = format;
    iVar1 = SDL_OpenAudio(&local_28,&mixer);
    iVar3 = -1;
    if (-1 < iVar1) {
      iVar1 = open_music(&mixer);
      if (iVar1 < 0) {
        SDL_CloseAudio();
        iVar3 = -1;
      }
      else {
        num_channels = 8;
        p_Var2 = malloc(0x1c0);
        iVar1 = num_channels;
        mix_channel = p_Var2;
        if (0 < num_channels) {
          iVar3 = 0;
          do {
            iVar3 = iVar3 + 1;
            p_Var2->chunk = (Mix_Chunk *)0x0;
            p_Var2->playing = 0;
            p_Var2->looping = 0;
            p_Var2->volume = 0x80;
            p_Var2->fade_volume = 0x80;
            p_Var2->fading = MIX_NO_FADING;
            p_Var2->tag = -1;
            p_Var2->expire = 0;
            p_Var2->effects = (effect_info *)0x0;
            p_Var2->paused = 0;
            p_Var2 = p_Var2 + 1;
          } while (iVar1 != iVar3);
        }
        Mix_VolumeMusic(0x80);
        _Mix_InitEffects();
        audio_opened = 1;
        SDL_PauseAudio(0);
        iVar3 = 0;
      }
    }
  }
  else {
    audio_opened = audio_opened + 1;
    iVar3 = 0;
  }
  return iVar3;
}



----------------------------------------

// Function: mix_channels @ 08942148

/* WARNING: Removing unreachable block (ram,0x08942298) */

void mix_channels(void *udata,Uint8 *stream,int len)

{
  bool bVar1;
  Uint32 UVar2;
  _Mix_Channel *p_Var3;
  Uint8 *pUVar4;
  uint uVar5;
  Mix_Chunk *pMVar6;
  Uint32 UVar7;
  int iVar8;
  Mix_Fading MVar9;
  _Mix_Channel *p_Var10;
  uint uVar11;
  Uint32 UVar12;
  int iVar13;
  int channel;
  int local_2c;
  
                    /* Unresolved local var: Uint8 * mix_input@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int mixable@[???]
                       Unresolved local var: int volume@[???]
                       Unresolved local var: Uint32 sdl_ticks@[???] */
  if ((music_active != 0) || (mix_music != music_mixer)) {
    (*mix_music)(music_data,stream,len);
  }
  UVar2 = SDL_GetTicks();
  channel = 0;
  if (0 < num_channels) {
LAB_089421d4:
    do {
      p_Var3 = mix_channel;
      if (mix_channel[channel].paused == 0) {
        if (mix_channel[channel].expire == 0) {
          MVar9 = mix_channel[channel].fading;
LAB_08942210:
          if (MVar9 != MIX_NO_FADING) {
                    /* Unresolved local var: Uint32 ticks@[???] */
            uVar11 = mix_channel[channel].fade_length;
            uVar5 = UVar2 - mix_channel[channel].ticks_fade;
            if (uVar11 < uVar5) {
              if (MVar9 == MIX_FADING_OUT) {
                iVar8 = mix_channel[channel].fade_volume;
                mix_channel[channel].playing = 0;
                p_Var3[channel].expire = 0;
                Mix_Volume(channel,iVar8);
                _Mix_channel_done_playing(channel);
              }
              mix_channel[channel].fading = MIX_NO_FADING;
            }
            else if (MVar9 == MIX_FADING_OUT) {
              if (uVar11 == 0) {
                trap(7);
              }
              Mix_Volume(channel,((uVar11 - uVar5) * mix_channel[channel].fade_volume) / uVar11);
            }
            else {
              if (uVar11 == 0) {
                trap(7);
              }
              Mix_Volume(channel,(uVar5 * mix_channel[channel].fade_volume) / uVar11);
            }
          }
        }
        else {
          if (UVar2 <= mix_channel[channel].expire) {
            MVar9 = mix_channel[channel].fading;
            goto LAB_08942210;
          }
          mix_channel[channel].expire = 0;
          p_Var3[channel].playing = 0;
          p_Var3[channel].fading = MIX_NO_FADING;
          _Mix_channel_done_playing(channel);
        }
        p_Var3 = mix_channel + channel;
        iVar8 = p_Var3->playing;
        if (0 < iVar8) {
                    /* Unresolved local var: int index@[???]
                       Unresolved local var: int remaining@[???] */
          iVar13 = 0;
          if (len < 1) {
            p_Var10 = mix_channel + channel;
            iVar8 = p_Var10->looping;
            if (iVar8 != 0) {
              bVar1 = 0 < len;
              goto LAB_08942320;
            }
            iVar13 = p_Var10->playing;
          }
          else {
            pMVar6 = p_Var3->chunk;
            while( true ) {
              UVar12 = iVar8 + (len - iVar13);
              local_2c = (int)((uint)pMVar6->volume * p_Var3->volume) / 0x80;
              pUVar4 = Mix_DoEffects(channel,p_Var3->samples,UVar12);
              SDL_MixAudio(stream + iVar13,pUVar4,UVar12,local_2c);
              iVar13 = iVar13 + UVar12;
              if (pUVar4 != mix_channel[channel].samples) {
                free(pUVar4);
              }
              p_Var3 = mix_channel;
              p_Var10 = mix_channel + channel;
              iVar8 = p_Var10->playing - UVar12;
              p_Var10->samples = p_Var10->samples + UVar12;
              p_Var10->playing = iVar8;
              if (iVar8 == 0) {
                iVar8 = p_Var10->looping;
                if (iVar8 != 0) {
                  bVar1 = iVar13 < len;
                  goto LAB_08942320;
                }
                _Mix_channel_done_playing(channel);
                p_Var3 = mix_channel;
              }
              p_Var3 = p_Var3 + channel;
              iVar8 = p_Var3->playing;
              if ((iVar8 < 1) || (len <= iVar13)) break;
              pMVar6 = p_Var3->chunk;
            }
            p_Var10 = mix_channel + channel;
            iVar8 = p_Var10->looping;
            if (iVar8 == 0) {
              iVar13 = p_Var10->playing;
            }
            else {
              bVar1 = iVar13 < len;
LAB_08942320:
              if (bVar1) {
                pMVar6 = p_Var10->chunk;
                do {
                    /* Unresolved local var: int alen@[???] */
                  UVar12 = (len - iVar13) + pMVar6->alen;
                  pUVar4 = Mix_DoEffects(channel,pMVar6->abuf,UVar12);
                  SDL_MixAudio(stream + iVar13,pUVar4,UVar12,local_2c);
                  iVar13 = iVar13 + UVar12;
                  if (pUVar4 != (mix_channel[channel].chunk)->abuf) {
                    free(pUVar4);
                  }
                  p_Var10 = mix_channel + channel;
                  pMVar6 = p_Var10->chunk;
                  iVar8 = p_Var10->looping + -1;
                  p_Var10->looping = iVar8;
                  UVar7 = pMVar6->alen;
                  p_Var10->samples = pMVar6->abuf + UVar12;
                  p_Var10->playing = UVar7 - UVar12;
                  if (iVar8 == 0) {
                    iVar13 = p_Var10->playing;
                    goto LAB_089423d4;
                  }
                } while (iVar13 < len);
                iVar13 = p_Var10->playing;
              }
              else {
                iVar13 = p_Var10->playing;
              }
            }
          }
LAB_089423d4:
          if (((iVar13 == 0) && (iVar8 != 0)) && (p_Var10->looping = iVar8 + -1, iVar8 + -1 != 0)) {
            channel = channel + 1;
            pUVar4 = p_Var10->chunk->abuf;
            p_Var10->playing = p_Var10->chunk->alen;
            bVar1 = num_channels <= channel;
            p_Var10->samples = pUVar4;
            if (bVar1) break;
            goto LAB_089421d4;
          }
        }
      }
      channel = channel + 1;
    } while (channel < num_channels);
  }
  Mix_DoEffects(-2,stream,len);
  if (mix_postmix != (_func_void_void_ptr_Uint8_ptr_int *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0894245c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*mix_postmix)(mix_postmix_data,stream,len);
    return;
  }
  return;
}



----------------------------------------

// Function: MIX_string_equals @ 089425c4

int MIX_string_equals(char *str1,char *str2)

{
  byte bVar1;
  byte bVar2;
  uint uVar3;
  uint uVar4;
  
  bVar2 = *str1;
  if (bVar2 == 0) {
    bVar2 = *str2;
  }
  else {
    bVar1 = *str2;
    while( true ) {
      if (bVar1 == 0) {
        return 0;
      }
      uVar4 = (uint)bVar2;
                    /* Unresolved local var: int __x@[???] */
      uVar3 = (uint)bVar1;
      str1 = str1 + 1;
      str2 = str2 + 1;
      if ((__ctype_ptr[uVar4] & 2U) != 0) {
        uVar4 = uVar4 - 0x20;
      }
      if ((__ctype_ptr[uVar3] & 2U) != 0) {
        uVar3 = uVar3 - 0x20;
      }
      if (uVar4 != uVar3) {
        return 0;
      }
      bVar2 = *str1;
      if (bVar2 == 0) break;
      bVar1 = *str2;
    }
    bVar2 = *str2;
  }
  return (uint)(bVar2 == 0);
}



----------------------------------------

// Function: Mix_PauseMusic @ 08942648

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Mix_PauseMusic(void)

{
  music_active = 0;
  return;
}



----------------------------------------

// Function: Mix_ResumeMusic @ 08942658

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Mix_ResumeMusic(void)

{
  music_active = 1;
  return;
}



----------------------------------------

// Function: Mix_PausedMusic @ 0894266c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Mix_PausedMusic(void)

{
  return (uint)(music_active == 0);
}



----------------------------------------

// Function: Mix_LoadMUS_RW @ 0894267c

Mix_Music * Mix_LoadMUS_RW(SDL_RWops *rw)

{
  int iVar1;
  int iVar2;
  Mix_Music *aptr;
  OGG_music *pOVar3;
  MODULE *pMVar4;
  char *pcVar5;
  char acStack_18 [4];
  undefined1 local_14;
  
                    /* Unresolved local var: Uint8[5] magic@[???]
                       Unresolved local var: Mix_Music * music@[???]
                       Unresolved local var: int start@[???] */
  iVar1 = (*rw->seek)(rw,0,1);
  iVar2 = (*rw->read)(rw,acStack_18,1,4);
  if (iVar2 != 4) {
    SDL_SetError("Couldn\'t read from RWops",iVar1);
    return (Mix_Music *)0x0;
  }
  (*rw->seek)(rw,iVar1,0);
  local_14 = 0;
  aptr = malloc(0x18);
  if (aptr == (Mix_Music *)0x0) {
    SDL_SetError("Out of memory");
    return (Mix_Music *)0x0;
  }
  aptr->error = 0;
  iVar1 = strcmp(acStack_18,"OggS");
  if (iVar1 == 0) {
    aptr->type = MUS_OGG;
    pOVar3 = OGG_new_RW(rw);
    (aptr->data).ogg = pOVar3;
    if (pOVar3 == (OGG_music *)0x0) {
LAB_08942794:
      aptr->error = 1;
      goto LAB_08942734;
    }
  }
  else {
    aptr->type = MUS_MOD;
    pMVar4 = Player_LoadRW(rw,0x40,0);
    (aptr->data).module = pMVar4;
    if (pMVar4 == (MODULE *)0x0) {
      pcVar5 = MikMod_strerror(MikMod_errno);
      SDL_SetError("%s",pcVar5);
      goto LAB_08942794;
    }
  }
  if (aptr->error == 0) {
    return aptr;
  }
LAB_08942734:
  free(aptr);
  return (Mix_Music *)0x0;
}



----------------------------------------

// Function: Mix_GetSynchroValue @ 089427e0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Mix_GetSynchroValue(void)

{
  BOOL BVar1;
  int iVar2;
  
  if ((((music_playing != (Mix_Music *)0x0) && (music_stopped == 0)) &&
      (music_playing->type == MUS_MOD)) && (BVar1 = Player_Active(), BVar1 != 0)) {
    iVar2 = Player_GetSynchroValue();
    return iVar2;
  }
  return -1;
}



----------------------------------------

// Function: Mix_SetSynchroValue @ 08942840

int Mix_SetSynchroValue(int i)

{
  BOOL BVar1;
  
  if (music_playing != (Mix_Music *)0x0) {
    if (music_stopped != 0) {
      return -1;
    }
    if (music_playing->type != MUS_MOD) {
      return -1;
    }
    BVar1 = Player_Active();
    if (BVar1 != 0) {
      Player_SetSynchroValue(i);
      return 0;
    }
  }
  return -1;
}



----------------------------------------

// Function: Mix_FadingMusic @ 089428b4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

Mix_Fading Mix_FadingMusic(void)

{
  Mix_Fading MVar1;
  
                    /* Unresolved local var: Mix_Fading fading@[???] */
  SDL_LockAudio();
  MVar1 = MIX_NO_FADING;
  if (music_playing != (Mix_Music *)0x0) {
    MVar1 = music_playing->fading;
  }
  SDL_UnlockAudio();
  return MVar1;
}



----------------------------------------

// Function: Mix_FadeOutMusic @ 089428fc

int Mix_FadeOutMusic(int ms)

{
  Mix_Music *pMVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: int retval@[???] */
  SDL_LockAudio();
  pMVar1 = music_playing;
  iVar2 = 0;
  if ((music_playing != (Mix_Music *)0x0) && (music_playing->fading == MIX_NO_FADING)) {
    iVar3 = ms / ms_per_step;
    if (ms_per_step == 0) {
      trap(7);
    }
    iVar2 = 1;
    music_playing->fading = MIX_FADING_OUT;
    pMVar1->fade_step = 0;
    pMVar1->fade_steps = iVar3;
  }
  SDL_UnlockAudio();
  return iVar2;
}



----------------------------------------

// Function: Mix_GetMusicType @ 08942988

Mix_MusicType Mix_GetMusicType(Mix_Music *music)

{
  Mix_MusicType MVar1;
  
                    /* Unresolved local var: Mix_MusicType type@[???] */
  if (music == (Mix_Music *)0x0) {
    SDL_LockAudio();
    MVar1 = MUS_NONE;
    if (music_playing != (Mix_Music *)0x0) {
      MVar1 = music_playing->type;
    }
    SDL_UnlockAudio();
  }
  else {
    MVar1 = music->type;
  }
  return MVar1;
}



----------------------------------------

// Function: Mix_HookMusicFinished @ 089429e0

void Mix_HookMusicFinished(_func_void *music_finished)

{
  SDL_LockAudio();
  music_finished_hook = music_finished;
  SDL_UnlockAudio();
  return;
}



----------------------------------------

// Function: music_internal_playing @ 08942a0c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int music_internal_playing(void)

{
  uint uVar1;
  BOOL BVar2;
  int iVar3;
  Mix_MusicType MVar4;
  
                    /* Unresolved local var: int playing@[???] */
  MVar4 = music_playing->type;
  if (MVar4 == MUS_MOD) {
    BVar2 = Player_Active();
    return (uint)(BVar2 != 0);
  }
  if (MVar4 < MUS_MID) {
    uVar1 = 0;
    if (MVar4 == MUS_WAV) {
      iVar3 = WAVStream_Active();
      return (uint)(iVar3 != 0);
    }
  }
  else if (MVar4 == MUS_MID) {
    if (timidity_ok == 0) {
      uVar1 = 1;
    }
    else {
      iVar3 = Timidity_Active();
      uVar1 = (uint)(iVar3 != 0);
    }
  }
  else if (MVar4 == MUS_OGG) {
    iVar3 = OGG_playing((music_playing->data).ogg);
    uVar1 = (uint)(iVar3 != 0);
  }
  else {
    uVar1 = 0;
  }
  return uVar1;
}



----------------------------------------

// Function: Mix_PlayingMusic @ 08942acc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Mix_PlayingMusic(void)

{
  int iVar1;
  
                    /* Unresolved local var: int playing@[???] */
  SDL_LockAudio();
  iVar1 = 0;
  if (music_playing != (Mix_Music *)0x0) {
    iVar1 = music_internal_playing();
  }
  SDL_UnlockAudio();
  return iVar1;
}



----------------------------------------

// Function: music_internal_halt @ 08942b18

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void music_internal_halt(void)

{
  Mix_Music *pMVar1;
  Mix_MusicType MVar2;
  
  MVar2 = music_playing->type;
  if (MVar2 == MUS_MOD) {
    Player_Stop();
  }
  else if (MVar2 < MUS_MID) {
    if (MVar2 != MUS_WAV) {
      return;
    }
    WAVStream_Stop();
  }
  else if (MVar2 == MUS_MID) {
    if (timidity_ok != 0) {
      Timidity_Stop();
    }
  }
  else {
    if (MVar2 != MUS_OGG) {
      return;
    }
    OGG_stop((music_playing->data).ogg);
  }
  pMVar1 = music_playing;
  music_playing = (Mix_Music *)0x0;
  pMVar1->fading = MIX_NO_FADING;
  return;
}



----------------------------------------

// Function: Mix_HaltMusic @ 08942bd4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Mix_HaltMusic(void)

{
  SDL_LockAudio();
  if (music_playing != (Mix_Music *)0x0) {
    music_internal_halt();
  }
  SDL_UnlockAudio();
  return 0;
}



----------------------------------------

// Function: close_music @ 08942c14

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void close_music(void)

{
  Mix_HaltMusic();
  MikMod_Exit();
  MikMod_UnregisterAllLoaders();
  MikMod_UnregisterAllDrivers();
  return;
}



----------------------------------------

// Function: Mix_SetMusicCMD @ 08942c40

int Mix_SetMusicCMD(char *command)

{
  size_t sVar1;
  int iVar2;
  
  Mix_HaltMusic();
  if (music_cmd != (char *)0x0) {
    free(music_cmd);
    music_cmd = (char *)0x0;
  }
  iVar2 = 0;
  if (command != (char *)0x0) {
    sVar1 = strlen(command);
    music_cmd = malloc(sVar1 + 1);
    iVar2 = -1;
    if (music_cmd != (char *)0x0) {
      strcpy(music_cmd,command);
      iVar2 = 0;
    }
  }
  return iVar2;
}



----------------------------------------

// Function: music_internal_volume @ 08942ccc

void music_internal_volume(int volume)

{
  Mix_MusicType MVar1;
  
  MVar1 = music_playing->type;
  if (MVar1 == MUS_MOD) {
    Player_SetVolume((SWORD)volume);
    return;
  }
  if (MVar1 < MUS_MID) {
    if (MVar1 == MUS_WAV) {
      WAVStream_SetVolume(volume);
      return;
    }
  }
  else if (MVar1 == MUS_MID) {
    if (timidity_ok != 0) {
      Timidity_SetVolume(volume);
      return;
    }
  }
  else if (MVar1 == MUS_OGG) {
    OGG_setvolume((music_playing->data).ogg,volume);
    return;
  }
  return;
}



----------------------------------------

// Function: Mix_VolumeMusic @ 08942d48

int Mix_VolumeMusic(int volume)

{
  int iVar1;
  
                    /* Unresolved local var: int prev_volume@[???] */
  iVar1 = music_volume;
  if (-1 < volume) {
    music_volume = volume + 0x80;
    SDL_LockAudio();
    if (music_playing != (Mix_Music *)0x0) {
      music_internal_volume(music_volume);
    }
    SDL_UnlockAudio();
  }
  return iVar1;
}



----------------------------------------

// Function: music_internal_initialize_volume @ 08942dac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void music_internal_initialize_volume(void)

{
  int volume;
  
  volume = 0;
  if (music_playing->fading != MIX_FADING_IN) {
    volume = music_volume;
  }
  music_internal_volume(volume);
  return;
}



----------------------------------------

// Function: music_internal_position @ 08942dd4

int music_internal_position(double position)

{
  USItype UVar1;
  undefined4 in_a0;
  undefined4 in_a1;
  
                    /* Unresolved local var: int retval@[???] */
  if (music_playing->type == MUS_MOD) {
    UVar1 = __fixunsdfsi(position);
    Player_SetPosition((UWORD)UVar1);
    return 0;
  }
  if (music_playing->type != MUS_OGG) {
    return -1;
  }
  OGG_jump_to_time((music_playing->data).ogg,(double)CONCAT44(in_a1,in_a0));
  return 0;
}



----------------------------------------

// Function: Mix_SetMusicPosition @ 08942e58

int Mix_SetMusicPosition(double position)

{
  int iVar1;
  
                    /* Unresolved local var: int retval@[???] */
  SDL_LockAudio();
  if (music_playing == (Mix_Music *)0x0) {
    SDL_SetError("Music isn\'t playing");
    iVar1 = -1;
  }
  else {
    iVar1 = music_internal_position(position);
    if (iVar1 < 0) {
      SDL_SetError("Position not implemented for music type");
      SDL_UnlockAudio();
      return iVar1;
    }
  }
  SDL_UnlockAudio();
  return iVar1;
}



----------------------------------------

// Function: Mix_RewindMusic @ 08942efc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Mix_RewindMusic(void)

{
  double in_f12_13;
  
  Mix_SetMusicPosition(in_f12_13);
  return;
}



----------------------------------------

// Function: music_internal_play @ 08942f08

int music_internal_play(Mix_Music *music,double position)

{
  SItype SVar1;
  int iVar2;
  Mix_MusicType MVar3;
  double in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int retval@[???] */
  if (music_playing != (Mix_Music *)0x0) {
    music_internal_halt();
  }
  music_playing = music;
  if (music->type != MUS_MOD) {
    music_internal_initialize_volume();
    MVar3 = music->type;
    if (MVar3 != MUS_MOD) {
      if (MVar3 < MUS_MID) {
        if (MVar3 != MUS_WAV) {
LAB_08943004:
          SDL_SetError("Can\'t play unknown music type");
          music_playing = (Mix_Music *)0x0;
          return -1;
        }
        WAVStream_Start((music->data).wave);
      }
      else if (MVar3 == MUS_MID) {
        if (timidity_ok != 0) {
          Timidity_Start((music->data).midi);
        }
      }
      else {
        if (MVar3 != MUS_OGG) goto LAB_08943004;
        OGG_play((music->data).ogg);
      }
      goto LAB_08942fac;
    }
  }
  Player_Start((music->data).module);
  music_internal_initialize_volume();
LAB_08942fac:
  SVar1 = __gtdf2(in_f12_13,in_f14_15);
  if (SVar1 < 1) {
    music_internal_position(in_f12_13);
  }
  else {
    iVar2 = music_internal_position(in_f12_13);
    if (iVar2 < 0) {
      SDL_SetError("Position not implemented for music type");
      music_playing = (Mix_Music *)0x0;
      return -1;
    }
  }
  return 0;
}



----------------------------------------

// Function: Mix_FadeInMusicPos @ 08943090

int Mix_FadeInMusicPos(Mix_Music *music,int loops,int ms,double position)

{
  int iVar1;
  Mix_Fading MVar2;
  undefined4 in_t0;
  undefined4 in_t1;
  
                    /* Unresolved local var: int retval@[???] */
  if (music == (Mix_Music *)0x0) {
    SDL_SetError("music parameter was NULL");
    iVar1 = -1;
  }
  else {
    if (ms == 0) {
      music->fading = MIX_NO_FADING;
    }
    else {
      music->fading = MIX_FADING_IN;
    }
    iVar1 = ms_per_step;
    music->fade_step = 0;
    if (iVar1 == 0) {
      trap(7);
    }
    music->fade_steps = ms / iVar1;
    SDL_LockAudio();
    if (music_playing != (Mix_Music *)0x0) {
      MVar2 = music_playing->fading;
      while (MVar2 == MIX_FADING_OUT) {
        SDL_UnlockAudio();
        SDL_Delay(100);
        SDL_LockAudio();
        if (music_playing == (Mix_Music *)0x0) break;
        MVar2 = music_playing->fading;
      }
    }
    music_active = 1;
    music_loops = loops;
    iVar1 = music_internal_play(music,(double)CONCAT44(in_t1,in_t0));
    SDL_UnlockAudio();
  }
  return iVar1;
}



----------------------------------------

// Function: Mix_PlayMusic @ 089431c8

int Mix_PlayMusic(Mix_Music *music,int loops)

{
  int iVar1;
  double in_stack_00000010;
  
  iVar1 = Mix_FadeInMusicPos(music,loops,0,in_stack_00000010);
  return iVar1;
}



----------------------------------------

// Function: Mix_FadeInMusic @ 089431d8

int Mix_FadeInMusic(Mix_Music *music,int loops,int ms)

{
  int iVar1;
  double in_stack_00000010;
  
  iVar1 = Mix_FadeInMusicPos(music,loops,ms,in_stack_00000010);
  return iVar1;
}



----------------------------------------

// Function: Mix_FreeMusic @ 089431e4

void Mix_FreeMusic(Mix_Music *music)

{
  Mix_Fading MVar1;
  Mix_MusicType MVar2;
  
  if (music == (Mix_Music *)0x0) {
    return;
  }
  SDL_LockAudio();
  if (music == music_playing) {
    MVar1 = music->fading;
    while (MVar1 == MIX_FADING_OUT) {
      SDL_UnlockAudio();
      SDL_Delay(100);
      SDL_LockAudio();
      MVar1 = music->fading;
    }
    if (music == music_playing) {
      music_internal_halt();
    }
  }
  SDL_UnlockAudio();
  MVar2 = music->type;
  if (MVar2 != MUS_MOD) {
    if (MVar2 < MUS_MID) {
      if (MVar2 == MUS_WAV) {
        WAVStream_FreeSong((music->data).wave);
      }
    }
    else if (MVar2 == MUS_MID) {
      if (timidity_ok != 0) {
        Timidity_FreeSong((music->data).midi);
      }
    }
    else if (MVar2 == MUS_OGG) {
      OGG_delete((music->data).ogg);
    }
    free(music);
    return;
  }
  Player_Free((music->data).module);
  free(music);
  return;
}



----------------------------------------

// Function: Mix_LoadMUS @ 08943330

Mix_Music * Mix_LoadMUS(char *file)

{
  bool bVar1;
  FILE *fp;
  size_t sVar2;
  char *pcVar3;
  Mix_Music *aptr;
  int iVar4;
  WAVStream *pWVar5;
  MidiSong *pMVar6;
  OGG_music *pOVar7;
  MODULE *pMVar8;
  char acStack_30 [4];
  undefined1 local_2c;
  undefined1 auStack_2b [4];
  char acStack_27 [4];
  undefined1 local_23;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: char * ext@[???]
                       Unresolved local var: Uint8[5] magic@[???]
                       Unresolved local var: Uint8[9] moremagic@[???]
                       Unresolved local var: Mix_Music * music@[???] */
  fp = fopen(file,"rb");
  if (fp == (FILE *)0x0) {
LAB_0894345c:
    SDL_SetError("Couldn\'t read from \'%s\'",file);
    return (Mix_Music *)0x0;
  }
  sVar2 = fread(acStack_30,4,1,fp);
  if (sVar2 == 0) {
    fclose(fp);
    goto LAB_0894345c;
  }
  sVar2 = fread(auStack_2b,8,1,fp);
  if (sVar2 == 0) goto LAB_0894345c;
  local_2c = 0;
  local_23 = 0;
  fclose(fp);
  pcVar3 = strrchr(file,0x2e);
  if (pcVar3 != (char *)0x0) {
    pcVar3 = pcVar3 + 1;
  }
  aptr = malloc(0x18);
  if (aptr == (Mix_Music *)0x0) {
    SDL_SetError("Out of memory");
    return (Mix_Music *)0x0;
  }
  aptr->error = 0;
  if ((((pcVar3 == (char *)0x0) || (iVar4 = MIX_string_equals(pcVar3,"WAV"), iVar4 == 0)) &&
      ((iVar4 = strcmp(acStack_30,"RIFF"), iVar4 != 0 ||
       (iVar4 = strcmp(acStack_27,"WAVE"), iVar4 != 0)))) &&
     (iVar4 = strcmp(acStack_30,"FORM"), iVar4 != 0)) {
    if ((((pcVar3 != (char *)0x0) &&
         ((iVar4 = MIX_string_equals(pcVar3,"MID"), iVar4 != 0 ||
          (iVar4 = MIX_string_equals(pcVar3,"MIDI"), iVar4 != 0)))) ||
        (iVar4 = strcmp(acStack_30,"MThd"), iVar4 == 0)) ||
       ((iVar4 = strcmp(acStack_30,"RIFF"), iVar4 == 0 &&
        (iVar4 = strcmp(acStack_27,"RMID"), iVar4 == 0)))) {
      bVar1 = timidity_ok != 0;
      aptr->type = MUS_MID;
      if (bVar1) {
        pMVar6 = Timidity_LoadSong(file);
        (aptr->data).midi = pMVar6;
        if (pMVar6 != (MidiSong *)0x0) goto LAB_08943414;
      }
      pcVar3 = Timidity_Error();
LAB_08943508:
      SDL_SetError("%s",pcVar3);
      aptr->error = 1;
      goto LAB_08943420;
    }
    if (((pcVar3 == (char *)0x0) || (iVar4 = MIX_string_equals(pcVar3,"OGG"), iVar4 == 0)) &&
       (iVar4 = strcmp(acStack_30,"OggS"), iVar4 != 0)) {
      aptr->type = MUS_MOD;
      pMVar8 = Player_Load(file,0x40,0);
      (aptr->data).module = pMVar8;
      if (pMVar8 == (MODULE *)0x0) {
        pcVar3 = MikMod_strerror(MikMod_errno);
        goto LAB_08943508;
      }
      pMVar8->extspd = 1;
      ((aptr->data).module)->panflag = 1;
      ((aptr->data).module)->wrap = 0;
      ((aptr->data).module)->loop = 0;
    }
    else {
      aptr->type = MUS_OGG;
      pOVar7 = OGG_new(file);
      (aptr->data).ogg = pOVar7;
      if (pOVar7 == (OGG_music *)0x0) {
        aptr->error = 1;
        goto LAB_08943420;
      }
    }
  }
  else {
    aptr->type = MUS_WAV;
    pWVar5 = WAVStream_LoadSong(file,acStack_30);
    (aptr->data).wave = pWVar5;
    if (pWVar5 == (WAVStream *)0x0) {
      SDL_SetError("Unable to load WAV file");
      aptr->error = 1;
      goto LAB_08943420;
    }
  }
LAB_08943414:
  if (aptr->error == 0) {
    return aptr;
  }
LAB_08943420:
  free(aptr);
  return (Mix_Music *)0x0;
}



----------------------------------------

// Function: open_music @ 08943688

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

int open_music(SDL_AudioSpec *mixer)

{
  ushort uVar1;
  int iVar2;
  BOOL BVar3;
  int iVar4;
  char *pcVar5;
  uint uVar6;
  uint samples;
  float arg_a;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int music_error@[???] */
  iVar2 = WAVStream_Init(mixer);
  uVar1 = mixer->format;
  iVar2 = -(iVar2 >> 0x1f);
  music_swap8 = 0;
  music_swap16 = 0;
  if (uVar1 == 0x8008) {
LAB_089438e4:
    if (uVar1 == 0x8008) {
      music_swap8 = 1;
      md_mode = 0;
    }
    else {
      md_mode = 0;
    }
  }
  else {
    if (uVar1 < 0x8009) {
      if (uVar1 == 8) goto LAB_089438e4;
    }
    else if ((uVar1 == 0x8010) || (uVar1 == 0x9010)) {
      music_swap16 = (int)(uVar1 == 0x9010);
      md_mode = 1;
      goto LAB_089436ec;
    }
    SDL_SetError("Unknown hardware audio format");
    iVar2 = iVar2 + 1;
  }
LAB_089436ec:
  current_output_channels = (int)mixer->channels;
  current_output_format = mixer->format;
  if (1 < (uint)current_output_channels) {
    if (6 < (uint)current_output_channels) {
      SDL_SetError("Hardware uses more channels than mixer");
      iVar2 = iVar2 + 1;
    }
    md_mode = md_mode | 2;
  }
  md_mixfreq = (UWORD)mixer->freq;
  md_volume = '`';
  md_pansep = 0x80;
  md_musicvolume = 0x80;
  md_device = 0;
  md_sndfxvolume = 0x80;
  md_reverb = '\0';
  MikMod_RegisterAllDrivers();
  MikMod_RegisterAllLoaders();
  BVar3 = MikMod_Init((CHAR *)0x0);
  if (BVar3 == 0) {
    uVar6 = mixer->size;
  }
  else {
    iVar2 = iVar2 + 1;
    pcVar5 = MikMod_strerror(MikMod_errno);
    SDL_SetError("%s",pcVar5);
    uVar6 = mixer->size;
  }
  samples = (uint)mixer->samples;
  samplesize = uVar6 / samples;
  if (samples == 0) {
    trap(7);
  }
  iVar4 = Timidity_Init(mixer->freq,(uint)mixer->format,(uint)mixer->channels,samples);
  if (iVar4 == 0) {
    timidity_ok = 1;
    iVar4 = OGG_init(mixer);
  }
  else {
    timidity_ok = 0;
    iVar4 = OGG_init(mixer);
  }
  if (iVar4 < 0) {
    if (iVar2 == -1) goto LAB_0894385c;
  }
  else if (iVar2 == 0) {
LAB_0894385c:
    music_stopped = 0;
    music_playing = (Mix_Music *)0x0;
    Mix_VolumeMusic(0x80);
    arg_a = (float)mixer->samples;
    __extendsfdf2(arg_a);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    __floatsidf(mixer->freq);
    __divdf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    ms_per_step = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
    return 0;
  }
  music_stopped = 0;
  music_playing = (Mix_Music *)0x0;
  return -1;
}



----------------------------------------

// Function: music_mixer @ 08943944

/* WARNING: Removing unreachable block (ram,0x08943c0c) */
/* WARNING: Removing unreachable block (ram,0x08943d18) */
/* WARNING: Removing unreachable block (ram,0x08943c98) */

void music_mixer(void *udata,Uint8 *stream,int len)

{
  int *piVar1;
  Uint8 UVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  Mix_MusicType MVar6;
  Uint8 *pUVar7;
  Uint8 *pUVar8;
  Mix_Fading MVar10;
  ULONG b;
  Uint8 *pUVar9;
  
  if (music_playing == (Mix_Music *)0x0) {
    return;
  }
  if (music_active == 0) {
    return;
  }
  if (music_playing->fading == MIX_NO_FADING) {
LAB_089439f4:
    iVar5 = music_internal_playing();
    iVar4 = music_loops;
joined_r0x089439fc:
    music_loops = iVar4;
    if (iVar5 == 0) {
      music_loops = iVar4 + -1;
      if ((iVar4 == 0) || (iVar4 = music_loops, music_loops == 0)) goto LAB_08943a9c;
                    /* Unresolved local var: Mix_Fading current_fade@[???] */
      MVar10 = music_playing->fading;
      music_internal_play(music_playing,0.0);
      music_playing->fading = MVar10;
    }
    MVar6 = music_playing->type;
    if (MVar6 == MUS_MOD) {
      if (current_output_channels < 3) {
        VC_WriteBytes((SBYTE *)stream,len);
      }
      else {
                    /* Unresolved local var: int small_len@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Uint8 * src@[???]
                       Unresolved local var: Uint8 * dst@[???] */
        b = (len << 1) / current_output_channels;
        if (current_output_channels == 0) {
          trap(7);
        }
        VC_WriteBytes((SBYTE *)stream,b);
        iVar4 = current_output_channels;
        if ((char)current_output_format == '\b') {
          iVar5 = (int)b / 2;
          if (iVar5 != 0) {
            pUVar7 = stream + (len - current_output_channels);
            iVar3 = -current_output_channels;
            pUVar9 = stream + b;
            do {
              pUVar8 = pUVar9 + -2;
              iVar5 = iVar5 + -1;
              *pUVar7 = *pUVar8;
              pUVar7[1] = pUVar9[-1];
              pUVar7[2] = *pUVar8;
              pUVar7[3] = pUVar9[-1];
              if (iVar4 == 6) {
                pUVar7[4] = *pUVar8;
                pUVar7[5] = pUVar9[-1];
              }
              pUVar7 = pUVar7 + iVar3;
              pUVar9 = pUVar8;
            } while (iVar5 != 0);
          }
        }
        else if (((char)current_output_format == '\x10') && (iVar5 = (int)b / 4, iVar5 != 0)) {
          pUVar7 = stream + current_output_channels * -2 + len;
          iVar3 = current_output_channels * -2;
          pUVar9 = stream + b;
          do {
            pUVar8 = pUVar9 + -4;
            iVar5 = iVar5 + -1;
            *pUVar7 = *pUVar8;
            pUVar7[1] = pUVar9[-3];
            pUVar7[2] = pUVar9[-2];
            pUVar7[3] = pUVar9[-1];
            pUVar7[4] = *pUVar8;
            pUVar7[5] = pUVar9[-3];
            pUVar7[6] = pUVar9[-2];
            pUVar7[7] = pUVar9[-1];
            if (iVar4 == 6) {
              pUVar7[8] = *pUVar8;
              pUVar7[9] = pUVar9[-3];
              pUVar7[10] = pUVar9[-2];
              pUVar7[0xb] = pUVar9[-1];
            }
            pUVar7 = pUVar7 + iVar3;
            pUVar9 = pUVar8;
          } while (iVar5 != 0);
        }
      }
      if (music_swap8 == 0) {
        if (music_swap16 != 0) {
                    /* Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: Uint8 tmp@[???]
                       Unresolved local var: int i@[???] */
          for (iVar4 = len / 2; iVar4 != 0; iVar4 = iVar4 + -1) {
            UVar2 = stream[1];
            stream[1] = *stream;
            *stream = UVar2;
            stream = stream + 2;
          }
        }
      }
      else {
                    /* Unresolved local var: Uint8 * dst@[???]
                       Unresolved local var: int i@[???] */
        for (; len != 0; len = len + -1) {
          *stream = *stream ^ 0x80;
          stream = stream + 1;
        }
      }
    }
    else if (MVar6 < MUS_MID) {
      if (MVar6 == MUS_WAV) {
        WAVStream_PlaySome(stream,len);
        return;
      }
    }
    else if (MVar6 == MUS_MID) {
      if (timidity_ok != 0) {
                    /* Unresolved local var: int samples@[???] */
        if (samplesize == 0) {
          trap(7);
        }
        Timidity_PlaySome(stream,len / samplesize);
        return;
      }
    }
    else if (MVar6 == MUS_OGG) {
      OGG_playAudio((music_playing->data).ogg,stream,len);
      return;
    }
  }
  else {
    iVar4 = music_playing->fade_step;
    piVar1 = &music_playing->fade_steps;
    music_playing->fade_step = iVar4 + 1;
    if (iVar4 < *piVar1) {
                    /* Unresolved local var: int volume@[DW_OP_reg4(a0)]
                       Unresolved local var: int fade_step@[???]
                       Unresolved local var: int fade_steps@[???] */
      iVar4 = music_playing->fade_steps;
      if (music_playing->fading == MIX_FADING_OUT) {
        if (iVar4 == 0) {
          trap(7);
        }
        music_internal_volume(((iVar4 - music_playing->fade_step) * music_volume) / iVar4);
      }
      else {
        if (iVar4 == 0) {
          trap(7);
        }
        music_internal_volume((music_playing->fade_step * music_volume) / iVar4);
      }
      goto LAB_089439f4;
    }
    iVar4 = music_loops;
    if (music_playing->fading != MIX_FADING_OUT) {
      music_playing->fading = MIX_NO_FADING;
      iVar5 = music_internal_playing();
      iVar4 = music_loops;
      goto joined_r0x089439fc;
    }
LAB_08943a9c:
    music_loops = iVar4;
    music_internal_halt();
    if (music_finished_hook != (_func_void *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08943ac4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*music_finished_hook)();
      return;
    }
  }
  return;
}



----------------------------------------

// Function: OGG_init @ 08943db4

int OGG_init(SDL_AudioSpec *mixerfmt)

{
  mixer.userdata = mixerfmt->userdata;
  mixer.format = mixerfmt->format;
  mixer.channels = mixerfmt->channels;
  mixer.silence = mixerfmt->silence;
  mixer.samples = mixerfmt->samples;
  mixer.padding = mixerfmt->padding;
  mixer.size = mixerfmt->size;
  mixer.callback = mixerfmt->callback;
  mixer.freq = mixerfmt->freq;
  return 0;
}



----------------------------------------

// Function: OGG_setvolume @ 08943df4

void OGG_setvolume(OGG_music *music,int volume)

{
  music->volume = volume;
  return;
}



----------------------------------------

// Function: sdl_read_func @ 08943dfc

size_t sdl_read_func(void *ptr,size_t size,size_t nmemb,void *datasource)

{
  size_t sVar1;
  
                    /* WARNING: Could not recover jumptable at 0x08943e18. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  sVar1 = (**(code **)((int)datasource + 4))(datasource,ptr,size,nmemb);
  return sVar1;
}



----------------------------------------

// Function: sdl_seek_func @ 08943e20

int sdl_seek_func(void *datasource,ogg_int64_t offset,int whence)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x08943e28. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (**(code **)datasource)(datasource,(int)offset);
  return iVar1;
}



----------------------------------------

// Function: sdl_close_func @ 08943e30

int sdl_close_func(void *datasource)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x08943e34. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (**(code **)((int)datasource + 0xc))();
  return iVar1;
}



----------------------------------------

// Function: sdl_tell_func @ 08943e3c

long sdl_tell_func(void *datasource)

{
  long lVar1;
  
                    /* WARNING: Could not recover jumptable at 0x08943e44. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  lVar1 = (**(code **)datasource)(datasource,0,1);
  return lVar1;
}



----------------------------------------

// Function: OGG_play @ 08943e4c

void OGG_play(OGG_music *music)

{
  music->playing = 1;
  return;
}



----------------------------------------

// Function: OGG_playing @ 08943e58

int OGG_playing(OGG_music *music)

{
  return music->playing;
}



----------------------------------------

// Function: OGG_stop @ 08943e60

void OGG_stop(OGG_music *music)

{
  music->playing = 0;
  return;
}



----------------------------------------

// Function: OGG_jump_to_time @ 08943e68

void OGG_jump_to_time(OGG_music *music,double time)

{
  DFtype in_f12_13;
  
  __fixdfdi(in_f12_13);
  ov_time_seek(&music->vf);
  return;
}



----------------------------------------

// Function: OGG_delete @ 08943ea0

void OGG_delete(OGG_music *music)

{
  Uint8 *aptr;
  
  if (music != (OGG_music *)0x0) {
    aptr = (music->cvt).buf;
    if (aptr != (Uint8 *)0x0) {
      free(aptr);
    }
    ov_clear(&music->vf);
    free(music);
    return;
  }
  return;
}



----------------------------------------

// Function: OGG_playAudio @ 08943ef4

void OGG_playAudio(OGG_music *music,Uint8 *snd,int len)

{
  size_t len0;
  int iVar1;
  Uint8 *pUVar2;
  int volume;
  Uint32 len_00;
  SDL_AudioCVT *cvt;
  int local_1030;
  undefined1 auStackY_102c [12];
  Uint16 in_stack_ffffefe0;
  Uint8 in_stack_ffffefe4;
  int in_stack_ffffefe8;
  
                    /* Unresolved local var: int mixable@[???] */
  if ((0 < len) && (music->playing != 0)) {
    iVar1 = music->len_available;
    cvt = &music->cvt;
    if (iVar1 == 0) goto LAB_08943fac;
LAB_08943f54:
    volume = music->volume;
LAB_08943f58:
    len_00 = len + iVar1;
    if (volume == 0x80) goto LAB_08944070;
LAB_08943f64:
    SDL_MixAudio(snd,music->snd_available,len_00,volume);
    len = len - len_00;
    iVar1 = music->len_available - len_00;
    music->snd_available = music->snd_available + len_00;
    music->len_available = iVar1;
    if (0 < len) {
      do {
        if (music->playing == 0) {
          return;
        }
        snd = snd + len_00;
        if (iVar1 != 0) goto LAB_08943f54;
LAB_08943fac:
        len0 = ov_read(&music->vf,auStackY_102c,0x1000,&local_1030);
                    /* Unresolved local var: int section@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: char[4096] data@[???]
                       Unresolved local var: SDL_AudioCVT * cvt@[???] */
        if ((int)len0 < 1) {
          iVar1 = music->len_available;
          if (len0 != 0) {
            volume = music->volume;
            goto LAB_08943f58;
          }
LAB_089440f4:
          music->playing = 0;
          goto LAB_08943f54;
        }
        if (music->section != local_1030) {
          iVar1 = ov_info(&music->vf,0xffffffff);
                    /* Unresolved local var: vorbis_info * vi@[???] */
          SDL_BuildAudioCVT(cvt,0x8010,*(Uint8 *)(iVar1 + 4),*(int *)(iVar1 + 8),in_stack_ffffefe0,
                            in_stack_ffffefe4,in_stack_ffffefe8);
          pUVar2 = (music->cvt).buf;
          if (pUVar2 == (Uint8 *)0x0) {
            iVar1 = (music->cvt).len_mult;
          }
          else {
            free(pUVar2);
            iVar1 = (music->cvt).len_mult;
          }
          pUVar2 = malloc(iVar1 << 0xc);
          (music->cvt).buf = pUVar2;
          music->section = local_1030;
        }
        pUVar2 = (music->cvt).buf;
        if (pUVar2 == (Uint8 *)0x0) {
          SDL_SetError("Out of memory");
          iVar1 = music->len_available;
          goto LAB_089440f4;
        }
        memcpy(pUVar2,auStackY_102c,len0);
        if (cvt->needed == 0) {
          (music->cvt).len_cvt = len0;
          pUVar2 = (music->cvt).buf;
        }
        else {
          (music->cvt).len = len0;
          SDL_ConvertAudio(cvt);
          pUVar2 = (music->cvt).buf;
        }
        iVar1 = (music->cvt).len_cvt;
        volume = music->volume;
        music->snd_available = pUVar2;
        music->len_available = iVar1;
        len_00 = len + iVar1;
        if (volume != 0x80) goto LAB_08943f64;
LAB_08944070:
        memcpy(snd,music->snd_available,len_00);
        len = len - len_00;
        iVar1 = music->len_available - len_00;
        music->snd_available = music->snd_available + len_00;
        music->len_available = iVar1;
        if (len < 1) {
          return;
        }
      } while( true );
    }
  }
  return;
}



----------------------------------------

// Function: OGG_new_RW @ 0894410c

OGG_music * OGG_new_RW(SDL_RWops *rw)

{
  OGG_music *music;
  int iVar1;
  
                    /* Unresolved local var: OGG_music * music@[???]
                       Unresolved local var: ov_callbacks callbacks@[???] */
  music = malloc(0x198);
  if (music == (OGG_music *)0x0) {
    SDL_SetError("Out of memory");
    return (OGG_music *)0x0;
  }
  memset(music,0,0x198);
  OGG_stop(music);
  OGG_setvolume(music,0x80);
  music->section = -1;
  iVar1 = ov_open_callbacks(rw,&music->vf,0,0);
  if (iVar1 < 0) {
    SDL_SetError("Not an Ogg Vorbis audio stream");
    free(music);
    (*rw->close)(rw);
    music = (OGG_music *)0x0;
  }
  return music;
}



----------------------------------------

// Function: OGG_new @ 08944218

OGG_music * OGG_new(char *file)

{
  OGG_music *music;
  FILE *fp;
  int iVar1;
  
                    /* Unresolved local var: OGG_music * music@[???]
                       Unresolved local var: FILE * fp@[???] */
  music = malloc(0x198);
  if (music != (OGG_music *)0x0) {
    memset(music,0,0x198);
    OGG_stop(music);
    OGG_setvolume(music,0x80);
    music->section = -1;
    fp = fopen(file,"rb");
    if (fp == (FILE *)0x0) {
      SDL_SetError("Couldn\'t open %s",file,0,0);
      free(music);
      music = (OGG_music *)0x0;
    }
    else {
      iVar1 = ov_open(fp,&music->vf);
      if (iVar1 < 0) {
        SDL_SetError("Not an Ogg Vorbis audio stream");
        free(music);
        fclose(fp);
        music = (OGG_music *)0x0;
      }
    }
    return music;
  }
  SDL_SetError("Out of memory");
  return (OGG_music *)0x0;
}



----------------------------------------

// Function: WAVStream_Init @ 08944330

int WAVStream_Init(SDL_AudioSpec *mixerfmt)

{
  mixer.userdata = mixerfmt->userdata;
  mixer.format = mixerfmt->format;
  mixer.channels = mixerfmt->channels;
  mixer.silence = mixerfmt->silence;
  mixer.samples = mixerfmt->samples;
  mixer.padding = mixerfmt->padding;
  mixer.size = mixerfmt->size;
  mixer.callback = mixerfmt->callback;
  mixer.freq = mixerfmt->freq;
  return 0;
}



----------------------------------------

// Function: WAVStream_SetVolume @ 08944370

void WAVStream_SetVolume(int volume)

{
  wavestream_volume = volume;
  return;
}



----------------------------------------

// Function: WAVStream_Stop @ 0894437c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void WAVStream_Stop(void)

{
  music = (WAVStream *)0x0;
  return;
}



----------------------------------------

// Function: WAVStream_Active @ 08944388

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int WAVStream_Active(void)

{
  uint uVar1;
  long lVar2;
  
                    /* Unresolved local var: int active@[???] */
  uVar1 = 0;
  if (music != (WAVStream *)0x0) {
    lVar2 = ftell(music->wavefp);
    uVar1 = (uint)(lVar2 < music->stop);
  }
  return uVar1;
}



----------------------------------------

// Function: WAVStream_FreeSong @ 089443c8

void WAVStream_FreeSong(WAVStream *wave)

{
  Uint8 *aptr;
  
  if (wave != (WAVStream *)0x0) {
    if (wave->wavefp != (FILE *)0x0) {
      fclose(wave->wavefp);
    }
    aptr = (wave->cvt).buf;
    if (aptr != (Uint8 *)0x0) {
      free(aptr);
    }
    free(wave);
    return;
  }
  return;
}



----------------------------------------

// Function: WAVStream_PlaySome @ 08944428

void WAVStream_PlaySome(Uint8 *stream,int len)

{
  WAVStream *pWVar1;
  long lVar2;
  SItype SVar3;
  size_t sVar4;
  Uint8 *pUVar5;
  int iVar6;
  WAVStream *pWVar7;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: long pos@[???] */
  if (music != (WAVStream *)0x0) {
    lVar2 = ftell(music->wavefp);
    pWVar7 = music;
    if (lVar2 < music->stop) {
      if ((music->cvt).needed == 0) {
        fread(stream,(music->stop - lVar2) + len,1,music->wavefp);
        return;
      }
                    /* Unresolved local var: int original_len@[???] */
      __floatsidf(len);
      __divdf3(in_f12_13,in_f14_15);
      SVar3 = __fixdfsi(in_f12_13);
      if (SVar3 != (pWVar7->cvt).len) {
                    /* Unresolved local var: int worksize@[???] */
        pUVar5 = (pWVar7->cvt).buf;
        if (pUVar5 == (Uint8 *)0x0) {
          iVar6 = (pWVar7->cvt).len_mult;
        }
        else {
          free(pUVar5);
          iVar6 = (music->cvt).len_mult;
          pWVar7 = music;
        }
        pUVar5 = malloc(SVar3 * iVar6);
        pWVar1 = music;
        (pWVar7->cvt).buf = pUVar5;
        if ((pWVar1->cvt).buf == (Uint8 *)0x0) {
          return;
        }
        (pWVar1->cvt).len = SVar3;
      }
      sVar4 = fread((music->cvt).buf,1,SVar3 + (music->stop - lVar2),music->wavefp);
      pWVar7 = music;
      if (((music->cvt).src_format & 0x10) == 0) {
        (music->cvt).len = sVar4;
      }
      else {
        if ((sVar4 & 1) != 0) {
          sVar4 = sVar4 - 1;
        }
        (music->cvt).len = sVar4;
      }
      SDL_ConvertAudio(&pWVar7->cvt);
      SDL_MixAudio(stream,(music->cvt).buf,(music->cvt).len_cvt,wavestream_volume);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: WAVStream_Start @ 089445d4

void WAVStream_Start(WAVStream *wave)

{
  FILE *fp;
  long offset;
  
  fp = wave->wavefp;
  offset = wave->start;
  fp->_flags = fp->_flags & 0xff9f;
  fseek(fp,offset,0);
  music = wave;
  return;
}



----------------------------------------

// Function: ReadChunk @ 0894461c

int ReadChunk(SDL_RWops *src,Chunk *chunk,int read_data)

{
  Uint32 UVar1;
  Uint8 *pUVar2;
  int iVar3;
  
  UVar1 = SDL_ReadLE32(src);
  chunk->magic = UVar1;
  UVar1 = SDL_ReadLE32(src);
  chunk->length = UVar1;
  if (read_data == 0) {
    (*src->seek)(src,UVar1,1);
    UVar1 = chunk->length;
  }
  else {
    pUVar2 = malloc(UVar1);
    chunk->data = pUVar2;
    if (pUVar2 == (Uint8 *)0x0) {
      SDL_SetError("Out of memory");
      UVar1 = 0xffffffff;
    }
    else {
      iVar3 = (*src->read)(src,pUVar2,chunk->length,1);
      if (iVar3 == 1) {
        UVar1 = chunk->length;
      }
      else {
        SDL_SetError("Couldn\'t read chunk");
        free(chunk->data);
        UVar1 = 0xffffffff;
      }
    }
  }
  return UVar1;
}



----------------------------------------

// Function: WAVStream_LoadSong @ 089446f4

WAVStream * WAVStream_LoadSong(char *file,char *magic)

{
  bool bVar1;
  bool bVar2;
  Uint16 UVar3;
  WAVStream *m;
  int iVar4;
  FILE *fp;
  SDL_RWops *pSVar5;
  Uint32 UVar6;
  Uint32 UVar7;
  _func_int_SDL_RWops_ptr *p_Var8;
  _func_int_SDL_RWops_ptr_int_int *p_Var9;
  int iVar10;
  undefined2 extraout_var;
  undefined2 extraout_var_00;
  FILE *pFVar11;
  byte local_70;
  byte local_6f;
  byte local_6e;
  byte local_6d;
  byte local_6c;
  byte local_6b;
  Uint32 local_64;
  Uint16 in_stack_ffffffa0;
  Uint8 dst_channels;
  short *in_stack_ffffffa4;
  short *psVar12;
  Uint8 *pUVar13;
  int in_stack_ffffffa8;
  undefined4 local_54;
  int local_3c;
  Uint32 local_38;
  uint local_34;
  int local_30;
  
                    /* Unresolved local var: WAVStream * wave@[???]
                       Unresolved local var: SDL_AudioSpec wavespec@[???] */
  if (mixer.format == 0) {
    SDL_SetError("WAV music output not started");
    return (WAVStream *)0x0;
  }
  m = malloc(0x68);
  if (m == (WAVStream *)0x0) {
    return (WAVStream *)0x0;
  }
  memset(m,0,0x68);
  iVar4 = strcmp(magic,"RIFF");
  if (iVar4 == 0) {
    pFVar11 = fopen(file,"rb");
    dst_channels = (Uint8)in_stack_ffffffa4;
                    /* Unresolved local var: int was_error@[???]
                       Unresolved local var: FILE * wavefp@[???]
                       Unresolved local var: SDL_RWops * src@[???]
                       Unresolved local var: Chunk chunk@[???]
                       Unresolved local var: int lenread@[???]
                       Unresolved local var: Uint32 RIFFchunk@[???]
                       Unresolved local var: Uint32 wavelen@[???]
                       Unresolved local var: Uint32 WAVEmagic@[???]
                       Unresolved local var: WaveFMT * format@[???] */
    local_30 = in_stack_ffffffa8;
    if (pFVar11 == (FILE *)0x0) goto LAB_08944800;
    pSVar5 = SDL_RWFromFP(pFVar11,0);
    dst_channels = (Uint8)in_stack_ffffffa4;
    local_30 = in_stack_ffffffa8;
    if (pSVar5 != (SDL_RWops *)0x0) {
      UVar6 = SDL_ReadLE32(pSVar5);
      SDL_ReadLE32(pSVar5);
      UVar7 = SDL_ReadLE32(pSVar5);
      if ((UVar6 == 0x46464952) && (UVar7 == 0x45564157)) {
        in_stack_ffffffa4 = (short *)0x0;
        do {
          if (in_stack_ffffffa4 != (short *)0x0) {
            free(in_stack_ffffffa4);
          }
          iVar4 = ReadChunk(pSVar5,(Chunk *)&local_64,1);
          if (iVar4 < 0) goto LAB_089447e4;
        } while ((local_64 == 0x74636166) || (local_64 == 0x5453494c));
        if (local_64 == 0x20746d66) {
          if (*in_stack_ffffffa4 == 1) {
            local_54 = 0;
            in_stack_ffffffa8 = *(int *)(in_stack_ffffffa4 + 2);
            if (in_stack_ffffffa4[7] == 8) {
              local_54._0_2_ = 8;
            }
            else {
              if (in_stack_ffffffa4[7] != 0x10) {
                psVar12 = in_stack_ffffffa4;
                SDL_SetError("Unknown PCM data format");
                dst_channels = (Uint8)psVar12;
                bVar1 = true;
                goto LAB_08944b54;
              }
              local_54._0_2_ = 0x8010;
            }
            local_54._0_3_ = CONCAT12((char)in_stack_ffffffa4[1],(Uint16)local_54);
            local_54 = (uint)(uint3)local_54;
            pUVar13 = (Uint8 *)0x0;
            p_Var9 = pSVar5->seek;
            do {
              iVar4 = (*p_Var9)(pSVar5,0,1);
              m->start = iVar4 + 8;
              iVar4 = ReadChunk(pSVar5,(Chunk *)&local_64,0);
              dst_channels = (Uint8)pUVar13;
              if (iVar4 < 0) {
                bVar1 = true;
                goto LAB_08944b54;
              }
              p_Var9 = pSVar5->seek;
            } while (local_64 != 0x61746164);
            iVar4 = (*p_Var9)(pSVar5,0,1);
            bVar1 = false;
            m->stop = iVar4;
          }
          else {
            psVar12 = in_stack_ffffffa4;
            SDL_SetError("Unknown WAVE data format");
            dst_channels = (Uint8)psVar12;
            bVar1 = true;
          }
        }
        else {
          psVar12 = in_stack_ffffffa4;
          free(in_stack_ffffffa4);
          dst_channels = (Uint8)psVar12;
          SDL_SetError("Complex WAVE files not supported");
          bVar1 = true;
          if (in_stack_ffffffa4 == (short *)0x0) goto LAB_089447ec;
        }
LAB_08944b54:
        free(in_stack_ffffffa4);
        p_Var8 = pSVar5->close;
      }
      else {
        SDL_SetError("Unrecognized file type (not WAVE)");
LAB_089447e4:
        dst_channels = (Uint8)in_stack_ffffffa4;
        local_30 = in_stack_ffffffa8;
        if (pSVar5 == (SDL_RWops *)0x0) goto LAB_08944908;
LAB_089447ec:
        bVar1 = true;
        p_Var8 = pSVar5->close;
      }
      (*p_Var8)(pSVar5);
      local_30 = in_stack_ffffffa8;
      if (!bVar1) goto LAB_08944800;
    }
LAB_08944908:
    in_stack_ffffffa8 = local_30;
    if (pFVar11 != (FILE *)0x0) goto LAB_08944910;
    m->wavefp = (FILE *)0x0;
  }
  else {
    iVar4 = strcmp(magic,"FORM");
    dst_channels = (Uint8)in_stack_ffffffa4;
    if (iVar4 != 0) {
      SDL_SetError("Unknown WAVE format");
      pFVar11 = m->wavefp;
      local_30 = in_stack_ffffffa8;
      goto LAB_08944808;
    }
    fp = fopen(file,"rb");
    dst_channels = (Uint8)in_stack_ffffffa4;
                    /* Unresolved local var: int was_error@[???]
                       Unresolved local var: int found_SSND@[???]
                       Unresolved local var: int found_COMM@[???]
                       Unresolved local var: FILE * wavefp@[???]
                       Unresolved local var: SDL_RWops * src@[???]
                       Unresolved local var: Uint32 chunk_type@[???]
                       Unresolved local var: Uint32 chunk_length@[???]
                       Unresolved local var: long next_chunk@[???]
                       Unresolved local var: Uint32 FORMchunk@[???]
                       Unresolved local var: Uint32 AIFFmagic@[???]
                       Unresolved local var: Uint32 offset@[???]
                       Unresolved local var: Uint32 blocksize@[???]
                       Unresolved local var: Uint16 channels@[???]
                       Unresolved local var: Uint32 numsamples@[???]
                       Unresolved local var: Uint16 samplesize@[???]
                       Unresolved local var: Uint8[10] sane_freq@[???]
                       Unresolved local var: Uint32 frequency@[???] */
    pFVar11 = (FILE *)0x0;
    local_30 = in_stack_ffffffa8;
    if (fp == (FILE *)0x0) goto LAB_08944800;
    pSVar5 = SDL_RWFromFP(fp,0);
    dst_channels = (Uint8)in_stack_ffffffa4;
    pFVar11 = fp;
    if (pSVar5 != (SDL_RWops *)0x0) {
      UVar6 = SDL_ReadLE32(pSVar5);
      SDL_ReadBE32(pSVar5);
      UVar7 = SDL_ReadLE32(pSVar5);
      dst_channels = (Uint8)in_stack_ffffffa4;
      if ((UVar6 == 0x4d524f46) && (UVar7 == 0x46464941)) {
        bVar2 = false;
        bVar1 = false;
        local_3c = 0;
        local_38 = 0;
        local_34 = 0;
        local_30 = 0;
        do {
          UVar6 = SDL_ReadLE32(pSVar5);
          UVar7 = SDL_ReadBE32(pSVar5);
          iVar4 = (*pSVar5->seek)(pSVar5,0,1);
          dst_channels = (Uint8)in_stack_ffffffa4;
          if (UVar7 == 0) break;
          if (UVar6 == 0x444e5353) {
            UVar6 = SDL_ReadBE32(pSVar5);
            SDL_ReadBE32(pSVar5);
            iVar10 = (*pSVar5->seek)(pSVar5,0,1);
            bVar2 = true;
            m->start = UVar6 + iVar10;
LAB_08944a60:
            dst_channels = (Uint8)in_stack_ffffffa4;
            if (bVar1) goto LAB_08944a68;
            p_Var9 = pSVar5->seek;
          }
          else {
            if (UVar6 == 0x4d4d4f43) {
              UVar3 = SDL_ReadBE16(pSVar5);
              local_3c = CONCAT22(extraout_var,UVar3);
              local_38 = SDL_ReadBE32(pSVar5);
              UVar3 = SDL_ReadBE16(pSVar5);
              local_34 = CONCAT22(extraout_var_00,UVar3);
              (*pSVar5->read)(pSVar5,&local_70,10,1);
              if ((char)local_70 < '\0') {
                bVar1 = true;
                local_30 = 0;
              }
              else if (local_70 < 0x40) {
                bVar1 = true;
                local_30 = 1;
              }
              else if (local_70 == 0x40) {
                if (local_6f < 0x1d) {
                  local_30 = (int)((uint)local_6e << 0x17 | (uint)local_6d << 0xf |
                                  (uint)local_6c << 7 | (uint)(local_6b >> 1)) >>
                             (0x1d - local_6f & 0x1f);
                  bVar1 = true;
                }
                else {
                  bVar1 = true;
                  local_30 = 800000000;
                }
              }
              else {
                bVar1 = true;
                local_30 = 0x4000000;
              }
            }
            if (bVar2) goto LAB_08944a60;
            p_Var9 = pSVar5->seek;
          }
          iVar4 = (*p_Var9)(pSVar5,UVar7 + iVar4,0);
          dst_channels = (Uint8)in_stack_ffffffa4;
        } while (iVar4 != -1);
        if (bVar2) {
          if (bVar1) {
LAB_08944a68:
            m->stop = m->start + local_3c * local_38 * ((local_34 & 0x7ffff) >> 3);
            local_54 = 0;
            if (local_34 == 8) {
              local_54._0_2_ = 0x8008;
            }
            else {
              if (local_34 != 0x10) {
                SDL_SetError("Unknown samplesize in data format");
                p_Var8 = pSVar5->close;
                in_stack_ffffffa8 = local_30;
                goto LAB_089448e8;
              }
              local_54._0_2_ = 0x9010;
            }
            local_54._0_3_ = CONCAT12((char)local_3c,(Uint16)local_54);
            local_54 = (uint)(uint3)local_54;
            (*pSVar5->close)(pSVar5);
            m->wavefp = fp;
            goto LAB_08944804;
          }
          SDL_SetError("Bad AIFF file (no COMM chunk)");
          p_Var8 = pSVar5->close;
        }
        else {
          SDL_SetError("Bad AIFF file (no SSND chunk)");
          p_Var8 = pSVar5->close;
        }
      }
      else {
        SDL_SetError("Unrecognized file type (not AIFF)");
        p_Var8 = pSVar5->close;
      }
LAB_089448e8:
      (*p_Var8)(pSVar5);
    }
LAB_08944910:
    fclose(pFVar11);
    pFVar11 = (FILE *)0x0;
    local_30 = in_stack_ffffffa8;
LAB_08944800:
    m->wavefp = pFVar11;
  }
LAB_08944804:
  pFVar11 = m->wavefp;
LAB_08944808:
  if (pFVar11 == (FILE *)0x0) {
    free(m);
    m = (WAVStream *)0x0;
  }
  else {
    SDL_BuildAudioCVT(&m->cvt,(Uint16)local_54,local_54._2_1_,local_30,in_stack_ffffffa0,
                      dst_channels,local_30);
  }
  return m;
}



----------------------------------------

// Function: _Eff_build_volume_table_s8 @ 08944d90

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void * _Eff_build_volume_table_s8(void)

{
  undefined1 *puVar1;
  SItype SVar2;
  int iVar3;
  int iVar4;
  undefined1 *puVar5;
  int iVar6;
  float fVar7;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int volume@[???]
                       Unresolved local var: int sample@[???]
                       Unresolved local var: Sint8 * rc@[???] */
  if ((_Eff_volume_table == (void *)0x0) && (puVar1 = malloc(0x10000), puVar1 != (undefined1 *)0x0))
  {
    iVar6 = 0;
    _Eff_volume_table = puVar1;
    do {
      fVar7 = (float)iVar6;
      __extendsfdf2(fVar7);
      __divdf3((FLO_type_conflict)CONCAT44(in_f13,fVar7),in_f14_15);
      iVar3 = -0x80;
      puVar5 = puVar1;
      do {
        iVar4 = iVar3 + 1;
        fVar7 = (float)iVar3;
        __extendsfdf2(fVar7);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,fVar7),in_f14_15);
        SVar2 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,fVar7));
        *puVar5 = (char)SVar2;
        puVar5 = puVar5 + 1;
        iVar3 = iVar4;
      } while (iVar4 != 0x80);
      iVar6 = iVar6 + 1;
      puVar1 = puVar1 + 0x100;
    } while (iVar6 != 0x100);
    return _Eff_volume_table;
  }
  return _Eff_volume_table;
}



----------------------------------------

// Function: _Eff_build_volume_table_u8 @ 08944ec4

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void * _Eff_build_volume_table_u8(void)

{
  char *pcVar1;
  USItype UVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  int iVar6;
  float fVar7;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int volume@[???]
                       Unresolved local var: int sample@[???]
                       Unresolved local var: Uint8 * rc@[???] */
  if (_Mix_effects_max_speed == 0) {
    return (void *)0x0;
  }
  if ((_Eff_volume_table == (void *)0x0) && (pcVar1 = malloc(0x10000), pcVar1 != (char *)0x0)) {
    iVar6 = 0;
    _Eff_volume_table = pcVar1;
    do {
      fVar7 = (float)iVar6;
      __extendsfdf2(fVar7);
      __divdf3((FLO_type_conflict)CONCAT44(in_f13,fVar7),in_f14_15);
      iVar3 = -0x80;
      pcVar5 = pcVar1;
      do {
        iVar4 = iVar3 + 1;
        fVar7 = (float)iVar3;
        __extendsfdf2(fVar7);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,fVar7),in_f14_15);
        UVar2 = __fixunsdfsi((DFtype)CONCAT44(in_f13,fVar7));
        *pcVar5 = (char)UVar2 + -0x80;
        pcVar5 = pcVar5 + 1;
        iVar3 = iVar4;
      } while (iVar4 != 0x80);
      iVar6 = iVar6 + 1;
      pcVar1 = pcVar1 + 0x100;
    } while (iVar6 != 0x100);
  }
  return _Eff_volume_table;
}



----------------------------------------

// Function: _Mix_InitEffects @ 08945010

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _Mix_InitEffects(void)

{
  char *pcVar1;
  
  pcVar1 = getenv("MIX_EFFECTSMAXSPEED");
  _Mix_effects_max_speed = (uint)(pcVar1 != (char *)0x0);
  return;
}



----------------------------------------

// Function: Interpolate @ 0894503c

SWORD Interpolate(SWORD p,SWORD p1,SWORD p2,SWORD v1,SWORD v2)

{
  int iVar1;
  short in_t0;
  int iVar2;
  
  iVar1 = (int)p1;
  if (iVar1 != p2) {
    iVar2 = p2 - iVar1;
    if (iVar1 != p) {
      if (iVar2 == 0) {
        trap(7);
      }
      v1 = (short)(((p - iVar1) * ((int)in_t0 - (int)v1)) / iVar2) + v1;
    }
  }
  return v1;
}



----------------------------------------

// Function: getlinearperiod @ 08945090

UWORD getlinearperiod(UWORD note,ULONG fine)

{
                    /* Unresolved local var: UWORD t@[???] */
  return (0xf2 - note) * 0x20 - (short)(fine >> 1);
}



----------------------------------------

// Function: GetPeriod @ 089450b0

/* WARNING: Removing unreachable block (ram,0x089450f8) */
/* WARNING: Removing unreachable block (ram,0x08945158) */

UWORD GetPeriod(UWORD note,ULONG speed)

{
  uint uVar1;
  SWORD SVar2;
  UWORD UVar3;
  undefined2 extraout_var;
  SWORD in_stack_00000008;
  
  uVar1 = (uint)note;
  if ((pf->flags & 1) == 0) {
                    /* Unresolved local var: UWORD n@[???]
                       Unresolved local var: UWORD o@[???] */
    UVar3 = 0x1092;
    if (speed != 0) {
      if (speed == 0) {
        trap(7);
      }
      return (UWORD)(((uint)oldperiods[uVar1 % 0x18] * 0x20ab >> (uVar1 / 0x18 & 0x1f)) / speed);
    }
  }
  else {
                    /* Unresolved local var: UWORD n@[???]
                       Unresolved local var: UWORD o@[???]
                       Unresolved local var: UWORD p1@[???]
                       Unresolved local var: UWORD p2@[???]
                       Unresolved local var: ULONG i@[???] */
    if ((pf->flags & 2) != 0) {
      UVar3 = getlinearperiod(note,speed);
      return UVar3;
    }
    SVar2 = Interpolate((SWORD)(speed >> 4),0,0xf,logtab[(uVar1 % 0x18) * 4 + (speed >> 4)],
                        in_stack_00000008);
    UVar3 = (UWORD)(CONCAT22(extraout_var,SVar2) >> (uVar1 / 0x18 & 0x1f));
  }
  return UVar3;
}



----------------------------------------

// Function: StartEnvelope @ 089451c4

void StartEnvelope(ENVPR *t,UBYTE flg,UBYTE pts,UBYTE susbeg,UBYTE susend,UBYTE beg,UBYTE end,
                  ENVPT *p,UBYTE keyoff)

{
  byte bVar1;
  ushort uVar2;
  UBYTE in_t0;
  UBYTE in_t1;
  UBYTE in_t2;
  ENVPT *in_t3;
  byte local_res0;
  
  t->flg = flg;
  t->pts = pts;
  t->susbeg = susbeg;
  t->susend = in_t0;
  t->beg = in_t1;
  t->end = in_t2;
  t->env = in_t3;
  t->a = 0;
  t->p = 0;
  uVar2 = 1;
  if ((flg & 2) != 0) {
    uVar2 = local_res0 & 1;
  }
  bVar1 = t->pts;
  t->b = uVar2;
  if ((1 < bVar1) && (t->env->pos == t->env[1].pos)) {
    t->b = uVar2 + 1;
    t->a = t->a + 1;
  }
  if ((ushort)bVar1 <= t->b) {
    t->b = bVar1 - 1;
  }
  return;
}



----------------------------------------

// Function: ProcessEnvelope @ 08945258

SWORD ProcessEnvelope(ENVPR *t,SWORD v,UBYTE keyoff)

{
  byte bVar1;
  byte bVar2;
  ushort p;
  SWORD SVar3;
  int iVar4;
  short sVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  SWORD unaff_s4;
  ENVPT *pEVar9;
  
  bVar1 = t->flg;
  if ((bVar1 & 1) == 0) {
    return v;
  }
                    /* Unresolved local var: UBYTE a@[???]
                       Unresolved local var: UBYTE b@[???]
                       Unresolved local var: UWORD p@[???] */
  p = t->p;
  if ((bVar1 & 2) == 0) {
    pEVar9 = t->env;
  }
  else {
    pEVar9 = t->env;
    if ((((uint)t->susend == (uint)t->susbeg) && ((keyoff & 1) == 0)) &&
       ((uint)p == (int)pEVar9[t->susend].pos)) {
      return pEVar9[t->susend].val;
    }
  }
  uVar7 = t->a & 0xff;
  uVar8 = t->b & 0xff;
  if (uVar7 == uVar8) {
    SVar3 = pEVar9[uVar8].val;
  }
  else {
    SVar3 = Interpolate(p,pEVar9[uVar7].pos,pEVar9[uVar8].pos,pEVar9[uVar7].val,unaff_s4);
  }
  uVar6 = p + 1;
  sVar5 = (short)uVar6;
  if ((int)(uVar6 & 0xffff) < (int)pEVar9[uVar8].pos) {
    t->p = sVar5;
    uVar6 = uVar8;
    goto LAB_08945374;
  }
  uVar7 = uVar8 + 1 & 0xff;
  if ((((bVar1 & 2) == 0) || ((keyoff & 1) != 0)) || (uVar6 = (uint)t->susend, uVar7 <= uVar6)) {
    if ((bVar1 & 4) == 0) {
      bVar2 = t->pts;
LAB_089453f8:
      if (bVar2 <= uVar7) {
        if ((((bVar1 & 8) != 0) && (iVar4 = (int)mp_channel, iVar4 != -1)) &&
           (pf->voice[iVar4].keyoff = pf->voice[iVar4].keyoff | 2, SVar3 == 0)) {
          pf->voice[iVar4].fadevol = 0;
        }
        t->p = sVar5 + -1;
        t->a = (UWORD)uVar8;
        t->b = (UWORD)uVar7 - 1 & 0xff;
        return SVar3;
      }
      t->p = sVar5;
      t->a = (UWORD)uVar8;
      t->b = (UWORD)uVar7;
      return SVar3;
    }
    uVar6 = (uint)t->end;
    if (uVar7 <= uVar6) {
      bVar2 = t->pts;
      goto LAB_089453f8;
    }
    uVar7 = (uint)t->beg;
    iVar4 = uVar7 << 2;
    if (uVar6 != uVar7) goto LAB_0894535c;
  }
  else {
    uVar7 = (uint)t->susbeg;
    if (uVar6 == uVar7) {
      iVar4 = uVar7 << 2;
    }
    else {
LAB_0894535c:
      uVar6 = uVar7 + 1 & 0xff;
      iVar4 = uVar7 << 2;
    }
  }
  t->p = *(SWORD *)((int)&pEVar9->pos + iVar4);
LAB_08945374:
  t->a = (UWORD)uVar7;
  t->b = (UWORD)uVar6;
  return SVar3;
}



----------------------------------------

// Function: getfrequency @ 089454a4

/* WARNING: Removing unreachable block (ram,0x089454dc) */

ULONG getfrequency(UBYTE flags,ULONG period)

{
  ULONG UVar1;
  
  if ((flags & 2) == 0) {
    UVar1 = 0xda7790;
    if ((period != 0) && (UVar1 = 0xda7790 / period, period == 0)) {
      trap(7);
    }
    return UVar1;
  }
  return lintab[period % 0x300] >> (period / 0x300 & 0x1f);
}



----------------------------------------

// Function: DoEEffects @ 08945504

void DoEEffects(UBYTE dat)

{
  UWORD UVar1;
  MP_CONTROL *pMVar2;
  SBYTE SVar3;
  short sVar4;
  byte bVar5;
  UWORD UVar6;
  uint uVar7;
  
  pMVar2 = a;
                    /* Unresolved local var: UBYTE nib@[???] */
  uVar7 = dat & 0xf;
  bVar5 = (byte)uVar7;
  UVar6 = (UWORD)uVar7;
  switch(dat >> 4) {
  case '\x01':
    if (a->period != 0) {
      if (pf->vbtick != 0) {
        return;
      }
      a->tmpperiod = a->tmpperiod + UVar6 * -4;
    }
    break;
  case '\x02':
    if ((a->period != 0) && (pf->vbtick == 0)) {
      a->tmpperiod = UVar6 * 4 + a->tmpperiod;
    }
    break;
  case '\x03':
    a->glissando = bVar5;
    break;
  case '\x04':
    a->wavecontrol = bVar5 | a->wavecontrol & 0xf0;
    break;
  case '\x05':
    if (a->period != 0) {
      if ((pf->flags & 1) == 0) {
        a->speed = (uint)finetune[uVar7];
      }
      else {
        a->speed = uVar7 + 0x80;
      }
      UVar6 = GetPeriod((ushort)pMVar2->note << 1,pMVar2->speed);
      pMVar2->tmpperiod = UVar6;
    }
    break;
  case '\x06':
    if (pf->vbtick != 0) {
      return;
    }
    if ((dat & 0xf) == 0) {
      a->pat_reppos = pf->patpos - 1;
    }
    else {
      UVar1 = a->pat_repcnt;
      if (UVar1 == 0) {
        a->pat_repcnt = UVar6;
      }
      else {
        a->pat_repcnt = UVar1 - 1;
        if (UVar1 == 1) {
          pMVar2->pat_reppos = -2;
          return;
        }
      }
      UVar6 = pMVar2->pat_reppos;
      if (UVar6 == 0xfffe) {
        UVar6 = pf->patpos - 1;
        pMVar2->pat_reppos = UVar6;
      }
      if (UVar6 == 0xffff) {
        pf->pat_repcrazy = '\x01';
        pf->patpos = 0;
      }
      else {
        pf->patpos = UVar6;
      }
    }
    break;
  case '\a':
    a->wavecontrol = a->wavecontrol & 0xf | (byte)(uVar7 << 4);
    break;
  case '\b':
    if (pf->panflag != 0) {
      if (uVar7 < 9) {
        UVar6 = (UWORD)(uVar7 << 4);
      }
      else {
        UVar6 = UVar6 * 0x11 & 0xff;
      }
      pf->panning[mp_channel] = UVar6;
      pMVar2->panning = UVar6;
    }
    break;
  case '\t':
    if ((dat & 0xf) != 0) {
      if (a->retrig == '\0') {
        if (a->period == 0) {
          a->retrig = bVar5;
        }
        else {
          a->kick = '\x01';
          pMVar2->retrig = bVar5;
        }
        SVar3 = pMVar2->retrig;
      }
      else {
        SVar3 = a->retrig;
      }
      pMVar2->retrig = SVar3 + -1;
    }
    break;
  case '\n':
    if ((pf->vbtick == 0) && (sVar4 = UVar6 + a->tmpvolume, a->tmpvolume = sVar4, 0x40 < sVar4)) {
      pMVar2->tmpvolume = 0x40;
    }
    break;
  case '\v':
    if (pf->vbtick != 0) {
      return;
    }
    sVar4 = a->tmpvolume - UVar6;
    a->tmpvolume = sVar4;
    if (sVar4 < 0) {
      pMVar2->tmpvolume = 0;
    }
    break;
  case '\f':
    if (uVar7 <= pf->vbtick) {
      a->tmpvolume = 0;
    }
    break;
  case '\r':
    if (pf->vbtick == 0) {
      a->notedelay = bVar5;
    }
    else if (a->notedelay != '\0') {
      a->notedelay = a->notedelay + 0xff;
    }
    break;
  case '\x0e':
    if (pf->vbtick != 0) {
      return;
    }
    if (pf->patdly2 != '\0') {
      return;
    }
    pf->patdly = bVar5 + 1;
  }
  return;
}



----------------------------------------

// Function: DoVolSlide @ 0894589c

void DoVolSlide(UBYTE dat)

{
  MP_CONTROL *pMVar1;
  short sVar2;
  
  pMVar1 = a;
  if (pf->vbtick != 0) {
    if ((dat & 0xf) == 0) {
      sVar2 = (ushort)(dat >> 4) + a->tmpvolume;
      a->tmpvolume = sVar2;
      if (0x40 < sVar2) {
        pMVar1->tmpvolume = 0x40;
      }
    }
    else {
      sVar2 = a->tmpvolume - (dat & 0xf);
      a->tmpvolume = sVar2;
      if (sVar2 < 0) {
        pMVar1->tmpvolume = 0;
        return;
      }
    }
  }
  return;
}



----------------------------------------

// Function: DoToneSlide @ 08945910

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void DoToneSlide(void)

{
  UWORD *pUVar1;
  ushort uVar2;
  ushort uVar3;
  MP_CONTROL *pMVar4;
  
  pMVar4 = a;
  if (pf->vbtick == 0) {
    a->tmpperiod = a->period;
    return;
  }
                    /* Unresolved local var: int dist@[???] */
  uVar2 = a->period;
  uVar3 = a->wantedperiod;
  if ((uint)uVar2 == (uint)uVar3) {
    a->tmpperiod = uVar3;
  }
  else {
    if (a->portspeed == 0) {
      if (0 < (int)((uint)uVar2 - (uint)uVar3)) {
        pUVar1 = &a->tmpperiod;
        a->period = uVar2;
        pMVar4->tmpperiod = *pUVar1;
        return;
      }
      pUVar1 = &a->tmpperiod;
      a->period = uVar2;
      pMVar4->tmpperiod = *pUVar1;
      return;
    }
    a->tmpperiod = uVar3;
  }
  pMVar4->period = uVar3;
  return;
}



----------------------------------------

// Function: DoS3MVolSlide @ 089459a0

void DoS3MVolSlide(UBYTE inf)

{
  short sVar1;
  SWORD SVar2;
  ushort uVar3;
  
  explicitslides = 1;
  if (inf == '\0') {
    inf = a->s3mvolslide;
    uVar3 = (ushort)(inf >> 4);
    if ((inf & 0xf) == 0) goto LAB_089459cc;
LAB_08945a2c:
    if (uVar3 == 0) {
      if (pf->vbtick == 0) {
        if ((pf->flags & 0x10) == 0) {
          sVar1 = a->tmpvolume;
          goto joined_r0x08945a6c;
        }
        sVar1 = a->tmpvolume;
      }
      else {
LAB_08945a58:
        sVar1 = a->tmpvolume;
      }
      a->tmpvolume = sVar1 - (inf & 0xf);
      sVar1 = a->tmpvolume;
      goto joined_r0x08945a6c;
    }
    if ((inf & 0xf) == 0xf) {
      if (pf->vbtick == 0) {
        SVar2 = a->tmpvolume;
        goto LAB_089459e8;
      }
    }
    else {
      if (uVar3 != 0xf) {
        return;
      }
      if (pf->vbtick == 0) goto LAB_08945a58;
    }
  }
  else {
    uVar3 = (ushort)(inf >> 4);
    a->s3mvolslide = inf;
    if ((inf & 0xf) != 0) goto LAB_08945a2c;
LAB_089459cc:
    if (pf->vbtick == 0) {
      if ((pf->flags & 0x10) != 0) {
        SVar2 = a->tmpvolume;
        goto LAB_089459e8;
      }
    }
    else {
      SVar2 = a->tmpvolume;
LAB_089459e8:
      a->tmpvolume = uVar3 + SVar2;
    }
  }
  sVar1 = a->tmpvolume;
joined_r0x08945a6c:
  if (-1 < sVar1) {
    if (0x40 < sVar1) {
      a->tmpvolume = 0x40;
    }
    return;
  }
  a->tmpvolume = 0;
  return;
}



----------------------------------------

// Function: DoS3MSlideDn @ 08945ad0

void DoS3MSlideDn(UBYTE inf)

{
  if (inf == '\0') {
    inf = (UBYTE)a->slidespeed;
  }
  else {
    a->slidespeed = (ushort)inf;
  }
  if (inf >> 4 == 0xf) {
    if (pf->vbtick == 0) {
      a->tmpperiod = (inf & 0xf) * 4 + a->tmpperiod;
      return;
    }
  }
  else {
                    /* Unresolved local var: UBYTE hi@[???]
                       Unresolved local var: UBYTE lo@[???] */
    if (inf >> 4 == 0xe) {
      if (pf->vbtick == 0) {
        a->tmpperiod = (inf & 0xf) + a->tmpperiod;
        return;
      }
    }
    else if (pf->vbtick != 0) {
      a->tmpperiod = (ushort)inf * 4 + a->tmpperiod;
    }
  }
  return;
}



----------------------------------------

// Function: DoS3MSlideUp @ 08945b88

void DoS3MSlideUp(UBYTE inf)

{
  if (inf == '\0') {
    inf = (UBYTE)a->slidespeed;
  }
  else {
    a->slidespeed = (ushort)inf;
  }
  if (inf >> 4 == 0xf) {
    if (pf->vbtick == 0) {
      a->tmpperiod = a->tmpperiod + (inf & 0xf) * -4;
      return;
    }
  }
  else {
                    /* Unresolved local var: UBYTE hi@[???]
                       Unresolved local var: UBYTE lo@[???] */
    if (inf >> 4 == 0xe) {
      if (pf->vbtick == 0) {
        a->tmpperiod = a->tmpperiod - (inf & 0xf);
        return;
      }
    }
    else if (pf->vbtick != 0) {
      a->tmpperiod = a->tmpperiod + (ushort)inf * -4;
    }
  }
  return;
}



----------------------------------------

// Function: DoXMVolSlide @ 08945c40

void DoXMVolSlide(UBYTE inf)

{
  MP_CONTROL *pMVar1;
  short sVar2;
  
                    /* Unresolved local var: UBYTE lo@[???]
                       Unresolved local var: UBYTE hi@[???] */
  explicitslides = 2;
  if (inf == '\0') {
    inf = a->s3mvolslide;
  }
  else {
    a->s3mvolslide = inf;
  }
  pMVar1 = a;
  if (pf->vbtick != 0) {
    if (inf >> 4 == 0) {
      sVar2 = a->tmpvolume - (inf & 0xf);
      a->tmpvolume = sVar2;
      if (sVar2 < 0) {
        pMVar1->tmpvolume = 0;
        return;
      }
    }
    else {
      sVar2 = (ushort)(inf >> 4) + a->tmpvolume;
      a->tmpvolume = sVar2;
      if (0x40 < sVar2) {
        pMVar1->tmpvolume = 0x40;
      }
    }
  }
  return;
}



----------------------------------------

// Function: DoITToneSlide @ 08945cd4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void DoITToneSlide(void)

{
  UWORD *pUVar1;
  ushort uVar2;
  ushort uVar3;
  MP_CONTROL *pMVar4;
  
  pMVar4 = a;
  if (a->oldnote != '\0') {
    if (pf->vbtick != 0) {
      uVar2 = a->period;
                    /* Unresolved local var: int dist@[DW_OP_reg4(a0)] */
      uVar3 = a->wantedperiod;
      if ((uint)uVar2 == (uint)uVar3) {
        a->tmpperiod = uVar3;
      }
      else {
        if (a->portspeed == 0) {
          if (0 < (int)((uint)uVar2 - (uint)uVar3)) {
            pUVar1 = &a->tmpperiod;
            a->period = uVar2;
            pMVar4->tmpperiod = *pUVar1;
            return;
          }
          pUVar1 = &a->tmpperiod;
          a->period = uVar2;
          pMVar4->tmpperiod = *pUVar1;
          return;
        }
        a->tmpperiod = uVar3;
      }
      pMVar4->period = uVar3;
      return;
    }
    a->tmpperiod = a->period;
  }
  return;
}



----------------------------------------

// Function: DoNNAEffects @ 08945d70

void DoNNAEffects(UBYTE dat)

{
  MP_CONTROL *pMVar1;
  uint uVar2;
  MP_VOICE *pMVar3;
  int iVar4;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: MP_VOICE * aout@[???] */
  pMVar1 = a;
  pMVar3 = a->slave;
  switch(dat & 0xf) {
  case 0:
    uVar2 = (uint)md_sngchn;
    if (uVar2 != 0) {
      iVar4 = 0;
      pMVar3 = pf->voice;
      do {
        if (pMVar1 == pMVar3[iVar4].master) {
          pMVar3[iVar4].fadevol = 0;
        }
        iVar4 = iVar4 + 1;
      } while (iVar4 < (int)uVar2);
    }
    break;
  case 1:
    if (md_sngchn != '\0') {
      iVar4 = 0;
      do {
        pMVar3 = pf->voice;
        uVar2 = (uint)md_sngchn;
        if (pMVar1 == pMVar3[iVar4].master) {
          pMVar3[iVar4].keyoff = pMVar3[iVar4].keyoff | 1;
          if ((pf->voice[iVar4].venv.flg & 5) == 1) {
            uVar2 = (uint)md_sngchn;
          }
          else {
            pf->voice[iVar4].keyoff = '\x03';
            uVar2 = (uint)md_sngchn;
          }
        }
        iVar4 = iVar4 + 1;
      } while (iVar4 < (int)uVar2);
    }
    break;
  case 2:
    iVar4 = 0;
    if (md_sngchn != '\0') {
      do {
        pMVar3 = pf->voice;
        if (pMVar1 == pMVar3[iVar4].master) {
          pMVar3[iVar4].keyoff = pMVar3[iVar4].keyoff | 2;
        }
        iVar4 = iVar4 + 1;
      } while (iVar4 < (int)(uint)md_sngchn);
    }
    break;
  case 3:
    a->nna = a->nna & 0xfc;
    return;
  case 4:
    a->nna = a->nna & 0xfc | 1;
    return;
  case 5:
    a->nna = a->nna & 0xfc | 2;
    return;
  case 6:
    a->nna = a->nna & 0xfc | 3;
    return;
  case 7:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->volflg = pMVar3->volflg & 0xfe;
      return;
    }
    break;
  case 8:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->volflg = pMVar3->volflg | 1;
      return;
    }
    break;
  case 9:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->panflg = pMVar3->panflg & 0xfe;
      return;
    }
    break;
  case 10:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->panflg = pMVar3->panflg | 1;
      return;
    }
    break;
  case 0xb:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->pitflg = pMVar3->pitflg & 0xfe;
      return;
    }
    break;
  case 0xc:
    if (pMVar3 != (MP_VOICE *)0x0) {
      pMVar3->pitflg = pMVar3->pitflg | 1;
      return;
    }
  }
  return;
}



----------------------------------------

// Function: Player_Init_internal @ 08945fcc

void Player_Init_internal(MODULE *mf)

{
  byte bVar1;
  ushort uVar2;
  MP_CONTROL *pMVar3;
  ushort uVar4;
  MODULE *pMVar5;
  ushort uVar6;
  int iVar7;
  int iVar8;
  
                    /* Unresolved local var: int t@[???] */
  if (mf->numchn != '\0') {
    pMVar3 = mf->control;
    pMVar5 = mf;
    iVar7 = 0;
    do {
      iVar8 = iVar7 + 1;
      pMVar3[iVar7].chanvol = mf->chanvol[iVar7];
      pMVar3 = mf->control;
      pMVar3[iVar7].panning = pMVar5->panning[0];
      pMVar5 = (MODULE *)((int)&pMVar5->songname + 2);
      iVar7 = iVar8;
    } while (iVar8 < (int)(uint)mf->numchn);
  }
  bVar1 = mf->initspeed;
  mf->sngtime = 0;
  mf->sngremainder = 0;
  mf->pat_repcrazy = '\0';
  mf->sngpos = 0;
  if (bVar1 == 0) {
    uVar6 = 6;
  }
  else {
    uVar6 = 0x20;
    if (bVar1 < 0x20) {
      uVar6 = (ushort)bVar1;
    }
  }
  uVar4 = mf->inittempo;
  uVar2 = 0x80;
  if (mf->initvolume < 0x81) {
    uVar2 = (ushort)mf->initvolume;
  }
  mf->volume = uVar2;
  mf->vbtick = uVar6;
  mf->sngspd = uVar6;
  mf->patdly = '\0';
  mf->patdly2 = '\0';
  if (uVar4 < 0x20) {
    uVar4 = 0x20;
  }
  mf->bpm = uVar4;
  mf->posjmp = 2;
  mf->numrow = 0xffff;
  mf->patbrk = 0;
  mf->realchn = '\0';
  mf->patpos = 0;
  return;
}



----------------------------------------

// Function: Player_SetVolume @ 089460a8

void Player_SetVolume(SWORD volume)

{
  MODULE *pMVar1;
  ushort uVar2;
  
  pMVar1 = pf;
  if (pf != (MODULE *)0x0) {
    uVar2 = 0;
    if ((-1 < volume) && (uVar2 = volume & 0xff, 0x80 < volume)) {
      pf->volume = 0x80;
      pMVar1->initvolume = 0x80;
      return;
    }
    pf->volume = uVar2;
    pMVar1->initvolume = (UBYTE)uVar2;
  }
  return;
}



----------------------------------------

// Function: Player_GetModule @ 089460f8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

MODULE * Player_GetModule(void)

{
                    /* Unresolved local var: MODULE * result@[???] */
  return pf;
}



----------------------------------------

// Function: Player_Active @ 08946104

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL Player_Active(void)

{
  uint uVar1;
  
                    /* Unresolved local var: BOOL result@[???] */
  uVar1 = 0;
  if (pf != (MODULE *)0x0) {
    uVar1 = (uint)((int)pf->sngpos < (int)(uint)pf->numpos);
  }
  return uVar1;
}



----------------------------------------

// Function: Player_Muted @ 08946128

BOOL Player_Muted(UBYTE chan)

{
  uint uVar1;
  
                    /* Unresolved local var: BOOL result@[DW_OP_reg5(a1)] */
  uVar1 = 1;
  if ((pf != (MODULE *)0x0) && ((uint)chan < (uint)pf->numchn)) {
    uVar1 = (uint)pf->control[chan].muted;
  }
  return uVar1;
}



----------------------------------------

// Function: Player_GetChannelVoice @ 0894616c

int Player_GetChannelVoice(UBYTE chan)

{
  int iVar1;
  
                    /* Unresolved local var: int result@[DW_OP_reg5(a1)] */
  iVar1 = 0;
  if ((pf != (MODULE *)0x0) && (iVar1 = -1, (uint)chan < (uint)pf->numchn)) {
    return (uint)pf->control[chan].slavechn;
  }
  return iVar1;
}



----------------------------------------

// Function: Player_GetChannelPeriod @ 089461b8

UWORD Player_GetChannelPeriod(UBYTE chan)

{
  UWORD UVar1;
  
                    /* Unresolved local var: UWORD result@[???] */
  UVar1 = 0;
  if ((pf != (MODULE *)0x0) && ((uint)chan < (uint)pf->numchn)) {
    UVar1 = pf->control[chan].period;
  }
  return UVar1;
}



----------------------------------------

// Function: Player_Paused_internal @ 089461fc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL Player_Paused_internal(void)

{
  BOOL BVar1;
  
  BVar1 = 1;
  if (pf != (MODULE *)0x0) {
    BVar1 = pf->forbid;
  }
  return BVar1;
}



----------------------------------------

// Function: Player_Paused @ 08946218

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL Player_Paused(void)

{
  BOOL BVar1;
  
  BVar1 = 1;
  if (pf != (MODULE *)0x0) {
    BVar1 = pf->forbid;
  }
  return BVar1;
}



----------------------------------------

// Function: Player_TogglePause @ 08946220

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_TogglePause(void)

{
  if (pf != (MODULE *)0x0) {
    pf->forbid = 1 - pf->forbid;
  }
  return;
}



----------------------------------------

// Function: Player_SetSpeed @ 08946244

void Player_SetSpeed(UWORD speed)

{
  UWORD UVar1;
  UWORD UVar2;
  
  if (pf != (MODULE *)0x0) {
    UVar2 = speed;
    if (0x20 < speed) {
      UVar2 = 0x20;
    }
    UVar1 = 1;
    if (speed != 0) {
      UVar1 = UVar2;
    }
    pf->sngspd = UVar1;
  }
  return;
}



----------------------------------------

// Function: Player_SetTempo @ 0894627c

void Player_SetTempo(UWORD tempo)

{
  if (tempo < 0x20) {
    tempo = 0x20;
  }
  if (pf != (MODULE *)0x0) {
    if ((pf->flags & 0x40) == 0) {
      if (0xff < tempo) {
        tempo = 0xff;
      }
      pf->bpm = tempo;
      return;
    }
    pf->bpm = tempo;
  }
  return;
}



----------------------------------------

// Function: Player_SetSynchroValue @ 089462c4

void Player_SetSynchroValue(int i)

{
  _pl_synchro_value = i;
  return;
}



----------------------------------------

// Function: Player_GetSynchroValue @ 089462d0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Player_GetSynchroValue(void)

{
  return _pl_synchro_value;
}



----------------------------------------

// Function: Player_ToggleMute @ 089462dc

void Player_ToggleMute(SLONG arg1,...)

{
  bool bVar1;
  int iVar2;
  uint in_a1;
  uint in_a2;
  uint uVar3;
  
                    /* Unresolved local var: va_list args@[???]
                       Unresolved local var: SLONG arg2@[???]
                       Unresolved local var: SLONG arg3@[???]
                       Unresolved local var: ULONG t@[???] */
  if (pf != (MODULE *)0x0) {
    if (arg1 == 32000) {
      if (in_a1 == 0) {
        bVar1 = (int)in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < (int)in_a1;
      }
      if (((!bVar1) && ((int)in_a2 < (int)(uint)pf->numchn)) && (uVar3 = 0, pf->numchn != 0)) {
        bVar1 = in_a1 != 0;
        do {
          if ((bVar1) || (in_a2 < uVar3)) {
            pf->control[uVar3].muted = '\x01' - pf->control[uVar3].muted;
          }
          uVar3 = uVar3 + 1;
          bVar1 = uVar3 < in_a1;
        } while (uVar3 < pf->numchn);
      }
    }
    else if (arg1 == 0x7d01) {
      if (in_a1 == 0) {
        bVar1 = (int)in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < (int)in_a1;
      }
      if (((!bVar1) && ((int)in_a2 < (int)(uint)pf->numchn)) && ((int)in_a1 < (int)(uint)pf->numchn)
         ) {
        iVar2 = in_a1 * 0x7c;
        do {
          in_a1 = in_a1 + 1;
          (&pf->control->muted)[iVar2] = '\x01' - (&pf->control->muted)[iVar2];
          iVar2 = iVar2 + 0x7c;
          if ((int)(uint)pf->numchn <= (int)in_a1) {
            return;
          }
        } while ((int)in_a1 <= (int)in_a2);
      }
    }
    else if (arg1 < (int)(uint)pf->numchn) {
      pf->control[arg1].muted = '\x01' - pf->control[arg1].muted;
    }
  }
  return;
}



----------------------------------------

// Function: Player_Mute @ 08946484

void Player_Mute(SLONG arg1,...)

{
  bool bVar1;
  int iVar2;
  int in_a1;
  int in_a2;
  
                    /* Unresolved local var: va_list args@[???]
                       Unresolved local var: SLONG t@[???]
                       Unresolved local var: SLONG arg2@[???]
                       Unresolved local var: SLONG arg3@[???] */
  if (pf != (MODULE *)0x0) {
    if (arg1 == 32000) {
      if (in_a1 == 0) {
        bVar1 = in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < in_a1;
      }
      if (((!bVar1) && (in_a2 < (int)(uint)pf->numchn)) && (iVar2 = 0, pf->numchn != 0)) {
        bVar1 = 0 < in_a1;
        do {
          if ((bVar1) || (in_a2 < iVar2)) {
            pf->control[iVar2].muted = '\x01';
          }
          iVar2 = iVar2 + 1;
          bVar1 = iVar2 < in_a1;
        } while (iVar2 < (int)(uint)pf->numchn);
      }
    }
    else if (arg1 == 0x7d01) {
      if (in_a1 == 0) {
        bVar1 = in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < in_a1;
      }
      if (((!bVar1) && (in_a2 < (int)(uint)pf->numchn)) && (in_a1 < (int)(uint)pf->numchn)) {
        iVar2 = in_a1 * 0x7c;
        do {
          in_a1 = in_a1 + 1;
          (&pf->control->muted)[iVar2] = '\x01';
          iVar2 = iVar2 + 0x7c;
          if ((int)(uint)pf->numchn <= in_a1) {
            return;
          }
        } while (in_a1 <= in_a2);
      }
    }
    else if (arg1 < (int)(uint)pf->numchn) {
      pf->control[arg1].muted = '\x01';
    }
  }
  return;
}



----------------------------------------

// Function: Player_Unmute @ 08946614

void Player_Unmute(SLONG arg1,...)

{
  bool bVar1;
  int iVar2;
  int in_a1;
  int in_a2;
  
                    /* Unresolved local var: va_list args@[???]
                       Unresolved local var: SLONG t@[???]
                       Unresolved local var: SLONG arg2@[???]
                       Unresolved local var: SLONG arg3@[???] */
  if (pf != (MODULE *)0x0) {
    if (arg1 == 32000) {
      if (in_a1 == 0) {
        bVar1 = in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < in_a1;
      }
      if (((!bVar1) && (in_a2 < (int)(uint)pf->numchn)) && (iVar2 = 0, pf->numchn != 0)) {
        bVar1 = 0 < in_a1;
        do {
          if ((bVar1) || (in_a2 < iVar2)) {
            pf->control[iVar2].muted = '\0';
          }
          iVar2 = iVar2 + 1;
          bVar1 = iVar2 < in_a1;
        } while (iVar2 < (int)(uint)pf->numchn);
      }
    }
    else if (arg1 == 0x7d01) {
      if (in_a1 == 0) {
        bVar1 = in_a2 < 0;
        if (in_a2 == 0) {
          return;
        }
      }
      else {
        in_a2 = 0;
        bVar1 = 0 < in_a1;
      }
      if (((!bVar1) && (in_a2 < (int)(uint)pf->numchn)) && (in_a1 < (int)(uint)pf->numchn)) {
        iVar2 = in_a1 * 0x7c;
        do {
          in_a1 = in_a1 + 1;
          (&pf->control->muted)[iVar2] = '\0';
          iVar2 = iVar2 + 0x7c;
          if ((int)(uint)pf->numchn <= in_a1) {
            return;
          }
        } while (in_a1 <= in_a2);
      }
    }
    else if (arg1 < (int)(uint)pf->numchn) {
      pf->control[arg1].muted = '\0';
    }
  }
  return;
}



----------------------------------------

// Function: Player_SetPosition @ 08946798

void Player_SetPosition(UWORD pos)

{
  MODULE *pMVar1;
  UBYTE UVar2;
  MP_VOICE *pMVar3;
  uint uVar4;
  int iVar5;
  MP_CONTROL *pMVar6;
  int iVar7;
  ushort uVar8;
  
  UVar2 = md_sngchn;
  pMVar1 = pf;
  if (pf != (MODULE *)0x0) {
                    /* Unresolved local var: int t@[???] */
    uVar8 = pf->numpos;
    if (pos < pf->numpos) {
      uVar8 = pos;
    }
    pf->vbtick = pf->sngspd;
    pMVar1->forbid = 1;
    pMVar1->posjmp = 2;
    pMVar1->patbrk = 0;
    pMVar1->sngpos = uVar8;
    if (UVar2 != '\0') {
      iVar5 = 0;
      do {
        Voice_Stop_internal((SBYTE)iVar5);
        uVar4 = (uint)md_sngchn;
        iVar7 = iVar5 + 1;
        pMVar3 = pf->voice;
        pMVar3[iVar5].s = (SAMPLE *)0x0;
        pMVar3[iVar5].i = (INSTRUMENT *)0x0;
        iVar5 = iVar7;
      } while (iVar7 < (int)uVar4);
    }
    pMVar1 = pf;
    if (pf->numchn != '\0') {
      pMVar6 = pf->control;
      iVar5 = 0;
      do {
        iVar7 = iVar5 + 1;
        pMVar1->control[iVar5].i = (INSTRUMENT *)0x0;
        pMVar6[iVar5].s = (SAMPLE *)0x0;
        iVar5 = iVar7;
      } while (iVar7 < (int)(uint)pMVar1->numchn);
    }
    pMVar1->forbid = 0;
    if (uVar8 == 0) {
      Player_Init_internal(pf);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: Player_PrevPosition @ 089468d4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_PrevPosition(void)

{
  UWORD *pUVar1;
  MODULE *pMVar2;
  UBYTE UVar3;
  MP_VOICE *pMVar4;
  uint uVar5;
  int iVar6;
  MP_CONTROL *pMVar7;
  int iVar8;
  
  UVar3 = md_sngchn;
  pMVar2 = pf;
  if (pf != (MODULE *)0x0) {
    pUVar1 = &pf->sngspd;
                    /* Unresolved local var: int t@[???] */
    pf->posjmp = 1;
    pMVar2->vbtick = *pUVar1;
    pMVar2->forbid = 1;
    pMVar2->patbrk = 0;
    if (UVar3 != '\0') {
      iVar6 = 0;
      do {
        Voice_Stop_internal((SBYTE)iVar6);
        uVar5 = (uint)md_sngchn;
        iVar8 = iVar6 + 1;
        pMVar4 = pf->voice;
        pMVar4[iVar6].s = (SAMPLE *)0x0;
        pMVar4[iVar6].i = (INSTRUMENT *)0x0;
        iVar6 = iVar8;
      } while (iVar8 < (int)uVar5);
    }
    pMVar2 = pf;
    if (pf->numchn == '\0') {
      pf->forbid = 0;
    }
    else {
      pMVar7 = pf->control;
      iVar6 = 0;
      do {
        iVar8 = iVar6 + 1;
        pMVar2->control[iVar6].i = (INSTRUMENT *)0x0;
        pMVar7[iVar6].s = (SAMPLE *)0x0;
        iVar6 = iVar8;
      } while (iVar8 < (int)(uint)pMVar2->numchn);
      pMVar2->forbid = 0;
    }
  }
  return;
}



----------------------------------------

// Function: Player_NextPosition @ 089469c8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_NextPosition(void)

{
  MODULE *pMVar1;
  UBYTE UVar2;
  MP_VOICE *pMVar3;
  uint uVar4;
  int iVar5;
  MP_CONTROL *pMVar6;
  int iVar7;
  
  UVar2 = md_sngchn;
  pMVar1 = pf;
  if (pf != (MODULE *)0x0) {
                    /* Unresolved local var: int t@[???] */
    pf->vbtick = pf->sngspd;
    pMVar1->forbid = 1;
    pMVar1->posjmp = 3;
    pMVar1->patbrk = 0;
    if (UVar2 != '\0') {
      iVar5 = 0;
      do {
        Voice_Stop_internal((SBYTE)iVar5);
        uVar4 = (uint)md_sngchn;
        iVar7 = iVar5 + 1;
        pMVar3 = pf->voice;
        pMVar3[iVar5].s = (SAMPLE *)0x0;
        pMVar3[iVar5].i = (INSTRUMENT *)0x0;
        iVar5 = iVar7;
      } while (iVar7 < (int)uVar4);
    }
    pMVar1 = pf;
    if (pf->numchn == '\0') {
      pf->forbid = 0;
    }
    else {
      pMVar6 = pf->control;
      iVar5 = 0;
      do {
        iVar7 = iVar5 + 1;
        pMVar1->control[iVar5].i = (INSTRUMENT *)0x0;
        pMVar6[iVar5].s = (SAMPLE *)0x0;
        iVar5 = iVar7;
      } while (iVar7 < (int)(uint)pMVar1->numchn);
      pMVar1->forbid = 0;
    }
  }
  return;
}



----------------------------------------

// Function: Player_Stop_internal @ 08946ac0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_Stop_internal(void)

{
  if (md_sfxchn == '\0') {
    MikMod_DisableOutput_internal();
  }
  if (pf != (MODULE *)0x0) {
    pf->forbid = 1;
  }
  pf = (MODULE *)0x0;
  return;
}



----------------------------------------

// Function: Player_Stop @ 08946b0c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_Stop(void)

{
  if (md_sfxchn == '\0') {
    MikMod_DisableOutput_internal();
  }
  if (pf != (MODULE *)0x0) {
    pf->forbid = 1;
  }
  pf = (MODULE *)0x0;
  return;
}



----------------------------------------

// Function: Player_Start @ 08946b14

void Player_Start(MODULE *mf)

{
  bool bVar1;
  MODULE *pMVar2;
  MODULE *pMVar3;
  BOOL BVar4;
  int iVar5;
  
                    /* Unresolved local var: int t@[???] */
  pMVar3 = pf;
  if (mf != (MODULE *)0x0) {
    BVar4 = MikMod_Active();
    if (BVar4 == 0) {
      MikMod_EnableOutput();
    }
    pMVar2 = pf;
    bVar1 = mf != pf;
    mf->forbid = 0;
    pMVar3 = mf;
    if (bVar1) {
      if (pMVar2 != (MODULE *)0x0) {
        pMVar2->forbid = 1;
      }
      iVar5 = 0;
      pMVar3 = mf;
      if (md_sngchn != '\0') {
        do {
          Voice_Stop_internal((SBYTE)iVar5);
          iVar5 = iVar5 + 1;
          pMVar3 = mf;
        } while (iVar5 < (int)(uint)md_sngchn);
      }
    }
  }
  pf = pMVar3;
  return;
}



----------------------------------------

// Function: Player_Exit_internal @ 08946bbc

void Player_Exit_internal(MODULE *mf)

{
  if (mf != (MODULE *)0x0) {
    if (mf == pf) {
      Player_Stop_internal();
      pf = (MODULE *)0x0;
    }
    if (mf->control != (MP_CONTROL *)0x0) {
      free(mf->control);
    }
    if (mf->voice != (MP_VOICE *)0x0) {
      free(mf->voice);
    }
    mf->voice = (MP_VOICE *)0x0;
    mf->control = (MP_CONTROL *)0x0;
  }
  return;
}



----------------------------------------

// Function: Player_Exit @ 08946c38

void Player_Exit(MODULE *mf)

{
  if (mf != (MODULE *)0x0) {
    if (mf == pf) {
      Player_Stop_internal();
      pf = (MODULE *)0x0;
    }
    if (mf->control != (MP_CONTROL *)0x0) {
      free(mf->control);
    }
    if (mf->voice != (MP_VOICE *)0x0) {
      free(mf->voice);
    }
    mf->voice = (MP_VOICE *)0x0;
    mf->control = (MP_CONTROL *)0x0;
  }
  return;
}



----------------------------------------

// Function: Player_Init @ 08946c40

BOOL Player_Init(MODULE *mf)

{
  MP_CONTROL *pMVar1;
  MP_VOICE *pMVar2;
  
  mf->loop = 1;
  mf->extspd = 1;
  mf->panflag = 1;
  mf->wrap = 0;
  mf->fadeout = 0;
  mf->relspd = 0;
  pMVar1 = _mm_calloc((uint)mf->numchn,0x7c);
  mf->control = pMVar1;
  if (pMVar1 != (MP_CONTROL *)0x0) {
    pMVar2 = _mm_calloc((uint)md_sngchn,0x68);
    mf->voice = pMVar2;
    if (pMVar2 != (MP_VOICE *)0x0) {
      Player_Init_internal(mf);
      return 0;
    }
  }
  return 1;
}



----------------------------------------

// Function: pt_EffectsPass2 @ 08946ccc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void pt_EffectsPass2(void)

{
  UBYTE UVar1;
  byte bVar2;
  int iVar3;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  
                    /* Unresolved local var: UBYTE c@[???] */
  mp_channel = 0;
  if (pf->numchn != '\0') {
    iVar3 = 0;
    do {
      a = pf->control + iVar3;
      if (a->row != (UBYTE *)0x0) {
        UniSetRow(a->row);
        do {
          UVar1 = UniGetByte();
          iVar3 = CONCAT31(extraout_var,UVar1);
          while( true ) {
            if (iVar3 == 0) goto LAB_08946d68;
            if (iVar3 == 0x36) break;
            UniSkipOpcode((UBYTE)iVar3);
            UVar1 = UniGetByte();
            iVar3 = CONCAT31(extraout_var_00,UVar1);
          }
          bVar2 = UniGetByte();
          if ((CONCAT31(extraout_var_01,bVar2) & 0xfff) >> 4 == 7) {
            DoNNAEffects(bVar2 & 0xf);
          }
        } while( true );
      }
LAB_08946d68:
      mp_channel = mp_channel + 1;
      iVar3 = (int)mp_channel;
    } while (iVar3 < (int)(uint)pf->numchn);
  }
  return;
}



----------------------------------------

// Function: pt_NNA @ 08946dd4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void pt_NNA(void)

{
  UBYTE UVar1;
  BOOL BVar2;
  uint uVar3;
  int iVar4;
  MP_VOICE *pMVar5;
  MP_CONTROL *pMVar6;
  
  mp_channel = 0;
  if (pf->numchn != '\0') {
    iVar4 = 0;
    do {
      pMVar6 = pf->control + iVar4;
      a = pMVar6;
      if (pMVar6->kick == '\x01') {
                    /* Unresolved local var: BOOL k@[???] */
        pMVar5 = pMVar6->slave;
        if (pMVar5 == (MP_VOICE *)0x0) {
          UVar1 = pMVar6->dct;
        }
        else {
                    /* Unresolved local var: MP_VOICE * aout@[???] */
          if ((pMVar5->nna & 3) == 0) {
            UVar1 = pMVar6->dct;
          }
          else {
            pMVar6->slave = (MP_VOICE *)0x0;
            pMVar5->mflag = 0;
            if (pMVar5->nna == '\x02') {
              pMVar5->keyoff = pMVar5->keyoff | 1;
              if ((pMVar5->volflg & 5) != 1) {
                pMVar5->keyoff = '\x03';
              }
            }
            else if (pMVar5->nna == '\x03') {
              pMVar5->keyoff = pMVar5->keyoff | 2;
            }
            UVar1 = pMVar6->dct;
          }
        }
                    /* Unresolved local var: int t@[???] */
        if ((UVar1 != '\0') && (iVar4 = 0, md_sngchn != '\0')) {
          do {
            BVar2 = Voice_Stopped_internal((SBYTE)iVar4);
            uVar3 = (uint)md_sngchn;
            if (BVar2 == 0) {
              pMVar5 = pf->voice;
              uVar3 = (uint)md_sngchn;
              if ((pMVar5[iVar4].masterchn == mp_channel) &&
                 (uVar3 = (uint)md_sngchn, a->sample == pMVar5[iVar4].sample)) {
                UVar1 = a->dct;
                if (UVar1 == '\x02') {
                  uVar3 = (uint)md_sngchn;
                  if (a->handle != pMVar5[iVar4].handle) goto LAB_08946ed0;
                  UVar1 = a->dca;
                }
                else if (UVar1 == '\x03') {
                  UVar1 = a->dca;
                }
                else {
                  uVar3 = (uint)md_sngchn;
                  if ((UVar1 != '\x01') || (uVar3 = (uint)md_sngchn, a->note != pMVar5[iVar4].note))
                  goto LAB_08946ed0;
                  UVar1 = a->dca;
                }
                if (UVar1 == '\x01') {
                  pMVar5[iVar4].keyoff = pMVar5[iVar4].keyoff | 1;
                  if ((pf->voice[iVar4].volflg & 5) == 1) {
                    uVar3 = (uint)md_sngchn;
                    goto LAB_08946ed0;
                  }
                  pf->voice[iVar4].keyoff = '\x03';
                }
                else if (UVar1 == '\0') {
                  pMVar5[iVar4].fadevol = 0;
                }
                else {
                  uVar3 = (uint)md_sngchn;
                  if (UVar1 != '\x02') goto LAB_08946ed0;
                  pMVar5[iVar4].keyoff = pMVar5[iVar4].keyoff | 2;
                }
                uVar3 = (uint)md_sngchn;
              }
            }
LAB_08946ed0:
            iVar4 = iVar4 + 1;
          } while (iVar4 < (int)uVar3);
        }
      }
      mp_channel = mp_channel + 1;
      iVar4 = (int)mp_channel;
    } while (iVar4 < (int)(uint)pf->numchn);
  }
  return;
}



----------------------------------------

// Function: pt_SetupVoices @ 08947020

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void pt_SetupVoices(void)

{
  UBYTE UVar1;
  SWORD SVar2;
  int iVar3;
  BOOL BVar4;
  uint uVar5;
  MP_CONTROL *pMVar6;
  SAMPLE *pSVar7;
  SLONG SVar8;
  uint uVar9;
  MP_VOICE *pMVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  
                    /* Unresolved local var: MP_VOICE * aout@[???] */
  mp_channel = 0;
  if (pf->numchn != '\0') {
    uVar11 = 0;
    do {
      pMVar6 = pf->control + uVar11;
      a = pMVar6;
      if (pMVar6->notedelay == '\0') {
        if (pMVar6->kick == '\x01') {
          if ((pf->flags & 8) == 0) {
            pMVar10 = pf->voice;
            pMVar6->slavechn = (UBYTE)uVar11;
            pMVar6->slave = pMVar10 + (uVar11 & 0xff);
LAB_089471f0:
            pMVar10 = a->slave;
            if (pMVar10 == (MP_VOICE *)0x0) goto LAB_0894713c;
            iVar3 = pMVar10->mflag;
          }
          else {
            pMVar10 = pMVar6->slave;
            if (pMVar10 == (MP_VOICE *)0x0) {
                    /* Unresolved local var: int newchn@[???]
                       Unresolved local var: MP_VOICE * a@[???]
                       Unresolved local var: ULONG t@[???]
                       Unresolved local var: ULONG k@[???]
                       Unresolved local var: ULONG tvol@[???]
                       Unresolved local var: ULONG pp@[???] */
              uVar11 = 0;
              if (md_sngchn != '\0') {
                do {
                  UVar1 = pf->voice[uVar11].kick;
                  if (((UVar1 == '\0') || (UVar1 == '\x04')) &&
                     (BVar4 = Voice_Stopped_internal((SBYTE)uVar11), BVar4 != 0)) goto LAB_08947300;
                  uVar12 = (uint)md_sngchn;
                  uVar11 = uVar11 + 1;
                } while (uVar11 < uVar12);
                pMVar10 = pf->voice;
                if (uVar12 != 0) {
                  uVar13 = 0;
                  uVar9 = 0;
                  uVar14 = 0xffffff;
                  do {
                    if (pMVar10->kick == '\0') {
                      pSVar7 = pMVar10->s;
LAB_089472b4:
                      uVar5 = pMVar10->totalvol << ((pSVar7->flags & 0x1ff) >> 8);
                      if ((pMVar10->master != (MP_CONTROL *)0x0) &&
                         (pMVar10->master->slave == pMVar10)) {
                        uVar5 = uVar5 << 2;
                      }
                      uVar11 = uVar13;
                      if (uVar14 <= uVar5) {
                        uVar11 = uVar9;
                        uVar5 = uVar14;
                      }
                    }
                    else {
                      uVar11 = uVar9;
                      uVar5 = uVar14;
                      if (pMVar10->kick == '\x04') {
                        pSVar7 = pMVar10->s;
                        goto LAB_089472b4;
                      }
                    }
                    uVar13 = uVar13 + 1;
                    pMVar10 = pMVar10 + 1;
                    uVar9 = uVar11;
                    uVar14 = uVar5;
                  } while (uVar13 != uVar12);
                  if (uVar5 < 0xdac1) {
LAB_08947300:
                    pMVar6 = a;
                    if (uVar11 != 0xffffffff) {
                      pMVar10 = pf->voice;
                      a->slavechn = (UBYTE)uVar11;
                      pMVar6->slave = pMVar10 + (uVar11 & 0xff);
                    }
                  }
                }
              }
              goto LAB_089471f0;
            }
            iVar3 = pMVar10->mflag;
          }
          pMVar6 = a;
          if ((iVar3 != 0) && (pMVar10->master != (MP_CONTROL *)0x0)) {
            pMVar10->master->slave = (MP_VOICE *)0x0;
          }
          SVar2 = mp_channel;
          pMVar10->master = pMVar6;
          pMVar6->slave = pMVar10;
          pMVar10->masterchn = SVar2;
          pMVar10->mflag = 1;
LAB_089470ac:
          pMVar6 = a;
          pMVar10->kick = a->kick;
          pSVar7 = pMVar6->s;
          pMVar10->i = pMVar6->i;
          pMVar10->s = pSVar7;
          pMVar10->sample = pMVar6->sample;
          pMVar10->handle = pMVar6->handle;
          pMVar10->period = pMVar6->period;
          pMVar10->panning = pMVar6->panning;
          pMVar10->chanvol = pMVar6->chanvol;
          SVar8 = pMVar6->start;
          pMVar10->fadevol = pMVar6->fadevol;
          pMVar10->start = SVar8;
          pMVar10->volflg = pMVar6->volflg;
          pMVar10->panflg = pMVar6->panflg;
          pMVar10->pitflg = pMVar6->pitflg;
          pMVar10->volume = pMVar6->outvolume;
          pMVar10->keyoff = pMVar6->keyoff;
          pMVar10->note = pMVar6->note;
          pMVar10->nna = pMVar6->nna;
        }
        else {
          pMVar10 = pMVar6->slave;
          if (pMVar10 != (MP_VOICE *)0x0) goto LAB_089470ac;
        }
LAB_0894713c:
        a->kick = '\0';
      }
      mp_channel = mp_channel + 1;
      uVar11 = (uint)mp_channel;
    } while ((int)uVar11 < (int)(uint)pf->numchn);
  }
  return;
}



----------------------------------------

// Function: getrandom @ 08947330

int getrandom(int ceil)

{
  int iVar1;
  SItype SVar2;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
  iVar1 = rand();
  __floatsidf(iVar1 * ceil);
  __muldf3(in_f12_13,in_f14_15);
  SVar2 = __fixdfsi(in_f12_13);
  return SVar2;
}



----------------------------------------

// Function: DoITVibrato @ 08947384

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void DoITVibrato(void)

{
  char cVar1;
  MP_CONTROL *pMVar2;
  byte bVar3;
  short sVar4;
  uint uVar5;
  
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: UWORD temp@[???] */
  bVar3 = a->wavecontrol & 3;
  uVar5 = ((int)a->vibpos & 0x7fU) >> 2;
  if (bVar3 == 1) {
    cVar1 = a->vibpos;
    sVar4 = (short)(((uint)a->vibdepth * 0xff >> 8) << 2);
    pMVar2 = a;
  }
  else {
    if (bVar3 < 2) {
      if ((a->wavecontrol & 3) == 0) {
        uVar5 = (uint)""[uVar5];
      }
      else {
        uVar5 = 0;
      }
    }
    else if (bVar3 == 2) {
      uVar5 = uVar5 << 3;
      if (a->vibpos < 0) {
        uVar5 = uVar5 ^ 0xff;
      }
    }
    else if (bVar3 == 3) {
      uVar5 = getrandom(0x100);
      uVar5 = uVar5 & 0xffff;
    }
    else {
      uVar5 = 0;
    }
    cVar1 = a->vibpos;
    sVar4 = (short)(((uVar5 * a->vibdepth & 0xffff) >> 8) << 2);
    pMVar2 = a;
  }
  a = pMVar2;
  if (cVar1 < '\0') {
    pMVar2->period = pMVar2->tmpperiod - sVar4;
    pMVar2->vibpos = pMVar2->vibpos + pMVar2->vibspd;
    return;
  }
  pMVar2->period = sVar4 + pMVar2->tmpperiod;
  pMVar2->vibpos = pMVar2->vibpos + pMVar2->vibspd;
  return;
}



----------------------------------------

// Function: DoVibrato @ 089474b4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void DoVibrato(void)

{
  char cVar1;
  MP_CONTROL *pMVar2;
  byte bVar3;
  short sVar4;
  uint uVar5;
  
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: UWORD temp@[???] */
  bVar3 = a->wavecontrol & 3;
  uVar5 = ((int)a->vibpos & 0x7fU) >> 2;
  if (bVar3 == 1) {
    uVar5 = uVar5 << 3;
    if (a->vibpos < 0) {
      uVar5 = uVar5 ^ 0xff;
    }
    cVar1 = a->vibpos;
    sVar4 = (short)((uVar5 * a->vibdepth >> 7) << 2);
    pMVar2 = a;
  }
  else {
    if (bVar3 < 2) {
      if ((a->wavecontrol & 3) == 0) {
        uVar5 = (uint)""[uVar5];
      }
      else {
        uVar5 = 0;
      }
    }
    else if (bVar3 == 2) {
      uVar5 = 0xff;
    }
    else if (bVar3 == 3) {
      uVar5 = getrandom(0x100);
      uVar5 = uVar5 & 0xffff;
    }
    else {
      uVar5 = 0;
    }
    cVar1 = a->vibpos;
    sVar4 = (short)(((uVar5 * a->vibdepth & 0xffff) >> 7) << 2);
    pMVar2 = a;
  }
  a = pMVar2;
  if (cVar1 < '\0') {
    pMVar2->period = pMVar2->tmpperiod - sVar4;
  }
  else {
    pMVar2->period = sVar4 + pMVar2->tmpperiod;
  }
  if (pf->vbtick != 0) {
    pMVar2->vibpos = pMVar2->vibpos + pMVar2->vibspd;
  }
  return;
}



----------------------------------------

// Function: pt_EffectsPass1 @ 089475dc

/* WARNING: Removing unreachable block (ram,0x089495a0) */
/* WARNING: Removing unreachable block (ram,0x08948ab8) */
/* WARNING: Removing unreachable block (ram,0x08949058) */
/* WARNING: Removing unreachable block (ram,0x089478b0) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void pt_EffectsPass1(void)

{
  UBYTE *pUVar1;
  UWORD *pUVar2;
  SBYTE *pSVar3;
  byte bVar4;
  char cVar5;
  MODULE *pMVar6;
  MODULE *pMVar7;
  UBYTE UVar8;
  SBYTE SVar9;
  UBYTE UVar10;
  byte bVar11;
  SWORD SVar12;
  UWORD UVar13;
  short sVar14;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  undefined3 extraout_var_02;
  undefined3 extraout_var_03;
  undefined3 extraout_var_04;
  undefined3 extraout_var_05;
  undefined3 extraout_var_06;
  undefined3 extraout_var_07;
  undefined3 extraout_var_08;
  undefined3 extraout_var_09;
  undefined3 extraout_var_10;
  undefined3 extraout_var_11;
  undefined3 extraout_var_12;
  undefined3 extraout_var_13;
  undefined2 extraout_var_23;
  uint uVar16;
  undefined3 extraout_var_14;
  undefined3 extraout_var_15;
  undefined3 extraout_var_16;
  undefined3 extraout_var_17;
  undefined3 extraout_var_18;
  undefined3 extraout_var_19;
  undefined3 extraout_var_20;
  undefined3 extraout_var_21;
  undefined3 extraout_var_22;
  int iVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  INSTRUMENT *pIVar21;
  ushort uVar22;
  MP_CONTROL *pMVar23;
  ushort uVar24;
  MP_VOICE *pMVar25;
  ENVPT *pEVar26;
  uint uVar27;
  SAMPLE *pSVar15;
  
                    /* Unresolved local var: MP_VOICE * aout@[???] */
  mp_channel = 0;
  if (pf->numchn != '\0') {
    iVar19 = 0;
    do {
      while( true ) {
        pMVar23 = pf->control + iVar19;
        pMVar25 = pMVar23->slave;
        a = pMVar23;
        if (pMVar25 != (MP_VOICE *)0x0) {
          pMVar23->fadevol = pMVar25->fadevol;
          pMVar23->period = pMVar25->period;
          if (pMVar23->kick == '\x02') {
            pMVar23->keyoff = pMVar25->keyoff;
          }
        }
        if (pMVar23->row == (UBYTE *)0x0) break;
        UniSetRow(pMVar23->row);
        pMVar23 = a;
        explicitslides = 0;
        a->ownper = 0;
        pMVar23->ownvol = 0;
switchD_08948350_caseD_0:
        UVar8 = UniGetByte();
        iVar19 = CONCAT31(extraout_var,UVar8);
                    /* Unresolved local var: UBYTE dat@[???]
                       Unresolved local var: UBYTE c@[???] */
        if (iVar19 != 0) {
          do {
                    /* Unresolved local var: int oldsliding@[???] */
            pMVar23 = a;
            SVar9 = a->sliding;
            a->sliding = '\0';
            pMVar6 = pf;
                    /* WARNING: Could not find normalized switch variable to match jumptable */
            switch(iVar19) {
            case 1:
            case 2:
              goto switchD_089476b4_caseD_1;
            case 3:
              UVar8 = UniGetByte();
              uVar16 = CONCAT31(extraout_var_01,UVar8);
              if (pf->vbtick == 0) {
                if ((uVar16 == 0) && ((pf->flags & 0x100) != 0)) {
                  uVar16 = (uint)a->arpmem;
                }
                a->arpmem = (UBYTE)uVar16;
              }
              pMVar23 = a;
              if (a->period != 0) {
                bVar11 = a->arpmem;
                    /* Unresolved local var: UBYTE note@[???] */
                uVar22 = (ushort)a->note;
                if (bVar11 != 0) {
                  uVar16 = (uint)pf->vbtick % 3;
                  if (uVar16 == 1) {
                    uVar22 = uVar22 + (bVar11 >> 4) & 0xff;
                  }
                  else if (uVar16 == 2) {
                    uVar22 = uVar22 + (bVar11 & 0xf) & 0xff;
                  }
                  UVar13 = GetPeriod(uVar22 << 1,a->speed);
                  pMVar23->ownper = 1;
                  pMVar23->period = UVar13;
                }
              }
              goto switchD_08948350_caseD_0;
            case 4:
              UVar8 = UniGetByte();
              if ((pf->vbtick == 0) && (CONCAT31(extraout_var_02,UVar8) != 0)) {
                a->slidespeed = (short)CONCAT31(extraout_var_02,UVar8) << 2;
              }
              if ((a->period != 0) && (pf->vbtick != 0)) {
                a->tmpperiod = a->tmpperiod - a->slidespeed;
              }
              goto switchD_08948350_caseD_0;
            case 5:
              UVar8 = UniGetByte();
              if ((pf->vbtick == 0) && (CONCAT31(extraout_var_03,UVar8) != 0)) {
                a->slidespeed = (short)CONCAT31(extraout_var_03,UVar8) << 2;
              }
              if ((a->period != 0) && (pf->vbtick != 0)) {
                a->tmpperiod = a->tmpperiod + a->slidespeed;
              }
              goto switchD_08948350_caseD_0;
            case 6:
              UVar8 = UniGetByte();
              if ((pf->vbtick == 0) && (CONCAT31(extraout_var_04,UVar8) != 0)) {
                a->portspeed = (short)CONCAT31(extraout_var_04,UVar8) << 2;
              }
              pMVar23 = a;
              if (a->period != 0) {
                if (a->fadevol == 0) {
                  UVar8 = '\x01';
                  if (a->kick != '\x01') {
                    UVar8 = '\x02';
                  }
                  a->kick = UVar8;
                }
                else {
                  UVar8 = '\x04';
                  if (a->kick != '\x01') {
                    UVar8 = '\0';
                  }
                  a->kick = UVar8;
                }
                DoToneSlide();
                pMVar23->ownper = 1;
              }
              goto switchD_08948350_caseD_0;
            case 7:
            case 0x1f:
              bVar11 = UniGetByte();
              if (pf->vbtick != 0) {
                if (a->period != 0) {
                  DoVibrato();
                  a->ownper = 1;
                }
                goto switchD_08948350_caseD_0;
              }
              if ((bVar11 & 0xf) == 0) {
                if ((bVar11 & 0xf0) == 0) goto switchD_08948350_caseD_0;
                UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
              }
              else {
                a->vibdepth = bVar11 & 0xf;
                if ((bVar11 & 0xf0) == 0) goto switchD_08948350_caseD_0;
                UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
              }
              a->vibspd = UVar8;
              goto switchD_08948350_caseD_0;
            case 8:
              UVar8 = UniGetByte();
              pMVar23 = a;
              if (a->period != 0) {
                if (a->fadevol == 0) {
                  UVar10 = '\x01';
                  if (a->kick != '\x01') {
                    UVar10 = '\x02';
                  }
                  a->kick = UVar10;
                }
                else {
                  UVar10 = '\x04';
                  if (a->kick != '\x01') {
                    UVar10 = '\0';
                  }
                  a->kick = UVar10;
                }
                DoToneSlide();
                pMVar23->ownper = 1;
              }
              DoVolSlide(UVar8);
              goto switchD_08948350_caseD_0;
            case 9:
              UVar8 = UniGetByte();
              if ((a->period != 0) && (pf->vbtick != 0)) {
                DoVibrato();
                a->ownper = 1;
              }
              DoVolSlide(UVar8);
              goto switchD_08948350_caseD_0;
            case 10:
              bVar11 = UniGetByte();
              if (pf->vbtick == 0) {
                if ((bVar11 & 0xf) == 0) {
                  if ((bVar11 & 0xf0) != 0) {
                    UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
LAB_08948de4:
                    a->trmspd = UVar8;
                  }
                }
                else {
                  a->trmdepth = bVar11 & 0xf;
                  if ((bVar11 & 0xf0) != 0) {
                    UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
                    goto LAB_08948de4;
                  }
                }
              }
              if (a->period != 0) {
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: UWORD temp@[???] */
                uVar16 = (a->wavecontrol & 0x3f) >> 4;
                uVar18 = ((int)a->trmpos & 0x7fU) >> 2;
                if (uVar16 == 1) {
                  uVar22 = (ushort)(uVar18 << 3);
                  if (a->trmpos < 0) {
                    uVar22 = uVar22 ^ 0xff;
                  }
                }
                else if (uVar16 < 2) {
                  if (uVar16 == 0) {
                    uVar22 = (ushort)""[uVar18];
                  }
                  else {
                    uVar22 = 0;
                  }
                }
                else if (uVar16 == 2) {
                  uVar22 = 0xff;
                }
                else if (uVar16 == 3) {
                  iVar19 = getrandom(0x100);
                  uVar22 = (ushort)iVar19;
                }
                else {
                  uVar22 = 0;
                }
                pMVar23 = a;
                uVar22 = uVar22 * a->trmdepth;
                if (a->trmpos < '\0') {
                  sVar14 = a->tmpvolume - (uVar22 >> 6);
                  a->volume = sVar14;
                  if (sVar14 < 0) {
                    pMVar23->volume = 0;
                  }
                }
                else {
                  sVar14 = (uVar22 >> 6) + a->tmpvolume;
                  a->volume = sVar14;
                  if (0x40 < sVar14) {
                    pMVar23->volume = 0x40;
                  }
                }
                if (pf->vbtick != 0) {
                  pMVar23->trmpos = pMVar23->trmpos + pMVar23->trmspd;
                }
                pMVar23->ownvol = 1;
              }
              goto switchD_08948350_caseD_0;
            case 0xb:
              UVar8 = UniGetByte();
              pMVar23 = a;
              if (pf->panflag != 0) {
                UVar13 = (UWORD)CONCAT31(extraout_var_05,UVar8);
                pf->panning[mp_channel] = UVar13;
                pMVar23->panning = UVar13;
              }
              goto switchD_08948350_caseD_0;
            case 0xc:
              UVar8 = UniGetByte();
              pMVar23 = a;
              if (pf->vbtick == 0) {
                if (CONCAT31(extraout_var_06,UVar8) == 0) {
                  pSVar15 = a->s;
                  uVar16 = (uint)a->soffset | a->hioffset;
                  a->start = uVar16;
                }
                else {
                  a->soffset = (short)CONCAT31(extraout_var_06,UVar8) << 8;
                  pSVar15 = pMVar23->s;
                  uVar16 = (uint)pMVar23->soffset | pMVar23->hioffset;
                  pMVar23->start = uVar16;
                }
                if ((pSVar15 != (SAMPLE *)0x0) && (pSVar15->length < uVar16)) {
                  if ((pSVar15->flags & 0x300) == 0) {
                    pMVar23->start = pSVar15->length;
                  }
                  else {
                    pMVar23->start = pSVar15->loopstart;
                  }
                }
              }
              goto switchD_08948350_caseD_0;
            case 0xd:
              UVar8 = UniGetByte();
              DoVolSlide(UVar8);
              goto switchD_08948350_caseD_0;
            case 0xe:
              UVar8 = UniGetByte();
              iVar19 = CONCAT31(extraout_var_09,UVar8);
              if ((pf->vbtick != 0) || (pf->patdly2 != '\0')) goto switchD_08948350_caseD_0;
              iVar20 = (int)pf->sngpos;
              if (iVar19 == iVar20) {
                if (pf->patbrk == pf->patpos) goto switchD_08948350_caseD_0;
                iVar17 = pf->loop;
              }
              else {
                iVar17 = pf->loop;
              }
              if (iVar17 == 0) {
                if (pf->patbrk != 0) {
                  uVar22 = pf->numpos;
                  goto LAB_089490b4;
                }
                if ((iVar19 < iVar20) || (uVar16 = (uint)pf->numpos, iVar20 == uVar16 - 1)) {
LAB_08948018:
                  pf->posjmp = 3;
                  goto switchD_08948350_caseD_0;
                }
                if (iVar19 == iVar20) {
                  if ((pf->flags & 0x80) != 0) goto LAB_08948018;
                  goto LAB_089490b8;
                }
              }
              else {
                uVar22 = pf->numpos;
LAB_089490b4:
                uVar16 = (uint)uVar22;
LAB_089490b8:
                if (iVar20 == uVar16 - 1) {
                  uVar22 = 0x80;
                  if (pf->initvolume < 0x81) {
                    uVar22 = (ushort)pf->initvolume;
                  }
                  pf->volume = uVar22;
                }
              }
              pMVar6 = pf;
              pf->sngpos = (SWORD)iVar19;
              pMVar6->posjmp = 2;
              pMVar6->patpos = 0;
              goto switchD_08948350_caseD_0;
            case 0xf:
              UVar8 = UniGetByte();
              uVar16 = CONCAT31(extraout_var_07,UVar8);
              if (pf->vbtick == 0) {
                if (uVar16 == 0xff) {
                  a->anote = '\0';
                  a->tmpvolume = 0;
                }
                else {
                  uVar18 = 0x40;
                  if (uVar16 < 0x41) {
                    uVar18 = uVar16;
                  }
                  a->tmpvolume = (SWORD)uVar18;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x10:
              UVar8 = UniGetByte();
              pMVar6 = pf;
              uVar16 = CONCAT31(extraout_var_08,UVar8);
              if ((pf->vbtick == 0) && (pf->patdly2 == '\0')) {
                if ((pf->positions[pf->sngpos] != 0xff) &&
                   (pf->pattrows[pf->positions[pf->sngpos]] < uVar16)) {
                  uVar16 = pf->pattrows[pf->positions[pf->sngpos]] & 0xff;
                }
                pf->patbrk = (UWORD)uVar16;
                if (pMVar6->posjmp == 0) {
                  if ((((int)pMVar6->sngpos == pMVar6->numpos - 1) && (uVar16 != 0)) &&
                     ((pMVar6->loop != 0 ||
                      (((uint)pMVar6->positions[pMVar6->sngpos] == pMVar6->numpat - 1 &&
                       ((pMVar6->flags & 0x80) == 0)))))) {
                    pMVar6->posjmp = 2;
                    pMVar6->sngpos = 0;
                  }
                  else {
                    pMVar6->posjmp = 3;
                  }
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x11:
              UVar8 = UniGetByte();
              DoEEffects(UVar8);
              goto switchD_08948350_caseD_0;
            case 0x12:
              UVar8 = UniGetByte();
              pMVar6 = pf;
              uVar16 = CONCAT31(extraout_var_10,UVar8);
              if ((pf->vbtick == 0) && (pf->patdly2 == '\0')) {
                if ((pf->extspd == 0) || (uVar16 < 0x20)) {
                  if (uVar16 != 0) {
                    UVar13 = 0x20;
                    if (uVar16 < 0x21) {
                      UVar13 = (UWORD)uVar16;
                    }
                    pf->sngspd = UVar13;
                    pMVar6->vbtick = 0;
                  }
                }
                else {
                  pf->bpm = (UWORD)uVar16;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x13:
              bVar11 = UniGetByte();
              pMVar6 = pf;
              uVar22 = (ushort)bVar11;
              if ((pf->vbtick == 0) && (pf->patdly2 == '\0')) {
                if (0x80 < uVar22) {
                  uVar22 = uVar22 ^ 0x80;
                }
                if (uVar22 != 0) {
                  pf->sngspd = uVar22;
                  pMVar6->vbtick = 0;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x14:
              UVar8 = UniGetByte();
              DoS3MVolSlide(UVar8);
              goto switchD_08948350_caseD_0;
            case 0x15:
              UVar8 = UniGetByte();
              if (a->period != 0) {
                DoS3MSlideDn(UVar8);
              }
              goto switchD_08948350_caseD_0;
            case 0x16:
              UVar8 = UniGetByte();
              if (a->period != 0) {
                DoS3MSlideUp(UVar8);
              }
              goto switchD_08948350_caseD_0;
            case 0x17:
              bVar11 = UniGetByte();
              uVar16 = (uint)bVar11;
                    /* Unresolved local var: UBYTE on@[???]
                       Unresolved local var: UBYTE off@[???] */
              if (uVar16 == 0) {
                uVar16 = (uint)a->s3mtronof;
                if (uVar16 == 0) {
                  a->ownvol = 1;
                  goto switchD_08948350_caseD_0;
                }
              }
              else {
                a->s3mtronof = bVar11;
              }
              pMVar23 = a;
              if (pf->vbtick != 0) {
                uVar18 = (uVar16 >> 4) + 1;
                uVar16 = uVar18 + (uVar16 & 0xf) + 1;
                uVar27 = (uint)a->s3mtremor % uVar16;
                if (uVar16 == 0) {
                  trap(7);
                }
                a->s3mtremor = (UBYTE)uVar27;
                if (uVar27 < uVar18) {
                  SVar12 = pMVar23->tmpvolume;
                }
                else {
                  SVar12 = 0;
                }
                pMVar23->volume = SVar12;
                pMVar23->s3mtremor = pMVar23->s3mtremor + '\x01';
              }
              a->ownvol = 1;
              goto switchD_08948350_caseD_0;
            case 0x18:
              bVar11 = UniGetByte();
              pMVar23 = a;
              if (a->period == 0) goto switchD_08948350_caseD_0;
              if (bVar11 == 0) {
                if (a->s3mrtgspeed == '\0') goto switchD_08948350_caseD_0;
                SVar9 = a->retrig;
              }
              else {
                a->s3mrtgspeed = bVar11 & 0xf;
                pMVar23->s3mrtgslide = bVar11 >> 4;
                if (pMVar23->s3mrtgspeed == '\0') goto switchD_08948350_caseD_0;
                SVar9 = pMVar23->retrig;
              }
              if (SVar9 == '\0') {
                if (pMVar23->kick != '\x01') {
                  pMVar23->kick = '\x02';
                }
                pMVar23->retrig = pMVar23->s3mrtgspeed;
                if (pf->vbtick == 0) {
                  if ((pf->flags & 0x10) == 0) {
                    SVar9 = pMVar23->retrig;
                    goto LAB_08949104;
                  }
                  bVar11 = pMVar23->s3mrtgslide;
                }
                else {
                  bVar11 = pMVar23->s3mrtgslide;
                }
                uVar16 = (uint)bVar11;
                switch(uVar16) {
                case 0:
                case 8:
                  break;
                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                  pMVar23->tmpvolume = pMVar23->tmpvolume - (short)(1 << (uVar16 - 1 & 0x1f));
                  break;
                case 6:
                  pMVar23->tmpvolume = (SWORD)(((int)pMVar23->tmpvolume << 1) / 3);
                  break;
                case 7:
                  pMVar23->tmpvolume = pMVar23->tmpvolume >> 1;
                  break;
                case 9:
                case 10:
                case 0xb:
                case 0xc:
                case 0xd:
                  pMVar23->tmpvolume = (short)(1 << (uVar16 - 9 & 0x1f)) + pMVar23->tmpvolume;
                  break;
                case 0xe:
                  pMVar23->tmpvolume = (SWORD)(pMVar23->tmpvolume * 3 >> 1);
                  break;
                case 0xf:
                  pMVar23->tmpvolume = pMVar23->tmpvolume << 1;
                  break;
                default:
                  SVar12 = pMVar23->tmpvolume;
                  goto LAB_089490e8;
                }
                SVar12 = pMVar23->tmpvolume;
LAB_089490e8:
                if (SVar12 < 0) {
                  pMVar23->tmpvolume = 0;
                }
                else {
                  if (SVar12 < 0x41) {
                    SVar9 = pMVar23->retrig;
                    goto LAB_08949104;
                  }
                  pMVar23->tmpvolume = 0x40;
                }
                SVar9 = pMVar23->retrig;
              }
              else {
                SVar9 = pMVar23->retrig;
              }
LAB_08949104:
              pMVar23->retrig = SVar9 + -1;
              goto switchD_08948350_caseD_0;
            case 0x19:
              bVar11 = UniGetByte();
              if (pf->vbtick == 0) {
                if ((bVar11 & 0xf) != 0) {
                  a->trmdepth = bVar11 & 0xf;
                }
                if ((bVar11 & 0xf0) == 0) goto LAB_08947df0;
                a->trmspd = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
                uVar27 = (uint)a->trmpos;
                uVar16 = (a->wavecontrol & 0x3f) >> 4;
                uVar18 = (uVar27 & 0x7f) >> 2;
                if (uVar16 == 1) goto LAB_08948dd0;
LAB_08947e08:
                if (uVar16 < 2) {
                  if (uVar16 == 0) {
                    uVar22 = (ushort)""[uVar18];
                  }
                  else {
                    uVar22 = 0;
                  }
                }
                else if (uVar16 == 2) {
                  uVar22 = 0xff;
                }
                else if (uVar16 == 3) {
                  iVar19 = getrandom(0x100);
                  uVar22 = (ushort)iVar19;
                }
                else {
                  uVar22 = 0;
                }
              }
              else {
LAB_08947df0:
                uVar27 = (uint)a->trmpos;
                uVar16 = (a->wavecontrol & 0x3f) >> 4;
                uVar18 = (uVar27 & 0x7f) >> 2;
                if (uVar16 != 1) goto LAB_08947e08;
LAB_08948dd0:
                uVar22 = (ushort)(uVar18 << 3);
                if ((int)uVar27 < 0) {
                  uVar22 = uVar22 ^ 0xff;
                }
              }
              pMVar23 = a;
              uVar22 = uVar22 * a->trmdepth;
              if (a->trmpos < '\0') {
                sVar14 = a->tmpvolume - (uVar22 >> 7);
                a->volume = sVar14;
                if (sVar14 < 0) {
                  pMVar23->volume = 0;
                }
              }
              else {
                sVar14 = (uVar22 >> 7) + a->tmpvolume;
                a->volume = sVar14;
                if (0x40 < sVar14) {
                  pMVar23->volume = 0x40;
                }
              }
              if (pf->vbtick != 0) {
                pMVar23->trmpos = pMVar23->trmpos + pMVar23->trmspd;
              }
              pMVar23->ownvol = 1;
              goto switchD_08948350_caseD_0;
            case 0x1a:
              bVar11 = UniGetByte();
              if ((pf->vbtick == 0) && (pf->patdly2 == '\0')) {
                UVar13 = 0x20;
                if (0x1f < bVar11) {
                  UVar13 = (UWORD)bVar11;
                }
                pf->bpm = UVar13;
              }
              goto switchD_08948350_caseD_0;
            case 0x1b:
              bVar11 = UniGetByte();
              if (pf->vbtick != 0) {
                if (a->period != 0) {
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: UWORD temp@[???] */
                  bVar11 = a->wavecontrol & 3;
                  uVar16 = ((int)a->vibpos & 0x7fU) >> 2;
                  if (bVar11 == 1) {
                    uVar16 = uVar16 << 3;
                    if (a->vibpos < 0) {
                      uVar16 = uVar16 ^ 0xff;
                    }
                  }
                  else if (bVar11 < 2) {
                    if ((a->wavecontrol & 3) == 0) {
                      uVar16 = (uint)""[uVar16];
                    }
                    else {
                      uVar16 = 0;
                    }
                  }
                  else if (bVar11 == 2) {
                    uVar16 = 0xff;
                  }
                  else if (bVar11 == 3) {
                    uVar16 = getrandom(0x100);
                    uVar16 = uVar16 & 0xffff;
                  }
                  else {
                    uVar16 = 0;
                  }
                  pMVar23 = a;
                  bVar11 = (byte)(uVar16 * a->vibdepth >> 8);
                  if (a->vibpos < '\0') {
                    a->period = a->tmpperiod - (ushort)bVar11;
                  }
                  else {
                    a->period = (ushort)bVar11 + a->tmpperiod;
                  }
                  pMVar23->ownper = 1;
                  pMVar23->vibpos = pMVar23->vibpos + pMVar23->vibspd;
                }
                goto switchD_08948350_caseD_0;
              }
              if ((bVar11 & 0xf) == 0) {
                if ((bVar11 & 0xf0) == 0) goto switchD_08948350_caseD_0;
                UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
              }
              else {
                a->vibdepth = bVar11 & 0xf;
                if ((bVar11 & 0xf0) == 0) goto switchD_08948350_caseD_0;
                UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
              }
              a->vibspd = UVar8;
              goto switchD_08948350_caseD_0;
            case 0x1c:
              pMVar23->keyoff = pMVar23->keyoff | 1;
              if ((pMVar23->volflg & 5) != 1) {
                pMVar23->keyoff = '\x03';
              }
              goto switchD_08948350_caseD_0;
            case 0x1d:
              UVar8 = UniGetByte();
              pMVar23 = a;
              if ((((CONCAT31(extraout_var_11,UVar8) & 0xffff) <= (uint)pf->vbtick) ||
                  ((uint)pf->vbtick == pf->sngspd - 1)) &&
                 (pUVar1 = &a->volflg, a->keyoff = '\x03', (*pUVar1 & 1) == 0)) {
                pMVar23->fadevol = 0;
              }
              goto switchD_08948350_caseD_0;
            case 0x1e:
              UVar8 = UniGetByte();
              UVar10 = UniGetByte();
              pMVar23 = a;
              uVar16 = CONCAT31(extraout_var_12,UVar10);
                    /* Unresolved local var: UBYTE inf@[???] */
              if ((UVar8 == '\0') && (uVar16 == 0)) {
                uVar16 = (uint)a->voldata;
                UVar8 = a->voleffect;
              }
              else {
                a->voldata = UVar10;
                pMVar23->voleffect = UVar8;
              }
              UVar10 = (UBYTE)uVar16;
              switch(UVar8) {
              case '\x01':
                if (pf->vbtick == 0) {
                  if (0x40 < uVar16) {
                    uVar16 = 0x40;
                  }
                  a->tmpvolume = (ushort)uVar16 & 0xff;
                }
                break;
              case '\x02':
                if (pf->panflag != 0) {
                  a->panning = (UWORD)uVar16;
                }
                break;
              case '\x03':
                DoS3MVolSlide(UVar10);
                break;
              case '\x04':
                if (a->period != 0) {
                  DoS3MSlideDn(UVar10);
                }
                break;
              case '\x05':
                if (a->period != 0) {
                  DoS3MSlideUp(UVar10);
                }
                break;
              case '\x06':
                if (uVar16 != 0) {
                  a->slidespeed = (UWORD)uVar16;
                }
                pMVar23 = a;
                if (a->period != 0) {
                  if ((pf->vbtick == 0) || (a->newsamp != 0)) {
                    a->kick = '\x01';
                    pMVar23->start = -1;
                  }
                  else {
                    UVar8 = '\x04';
                    if (a->kick != '\x01') {
                      UVar8 = '\0';
                    }
                    a->kick = UVar8;
                  }
                  DoITToneSlide();
                  pMVar23->ownper = 1;
                }
                break;
              case '\a':
                if (pf->vbtick == 0) {
                  if ((uVar16 & 0xf) != 0) {
                    a->vibdepth = (UBYTE)(uVar16 & 0xf);
                  }
                  if ((uVar16 & 0xf0) != 0) {
                    a->vibspd = (UBYTE)((int)(uVar16 & 0xf0) >> 2);
                  }
                }
                if (a->period != 0) {
                  DoITVibrato();
                  a->ownper = 1;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x20:
              UVar8 = UniGetByte();
              DoXMVolSlide(UVar8);
              goto switchD_08948350_caseD_0;
            case 0x21:
              UVar8 = UniGetByte();
              if (pf->vbtick != 0) goto switchD_08948350_caseD_0;
              if (CONCAT31(extraout_var_14,UVar8) == 0) {
                if (a->period == 0) goto switchD_08948350_caseD_0;
                bVar11 = a->fportupspd;
              }
              else {
                a->fportupspd = UVar8;
                if (a->period == 0) goto switchD_08948350_caseD_0;
                bVar11 = a->fportupspd;
              }
              a->tmpperiod = a->tmpperiod + (ushort)bVar11 * -4;
              goto switchD_08948350_caseD_0;
            case 0x22:
              UVar8 = UniGetByte();
              if (pf->vbtick != 0) goto switchD_08948350_caseD_0;
              if (CONCAT31(extraout_var_15,UVar8) == 0) {
                if (a->period == 0) goto switchD_08948350_caseD_0;
                bVar11 = a->fportdnspd;
              }
              else {
                a->fportdnspd = UVar8;
                if (a->period == 0) goto switchD_08948350_caseD_0;
                bVar11 = a->fportdnspd;
              }
              a->tmpperiod = (ushort)bVar11 * 4 + a->tmpperiod;
              goto switchD_08948350_caseD_0;
            case 0x23:
              UVar8 = UniGetByte();
              if ((pf->vbtick == 0) && (CONCAT31(extraout_var_16,UVar8) != 0)) {
                a->fslideupspd = UVar8;
              }
              pMVar23 = a;
              sVar14 = (ushort)a->fslideupspd + a->tmpvolume;
              a->tmpvolume = sVar14;
              if (0x40 < sVar14) {
                pMVar23->tmpvolume = 0x40;
              }
              goto switchD_08948350_caseD_0;
            case 0x24:
              UVar8 = UniGetByte();
              pMVar23 = a;
              if ((pf->vbtick == 0) && (CONCAT31(extraout_var_17,UVar8) != 0)) {
                a->fslidednspd = UVar8;
                pMVar23 = a;
                sVar14 = a->tmpvolume - (ushort)a->fslidednspd;
                a->tmpvolume = sVar14;
                if (sVar14 < 0) {
                  pMVar23->tmpvolume = 0;
                }
              }
              else {
                sVar14 = a->tmpvolume - (ushort)a->fslidednspd;
                a->tmpvolume = sVar14;
                if (sVar14 < 0) {
                  pMVar23->tmpvolume = 0;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x25:
              UVar8 = UniGetByte();
              pMVar7 = pf;
              pMVar6->volume = (short)CONCAT31(extraout_var_13,UVar8) << 1;
              if (0x80 < pMVar7->volume) {
                pMVar7->volume = 0x80;
              }
              goto switchD_08948350_caseD_0;
            case 0x26:
              bVar11 = UniGetByte();
              uVar16 = (uint)bVar11;
              if (pf->vbtick != 0) {
                if (uVar16 == 0) {
                  uVar16 = (uint)pf->globalslide;
                }
                else {
                  pf->globalslide = bVar11;
                }
                pMVar6 = pf;
                if ((uVar16 & 0xf0) != 0) {
                  uVar16 = uVar16 & 0xf0;
                }
                sVar14 = ((short)(uVar16 >> 4) - ((ushort)uVar16 & 0xf)) * 2 + pf->volume;
                pf->volume = sVar14;
                if (sVar14 < 0) {
                  pMVar6->volume = 0;
                }
                else if (0x80 < sVar14) {
                  pMVar6->volume = 0x80;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x27:
              UVar8 = UniGetByte();
              uVar16 = CONCAT31(extraout_var_21,UVar8);
                    /* Unresolved local var: UWORD points@[???]
                       Unresolved local var: INSTRUMENT * i@[???]
                       Unresolved local var: MP_VOICE * aout@[???] */
              if (((pf->vbtick == 0) && (pIVar21 = a->i, pIVar21 != (INSTRUMENT *)0x0)) &&
                 (pMVar25 = a->slave, pMVar25 != (MP_VOICE *)0x0)) {
                uVar27 = (uint)(ushort)pIVar21->volenv[pIVar21->volpts - 1].pos;
                uVar18 = uVar16;
                if (uVar27 < uVar16) {
                  uVar18 = uVar27;
                }
                pEVar26 = (pMVar25->penv).env;
                (pMVar25->venv).p = (pMVar25->venv).env[uVar18].pos;
                uVar18 = (uint)(ushort)pIVar21->panenv[pIVar21->panpts - 1].pos;
                if (uVar16 <= uVar18) {
                  uVar18 = uVar16;
                }
                (pMVar25->penv).p = pEVar26[uVar18].pos;
              }
              goto switchD_08948350_caseD_0;
            case 0x28:
              bVar11 = UniGetByte();
              uVar16 = (uint)bVar11;
              if (pf->panflag != 0) {
                    /* Unresolved local var: UBYTE lo@[???]
                       Unresolved local var: UBYTE hi@[???]
                       Unresolved local var: SWORD pan@[???] */
                if (uVar16 == 0) {
                  uVar16 = (uint)a->pansspd;
                }
                else {
                  a->pansspd = bVar11;
                }
                if (pf->vbtick != 0) {
                  uVar22 = (ushort)uVar16 & 0xf;
                  if (uVar16 >> 4 != 0) {
                    uVar22 = 0;
                  }
                  sVar14 = 0x80;
                  if (a->panning != 0x200) {
                    sVar14 = a->panning;
                  }
                  a->panning = ((sVar14 + (short)(uVar16 >> 4)) - uVar22) + 0xff;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x29:
              UVar8 = UniGetByte();
              uVar16 = CONCAT31(extraout_var_18,UVar8);
              if (uVar16 == 0) {
                uVar16 = (uint)a->ffportupspd;
              }
              else {
                a->ffportupspd = UVar8;
              }
              pMVar23 = a;
              pUVar2 = &a->period;
              if (*pUVar2 != 0) {
                if (pf->vbtick == 0) {
                  uVar22 = (ushort)uVar16 & 0xff;
                  a->tmpperiod = a->tmpperiod - uVar22;
                  pMVar23->period = *pUVar2 - uVar22;
                  pMVar23->ownper = 1;
                }
                else {
                  a->ownper = 1;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x2a:
              UVar8 = UniGetByte();
              uVar16 = CONCAT31(extraout_var_19,UVar8);
              if (uVar16 == 0) {
                uVar16 = (uint)a->ffportdnspd;
              }
              else {
                a->ffportdnspd = UVar8;
              }
              pMVar23 = a;
              if (a->period != 0) {
                if (pf->vbtick == 0) {
                  pUVar2 = &a->tmpperiod;
                  uVar22 = (ushort)uVar16 & 0xff;
                  a->period = a->period + uVar22;
                  pMVar23->tmpperiod = uVar22 + *pUVar2;
                  pMVar23->ownper = 1;
                }
                else {
                  a->ownper = 1;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x2b:
              UVar8 = UniGetByte();
              if (CONCAT31(extraout_var_20,UVar8) != 0) {
                a->portspeed = (UWORD)CONCAT31(extraout_var_20,UVar8);
              }
              pMVar23 = a;
              if (a->period != 0) {
                if (pf->vbtick == 0) {
                  if (a->newsamp == 0) {
                    UVar8 = a->kick;
                    goto LAB_089485f4;
                  }
                  a->kick = '\x01';
                  pMVar23->start = -1;
                }
                else {
                  UVar8 = a->kick;
LAB_089485f4:
                  UVar10 = '\x04';
                  if (UVar8 != '\x01') {
                    UVar10 = '\0';
                  }
                  a->kick = UVar10;
                }
                DoITToneSlide();
                pMVar23->ownper = 1;
              }
              goto switchD_08948350_caseD_0;
            case 0x2c:
              bVar11 = UniGetByte();
              if (pf->vbtick == 0) {
                if ((bVar11 & 0xf) != 0) {
                  a->vibdepth = bVar11 & 0xf;
                }
                if ((bVar11 & 0xf0) == 0) goto LAB_08948650;
                a->vibspd = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
                UVar13 = a->period;
              }
              else {
LAB_08948650:
                UVar13 = a->period;
              }
              if (UVar13 != 0) {
                DoITVibrato();
                a->ownper = 1;
              }
              goto switchD_08948350_caseD_0;
            case 0x2d:
              bVar11 = UniGetByte();
              uVar16 = (uint)bVar11;
                    /* Unresolved local var: UBYTE on@[???]
                       Unresolved local var: UBYTE off@[???] */
              if (uVar16 == 0) {
                uVar16 = (uint)a->s3mtronof;
                if (uVar16 == 0) {
                  a->ownvol = 1;
                  goto switchD_08948350_caseD_0;
                }
              }
              else {
                a->s3mtronof = bVar11;
              }
              pMVar23 = a;
              if (pf->vbtick != 0) {
                uVar18 = (uVar16 >> 4) + (uVar16 & 0xf);
                uVar27 = (uint)a->s3mtremor % uVar18;
                if (uVar18 == 0) {
                  trap(7);
                }
                a->s3mtremor = (UBYTE)uVar27;
                if (uVar27 < uVar16 >> 4) {
                  SVar12 = pMVar23->tmpvolume;
                }
                else {
                  SVar12 = 0;
                }
                pMVar23->volume = SVar12;
                pMVar23->s3mtremor = pMVar23->s3mtremor + '\x01';
              }
              a->ownvol = 1;
              goto switchD_08948350_caseD_0;
            case 0x2e:
              UVar8 = UniGetByte();
              pMVar23->chanvol = UVar8;
              if (a->chanvol < 'A') {
                if (a->chanvol < '\0') {
                  a->chanvol = '\0';
                }
              }
              else {
                a->chanvol = '@';
              }
              goto switchD_08948350_caseD_0;
            case 0x2f:
              UVar8 = UniGetByte();
                    /* Unresolved local var: UBYTE lo@[???]
                       Unresolved local var: UBYTE hi@[???] */
              if (UVar8 != '\0') {
                a->chanvolslide = UVar8;
              }
              pMVar23 = a;
              bVar11 = a->chanvolslide;
              bVar4 = bVar11 >> 4;
              if (bVar4 == 0) {
LAB_08948b54:
                a->chanvol = a->chanvol - (bVar11 & 0xf);
LAB_08948b60:
                SVar9 = pMVar23->chanvol;
              }
              else {
                if ((bVar11 & 0xf) == 0) {
                  cVar5 = a->chanvol;
LAB_089489dc:
                  a->chanvol = bVar4 + cVar5;
                  goto LAB_08948b60;
                }
                if (bVar4 == 0xf) {
                  if (pf->vbtick == 0) goto LAB_08948b54;
                  SVar9 = a->chanvol;
                }
                else if ((bVar11 & 0xf) == 0xf) {
                  if (pf->vbtick == 0) {
                    cVar5 = a->chanvol;
                    goto LAB_089489dc;
                  }
                  SVar9 = a->chanvol;
                }
                else {
                  SVar9 = a->chanvol;
                }
              }
              if (SVar9 < '\0') {
                pMVar23->chanvol = '\0';
              }
              else if ('@' < SVar9) {
                pMVar23->chanvol = '@';
              }
              goto switchD_08948350_caseD_0;
            case 0x30:
              bVar11 = UniGetByte();
              if (pf->panflag != 0) {
                    /* Unresolved local var: UBYTE lo@[???]
                       Unresolved local var: UBYTE hi@[???]
                       Unresolved local var: SWORD pan@[???] */
                if (bVar11 == 0) {
                  sVar14 = a->panning;
                  uVar22 = (ushort)(a->pansspd >> 4);
                  uVar24 = a->pansspd & 0xf;
                  if (sVar14 == 0x200) {
                    sVar14 = 0x80;
                  }
                  if (uVar22 == 0) goto LAB_08948d8c;
LAB_08948a30:
                  if (uVar24 == 0) {
LAB_08948a60:
                    sVar14 = sVar14 + uVar22 * -4;
                  }
                  else if (uVar22 == 0xf) {
                    if (pf->vbtick == 0) goto LAB_08948d8c;
                  }
                  else if ((uVar24 == 0xf) && (pf->vbtick == 0)) goto LAB_08948a60;
                }
                else {
                  uVar22 = (ushort)(bVar11 >> 4);
                  uVar24 = bVar11 & 0xf;
                  a->pansspd = bVar11;
                  sVar14 = a->panning;
                  if (sVar14 == 0x200) {
                    sVar14 = 0x80;
                  }
                  if (uVar22 != 0) goto LAB_08948a30;
LAB_08948d8c:
                  sVar14 = uVar24 * 4 + sVar14;
                }
                a->panning = sVar14 + 0xff;
              }
              goto switchD_08948350_caseD_0;
            case 0x31:
              bVar11 = UniGetByte();
                    /* Unresolved local var: SWORD temp@[???] */
              if ((pf->vbtick == 0) && (pf->patdly2 == '\0')) {
                if ((bVar11 & 0x10) == 0) {
                  uVar22 = -(ushort)bVar11;
                }
                else {
                  uVar22 = bVar11 & 0xf;
                }
                UVar13 = uVar22 + pf->bpm;
                if ((short)UVar13 < 0x100) {
                  if ((short)UVar13 < 1) {
                    pf->bpm = 1;
                  }
                  else {
                    pf->bpm = UVar13;
                  }
                }
                else {
                  pf->bpm = 0xff;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x32:
              bVar11 = UniGetByte();
              if (pf->vbtick == 0) {
                if ((bVar11 & 0xf) == 0) {
                  if ((bVar11 & 0xf0) != 0) {
                    UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
LAB_08948f08:
                    a->vibspd = UVar8;
                  }
                }
                else {
                  a->vibdepth = bVar11 & 0xf;
                  if ((bVar11 & 0xf0) != 0) {
                    UVar8 = (UBYTE)((int)(bVar11 & 0xf0) >> 2);
                    goto LAB_08948f08;
                  }
                }
              }
              if (a->period != 0) {
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: UWORD temp@[???] */
                bVar11 = a->wavecontrol & 3;
                uVar16 = ((int)a->vibpos & 0x7fU) >> 2;
                if (bVar11 == 1) {
                  uVar16 = 0xff;
                }
                else if (bVar11 < 2) {
                  if ((a->wavecontrol & 3) == 0) {
                    uVar16 = (uint)""[uVar16];
                  }
                  else {
                    uVar16 = 0;
                  }
                }
                else if (bVar11 == 2) {
                  uVar16 = uVar16 << 3;
                  if (a->vibpos < 0) {
                    uVar16 = uVar16 ^ 0xff;
                  }
                }
                else if (bVar11 == 3) {
                  uVar16 = getrandom(0x100);
                  uVar16 = uVar16 & 0xffff;
                }
                else {
                  uVar16 = 0;
                }
                pMVar23 = a;
                bVar11 = (byte)(uVar16 * a->vibdepth >> 8);
                if (a->vibpos < '\0') {
                  a->period = a->tmpperiod - (ushort)bVar11;
                }
                else {
                  a->period = (ushort)bVar11 + a->tmpperiod;
                }
                pMVar23->ownper = 1;
                pMVar23->vibpos = pMVar23->vibpos + pMVar23->vibspd;
              }
              goto switchD_08948350_caseD_0;
            case 0x33:
              UVar8 = UniGetByte();
                    /* Unresolved local var: UBYTE lo@[???]
                       Unresolved local var: UBYTE hi@[???] */
              if (UVar8 != '\0') {
                pf->globalslide = UVar8;
              }
              bVar11 = pf->globalslide;
              bVar4 = bVar11 >> 4;
              if ((bVar11 & 0xf) == 0) {
                if (pf->vbtick != 0) {
                  sVar14 = pf->volume;
LAB_08948cdc:
                  pf->volume = (ushort)bVar4 + sVar14;
                }
              }
              else if (bVar4 == 0) {
                if (pf->vbtick != 0) {
                  sVar14 = pf->volume;
LAB_08948ef8:
                  pf->volume = sVar14 - (bVar11 & 0xf);
                }
              }
              else if ((bVar11 & 0xf) == 0xf) {
                if (pf->vbtick == 0) {
                  sVar14 = pf->volume;
                  goto LAB_08948cdc;
                }
              }
              else if ((bVar4 == 0xf) && (pf->vbtick == 0)) {
                sVar14 = pf->volume;
                goto LAB_08948ef8;
              }
              pMVar6 = pf;
              if (pf->volume < 0) {
                pf->volume = 0;
              }
              if (0x80 < pMVar6->volume) {
                pMVar6->volume = 0x80;
              }
              goto switchD_08948350_caseD_0;
            case 0x34:
              bVar11 = UniGetByte();
              if (pf->vbtick == 0) {
                if ((bVar11 & 0xf) != 0) {
                  a->panbdepth = bVar11 & 0xf;
                }
                if ((bVar11 & 0xf0) != 0) {
                  a->panbspd = (SBYTE)((int)(bVar11 & 0xf0) >> 4);
                }
                iVar19 = pf->panflag;
              }
              else {
                iVar19 = pf->panflag;
              }
              if (iVar19 != 0) {
                    /* Unresolved local var: UBYTE q@[???]
                       Unresolved local var: SLONG temp@[???] */
                UVar8 = a->panbwave;
                uVar16 = (uint)a->panbpos;
                if (UVar8 == '\x01') {
                  iVar19 = 0;
                  if (-1 < (char)a->panbpos) {
                    iVar19 = 0x40;
                  }
                }
                else if (UVar8 == '\0') {
                  iVar19 = (int)""[uVar16];
                }
                else if (UVar8 == '\x02') {
                  iVar19 = (uVar16 & 0x1f) << 3;
                }
                else if (UVar8 == '\x03') {
                  if ((int)uVar16 < (int)a->panbspd) {
                    iVar19 = 0;
                  }
                  else {
                    a->panbpos = '\0';
                    iVar19 = getrandom(0x100);
                  }
                }
                else {
                  iVar19 = 0;
                }
                pMVar23 = a;
                iVar19 = (int)(iVar19 * (uint)a->panbdepth) / 8 + (uint)pf->panning[mp_channel];
                if (iVar19 < 0) {
                  sVar14 = 0;
                }
                else {
                  sVar14 = (short)iVar19 + 0xff;
                }
                pUVar1 = &a->panbpos;
                pSVar3 = &a->panbspd;
                a->panning = sVar14;
                pMVar23->panbpos = *pUVar1 + *pSVar3;
              }
              goto switchD_08948350_caseD_0;
            case 0x35:
              UniSkipOpcode('5');
              goto switchD_08948350_caseD_0;
            case 0x36:
              bVar11 = UniGetByte();
              pMVar23 = a;
                    /* Unresolved local var: UBYTE inf@[???]
                       Unresolved local var: UBYTE c@[???] */
              if (bVar11 == 0) {
                uVar16 = (uint)a->ssdata;
                bVar4 = a->sseffect;
              }
              else {
                bVar4 = bVar11 >> 4;
                uVar16 = bVar11 & 0xf;
                a->ssdata = (UBYTE)uVar16;
                pMVar23->sseffect = bVar4;
              }
              pMVar23 = a;
              bVar11 = (byte)uVar16;
              switch(bVar4) {
              case 1:
                DoEEffects(bVar11 | 0x30);
                break;
              case 2:
                DoEEffects(bVar11 | 0x50);
                break;
              case 3:
                DoEEffects(bVar11 | 0x40);
                break;
              case 4:
                DoEEffects(bVar11 | 0x70);
                break;
              case 5:
                a->panbwave = bVar11;
                break;
              case 6:
                DoEEffects(bVar11 | 0xe0);
                break;
              case 7:
                DoNNAEffects(bVar11);
                break;
              case 8:
                DoEEffects(bVar11 | 0x80);
                break;
              case 9:
                if (pf->panflag != 0) {
                  pf->panning[mp_channel] = 0x200;
                  pMVar23->panning = 0x200;
                }
                break;
              case 10:
                if (pf->vbtick == 0) {
                  pUVar2 = &a->soffset;
                  pSVar15 = a->s;
                  a->hioffset = uVar16 << 0x10;
                  uVar16 = uVar16 << 0x10 | (uint)*pUVar2;
                  pMVar23->start = uVar16;
                  if ((pSVar15 != (SAMPLE *)0x0) && (pSVar15->length < uVar16)) {
                    if ((pSVar15->flags & 0x300) == 0) {
                      pMVar23->start = pSVar15->length;
                    }
                    else {
                      pMVar23->start = pSVar15->loopstart;
                    }
                  }
                }
                break;
              case 0xb:
                DoEEffects(bVar11 | 0x60);
                break;
              case 0xc:
                DoEEffects(bVar11 | 0xc0);
                break;
              case 0xd:
                DoEEffects(bVar11 | 0xd0);
                break;
              case 0xe:
                DoEEffects(bVar11 | 0xe0);
              }
              goto switchD_08948350_caseD_0;
            case 0x37:
              UVar13 = UniGetWord();
                    /* Unresolved local var: UWORD offset@[???] */
              if (CONCAT22(extraout_var_23,UVar13) != 0) {
                a->ultoffset = UVar13;
              }
              pMVar23 = a;
              pSVar15 = a->s;
              uVar16 = (uint)a->ultoffset << 2;
              a->start = uVar16;
              if ((pSVar15 != (SAMPLE *)0x0) && (pSVar15->length < uVar16)) {
                if ((pSVar15->flags & 0x300) == 0) {
                  pMVar23->start = pSVar15->length;
                }
                else {
                  pMVar23->start = pSVar15->loopstart;
                }
              }
              goto switchD_08948350_caseD_0;
            case 0x38:
              UVar13 = UniGetWord();
                    /* Unresolved local var: UWORD speed@[???] */
              pf->bpm = UVar13;
              goto switchD_08948350_caseD_0;
            case 0x39:
              DoEEffects((byte)(((uint)pf->sngspd << 0x17) >> 0x18) | 0x90);
              goto switchD_08948350_caseD_0;
            case 0x3a:
              DoEEffects((byte)(((uint)pf->sngspd << 0x17) >> 0x18) | 0xd0);
              goto switchD_08948350_caseD_0;
            case 0x3b:
              DoEEffects((byte)(pf->sngspd / 3) | 0x90);
              goto switchD_08948350_caseD_0;
            case 0x3c:
              UVar8 = UniGetByte();
              Player_SetSynchroValue(CONCAT31(extraout_var_22,UVar8));
              goto switchD_08948350_caseD_0;
            default:
              pMVar23->sliding = SVar9;
              UniSkipOpcode((UBYTE)iVar19);
              UVar8 = UniGetByte();
              iVar19 = CONCAT31(extraout_var_00,UVar8);
              if (iVar19 == 0) goto LAB_089476d8;
            }
          } while( true );
        }
LAB_089476d8:
        if ((pf->flags & 0x20) != 0) {
          if (explicitslides == 0) {
            if (a->sliding == '\x01') {
              DoS3MVolSlide('\0');
            }
            else if (a->sliding == '\x02') {
              DoXMVolSlide('\0');
            }
          }
          else if (a->tmpvolume != 0) {
            a->sliding = (SBYTE)explicitslides;
          }
        }
        pMVar23 = a;
        if (a->ownper == 0) {
          a->period = a->tmpperiod;
          SVar12 = pMVar23->ownvol;
        }
        else {
          SVar12 = a->ownvol;
        }
        if (SVar12 == 0) {
          pMVar23->volume = pMVar23->tmpvolume;
          pSVar15 = pMVar23->s;
        }
        else {
          pSVar15 = pMVar23->s;
        }
        if (pSVar15 == (SAMPLE *)0x0) break;
        if (pMVar23->i == (INSTRUMENT *)0x0) {
          pMVar23->outvolume = (SWORD)((int)((int)pMVar23->volume * (uint)pSVar15->globvol) >> 4);
        }
        else {
          pMVar23->outvolume =
               (SWORD)((int)((int)pMVar23->volume * (uint)pSVar15->globvol *
                            (uint)pMVar23->i->globvol) >> 10);
        }
        if (0x100 < pMVar23->outvolume) {
          pMVar23->volume = 0x100;
          break;
        }
        if (-1 < pMVar23->outvolume) break;
        pMVar23->outvolume = 0;
        mp_channel = mp_channel + 1;
        iVar19 = (int)mp_channel;
        if ((int)(uint)pf->numchn <= iVar19) {
          return;
        }
      }
      mp_channel = mp_channel + 1;
      iVar19 = (int)mp_channel;
    } while (iVar19 < (int)(uint)pf->numchn);
  }
  return;
switchD_089476b4_caseD_1:
  pMVar23->sliding = SVar9;
  UniSkipOpcode((UBYTE)iVar19);
  goto switchD_08948350_caseD_0;
}



----------------------------------------

// Function: pt_Notes @ 08949710

/* WARNING: Removing unreachable block (ram,0x08949c08) */
/* WARNING: Removing unreachable block (ram,0x08949c60) */
/* WARNING: Removing unreachable block (ram,0x08949bac) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void pt_Notes(void)

{
  byte bVar1;
  byte bVar2;
  ushort uVar3;
  SWORD SVar4;
  MP_CONTROL *pMVar5;
  UBYTE UVar6;
  UWORD UVar7;
  short sVar8;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  UBYTE *pUVar9;
  UBYTE **ppUVar10;
  ULONG UVar11;
  MODULE *pMVar12;
  SAMPLE *pSVar13;
  uint uVar14;
  int iVar15;
  short sVar16;
  MP_CONTROL *pMVar17;
  INSTRUMENT *pIVar18;
  
                    /* Unresolved local var: UBYTE c@[???]
                       Unresolved local var: UBYTE inst@[???]
                       Unresolved local var: int tr@[???]
                       Unresolved local var: int funky@[???] */
  uVar14 = (uint)pf->numchn;
  mp_channel = 0;
  if (uVar14 != 0) {
    iVar15 = 0;
    do {
      pMVar12 = pf;
      pMVar17 = pf->control + iVar15;
      a = pMVar17;
      if ((int)pf->sngpos < (int)(uint)pf->numpos) {
        uVar14 = (uint)pf->patterns[pf->positions[pf->sngpos] * uVar14 + iVar15];
        pf->numrow = pf->pattrows[pf->positions[pf->sngpos]];
        if (uVar14 < pf->numtrk) {
          ppUVar10 = pf->tracks;
          pMVar12 = pf;
          goto LAB_08949ad0;
        }
        pUVar9 = (UBYTE *)0x0;
      }
      else {
        uVar14 = (uint)pf->numtrk;
        pf->numrow = 0;
        if (uVar14 < pMVar12->numtrk) {
          ppUVar10 = pMVar12->tracks;
LAB_08949ad0:
          pUVar9 = UniFindRow(ppUVar10[uVar14],pMVar12->patpos);
        }
        else {
          pUVar9 = (UBYTE *)0x0;
        }
      }
      pMVar5 = a;
      pMVar12 = pf;
      pMVar17->row = pUVar9;
      pMVar5->newsamp = 0;
      if (pMVar12->vbtick == 0) {
        pMVar5->notedelay = '\0';
      }
      if (pMVar5->row != (UBYTE *)0x0) {
        uVar14 = 0;
        UniSetRow(pMVar5->row);
LAB_089497e4:
        UVar6 = UniGetByte();
        iVar15 = CONCAT31(extraout_var,UVar6);
        if (iVar15 != 0) {
          while (pMVar17 = a, iVar15 != 1) {
            if (iVar15 == 2) {
              UVar6 = UniGetByte();
              pMVar17 = a;
              if ((CONCAT31(extraout_var_01,UVar6) & 0xffff) < (uint)pf->numins) {
                if ((pf->flags & 4) == 0) {
                  pIVar18 = (INSTRUMENT *)0x0;
                }
                else {
                  pIVar18 = pf->instruments + CONCAT31(extraout_var_01,UVar6);
                }
                uVar14 = uVar14 | 2;
                a->sample = UVar6;
                pMVar17->i = pIVar18;
                pMVar17->retrig = '\0';
                pMVar17->s3mtremor = '\0';
              }
              goto LAB_089497e4;
            }
            UniSkipOpcode((UBYTE)iVar15);
            UVar6 = UniGetByte();
            iVar15 = CONCAT31(extraout_var_00,UVar6);
            if (iVar15 == 0) goto LAB_0894981c;
          }
          uVar14 = uVar14 | 1;
          a->oldnote = a->anote;
          UVar6 = UniGetByte();
          pMVar17->anote = UVar6;
          pMVar17 = a;
          UVar6 = a->wavecontrol;
          a->kick = '\x01';
          pMVar17->start = -1;
          pMVar17->sliding = '\0';
          if (-1 < (char)UVar6) {
            pMVar17->trmpos = '\0';
          }
          if ((pMVar17->wavecontrol & 8) == 0) {
            pMVar17->vibpos = '\0';
          }
          if (pMVar17->panbwave == '\0') {
            pMVar17->panbpos = '\0';
          }
          goto LAB_089497e4;
        }
LAB_0894981c:
        pMVar17 = a;
        if (uVar14 != 0) {
                    /* Unresolved local var: INSTRUMENT * i@[???]
                       Unresolved local var: SAMPLE * s@[???] */
          pIVar18 = a->i;
          if (pIVar18 == (INSTRUMENT *)0x0) {
            pUVar9 = &a->sample;
            a->note = a->anote;
            pSVar13 = pf->samples + *pUVar9;
          }
          else {
            uVar3 = pIVar18->samplenumber[a->anote];
            if ((uint)pf->numsmp <= (uint)uVar3) goto LAB_0894997c;
            pSVar13 = pf->samples;
            a->note = pIVar18->samplenote[a->anote];
            pSVar13 = pSVar13 + uVar3;
          }
          if (pSVar13 != pMVar17->s) {
            pMVar17->s = pSVar13;
            pMVar17->newsamp = pMVar17->period;
          }
          pMVar17->panning = pf->panning[mp_channel];
          if ((pSVar13->flags & 0x1000) == 0) {
            if (pIVar18 == (INSTRUMENT *)0x0) {
              UVar11 = pSVar13->speed;
              pMVar17->handle = pSVar13->handle;
              pMVar17->speed = UVar11;
              goto LAB_08949ca8;
            }
            if ((pIVar18->flags & 1) == 0) {
              UVar11 = pSVar13->speed;
              pMVar17->handle = pSVar13->handle;
              pMVar17->speed = UVar11;
            }
            else {
              UVar11 = pSVar13->speed;
              pMVar17->panning = pIVar18->panning;
              SVar4 = pSVar13->handle;
              pMVar17->speed = UVar11;
              pMVar17->handle = SVar4;
            }
LAB_089498d0:
            if (pf->panflag == 0) {
              UVar6 = pIVar18->pitflg;
            }
            else {
              if (((pIVar18->flags & 2) != 0) && (pMVar17->panning != 0x200)) {
                sVar8 = pMVar17->panning +
                        (short)((int)(((uint)pMVar17->anote - (uint)pIVar18->pitpancenter) *
                                     (uint)pIVar18->pitpansep) / 8);
                pMVar17->panning = sVar8;
                if (sVar8 < 0) {
                  pMVar17->panning = 0;
                }
                else {
                  if (sVar8 < 0x100) {
                    UVar6 = pIVar18->pitflg;
                    goto LAB_089498f4;
                  }
                  pMVar17->panning = 0xff;
                }
              }
              UVar6 = pIVar18->pitflg;
            }
LAB_089498f4:
            pMVar17->pitflg = UVar6;
            pMVar17->volflg = pIVar18->volflg;
            pMVar17->panflg = pIVar18->panflg;
            pMVar17->nna = pIVar18->nnatype;
            pMVar17->dca = pIVar18->dca;
            pMVar17->dct = pIVar18->dct;
          }
          else {
            UVar11 = pSVar13->speed;
            pMVar17->panning = pSVar13->panning;
            SVar4 = pSVar13->handle;
            pMVar17->speed = UVar11;
            pMVar17->handle = SVar4;
            if (pIVar18 != (INSTRUMENT *)0x0) goto LAB_089498d0;
LAB_08949ca8:
            pMVar17->pitflg = '\0';
            pMVar17->volflg = '\0';
            pMVar17->panflg = '\0';
            pMVar17->nna = '\0';
            pMVar17->dca = '\0';
            pMVar17->dct = '\0';
          }
          if ((uVar14 & 2) != 0) {
            bVar1 = pSVar13->volume;
            pMVar17->volume = (ushort)bVar1;
            pMVar17->tmpvolume = (ushort)bVar1;
            if (pIVar18 != (INSTRUMENT *)0x0) {
              bVar1 = pIVar18->rvolvar;
              if (bVar1 != 0) {
                bVar2 = pSVar13->volume;
                iVar15 = getrandom(0x200);
                pMVar5 = a;
                sVar16 = (ushort)bVar2 + (short)((int)(iVar15 * (uint)bVar2 * (uint)bVar1) / 0x6400)
                ;
                pMVar17->volume = sVar16;
                sVar8 = pMVar5->volume;
                pMVar17->tmpvolume = sVar16;
                if (sVar8 < 0) {
                  pMVar5->volume = 0;
                  pMVar5->tmpvolume = 0;
                }
                else if (0x40 < sVar8) {
                  pMVar5->volume = 0x40;
                  pMVar5->tmpvolume = 0x40;
                }
              }
              pMVar17 = a;
              if (pf->panflag != 0) {
                sVar8 = a->panning;
                if (sVar8 != 0x200) {
                  bVar1 = pIVar18->rpanvar;
                  iVar15 = getrandom(0x200);
                  pMVar5 = a;
                  pMVar17->panning =
                       sVar8 + (short)((int)(iVar15 * (int)sVar8 * (uint)bVar1) / 0x6400);
                  if (pMVar5->panning < 0) {
                    pMVar5->panning = 0;
                  }
                  else if (0xff < pMVar5->panning) {
                    pMVar5->panning = 0xff;
                  }
                }
              }
            }
          }
          pMVar17 = a;
          UVar7 = GetPeriod((ushort)a->note << 1,a->speed);
          pMVar17->wantedperiod = UVar7;
          pMVar17->keyoff = '\0';
          pMVar17->tmpperiod = UVar7;
        }
      }
LAB_0894997c:
      uVar14 = (uint)pf->numchn;
      mp_channel = mp_channel + 1;
      iVar15 = (int)mp_channel;
    } while (iVar15 < (int)uVar14);
  }
  return;
}



----------------------------------------

// Function: pt_UpdateVoices @ 08949ce0

/* WARNING: Removing unreachable block (ram,0x08949ef8) */

void pt_UpdateVoices(int max_volume)

{
  short sVar1;
  MODULE *pMVar2;
  SBYTE voice;
  byte bVar3;
  UWORD UVar4;
  ushort uVar5;
  SWORD SVar6;
  SWORD SVar7;
  undefined2 extraout_var;
  undefined2 extraout_var_00;
  undefined2 extraout_var_01;
  uint uVar8;
  short sVar9;
  uint uVar10;
  UBYTE UVar11;
  int iVar12;
  ULONG UVar13;
  uint uVar14;
  undefined4 unaff_s0;
  SAMPLE *s;
  undefined4 unaff_s1;
  MP_VOICE *pMVar15;
  undefined4 unaff_s2;
  ENVPT *unaff_s3;
  INSTRUMENT *pIVar16;
  undefined4 unaff_s4;
  uint uVar17;
  int iVar18;
  
                    /* Unresolved local var: SWORD envpan@[???]
                       Unresolved local var: SWORD envvol@[???]
                       Unresolved local var: SWORD envpit@[???]
                       Unresolved local var: UWORD playperiod@[???]
                       Unresolved local var: SLONG vibval@[???]
                       Unresolved local var: SLONG vibdpt@[???]
                       Unresolved local var: ULONG tmpvol@[???]
                       Unresolved local var: MP_VOICE * aout@[???]
                       Unresolved local var: INSTRUMENT * i@[???]
                       Unresolved local var: SAMPLE * s@[???] */
  pMVar2 = pf;
  pf->totalchn = '\0';
  pMVar2->realchn = '\0';
  mp_channel = 0;
  if (md_sngchn != '\0') {
    iVar12 = 0;
    do {
      while( true ) {
        pMVar15 = pf->voice + iVar12;
        s = pMVar15->s;
        pIVar16 = pMVar15->i;
        if ((s != (SAMPLE *)0x0) && (s->length != 0)) break;
LAB_0894a0ac:
        mp_channel = mp_channel + 1;
        iVar12 = (int)mp_channel;
        if ((int)(uint)md_sngchn <= iVar12) {
          return;
        }
      }
      if (pMVar15->period < 0x28) {
        pMVar15->period = 0x28;
LAB_08949d80:
        UVar11 = pMVar15->kick;
      }
      else {
        if (50000 < pMVar15->period) {
          pMVar15->period = 50000;
          goto LAB_08949d80;
        }
        UVar11 = pMVar15->kick;
      }
      if ((byte)(UVar11 - 1) < 2) {
        UVar13 = pMVar15->start;
        if (UVar13 == 0xffffffff) {
          if ((s->flags & 0x2000) == 0) {
            UVar13 = 0;
          }
          else {
            UVar13 = s->loopstart;
          }
        }
        Voice_Play_internal((SBYTE)iVar12,s,UVar13);
        pMVar15->fadevol = 0x8000;
        pMVar15->aswppos = 0;
      }
      if (pIVar16 == (INSTRUMENT *)0x0) {
LAB_08949db4:
        bVar3 = pMVar15->volflg;
LAB_08949db8:
        pMVar15->kick = '\0';
        if ((bVar3 & 1) == 0) goto LAB_08949dc4;
LAB_0894a350:
        SVar7 = ProcessEnvelope(&pMVar15->venv,0x100,pMVar15->keyoff);
        iVar12 = CONCAT22(extraout_var_00,SVar7);
        if ((pMVar15->panflg & 1) != 0) goto LAB_0894a374;
        bVar3 = pMVar15->pitflg;
LAB_08949dd8:
        SVar6 = 0x80;
        SVar7 = 0x80;
        if ((bVar3 & 1) == 0) {
          iVar18 = 0x20;
        }
        else {
LAB_0894a398:
          SVar6 = SVar7;
          SVar7 = ProcessEnvelope(&pMVar15->cenv,0x20,pMVar15->keyoff);
          iVar18 = CONCAT22(extraout_var_01,SVar7);
        }
      }
      else {
        if (pMVar15->kick == '\x01') {
          UVar11 = pMVar15->volflg;
        }
        else {
          if (pMVar15->kick != '\x04') goto LAB_08949db4;
          UVar11 = pMVar15->volflg;
        }
        StartEnvelope(&pMVar15->venv,UVar11,pIVar16->volpts,pIVar16->volsusbeg,(UBYTE)unaff_s0,
                      (UBYTE)unaff_s1,(UBYTE)unaff_s2,unaff_s3,(UBYTE)unaff_s4);
        StartEnvelope(&pMVar15->penv,pMVar15->panflg,pIVar16->panpts,pIVar16->pansusbeg,
                      (UBYTE)unaff_s0,(UBYTE)unaff_s1,(UBYTE)unaff_s2,unaff_s3,(UBYTE)unaff_s4);
        StartEnvelope(&pMVar15->cenv,pMVar15->pitflg,pIVar16->pitpts,pIVar16->pitsusbeg,
                      (UBYTE)unaff_s0,(UBYTE)unaff_s1,(UBYTE)unaff_s2,unaff_s3,(UBYTE)unaff_s4);
        if (((pMVar15->cenv).flg & 1) == 0) {
          bVar3 = pMVar15->volflg;
          goto LAB_08949db8;
        }
        UVar4 = GetPeriod((ushort)pMVar15->note << 1,pMVar15->master->speed);
        pMVar15->masterperiod = UVar4;
        pMVar15->kick = '\0';
        if ((pMVar15->volflg & 1) != 0) goto LAB_0894a350;
LAB_08949dc4:
        iVar12 = 0x100;
        if ((pMVar15->panflg & 1) == 0) {
          bVar3 = pMVar15->pitflg;
          goto LAB_08949dd8;
        }
LAB_0894a374:
        SVar6 = ProcessEnvelope(&pMVar15->penv,0x80,pMVar15->keyoff);
        SVar7 = SVar6;
        if ((pMVar15->pitflg & 1) != 0) goto LAB_0894a398;
        iVar18 = 0x20;
      }
      pMVar2 = pf;
      sVar9 = pf->sngpos;
      uVar5 = pf->numpos;
      sVar1 = pf->volume;
      uVar17 = (uint)pMVar15->fadevol * (int)pMVar15->chanvol * (int)pMVar15->volume;
      pMVar15->totalvol = uVar17 >> 0x10;
      if ((int)sVar9 < (int)(uint)uVar5) {
        uVar17 = (((uVar17 >> 0xe) * (int)sVar1 * iVar12 >> 0x16) * (uint)pMVar2->initvolume >> 7) *
                 max_volume >> 7;
      }
      else {
        uVar17 = 0;
      }
      if ((pMVar15->masterchn == -1) || (pMVar2->control[pMVar15->masterchn].muted == '\0')) {
        Voice_SetVolume_internal((SBYTE)mp_channel,(UWORD)uVar17);
        if (uVar17 == 0) {
LAB_08949e8c:
          UVar11 = pf->totalchn;
        }
        else {
          if (pMVar15->master != (MP_CONTROL *)0x0) {
            if (pMVar15 == pMVar15->master->slave) {
              pf->realchn = pf->realchn + '\x01';
            }
            goto LAB_08949e8c;
          }
          UVar11 = pf->totalchn;
        }
        pf->totalchn = UVar11 + '\x01';
        UVar13 = (ULONG)pMVar15->panning;
        if (UVar13 != 0x200) goto LAB_08949eac;
LAB_0894a3cc:
        Voice_SetPanning_internal((SBYTE)mp_channel,0x200);
        UVar4 = pMVar15->period;
      }
      else {
        Voice_SetVolume_internal((SBYTE)mp_channel,0);
        UVar13 = (ULONG)pMVar15->panning;
        if (UVar13 == 0x200) {
          goto LAB_0894a3cc;
        }
LAB_08949eac:
        if ((pf->panflag == 0) || (((pMVar15->penv).flg & 1) == 0)) {
          Voice_SetPanning_internal((SBYTE)mp_channel,UVar13);
          UVar4 = pMVar15->period;
        }
        else {
                    /* Unresolved local var: int newpan@[???] */
          iVar12 = (int)(short)UVar13 + ((SVar6 + -0x80) * 0x80) / 0x80;
          if (iVar12 < 0) {
            UVar13 = 0;
          }
          else {
            UVar13 = (ULONG)(short)((short)iVar12 + 0xff);
          }
          Voice_SetPanning_internal((SBYTE)mp_channel,UVar13);
          UVar4 = pMVar15->period;
        }
      }
      uVar14 = 0;
      if (UVar4 == 0) goto LAB_0894a120;
      if (s->vibdepth == '\0') {
        bVar3 = s->vibflags;
LAB_0894a124:
        if ((bVar3 & 1) == 0) {
          bVar3 = pMVar15->keyoff;
          goto LAB_08949f7c;
        }
        uVar5 = pMVar15->aswppos;
LAB_0894a134:
        uVar8 = (uint)s->vibdepth << 8;
        if ((uint)(uVar5 >> 8) < (uint)s->vibdepth) {
          uVar5 = uVar5 + s->vibsweep;
          uVar8 = (uint)uVar5;
          pMVar15->aswppos = uVar5;
        }
        if (pMVar15->mflag != 0) {
          sVar9 = (short)(uVar14 * uVar8 >> 0x10);
          if ((pf->flags & 2) == 0) {
            sVar9 = sVar9 >> 1;
          }
          goto LAB_08949fa8;
        }
        UVar4 = s->avibpos;
      }
      else {
        UVar11 = s->vibtype;
        if (UVar11 == '\x01') {
          uVar14 = 0xffffffc0;
          if ((s->avibpos & 0x80) == 0) {
            uVar14 = 0x40;
          }
LAB_0894a120:
          bVar3 = s->vibflags;
          goto LAB_0894a124;
        }
        if (UVar11 == '\0') {
          uVar14 = (uint)""[s->avibpos & 0x7f];
          if ((s->avibpos & 0x80) != 0) {
            uVar14 = -uVar14;
          }
          goto LAB_0894a120;
        }
        uVar14 = (uint)(byte)s->avibpos;
        if (UVar11 == '\x02') {
          uVar14 = 0x3f - ((int)(uVar14 ^ 0x80) >> 1);
          goto LAB_0894a120;
        }
        uVar14 = ((int)(uVar14 ^ 0x80) >> 1) - 0x40;
        if ((s->vibflags & 1) != 0) {
          uVar5 = pMVar15->aswppos;
          goto LAB_0894a134;
        }
        bVar3 = pMVar15->keyoff;
LAB_08949f7c:
        if ((bVar3 & 1) == 0) {
          uVar5 = pMVar15->aswppos;
          uVar10 = (uint)s->vibsweep;
          uVar8 = (uint)s->vibdepth;
          if (uVar10 <= uVar5) goto LAB_08949f9c;
          pMVar15->aswppos = uVar5 + 1;
          if (uVar10 == 0) {
            trap(7);
          }
          sVar9 = (short)(uVar14 * ((uVar5 * uVar8) / uVar10) >> 8);
        }
        else if (pMVar15->aswppos < (ushort)s->vibsweep) {
          sVar9 = 0;
        }
        else {
          uVar8 = (uint)s->vibdepth;
LAB_08949f9c:
          sVar9 = (short)(uVar14 * uVar8 >> 8);
        }
LAB_08949fa8:
        pMVar15->period = pMVar15->period - sVar9;
        UVar4 = s->avibpos;
      }
      s->avibpos = s->vibrate + UVar4 & 0xff;
      uVar8 = (uint)pMVar15->period;
      uVar14 = uVar8;
      if (((pMVar15->pitflg & 1) == 0) || (iVar18 == 0x20)) {
LAB_0894a03c:
        UVar4 = pMVar15->fadevol;
        uVar8 = uVar14;
      }
      else {
                    /* Unresolved local var: long p1@[???] */
        UVar4 = GetPeriod((ushort)pMVar15->note * 2 + (short)iVar18 + -0x20,pMVar15->master->speed);
        iVar12 = CONCAT22(extraout_var,UVar4) - (uint)pMVar15->masterperiod;
        if (0 < iVar12) {
          uVar14 = uVar8 + iVar12 & 0xffff;
          if (uVar14 <= uVar8) {
            bVar3 = pMVar15->keyoff;
LAB_0894a034:
            pMVar15->keyoff = bVar3 | 1;
            uVar14 = uVar8;
          }
          goto LAB_0894a03c;
        }
        if (iVar12 != 0) {
          uVar14 = uVar8 + iVar12 & 0xffff;
          if (uVar8 <= uVar14) {
            bVar3 = pMVar15->keyoff;
            goto LAB_0894a034;
          }
          goto LAB_0894a03c;
        }
        UVar4 = pMVar15->fadevol;
      }
      voice = (SBYTE)mp_channel;
      if (UVar4 == 0) {
        Voice_Stop_internal((SBYTE)mp_channel);
        pf->totalchn = pf->totalchn + 0xff;
        if (((uVar17 != 0) && (pMVar15->master != (MP_CONTROL *)0x0)) &&
           (pMVar15 == pMVar15->master->slave)) {
          pf->realchn = pf->realchn + 0xff;
        }
LAB_0894a084:
        md_bpm = pf->bpm + pf->relspd;
      }
      else {
        UVar13 = getfrequency((UBYTE)pf->flags,uVar8);
        Voice_SetFrequency_internal(voice,UVar13);
        pMVar2 = pf;
        if ((pIVar16 == (INSTRUMENT *)0x0) || ((pMVar15->keyoff & 2) == 0)) goto LAB_0894a084;
        if (pIVar16->volfade <= pMVar15->fadevol) {
          pMVar15->fadevol = pMVar15->fadevol - pIVar16->volfade;
          goto LAB_0894a084;
        }
        pMVar15->fadevol = 0;
        md_bpm = pMVar2->bpm + pMVar2->relspd;
      }
      if (md_bpm < 0x20) {
        md_bpm = 0x20;
        goto LAB_0894a0ac;
      }
      if (md_bpm < 0x100) goto LAB_0894a0ac;
      md_bpm = 0xff;
      mp_channel = mp_channel + 1;
      iVar12 = (int)mp_channel;
    } while (iVar12 < (int)(uint)md_sngchn);
  }
  return;
}



----------------------------------------

// Function: Player_HandleTick @ 0894a4d8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Player_HandleTick(void)

{
  ULONG *pUVar1;
  UBYTE *pUVar2;
  UBYTE UVar3;
  byte bVar4;
  MODULE *pMVar5;
  MODULE *pMVar6;
  int iVar7;
  ushort uVar8;
  UWORD UVar9;
  ushort uVar10;
  uint uVar11;
  int iVar12;
  uint uVar13;
  
                    /* Unresolved local var: int max_volume@[???] */
  pMVar6 = pf;
  if (pf == (MODULE *)0x0) {
    return;
  }
  if (pf->forbid != 0) {
    return;
  }
  if ((int)(uint)pf->numpos <= (int)pf->sngpos) {
    return;
  }
  uVar13 = (uint)pf->bpm;
  uVar11 = pf->sngremainder + 0xa00 & 0xffff;
  if (uVar13 == 0) {
    trap(7);
  }
  pUVar1 = &pf->sngtime;
  uVar10 = pf->sngspd;
  uVar8 = pf->vbtick + 1;
  pf->vbtick = uVar8;
  pMVar6->sngtime = *pUVar1 + uVar11 / uVar13;
  pMVar6->sngremainder = (UWORD)(uVar11 % uVar13);
  if (uVar10 <= uVar8) {
    if (pMVar6->pat_repcrazy == '\0') {
      pMVar6->patpos = pMVar6->patpos + 1;
    }
    else {
      pMVar6->pat_repcrazy = '\0';
    }
    pMVar6 = pf;
    pUVar2 = &pf->patdly;
    pf->vbtick = 0;
    if (*pUVar2 != '\0') {
      pMVar6->patdly2 = *pUVar2;
      pf->patdly = '\0';
      pMVar6 = pf;
    }
    UVar3 = pMVar6->patdly2;
    if (((UVar3 != '\0') && (pMVar6->patdly2 = UVar3 + 0xff, UVar3 != '\x01')) && (pf->patpos != 0))
    {
      pf->patpos = pf->patpos - 1;
    }
    uVar11 = (uint)pf->numrow;
    if ((pf->patpos < uVar11) || (uVar11 == 0)) {
LAB_0894a7c4:
      pMVar6 = pf;
      if (pf->posjmp != 0) {
        uVar11 = (uint)pf->numrow;
        if (uVar11 != 0) {
          uVar10 = pf->patbrk;
          goto LAB_0894a5f8;
        }
        pf->patpos = pf->numrow;
        goto LAB_0894a614;
      }
    }
    else {
      if (pf->posjmp == 0) {
        pf->posjmp = 3;
        goto LAB_0894a7c4;
      }
      uVar10 = pf->patbrk;
LAB_0894a5f8:
      pMVar6 = pf;
      if (uVar11 == 0) {
        trap(7);
      }
      pf->patpos = (UWORD)((uint)uVar10 % uVar11);
LAB_0894a614:
      pMVar6->pat_repcrazy = '\0';
      pMVar6 = pf;
      pUVar2 = &pf->numchn;
      pf->sngpos = pf->sngpos + pf->posjmp + -2;
      mp_channel = 0;
      if (*pUVar2 != '\0') {
        iVar7 = 0;
        do {
          iVar12 = iVar7 + 1;
          pMVar6->control[iVar7].pat_reppos = -1;
          iVar7 = iVar12;
        } while (iVar12 < (int)(uint)pMVar6->numchn);
        mp_channel = (SWORD)iVar12;
      }
      pMVar5 = pf;
      pMVar6->posjmp = 0;
      pMVar5->patbrk = 0;
      if ((int)pMVar5->sngpos < (int)(uint)pMVar5->numpos) {
        if (pMVar5->positions[pMVar5->sngpos] == 0xff) {
          iVar7 = pMVar5->wrap;
          goto LAB_0894a75c;
        }
      }
      else {
        iVar7 = pMVar5->wrap;
LAB_0894a75c:
        if (iVar7 == 0) {
          return;
        }
        pMVar5->sngpos = pMVar5->reppos;
        if (pMVar5->reppos == 0) {
          bVar4 = pMVar5->initspeed;
          uVar10 = 0x80;
          if (pMVar5->initvolume < 0x81) {
            uVar10 = (ushort)pMVar5->initvolume;
          }
          pMVar5->volume = uVar10;
          pMVar6 = pf;
          if (bVar4 == 0) {
            UVar9 = 6;
          }
          else {
            UVar9 = 0x20;
            if (bVar4 < 0x20) {
              UVar9 = (ushort)bVar4;
            }
          }
          pMVar5->sngspd = UVar9;
          uVar10 = pMVar6->inittempo;
          if (uVar10 < 0x20) {
            uVar10 = 0x20;
          }
          pMVar6->bpm = uVar10;
        }
      }
      if (pf->sngpos < 0) {
        pf->sngpos = pf->numpos - 1;
      }
    }
    if (pf->patdly2 == '\0') {
      pt_Notes();
    }
  }
  if ((int)pf->sngpos == pf->numpos - 1) {
    iVar7 = pf->fadeout;
  }
  else {
    if (pf->positions[pf->sngpos + 1] != 0xff) {
      iVar12 = 0x80;
      goto LAB_0894a714;
    }
    iVar7 = pf->fadeout;
  }
  iVar12 = 0x80;
  if (iVar7 != 0) {
    uVar11 = (uint)pf->numrow;
    if (uVar11 == 0) {
      iVar12 = 0;
    }
    else {
      iVar12 = (int)((uVar11 - pf->patpos) * 0x80) / (int)uVar11;
      if (uVar11 == 0) {
        trap(7);
      }
    }
  }
LAB_0894a714:
  pt_EffectsPass1();
  if ((pf->flags & 8) == 0) {
    pt_SetupVoices();
    pt_EffectsPass2();
    pt_UpdateVoices(iVar12);
    return;
  }
  pt_NNA();
  pt_SetupVoices();
  pt_EffectsPass2();
  pt_UpdateVoices(iVar12);
  return;
}



----------------------------------------

// Function: _mm_registerloader @ 0894a884

void _mm_registerloader(MLOADER *ldr)

{
  MLOADER *pMVar1;
  MLOADER *pMVar2;
  MLOADER *pMVar3;
  
                    /* Unresolved local var: MLOADER * cruise@[???] */
  if (firstloader != (MLOADER *)0x0) {
    pMVar1 = firstloader->next;
    pMVar3 = firstloader;
    while (pMVar2 = pMVar1, pMVar2 != (MLOADER *)0x0) {
      pMVar3 = pMVar2;
      pMVar1 = pMVar2->next;
    }
    pMVar3->next = ldr;
    return;
  }
  firstloader = ldr;
  return;
}



----------------------------------------

// Function: _mm_unregisterloaders @ 0894a8b0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _mm_unregisterloaders(void)

{
  MLOADER *pMVar1;
  
  while (firstloader != (MLOADER *)0x0) {
    pMVar1 = firstloader->next;
    firstloader->next = (MLOADER *)0x0;
    firstloader = pMVar1;
  }
  firstloader = (MLOADER *)0x0;
  return;
}



----------------------------------------

// Function: MikMod_RegisterLoader @ 0894a8d8

void MikMod_RegisterLoader(MLOADER *ldr)

{
  if ((ldr != (MLOADER *)0x0) && (ldr->next == (MLOADER *)0x0)) {
    _mm_registerloader(ldr);
    return;
  }
  return;
}



----------------------------------------

// Function: Player_LoadTitle @ 0894a8fc

CHAR * Player_LoadTitle(CHAR *filename)

{
  FILE *fp;
  MREADER *reader;
  BOOL BVar1;
  CHAR *pCVar2;
  MLOADER *pMVar3;
  
                    /* Unresolved local var: CHAR * result@[???]
                       Unresolved local var: FILE * fp@[???]
                       Unresolved local var: MREADER * reader@[???] */
  fp = _mm_fopen(filename,"rb");
  if (fp == (FILE *)0x0) {
    return (CHAR *)0x0;
  }
  reader = _mm_new_file_reader(fp);
  if (reader == (MREADER *)0x0) {
    pCVar2 = (CHAR *)0x0;
  }
  else {
                    /* Unresolved local var: MLOADER * l@[???] */
    MikMod_critical = 0;
    MikMod_errno = 0;
    modreader = reader;
    _mm_iobase_setcur(reader);
    for (pMVar3 = firstloader; pMVar3 != (MLOADER *)0x0; pMVar3 = pMVar3->next) {
      (*modreader->Seek)(modreader,0,0);
      BVar1 = (*pMVar3->Test)();
      if (BVar1 != 0) {
        pCVar2 = (*pMVar3->LoadTitle)();
        goto LAB_0894a9cc;
      }
    }
    MikMod_errno = 0xb;
    if ((code *)_mm_errorhandler != (code *)0x0) {
      (*(code *)_mm_errorhandler)();
    }
    pCVar2 = (CHAR *)0x0;
LAB_0894a9cc:
    _mm_delete_file_reader(reader);
  }
  fclose(fp);
  return pCVar2;
}



----------------------------------------

// Function: DupStr @ 0894aa30

CHAR * DupStr(CHAR *s,UWORD len,BOOL strict)

{
  CHAR *pCVar1;
  char cVar2;
  size_t size;
  uint uVar3;
  char *pcVar4;
  uint uVar5;
  
                    /* Unresolved local var: UWORD t@[???]
                       Unresolved local var: CHAR * d@[???] */
  uVar5 = (uint)len;
  if (len != 0) {
    cVar2 = s[uVar5 - 1];
    while ((cVar2 < '!' && (uVar5 = uVar5 - 1 & 0xffff, uVar5 != 0))) {
      cVar2 = s[uVar5 - 1];
    }
  }
  size = uVar5 + 1;
  uVar3 = uVar5;
  if ((strict != 0) && (size = 1, uVar5 != 0)) {
    if (*s == '\0') {
      uVar3 = 0;
    }
    else {
      uVar3 = 0;
      do {
        uVar3 = uVar3 + 1 & 0xffff;
        if (uVar3 == uVar5) {
          size = uVar5 + 1;
          uVar3 = uVar5;
          goto LAB_0894aacc;
        }
      } while (s[uVar3] != '\0');
      size = uVar3 + 1;
    }
  }
LAB_0894aacc:
  pCVar1 = _mm_malloc(size);
  if (pCVar1 != (CHAR *)0x0) {
    if (uVar3 != 0) {
      uVar5 = 0;
      do {
        cVar2 = s[uVar5];
        pcVar4 = pCVar1 + uVar5;
        if (cVar2 < ' ') {
          cVar2 = '.';
        }
        uVar5 = uVar5 + 1 & 0xffff;
        *pcVar4 = cVar2;
      } while (uVar3 != uVar5);
    }
    pCVar1[uVar3] = '\0';
  }
  return pCVar1;
}



----------------------------------------

// Function: ReadComment @ 0894ab38

BOOL ReadComment(UWORD len)

{
  uint uVar1;
  char *pcVar2;
  uint uVar3;
  
  uVar1 = (uint)len;
  if (len != 0) {
                    /* Unresolved local var: int i@[???] */
    of.comment = _mm_malloc(uVar1 + 1);
    if (of.comment == (CHAR *)0x0) {
      return 0;
    }
    (*modreader->Read)(modreader,of.comment,uVar1);
    uVar3 = 0;
    if (len != 0) {
      do {
        while( true ) {
          pcVar2 = of.comment + uVar3;
          uVar3 = uVar3 + 1;
          if (*pcVar2 == '\r') break;
          if (uVar1 == uVar3) goto LAB_0894abfc;
        }
        *pcVar2 = '\n';
      } while (uVar1 != uVar3);
    }
LAB_0894abfc:
    of.comment[uVar1] = '\0';
  }
  if (*of.comment == '\0') {
    free(of.comment);
    of.comment = (CHAR *)0x0;
  }
  return 1;
}



----------------------------------------

// Function: ML_FreeEx @ 0894ac24

void ML_FreeEx(MODULE *mf)

{
  int iVar1;
  void *aptr;
  CHAR *pCVar2;
  UWORD *pUVar3;
  SAMPLE *aptr_00;
  uint uVar4;
  UBYTE **aptr_01;
  INSTRUMENT *aptr_02;
  uint uVar5;
  
                    /* Unresolved local var: UWORD t@[???] */
  if (mf->songname == (CHAR *)0x0) {
    pCVar2 = mf->comment;
  }
  else {
    free(mf->songname);
    pCVar2 = mf->comment;
  }
  if (pCVar2 == (CHAR *)0x0) {
    pCVar2 = mf->modtype;
  }
  else {
    free(pCVar2);
    pCVar2 = mf->modtype;
  }
  if (pCVar2 == (CHAR *)0x0) {
    pUVar3 = mf->positions;
  }
  else {
    free(pCVar2);
    pUVar3 = mf->positions;
  }
  if (pUVar3 == (UWORD *)0x0) {
    pUVar3 = mf->patterns;
  }
  else {
    free(pUVar3);
    pUVar3 = mf->patterns;
  }
  if (pUVar3 == (UWORD *)0x0) {
    pUVar3 = mf->pattrows;
  }
  else {
    free(pUVar3);
    pUVar3 = mf->pattrows;
  }
  if (pUVar3 == (UWORD *)0x0) {
    aptr_01 = mf->tracks;
  }
  else {
    free(pUVar3);
    aptr_01 = mf->tracks;
  }
  if (aptr_01 == (UBYTE **)0x0) {
    aptr_02 = mf->instruments;
  }
  else {
    uVar4 = (uint)mf->numtrk;
    if (uVar4 != 0) {
      uVar5 = 0;
      iVar1 = 0;
      do {
        if (*(void **)(iVar1 + (int)aptr_01) != (void *)0x0) {
          free(*(void **)(iVar1 + (int)aptr_01));
          aptr_01 = mf->tracks;
          uVar4 = (uint)mf->numtrk;
        }
        uVar5 = uVar5 + 1 & 0xffff;
        iVar1 = uVar5 << 2;
      } while (uVar5 < uVar4);
    }
    free(aptr_01);
    aptr_02 = mf->instruments;
  }
  if (aptr_02 == (INSTRUMENT *)0x0) {
    aptr_00 = mf->samples;
  }
  else {
    uVar4 = (uint)mf->numins;
    if (uVar4 != 0) {
      uVar5 = 0;
      iVar1 = 0;
      do {
        aptr = *(void **)((int)aptr_02->samplenumber + iVar1 + -6);
        if (aptr != (void *)0x0) {
          free(aptr);
          aptr_02 = mf->instruments;
          uVar4 = (uint)mf->numins;
        }
        uVar5 = uVar5 + 1 & 0xffff;
        iVar1 = uVar5 * 0x30c;
      } while (uVar5 < uVar4);
    }
    free(aptr_02);
    aptr_00 = mf->samples;
  }
  if (aptr_00 != (SAMPLE *)0x0) {
    uVar4 = (uint)mf->numsmp;
    uVar5 = 0;
    if (uVar4 != 0) {
      do {
        while (aptr_00[uVar5].length == 0) {
LAB_0894adac:
          uVar5 = uVar5 + 1 & 0xffff;
          if (uVar4 <= uVar5) goto LAB_0894ae0c;
        }
        if (-1 < aptr_00[uVar5].handle) {
          MD_SampleUnload(aptr_00[uVar5].handle);
        }
        if (aptr_00[uVar5].samplename != (CHAR *)0x0) {
          free(aptr_00[uVar5].samplename);
          aptr_00 = mf->samples;
          uVar4 = (uint)mf->numsmp;
          goto LAB_0894adac;
        }
        uVar4 = (uint)mf->numsmp;
        uVar5 = uVar5 + 1 & 0xffff;
        aptr_00 = mf->samples;
      } while (uVar5 < uVar4);
    }
LAB_0894ae0c:
    free(aptr_00);
  }
  memset(mf,0,0x13c);
  if (mf == &of) {
    return;
  }
  free(mf);
  return;
}



----------------------------------------

// Function: Player_Free_internal @ 0894ae6c

void Player_Free_internal(MODULE *mf)

{
  if (mf != (MODULE *)0x0) {
    Player_Exit_internal(mf);
    ML_FreeEx(mf);
    return;
  }
  return;
}



----------------------------------------

// Function: Player_Free @ 0894aeac

void Player_Free(MODULE *mf)

{
  if (mf != (MODULE *)0x0) {
    Player_Exit_internal(mf);
    ML_FreeEx(mf);
    return;
  }
  return;
}



----------------------------------------

// Function: Player_LoadGeneric_internal @ 0894aeb4

MODULE * Player_LoadGeneric_internal(MREADER *reader,int maxchan,BOOL curious)

{
  bool bVar1;
  UBYTE UVar2;
  UBYTE UVar3;
  UWORD UVar4;
  MP_VOICE *pMVar5;
  MODULE *pMVar6;
  MODULE *pMVar7;
  UWORD UVar8;
  BOOL BVar9;
  UBYTE *pUVar10;
  ULONG UVar11;
  MODULE *mf;
  CHAR *pCVar12;
  uint uVar13;
  CHAR *pCVar14;
  MODULE *pMVar15;
  SAMPLE *s;
  MODULE *pMVar16;
  MLOADER *pMVar17;
  uint uVar18;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: MLOADER * l@[???]
                       Unresolved local var: BOOL ok@[???]
                       Unresolved local var: MODULE * mf@[???] */
  MikMod_critical = 0;
  MikMod_errno = 0;
  modreader = reader;
  _mm_iobase_setcur(reader);
  pMVar17 = firstloader;
  do {
    if (pMVar17 == (MLOADER *)0x0) {
      MikMod_errno = 0xb;
      if ((code *)_mm_errorhandler != (code *)0x0) {
        (*(code *)_mm_errorhandler)();
      }
LAB_0894b154:
      (*modreader->Seek)(modreader,0,0);
      _mm_iobase_revert();
      return (MODULE *)0x0;
    }
    (*modreader->Seek)(modreader,0,0);
    BVar9 = (*pMVar17->Test)();
    if (BVar9 != 0) {
      BVar9 = UniInit();
      if (BVar9 == 0) {
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
      }
      else {
        memset(&of,0,0x13c);
        of.initvolume = 0x80;
        of.panning[0] = 0;
        uVar18 = 1;
        do {
          uVar13 = uVar18 + 1;
          UVar8 = 0xff;
          if ((uVar13 & 2) == 0) {
            UVar8 = 0;
          }
          of.panning[uVar18] = UVar8;
          uVar18 = uVar13;
        } while (uVar13 != 0x40);
        pUVar10 = of.chanvol;
        of.chanvol[0] = '@';
        while (pUVar10 = pUVar10 + 1, (UWORD *)pUVar10 != &of.bpm) {
          *pUVar10 = '@';
        }
        BVar9 = (*pMVar17->Init)();
        if (BVar9 == 0) {
          (*pMVar17->Cleanup)();
          UniCleanup();
        }
        else {
          (*modreader->Seek)(modreader,0,0);
          BVar9 = (*pMVar17->Load)(curious);
          (*pMVar17->Cleanup)();
          UniCleanup();
          if (BVar9 != 0) {
                    /* Unresolved local var: SAMPLE * s@[???]
                       Unresolved local var: int u@[???] */
            uVar18 = (uint)of.numsmp;
            if (uVar18 != 0) {
              uVar13 = 0;
              UVar11 = (of.samples)->length;
              s = of.samples;
              while( true ) {
                uVar13 = uVar13 + 1;
                if (UVar11 != 0) {
                  SL_RegisterSample(s,0,modreader);
                }
                if (uVar18 == uVar13) break;
                UVar11 = s[1].length;
                s = s + 1;
              }
            }
            mf = _mm_malloc(0x13c);
            if (mf == (MODULE *)0x0) {
              ML_FreeEx(&of);
              (*modreader->Seek)(modreader,0,0);
              _mm_iobase_revert();
              if (_mm_errorhandler == (MikMod_handler_t)0x0) {
                return (MODULE *)0x0;
              }
              (*(code *)_mm_errorhandler)();
              return (MODULE *)0x0;
            }
                    /* Unresolved local var: MODULE * mf@[???] */
            pMVar6 = mf;
            pMVar7 = &of;
            do {
              pMVar16 = pMVar7;
              pMVar15 = pMVar6;
              pCVar12 = pMVar16->modtype;
              pCVar14 = pMVar16->comment;
              UVar8 = pMVar16->flags;
              UVar2 = pMVar16->numchn;
              UVar3 = pMVar16->numvoices;
              pMVar15->songname = pMVar16->songname;
              pMVar15->modtype = pCVar12;
              pMVar15->comment = pCVar14;
              pMVar15->flags = UVar8;
              pMVar5 = of.voice;
              pMVar15->numchn = UVar2;
              pMVar15->numvoices = UVar3;
              pMVar6 = (MODULE *)&pMVar15->numpos;
              pMVar7 = (MODULE *)&pMVar16->numpos;
            } while ((MP_VOICE **)&pMVar16->numpos != &of.voice);
            UVar8 = pMVar16->numins;
            UVar4 = pMVar16->numsmp;
            pMVar15->instruments = pMVar16->instruments;
            *(MP_VOICE **)&pMVar15->numpos = pMVar5;
            pMVar15->numins = UVar8;
            pMVar15->numsmp = UVar4;
            _mm_iobase_revert();
            if (maxchan < 1) goto LAB_0894b104;
            if ((mf->flags & 8) == 0) {
              uVar18 = (uint)mf->numchn;
              if (maxchan <= (int)uVar18) goto LAB_0894b0d4;
            }
            else {
              uVar18 = (uint)mf->numchn;
LAB_0894b0d4:
              uVar13 = maxchan + (uint)mf->numvoices;
              if (mf->numvoices == 0) {
                uVar13 = maxchan;
              }
              bVar1 = (int)uVar13 < (int)uVar18;
              uVar18 = uVar13;
              if (bVar1) {
                mf->flags = mf->flags | 8;
              }
            }
            BVar9 = MikMod_SetNumVoices_internal(uVar18,-1);
            if (BVar9 != 0) {
              Player_Free(mf);
              return (MODULE *)0x0;
            }
LAB_0894b104:
            BVar9 = SL_LoadSamples();
            if ((BVar9 == 0) && (BVar9 = Player_Init(mf), BVar9 == 0)) {
              return mf;
            }
            Player_Free_internal(mf);
            return (MODULE *)0x0;
          }
        }
        ML_FreeEx(&of);
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
      }
      goto LAB_0894b154;
    }
    pMVar17 = pMVar17->next;
  } while( true );
}



----------------------------------------

// Function: Player_LoadGeneric @ 0894b25c

MODULE * Player_LoadGeneric(MREADER *reader,int maxchan,BOOL curious)

{
  bool bVar1;
  UBYTE UVar2;
  UBYTE UVar3;
  UWORD UVar4;
  MP_VOICE *pMVar5;
  MODULE *pMVar6;
  MODULE *pMVar7;
  UWORD UVar8;
  BOOL BVar9;
  UBYTE *pUVar10;
  ULONG UVar11;
  MODULE *mf;
  CHAR *pCVar12;
  uint uVar13;
  CHAR *pCVar14;
  MODULE *pMVar15;
  SAMPLE *s;
  MODULE *pMVar16;
  MLOADER *pMVar17;
  uint uVar18;
  
  MikMod_critical = 0;
  MikMod_errno = 0;
  modreader = reader;
  _mm_iobase_setcur(reader);
                    /* Unresolved local var: MODULE * result@[???] */
  pMVar17 = firstloader;
  do {
    if (pMVar17 == (MLOADER *)0x0) {
      MikMod_errno = 0xb;
      if ((code *)_mm_errorhandler != (code *)0x0) {
        (*(code *)_mm_errorhandler)();
      }
LAB_0894b154:
      (*modreader->Seek)(modreader,0,0);
      _mm_iobase_revert();
      return (MODULE *)0x0;
    }
    (*modreader->Seek)(modreader,0,0);
    BVar9 = (*pMVar17->Test)();
    if (BVar9 != 0) {
      BVar9 = UniInit();
      if (BVar9 == 0) {
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
      }
      else {
        memset(&of,0,0x13c);
        of.initvolume = 0x80;
        of.panning[0] = 0;
        uVar18 = 1;
        do {
          uVar13 = uVar18 + 1;
          UVar8 = 0xff;
          if ((uVar13 & 2) == 0) {
            UVar8 = 0;
          }
          of.panning[uVar18] = UVar8;
          uVar18 = uVar13;
        } while (uVar13 != 0x40);
        pUVar10 = of.chanvol;
        of.chanvol[0] = '@';
        while (pUVar10 = pUVar10 + 1, (UWORD *)pUVar10 != &of.bpm) {
          *pUVar10 = '@';
        }
        BVar9 = (*pMVar17->Init)();
        if (BVar9 == 0) {
          (*pMVar17->Cleanup)();
          UniCleanup();
        }
        else {
          (*modreader->Seek)(modreader,0,0);
          BVar9 = (*pMVar17->Load)(curious);
          (*pMVar17->Cleanup)();
          UniCleanup();
          if (BVar9 != 0) {
            uVar18 = (uint)of.numsmp;
            if (uVar18 != 0) {
              uVar13 = 0;
              UVar11 = (of.samples)->length;
              s = of.samples;
              while( true ) {
                uVar13 = uVar13 + 1;
                if (UVar11 != 0) {
                  SL_RegisterSample(s,0,modreader);
                }
                if (uVar18 == uVar13) break;
                UVar11 = s[1].length;
                s = s + 1;
              }
            }
            mf = _mm_malloc(0x13c);
            if (mf == (MODULE *)0x0) {
              ML_FreeEx(&of);
              (*modreader->Seek)(modreader,0,0);
              _mm_iobase_revert();
              if (_mm_errorhandler == (MikMod_handler_t)0x0) {
                return (MODULE *)0x0;
              }
              (*(code *)_mm_errorhandler)();
              return (MODULE *)0x0;
            }
            pMVar6 = mf;
            pMVar7 = &of;
            do {
              pMVar16 = pMVar7;
              pMVar15 = pMVar6;
              pCVar12 = pMVar16->modtype;
              pCVar14 = pMVar16->comment;
              UVar8 = pMVar16->flags;
              UVar2 = pMVar16->numchn;
              UVar3 = pMVar16->numvoices;
              pMVar15->songname = pMVar16->songname;
              pMVar15->modtype = pCVar12;
              pMVar15->comment = pCVar14;
              pMVar15->flags = UVar8;
              pMVar5 = of.voice;
              pMVar15->numchn = UVar2;
              pMVar15->numvoices = UVar3;
              pMVar6 = (MODULE *)&pMVar15->numpos;
              pMVar7 = (MODULE *)&pMVar16->numpos;
            } while ((MP_VOICE **)&pMVar16->numpos != &of.voice);
            UVar8 = pMVar16->numins;
            UVar4 = pMVar16->numsmp;
            pMVar15->instruments = pMVar16->instruments;
            *(MP_VOICE **)&pMVar15->numpos = pMVar5;
            pMVar15->numins = UVar8;
            pMVar15->numsmp = UVar4;
            _mm_iobase_revert();
            if (maxchan < 1) goto LAB_0894b104;
            if ((mf->flags & 8) == 0) {
              uVar18 = (uint)mf->numchn;
              if (maxchan <= (int)uVar18) goto LAB_0894b0d4;
            }
            else {
              uVar18 = (uint)mf->numchn;
LAB_0894b0d4:
              uVar13 = maxchan + (uint)mf->numvoices;
              if (mf->numvoices == 0) {
                uVar13 = maxchan;
              }
              bVar1 = (int)uVar13 < (int)uVar18;
              uVar18 = uVar13;
              if (bVar1) {
                mf->flags = mf->flags | 8;
              }
            }
            BVar9 = MikMod_SetNumVoices_internal(uVar18,-1);
            if (BVar9 != 0) {
              Player_Free(mf);
              return (MODULE *)0x0;
            }
LAB_0894b104:
            BVar9 = SL_LoadSamples();
            if ((BVar9 == 0) && (BVar9 = Player_Init(mf), BVar9 == 0)) {
              return mf;
            }
            Player_Free_internal(mf);
            return (MODULE *)0x0;
          }
        }
        ML_FreeEx(&of);
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
      }
      goto LAB_0894b154;
    }
    pMVar17 = pMVar17->next;
  } while( true );
}



----------------------------------------

// Function: Player_LoadRW @ 0894b264

MODULE * Player_LoadRW(SDL_RWops *rw,int maxchan,BOOL curious)

{
  MREADER *reader;
  MODULE *pMVar1;
  
                    /* Unresolved local var: MODULE * result@[???]
                       Unresolved local var: MREADER * reader@[???] */
  reader = _mm_new_rwops_reader(rw);
  pMVar1 = (MODULE *)0x0;
  if (reader != (MREADER *)0x0) {
    pMVar1 = Player_LoadGeneric(reader,maxchan,curious);
    _mm_delete_rwops_reader(reader);
  }
  return pMVar1;
}



----------------------------------------

// Function: Player_LoadFP @ 0894b2cc

MODULE * Player_LoadFP(FILE *fp,int maxchan,BOOL curious)

{
  MREADER *reader;
  MODULE *pMVar1;
  
                    /* Unresolved local var: MODULE * result@[???]
                       Unresolved local var: MREADER * reader@[???] */
  reader = _mm_new_file_reader(fp);
  pMVar1 = (MODULE *)0x0;
  if (reader != (MREADER *)0x0) {
    pMVar1 = Player_LoadGeneric(reader,maxchan,curious);
    _mm_delete_file_reader(reader);
  }
  return pMVar1;
}



----------------------------------------

// Function: Player_Load @ 0894b334

MODULE * Player_Load(CHAR *filename,int maxchan,BOOL curious)

{
  FILE *fp;
  MODULE *pMVar1;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: MODULE * mf@[???] */
  fp = _mm_fopen(filename,"rb");
  pMVar1 = (MODULE *)0x0;
  if (fp != (FILE *)0x0) {
    pMVar1 = Player_LoadFP(fp,maxchan,curious);
    fclose(fp);
  }
  return pMVar1;
}



----------------------------------------

// Function: AllocSamples @ 0894b3a4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL AllocSamples(void)

{
  SAMPLE *pSVar1;
  undefined2 *puVar2;
  uint uVar3;
  int iVar4;
  
                    /* Unresolved local var: UWORD u@[???] */
  if (of.numsmp == 0) {
    MikMod_errno = 0xb;
  }
  else {
    of.samples = _mm_calloc((uint)of.numsmp,0x3c);
    if (of.samples != (SAMPLE *)0x0) {
      if (of.numsmp != 0) {
        uVar3 = 0;
        iVar4 = 0;
        do {
          uVar3 = uVar3 + 1 & 0xffff;
          puVar2 = (undefined2 *)((int)&(of.samples)->panning + iVar4);
          *(undefined1 *)(puVar2 + 0x12) = 0x40;
          pSVar1 = of.samples;
          *puVar2 = 0x80;
          puVar2[0x1c] = 0xffff;
          (&pSVar1->volume)[iVar4] = '@';
          iVar4 = uVar3 * 0x3c;
        } while (uVar3 < of.numsmp);
      }
      return 1;
    }
    of.samples = (SAMPLE *)0x0;
  }
  return 0;
}



----------------------------------------

// Function: AllocInstruments @ 0894b474

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL AllocInstruments(void)

{
  INSTRUMENT *pIVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int n@[???] */
  if (of.numins == 0) {
    MikMod_errno = 0xb;
  }
  else {
    of.instruments = _mm_calloc((uint)of.numins,0x30c);
    if (of.instruments != (INSTRUMENT *)0x0) {
      if (of.numins != 0) {
        iVar4 = 0;
        do {
          iVar2 = 0;
          do {
            of.instruments[iVar4].samplenote[iVar2] = (UBYTE)iVar2;
            pIVar1 = of.instruments;
            iVar3 = iVar2 + 1;
            of.instruments[iVar4].samplenumber[iVar2] = (UWORD)iVar4;
            iVar2 = iVar3;
          } while (iVar3 != 0x78);
          pIVar1[iVar4].globvol = '@';
          iVar4 = iVar4 + 1;
        } while (iVar4 < (int)(uint)of.numins);
      }
      return 1;
    }
    of.instruments = (INSTRUMENT *)0x0;
  }
  return 0;
}



----------------------------------------

// Function: AllocTracks @ 0894b560

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL AllocTracks(void)

{
  if (of.numtrk == 0) {
    MikMod_errno = 0xb;
    return 0;
  }
  of.tracks = _mm_calloc((uint)of.numtrk,4);
  return (uint)(of.tracks != (UBYTE **)0x0);
}



----------------------------------------

// Function: AllocPatterns @ 0894b5cc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL AllocPatterns(void)

{
  UWORD *pUVar1;
  UWORD *pUVar2;
  uint uVar3;
  int iVar4;
  UWORD UVar5;
  int iVar6;
  
                    /* Unresolved local var: int s@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int tracks@[???] */
  if (of.numpat != 0) {
    if (of.numchn != 0) {
      of.patterns = _mm_calloc((of.numpat + 1) * (uint)of.numchn,2);
      if (of.patterns == (UWORD *)0x0) {
        return 0;
      }
      pUVar2 = _mm_calloc(of.numpat + 1,2);
      if (pUVar2 == (UWORD *)0x0) {
        of.pattrows = pUVar2;
        return 0;
      }
      iVar6 = 0;
      UVar5 = 0;
      of.pattrows = pUVar2;
      do {
        *pUVar2 = 0x40;
        pUVar1 = of.patterns;
        uVar3 = (uint)of.numchn;
        if (uVar3 != 0) {
          iVar4 = 0;
          do {
            pUVar1[iVar6 * uVar3 + iVar4] = UVar5;
            uVar3 = (uint)of.numchn;
            iVar4 = iVar4 + 1;
            UVar5 = UVar5 + 1;
          } while (iVar4 < (int)uVar3);
        }
        iVar6 = iVar6 + 1;
        pUVar2 = pUVar2 + 1;
      } while (iVar6 <= (int)(uint)of.numpat);
      return 1;
    }
  }
  MikMod_errno = 0xb;
  return 0;
}



----------------------------------------

// Function: AllocPositions @ 0894b6dc

BOOL AllocPositions(int total)

{
  if (total == 0) {
    MikMod_errno = 0xb;
    return 0;
  }
  of.positions = _mm_calloc(total,2);
  return (uint)(of.positions != (UWORD *)0x0);
}



----------------------------------------

// Function: ReadLinedComment @ 0894b730

BOOL ReadLinedComment(UWORD lines,UWORD linelen)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  CHAR *pCVar5;
  char *pcVar6;
  char *aptr;
  char *s2;
  size_t sVar7;
  uint uVar8;
  uint uVar9;
  char *pcVar10;
  char *pcVar11;
  char *pcVar12;
  char *pcVar13;
  char *pcVar14;
  uint uVar15;
  
                    /* Unresolved local var: CHAR * tempcomment@[???]
                       Unresolved local var: CHAR * line@[???]
                       Unresolved local var: CHAR * storage@[???]
                       Unresolved local var: UWORD total@[???]
                       Unresolved local var: UWORD t@[???]
                       Unresolved local var: UWORD len@[???]
                       Unresolved local var: int i@[???] */
  uVar2 = (uint)lines;
  uVar3 = (uint)linelen;
  if (lines == 0) {
    return 1;
  }
  uVar15 = uVar2 * uVar3 & 0xffff;
  aptr = _mm_malloc(uVar15 + 1);
  if (aptr != (char *)0x0) {
    s2 = _mm_malloc(uVar3 + 1);
    if (s2 != (char *)0x0) {
      (*modreader->Read)(modreader,aptr,uVar15);
      pcVar13 = aptr + uVar3;
      pcVar14 = pcVar13 + -1;
      uVar8 = 0;
      uVar15 = 0;
      pcVar12 = aptr;
      do {
        if (*pcVar13 == ' ') {
          uVar9 = 0;
          pcVar6 = pcVar14;
          pcVar11 = pcVar13;
          do {
            pcVar10 = pcVar6;
            *pcVar11 = '\0';
            if (uVar9 == uVar3) break;
            uVar9 = uVar9 + 1;
            pcVar6 = pcVar10 + -1;
            pcVar11 = pcVar10;
          } while (*pcVar10 == ' ');
        }
        if (linelen == 0) goto LAB_0894b898;
        if (*pcVar12 == '\0') goto LAB_0894b898;
        for (uVar9 = 1;
            (uVar4 = uVar3 + 1, uVar3 != uVar9 && (uVar4 = uVar9 + 1, pcVar12[uVar9] != '\0'));
            uVar9 = uVar9 + 1) {
        }
        uVar8 = (uVar4 & 0xffff) + uVar8;
        while( true ) {
          uVar15 = uVar15 + 1 & 0xffff;
          uVar8 = uVar8 & 0xffff;
          if (uVar2 == uVar15) {
            if (uVar8 <= uVar2) {
              return 1;
            }
            of.comment = _mm_malloc(uVar8 + 1);
            if (of.comment == (CHAR *)0x0) {
              free(s2);
              goto LAB_0894b988;
            }
            uVar15 = 0;
            pcVar12 = aptr;
            goto LAB_0894b8e4;
          }
          pcVar14 = pcVar14 + uVar3;
          pcVar13 = pcVar13 + uVar3;
          pcVar12 = pcVar12 + uVar3;
          if (-1 < (int)uVar3) break;
LAB_0894b898:
          uVar8 = uVar8 + 1;
        }
      } while( true );
    }
LAB_0894b988:
    free(aptr);
  }
  return 0;
LAB_0894b8e4:
  pcVar13 = s2;
  if ((linelen != 0) && (cVar1 = *pcVar12, *s2 = cVar1, cVar1 != '\0')) {
    uVar8 = 0;
    do {
      pcVar13 = pcVar13 + 1;
      uVar8 = uVar8 + 1;
      if (uVar3 == uVar8) {
        pcVar13 = s2 + uVar8;
        break;
      }
      cVar1 = pcVar12[uVar8];
      *pcVar13 = cVar1;
    } while (cVar1 != '\0');
  }
  *pcVar13 = '\0';
  strcat(of.comment,s2);
  pCVar5 = of.comment;
  sVar7 = strlen(of.comment);
  pCVar5[sVar7] = DAT_089e4f68;
  uVar15 = uVar15 + 1 & 0xffff;
  (pCVar5 + sVar7)[1] = DAT_089e4f69;
  if (uVar2 == uVar15) {
    free(s2);
    free(aptr);
    return 1;
  }
  pcVar12 = pcVar12 + uVar3;
  goto LAB_0894b8e4;
}



----------------------------------------

// Function: MikMod_InfoLoader @ 0894ba08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * MikMod_InfoLoader(void)

{
  size_t sVar1;
  char *pcVar2;
  MLOADER *pMVar3;
  MLOADER *pMVar4;
  char *str;
  
                    /* Unresolved local var: int len@[???]
                       Unresolved local var: MLOADER * l@[???]
                       Unresolved local var: CHAR * list@[???] */
  str = (char *)0x0;
  if (firstloader != (MLOADER *)0x0) {
    pMVar4 = firstloader;
    for (pMVar3 = firstloader->next; pMVar3 != (MLOADER *)0x0; pMVar3 = pMVar3->next) {
      sVar1 = strlen(pMVar4->version);
      str = str + sVar1 + 2;
      pMVar4 = pMVar3;
    }
    sVar1 = strlen(pMVar4->version);
    pcVar2 = str + sVar1 + 1;
    str = (char *)0x0;
    if ((pcVar2 != (char *)0x0) && (str = _mm_malloc((size_t)pcVar2), str != (char *)0x0)) {
      *str = '\0';
      for (pMVar4 = firstloader; pMVar4 != (MLOADER *)0x0; pMVar4 = pMVar4->next) {
        pcVar2 = "%s%s\n";
        if (pMVar4->next == (MLOADER *)0x0) {
          pcVar2 = "%s%s";
        }
        sprintf(str,pcVar2,str,pMVar4->version);
      }
    }
  }
  return str;
}



----------------------------------------

// Function: _mm_RWopsReader_Eof @ 0894bae8

BOOL _mm_RWopsReader_Eof(MREADER *reader)

{
  _func_long_MREADER_ptr *p_Var1;
  _func_long_MREADER_ptr *p_Var2;
  
  p_Var2 = reader[1].Tell;
  p_Var1 = (_func_long_MREADER_ptr *)(**(code **)reader[1].Seek)(reader[1].Seek,0,1);
  return (uint)(p_Var2 == p_Var1);
}



----------------------------------------

// Function: _mm_RWopsReader_Read @ 0894bb28

BOOL _mm_RWopsReader_Read(MREADER *reader,void *ptr,size_t size)

{
  BOOL BVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894bb30. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (**(code **)(reader[1].Seek + 4))();
  return BVar1;
}



----------------------------------------

// Function: _mm_RWopsReader_Get @ 0894bb38

int _mm_RWopsReader_Get(MREADER *reader)

{
  int iVar1;
  int iVar2;
  char local_10 [8];
  
                    /* Unresolved local var: char buf@[???] */
  iVar1 = (**(code **)(reader[1].Seek + 4))(reader[1].Seek,local_10,1,1);
  iVar2 = -1;
  if (iVar1 == 1) {
    iVar2 = (int)local_10[0];
  }
  return iVar2;
}



----------------------------------------

// Function: _mm_RWopsReader_Seek @ 0894bb78

BOOL _mm_RWopsReader_Seek(MREADER *reader,long offset,int whence)

{
  BOOL BVar1;
  
  if (whence == 0) {
    offset = offset + _mm_iobase;
  }
                    /* WARNING: Could not recover jumptable at 0x0894bb94. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (**(code **)reader[1].Seek)(reader[1].Seek,offset);
  return BVar1;
}



----------------------------------------

// Function: _mm_RWopsReader_Tell @ 0894bb9c

long _mm_RWopsReader_Tell(MREADER *reader)

{
  int iVar1;
  
  iVar1 = (**(code **)reader[1].Seek)(reader[1].Seek,0,1);
  return iVar1 - _mm_iobase;
}



----------------------------------------

// Function: _mm_iobase_setcur @ 0894bbd0

void _mm_iobase_setcur(MREADER *reader)

{
  temp_iobase = _mm_iobase;
  _mm_iobase = (*reader->Tell)(reader);
  return;
}



----------------------------------------

// Function: _mm_iobase_revert @ 0894bc08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _mm_iobase_revert(void)

{
  _mm_iobase = temp_iobase;
  return;
}



----------------------------------------

// Function: _mm_FileReader_Eof @ 0894bc1c

BOOL _mm_FileReader_Eof(MREADER *reader)

{
  return (*(ushort *)(reader[1].Seek + 0xc) & 0x3f) >> 5;
}



----------------------------------------

// Function: _mm_write_M_UWORD @ 0894bc2c

void _mm_write_M_UWORD(UWORD data,MWRITER *writer)

{
  (*writer->Put)(writer,(uint)(byte)(data >> 8));
                    /* WARNING: Could not recover jumptable at 0x0894bc6c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*writer->Put)(writer,(uint)data & 0xff);
  return;
}



----------------------------------------

// Function: _mm_write_I_UWORD @ 0894bc74

void _mm_write_I_UWORD(UWORD data,MWRITER *writer)

{
  (*writer->Put)(writer,(uint)data & 0xff);
                    /* WARNING: Could not recover jumptable at 0x0894bcb4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*writer->Put)(writer,(uint)(byte)(data >> 8));
  return;
}



----------------------------------------

// Function: _mm_write_M_ULONG @ 0894bcbc

void _mm_write_M_ULONG(ULONG data,MWRITER *writer)

{
  _mm_write_M_UWORD((UWORD)(data >> 0x10),writer);
  _mm_write_M_UWORD((UWORD)data,writer);
  return;
}



----------------------------------------

// Function: _mm_write_I_ULONG @ 0894bcf8

void _mm_write_I_ULONG(ULONG data,MWRITER *writer)

{
  _mm_write_I_UWORD((UWORD)data,writer);
  _mm_write_I_UWORD((UWORD)(data >> 0x10),writer);
  return;
}



----------------------------------------

// Function: _mm_write_M_SWORD @ 0894bd34

void _mm_write_M_SWORD(SWORD data,MWRITER *writer)

{
  (*writer->Put)(writer,(uint)(byte)((ushort)data >> 8));
                    /* WARNING: Could not recover jumptable at 0x0894bc6c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*writer->Put)(writer,(uint)data & 0xff);
  return;
}



----------------------------------------

// Function: _mm_write_I_SWORD @ 0894bd3c

void _mm_write_I_SWORD(SWORD data,MWRITER *writer)

{
  (*writer->Put)(writer,(uint)data & 0xff);
                    /* WARNING: Could not recover jumptable at 0x0894bcb4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*writer->Put)(writer,(uint)(byte)((ushort)data >> 8));
  return;
}



----------------------------------------

// Function: _mm_write_M_SLONG @ 0894bd44

void _mm_write_M_SLONG(SLONG data,MWRITER *writer)

{
  _mm_write_M_UWORD((UWORD)((uint)data >> 0x10),writer);
  _mm_write_M_UWORD((UWORD)data,writer);
  return;
}



----------------------------------------

// Function: _mm_write_I_SLONG @ 0894bd4c

void _mm_write_I_SLONG(SLONG data,MWRITER *writer)

{
  _mm_write_I_UWORD((UWORD)data,writer);
  _mm_write_I_UWORD((UWORD)((uint)data >> 0x10),writer);
  return;
}



----------------------------------------

// Function: _mm_write_M_SWORDS @ 0894bd54

void _mm_write_M_SWORDS(SWORD *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_M_SWORD(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_M_UWORDS @ 0894bdb4

void _mm_write_M_UWORDS(UWORD *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_M_UWORD(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_I_SWORDS @ 0894be14

void _mm_write_I_SWORDS(SWORD *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_I_SWORD(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_I_UWORDS @ 0894be74

void _mm_write_I_UWORDS(UWORD *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_I_UWORD(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_M_SLONGS @ 0894bed4

void _mm_write_M_SLONGS(SLONG *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_M_SLONG(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_M_ULONGS @ 0894bf34

void _mm_write_M_ULONGS(ULONG *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_M_ULONG(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_I_SLONGS @ 0894bf94

void _mm_write_I_SLONGS(SLONG *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_I_SLONG(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_write_I_ULONGS @ 0894bff4

void _mm_write_I_ULONGS(ULONG *buffer,int number,MWRITER *writer)

{
  int iVar1;
  
  if (0 < number) {
    iVar1 = 0;
    do {
      iVar1 = iVar1 + 1;
      _mm_write_I_ULONG(*buffer,writer);
      buffer = buffer + 1;
    } while (iVar1 != number);
  }
  return;
}



----------------------------------------

// Function: _mm_read_string @ 0894c054

int _mm_read_string(CHAR *buffer,int number,MREADER *reader)

{
  BOOL BVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894c068. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (*reader->Read)(reader,buffer,number);
  return BVar1;
}



----------------------------------------

// Function: _mm_read_M_UWORD @ 0894c070

UWORD _mm_read_M_UWORD(MREADER *reader)

{
  uint uVar1;
  int iVar2;
  
                    /* Unresolved local var: UWORD result@[???] */
  uVar1 = (*reader->Get)(reader);
  iVar2 = (*reader->Get)(reader);
  return (ushort)iVar2 & 0xff | (ushort)((uVar1 & 0xff) << 8);
}



----------------------------------------

// Function: _mm_read_I_UWORD @ 0894c0bc

UWORD _mm_read_I_UWORD(MREADER *reader)

{
  int iVar1;
  uint uVar2;
  
                    /* Unresolved local var: UWORD result@[???] */
  iVar1 = (*reader->Get)(reader);
  uVar2 = (*reader->Get)(reader);
  return (ushort)iVar1 & 0xff | (ushort)((uVar2 & 0xff) << 8);
}



----------------------------------------

// Function: _mm_read_M_ULONG @ 0894c10c

ULONG _mm_read_M_ULONG(MREADER *reader)

{
  UWORD UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  
                    /* Unresolved local var: ULONG result@[???] */
  UVar1 = _mm_read_M_UWORD(reader);
  UVar2 = _mm_read_M_UWORD(reader);
  return (uint)UVar1 << 0x10 | CONCAT22(extraout_var,UVar2);
}



----------------------------------------

// Function: _mm_read_I_ULONG @ 0894c148

ULONG _mm_read_I_ULONG(MREADER *reader)

{
  UWORD UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  
                    /* Unresolved local var: ULONG result@[???] */
  UVar1 = _mm_read_I_UWORD(reader);
  UVar2 = _mm_read_I_UWORD(reader);
  return CONCAT22(extraout_var,UVar1) | (uint)UVar2 << 0x10;
}



----------------------------------------

// Function: _mm_read_M_SWORD @ 0894c188

SWORD _mm_read_M_SWORD(MREADER *reader)

{
  UWORD UVar1;
  
  UVar1 = _mm_read_M_UWORD(reader);
  return UVar1;
}



----------------------------------------

// Function: _mm_read_I_SWORD @ 0894c1a8

SWORD _mm_read_I_SWORD(MREADER *reader)

{
  UWORD UVar1;
  
  UVar1 = _mm_read_I_UWORD(reader);
  return UVar1;
}



----------------------------------------

// Function: _mm_read_M_SLONG @ 0894c1c8

SLONG _mm_read_M_SLONG(MREADER *reader)

{
  UWORD UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  
  UVar1 = _mm_read_M_UWORD(reader);
  UVar2 = _mm_read_M_UWORD(reader);
  return (uint)UVar1 << 0x10 | CONCAT22(extraout_var,UVar2);
}



----------------------------------------

// Function: _mm_read_I_SLONG @ 0894c1d0

SLONG _mm_read_I_SLONG(MREADER *reader)

{
  UWORD UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  
  UVar1 = _mm_read_I_UWORD(reader);
  UVar2 = _mm_read_I_UWORD(reader);
  return CONCAT22(extraout_var,UVar1) | (uint)UVar2 << 0x10;
}



----------------------------------------

// Function: _mm_read_M_SWORDS @ 0894c1d8

int _mm_read_M_SWORDS(SWORD *buffer,int number,MREADER *reader)

{
  SWORD SVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      SVar1 = _mm_read_M_SWORD(reader);
      iVar3 = iVar3 + 1;
      *buffer = SVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_M_UWORDS @ 0894c248

int _mm_read_M_UWORDS(UWORD *buffer,int number,MREADER *reader)

{
  UWORD UVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      UVar1 = _mm_read_M_UWORD(reader);
      iVar3 = iVar3 + 1;
      *buffer = UVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_I_SWORDS @ 0894c2b8

int _mm_read_I_SWORDS(SWORD *buffer,int number,MREADER *reader)

{
  SWORD SVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      SVar1 = _mm_read_I_SWORD(reader);
      iVar3 = iVar3 + 1;
      *buffer = SVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_I_UWORDS @ 0894c328

int _mm_read_I_UWORDS(UWORD *buffer,int number,MREADER *reader)

{
  UWORD UVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      UVar1 = _mm_read_I_UWORD(reader);
      iVar3 = iVar3 + 1;
      *buffer = UVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_M_SLONGS @ 0894c398

int _mm_read_M_SLONGS(SLONG *buffer,int number,MREADER *reader)

{
  SLONG SVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      SVar1 = _mm_read_M_SLONG(reader);
      iVar3 = iVar3 + 1;
      *buffer = SVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_M_ULONGS @ 0894c408

int _mm_read_M_ULONGS(ULONG *buffer,int number,MREADER *reader)

{
  ULONG UVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      UVar1 = _mm_read_M_ULONG(reader);
      iVar3 = iVar3 + 1;
      *buffer = UVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_I_SLONGS @ 0894c478

int _mm_read_I_SLONGS(SLONG *buffer,int number,MREADER *reader)

{
  SLONG SVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      SVar1 = _mm_read_I_SLONG(reader);
      iVar3 = iVar3 + 1;
      *buffer = SVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_read_I_ULONGS @ 0894c4e8

int _mm_read_I_ULONGS(ULONG *buffer,int number,MREADER *reader)

{
  ULONG UVar1;
  BOOL BVar2;
  int iVar3;
  
  if (0 < number) {
    iVar3 = 0;
    do {
      UVar1 = _mm_read_I_ULONG(reader);
      iVar3 = iVar3 + 1;
      *buffer = UVar1;
      buffer = buffer + 1;
    } while (iVar3 != number);
  }
  BVar2 = (*reader->Eof)(reader);
  return (uint)(BVar2 == 0);
}



----------------------------------------

// Function: _mm_write_string @ 0894c558

void _mm_write_string(CHAR *data,MWRITER *writer)

{
  size_t sVar1;
  
  if (data != (CHAR *)0x0) {
    sVar1 = strlen(data);
                    /* WARNING: Could not recover jumptable at 0x0894c598. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*writer->Write)(writer,data,sVar1);
    return;
  }
  return;
}



----------------------------------------

// Function: _mm_delete_file_writer @ 0894c5b4

void _mm_delete_file_writer(MWRITER *writer)

{
  if (writer != (MWRITER *)0x0) {
    free(writer);
    return;
  }
  return;
}



----------------------------------------

// Function: _mm_delete_file_reader @ 0894c5cc

void _mm_delete_file_reader(MREADER *reader)

{
  if (reader != (MREADER *)0x0) {
    free(reader);
    return;
  }
  return;
}



----------------------------------------

// Function: _mm_delete_rwops_reader @ 0894c5e4

void _mm_delete_rwops_reader(MREADER *reader)

{
  if (reader != (MREADER *)0x0) {
    free(reader);
    return;
  }
  return;
}



----------------------------------------

// Function: _mm_new_file_writer @ 0894c5fc

MWRITER * _mm_new_file_writer(FILE *fp)

{
  MWRITER *pMVar1;
  
                    /* Unresolved local var: MFILEWRITER * writer@[???] */
  pMVar1 = _mm_malloc(0x14);
  if (pMVar1 != (MWRITER *)0x0) {
    pMVar1->Seek = _mm_FileWriter_Seek;
    pMVar1->Tell = _mm_FileWriter_Tell;
    pMVar1[1].Seek = (_func_BOOL_MWRITER_ptr_long_int *)fp;
    pMVar1->Write = _mm_FileWriter_Write;
    pMVar1->Put = _mm_FileWriter_Put;
  }
  return pMVar1;
}



----------------------------------------

// Function: _mm_new_file_reader @ 0894c65c

MREADER * _mm_new_file_reader(FILE *fp)

{
  MREADER *pMVar1;
  
                    /* Unresolved local var: MFILEREADER * reader@[???] */
  pMVar1 = _mm_malloc(0x18);
  if (pMVar1 != (MREADER *)0x0) {
    pMVar1->Eof = _mm_FileReader_Eof;
    pMVar1->Read = _mm_FileReader_Read;
    pMVar1->Get = _mm_FileReader_Get;
    pMVar1[1].Seek = (_func_BOOL_MREADER_ptr_long_int *)fp;
    pMVar1->Seek = _mm_FileReader_Seek;
    pMVar1->Tell = _mm_FileReader_Tell;
  }
  return pMVar1;
}



----------------------------------------

// Function: _mm_new_rwops_reader @ 0894c6c8

MREADER * _mm_new_rwops_reader(SDL_RWops *rw)

{
  MREADER *pMVar1;
  _func_int_SDL_RWops_ptr_int_int *p_Var2;
  int iVar3;
  _func_long_MREADER_ptr *p_Var4;
  
                    /* Unresolved local var: int here@[???]
                       Unresolved local var: MRWOPSREADER * reader@[???] */
  pMVar1 = _mm_malloc(0x1c);
  if (pMVar1 != (MREADER *)0x0) {
    pMVar1->Eof = _mm_RWopsReader_Eof;
    pMVar1->Read = _mm_RWopsReader_Read;
    pMVar1->Get = _mm_RWopsReader_Get;
    p_Var2 = rw->seek;
    pMVar1->Tell = _mm_RWopsReader_Tell;
    pMVar1->Seek = _mm_RWopsReader_Seek;
    pMVar1[1].Seek = (_func_BOOL_MREADER_ptr_long_int *)rw;
    iVar3 = (*p_Var2)(rw,0,1);
    p_Var4 = (_func_long_MREADER_ptr *)(*rw->seek)(rw,0,2);
    p_Var2 = rw->seek;
    pMVar1[1].Tell = p_Var4;
    (*p_Var2)(rw,iVar3,0);
  }
  return pMVar1;
}



----------------------------------------

// Function: _mm_FileWriter_Put @ 0894c790

BOOL _mm_FileWriter_Put(MWRITER *writer,int value)

{
  int iVar1;
  
  iVar1 = fputc(value,(FILE *)writer[1].Seek);
  return iVar1;
}



----------------------------------------

// Function: _mm_FileWriter_Write @ 0894c7a0

BOOL _mm_FileWriter_Write(MWRITER *writer,void *ptr,size_t size)

{
  size_t sVar1;
  
  sVar1 = fwrite(ptr,size,1,(FILE *)writer[1].Seek);
  return (uint)(size == sVar1);
}



----------------------------------------

// Function: _mm_FileWriter_Tell @ 0894c7dc

long _mm_FileWriter_Tell(MWRITER *writer)

{
  long lVar1;
  
  lVar1 = _ftell_r(_impure_ptr,(FILE *)writer[1].Seek);
  return lVar1;
}



----------------------------------------

// Function: _mm_FileReader_Tell @ 0894c7e4

long _mm_FileReader_Tell(MREADER *reader)

{
  long lVar1;
  
  lVar1 = ftell((FILE *)reader[1].Seek);
  return lVar1 - _mm_iobase;
}



----------------------------------------

// Function: _mm_FileWriter_Seek @ 0894c80c

BOOL _mm_FileWriter_Seek(MWRITER *writer,long offset,int whence)

{
  int iVar1;
  
  iVar1 = _fseek_r(_impure_ptr,(FILE *)writer[1].Seek,offset,whence);
  return iVar1;
}



----------------------------------------

// Function: _mm_FileReader_Seek @ 0894c814

BOOL _mm_FileReader_Seek(MREADER *reader,long offset,int whence)

{
  int iVar1;
  
  if (whence == 0) {
    offset = offset + _mm_iobase;
  }
  iVar1 = fseek((FILE *)reader[1].Seek,offset,whence);
  return iVar1;
}



----------------------------------------

// Function: _mm_FileReader_Get @ 0894c830

int _mm_FileReader_Get(MREADER *reader)

{
  byte bVar1;
  int iVar2;
  FILE *fp;
  
  fp = (FILE *)reader[1].Seek;
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  else {
    __sinit(_impure_ptr);
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  if (-1 < iVar2) {
    bVar1 = *fp->_p;
    fp->_p = fp->_p + 1;
    return (uint)bVar1;
  }
  iVar2 = __srget_r(_impure_ptr,fp);
  return iVar2;
}



----------------------------------------

// Function: _mm_FileReader_Read @ 0894c838

BOOL _mm_FileReader_Read(MREADER *reader,void *ptr,size_t size)

{
  size_t sVar1;
  
  sVar1 = fread(ptr,size,1,(FILE *)reader[1].Seek);
  return sVar1;
}



----------------------------------------

// Function: _mm_fopen @ 0894c84c

FILE * _mm_fopen(CHAR *fname,CHAR *attrib)

{
  FILE *pFVar1;
  
                    /* Unresolved local var: FILE * fp@[???] */
  pFVar1 = fopen(fname,attrib);
  if (pFVar1 == (FILE *)0x0) {
    MikMod_errno = 1;
    if (_mm_errorhandler != (MikMod_handler_t)0x0) {
      (*(code *)_mm_errorhandler)();
      return (FILE *)0x0;
    }
  }
  return pFVar1;
}



----------------------------------------

// Function: _mm_FileExists @ 0894c8b0

BOOL _mm_FileExists(CHAR *fname)

{
  FILE *fp;
  
                    /* Unresolved local var: FILE * fp@[???] */
  fp = fopen(fname,"r");
  if (fp != (FILE *)0x0) {
    fclose(fp);
  }
  return (uint)(fp != (FILE *)0x0);
}



----------------------------------------

// Function: MikMod_strerror @ 0894c8ec

char * MikMod_strerror(int code)

{
  if (0x41 < (uint)code) {
    code = 0x42;
  }
  return _mm_errmsg[code];
}



----------------------------------------

// Function: _mm_registererrorhandler @ 0894c910

MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)

{
  MikMod_handler_t puVar1;
  
  puVar1 = _mm_errorhandler;
                    /* Unresolved local var: MikMod_handler_t oldproc@[???] */
  _mm_errorhandler = proc;
  return puVar1;
}



----------------------------------------

// Function: MikMod_RegisterErrorHandler @ 0894c920

MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t proc)

{
  MikMod_handler_t puVar1;
  
  puVar1 = _mm_errorhandler;
  _mm_errorhandler = proc;
  return puVar1;
                    /* Unresolved local var: MikMod_handler_t result@[???] */
}



----------------------------------------

// Function: UniSetRow @ 0894c928

void UniSetRow(UBYTE *t)

{
  UBYTE *pUVar1;
  
  pUVar1 = t + 1;
  rowstart = t;
  rowpc = t;
  if (t != (UBYTE *)0x0) {
    t = t + (*t & 0x1f);
    rowpc = pUVar1;
  }
  rowend = t;
  return;
}



----------------------------------------

// Function: UniGetByte @ 0894c95c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

UBYTE UniGetByte(void)

{
  UBYTE UVar1;
  
  UVar1 = '\0';
  if (rowpc < rowend) {
    UVar1 = *rowpc;
    rowpc = rowpc + 1;
  }
  return UVar1;
}



----------------------------------------

// Function: UniGetWord @ 0894c98c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

UWORD UniGetWord(void)

{
  byte bVar1;
  UBYTE UVar2;
  undefined3 extraout_var;
  
  bVar1 = UniGetByte();
  UVar2 = UniGetByte();
  return (ushort)bVar1 << 8 | (ushort)CONCAT31(extraout_var,UVar2);
}



----------------------------------------

// Function: UniSkipOpcode @ 0894c9c0

void UniSkipOpcode(UBYTE op)

{
  short sVar1;
  short sVar2;
  
  if (op < 0x3d) {
                    /* Unresolved local var: UWORD t@[???] */
    sVar2 = unioperands[op] - 1;
    if (sVar2 != -1) {
      sVar1 = unioperands[op] - sVar2;
      do {
        UniGetByte();
        sVar2 = sVar2 + -1;
      } while (sVar2 != (short)(sVar1 + -2));
    }
  }
  return;
}



----------------------------------------

// Function: UniFindRow @ 0894ca3c

UBYTE * UniFindRow(UBYTE *t,UWORD row)

{
  ushort uVar1;
  uint uVar2;
  
                    /* Unresolved local var: UBYTE c@[???]
                       Unresolved local var: UBYTE l@[???] */
  if (t != (UBYTE *)0x0) {
    uVar2 = (uint)*t;
    if (uVar2 == 0) {
      return (UBYTE *)0x0;
    }
    uVar1 = (*t >> 5) + 1;
    if (uVar1 <= row) {
      do {
        t = t + (uVar2 & 0x1f);
        uVar2 = (uint)*t;
        row = row - uVar1;
        uVar1 = (*t >> 5) + 1;
        if (uVar2 == 0) {
          return (UBYTE *)0x0;
        }
      } while (uVar1 <= row);
    }
  }
  return t;
}



----------------------------------------

// Function: UniReset @ 0894caac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void UniReset(void)

{
  unipc = 1;
  unitt = 0;
  lastp = 0;
  *unibuf = '\0';
  return;
}



----------------------------------------

// Function: UniCleanup @ 0894cad8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void UniCleanup(void)

{
  if (unibuf != (UBYTE *)0x0) {
    free(unibuf);
  }
  unibuf = (UBYTE *)0x0;
  return;
}



----------------------------------------

// Function: UniInit @ 0894cb10

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL UniInit(void)

{
  unimax = 0x80;
  unibuf = _mm_malloc(0x80);
  return (uint)(unibuf != (UBYTE *)0x0);
}



----------------------------------------

// Function: UniExpand @ 0894cb44

BOOL UniExpand(int wanted)

{
  UBYTE *pUVar1;
  BOOL BVar2;
  
                    /* Unresolved local var: UBYTE * newbuf@[???] */
  BVar2 = 1;
  if ((int)(uint)unimax <= (int)((uint)unipc + wanted)) {
    pUVar1 = realloc(unibuf,unimax + 0x80);
    BVar2 = 0;
    if (pUVar1 != (UBYTE *)0x0) {
      unibuf = pUVar1;
      unimax = unimax + 0x80;
      return 1;
    }
  }
  return BVar2;
}



----------------------------------------

// Function: UniDup @ 0894cbd4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

UBYTE * UniDup(void)

{
  BOOL BVar1;
  UBYTE *dst0;
  
                    /* Unresolved local var: UBYTE * d@[???] */
  BVar1 = UniExpand((uint)unitt - (uint)unipc);
  if (BVar1 != 0) {
    unibuf[unitt] = '\0';
    dst0 = _mm_malloc((uint)unipc);
    if (dst0 != (UBYTE *)0x0) {
      memcpy(dst0,unibuf,(uint)unipc);
      return dst0;
    }
  }
  return (UBYTE *)0x0;
}



----------------------------------------

// Function: UniNewline @ 0894cc68

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void UniNewline(void)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  BOOL BVar4;
  uint uVar5;
  byte *pbVar6;
  byte *pbVar7;
  uint uVar8;
  byte *pbVar9;
  uint uVar10;
  uint uVar11;
  
                    /* Unresolved local var: UWORD n@[???]
                       Unresolved local var: UWORD l@[???]
                       Unresolved local var: UWORD len@[???] */
  pbVar9 = unibuf + lastp;
  bVar1 = *pbVar9;
  uVar5 = (uint)unitt;
  uVar11 = unipc - uVar5 & 0xffff;
  if (((byte)((bVar1 >> 5) + 1) < 8) && ((bVar1 & 0x1f) == uVar11)) {
    uVar10 = uVar11 - 1 & 0xffff;
                    /* Unresolved local var: UWORD t@[???] */
    if (uVar10 == 0) {
LAB_0894cd70:
      unipc = unitt + 1;
      *pbVar9 = bVar1 + 0x20;
      return;
    }
    pbVar7 = unibuf + uVar5 + 2;
    if (unibuf[uVar5 + 1] == pbVar9[1]) {
      uVar8 = 0;
      pbVar6 = pbVar9 + 2;
      do {
        uVar8 = uVar8 + 1 & 0xffff;
        if (uVar10 == uVar8) goto LAB_0894cd70;
        bVar3 = *pbVar6;
        bVar2 = *pbVar7;
        pbVar6 = pbVar6 + 1;
        pbVar7 = pbVar7 + 1;
      } while (bVar3 == bVar2);
    }
  }
  BVar4 = UniExpand(uVar5 - unipc);
  if (BVar4 != 0) {
    unibuf[unitt] = (UBYTE)uVar11;
    lastp = unitt;
    unitt = unipc;
    unipc = unipc + 1;
  }
  return;
}



----------------------------------------

// Function: UniWriteWord @ 0894cd9c

void UniWriteWord(UWORD data)

{
  BOOL BVar1;
  UBYTE *pUVar2;
  uint uVar3;
  uint uVar4;
  
  BVar1 = UniExpand(2);
  if (BVar1 != 0) {
    uVar4 = (uint)unipc;
    uVar3 = uVar4 + 1;
    pUVar2 = unibuf + (uVar3 & 0xffff);
    unipc = (short)uVar3 + 1;
    unibuf[uVar4] = (UBYTE)(data >> 8);
    *pUVar2 = (UBYTE)data;
  }
  return;
}



----------------------------------------

// Function: UniWriteByte @ 0894cdfc

void UniWriteByte(UBYTE data)

{
  BOOL BVar1;
  uint uVar2;
  
  BVar1 = UniExpand(1);
  if (BVar1 != 0) {
    uVar2 = (uint)unipc;
    unipc = unipc + 1;
    unibuf[uVar2] = data;
  }
  return;
}



----------------------------------------

// Function: MikMod_UnregisterAllDrivers @ 0894ce48

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_UnregisterAllDrivers(void)

{
  MDRIVER *pMVar1;
  
  while (firstdriver != (MDRIVER *)0x0) {
    pMVar1 = firstdriver->next;
    firstdriver->next = (MDRIVER *)0x0;
    firstdriver = pMVar1;
  }
  firstdriver = (MDRIVER *)0x0;
  return;
}



----------------------------------------

// Function: _mm_registeralldrivers @ 0894ce50

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _mm_registeralldrivers(void)

{
  _mm_registerdriver(&drv_sdl);
  _mm_registerdriver(&drv_nos);
  return;
}



----------------------------------------

// Function: MikMod_RegisterAllDrivers @ 0894ce78

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_RegisterAllDrivers(void)

{
  _mm_registerdriver(&drv_sdl);
  _mm_registerdriver(&drv_nos);
  return;
}



----------------------------------------

// Function: MikMod_UnregisterAllLoaders @ 0894ce80

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_UnregisterAllLoaders(void)

{
  MLOADER *pMVar1;
  
  while (firstloader != (MLOADER *)0x0) {
    pMVar1 = firstloader->next;
    firstloader->next = (MLOADER *)0x0;
    firstloader = pMVar1;
  }
  firstloader = (MLOADER *)0x0;
  return;
}



----------------------------------------

// Function: MikMod_RegisterAllLoaders_internal @ 0894ce88

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_RegisterAllLoaders_internal(void)

{
  _mm_registerloader(&load_it);
  _mm_registerloader(&load_mod);
  _mm_registerloader(&load_s3m);
  _mm_registerloader(&load_xm);
  return;
}



----------------------------------------

// Function: MikMod_RegisterAllLoaders @ 0894cec8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_RegisterAllLoaders(void)

{
  _mm_registerloader(&load_it);
  _mm_registerloader(&load_mod);
  _mm_registerloader(&load_s3m);
  _mm_registerloader(&load_xm);
  return;
}



----------------------------------------

// Function: MD_SampleSpace @ 0894ced0

ULONG MD_SampleSpace(int type)

{
  ULONG UVar1;
  
  if (type == 0) {
    type = (md_mode & 0xf) >> 3;
  }
  else if (type == 1) {
                    /* WARNING: Could not recover jumptable at 0x0894cf18. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    UVar1 = (*md_driver->FreeSampleSpace)((md_mode & 7) >> 2);
    return UVar1;
  }
                    /* WARNING: Could not recover jumptable at 0x0894cef0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*md_driver->FreeSampleSpace)(type);
  return UVar1;
}



----------------------------------------

// Function: MD_SampleLength @ 0894cf20

ULONG MD_SampleLength(int type,SAMPLE *s)

{
  ULONG UVar1;
  
  if (type == 0) {
    type = (md_mode & 0xf) >> 3;
  }
  else if (type == 1) {
                    /* WARNING: Could not recover jumptable at 0x0894cf68. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    UVar1 = (*md_driver->RealSampleLength)((md_mode & 7) >> 2,s);
    return UVar1;
  }
                    /* WARNING: Could not recover jumptable at 0x0894cf40. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*md_driver->RealSampleLength)(type,s);
  return UVar1;
}



----------------------------------------

// Function: _mm_registerdriver @ 0894cf70

void _mm_registerdriver(MDRIVER *drv)

{
  MDRIVER *pMVar1;
  MDRIVER *pMVar2;
  MDRIVER *pMVar3;
  
                    /* Unresolved local var: MDRIVER * cruise@[???] */
  if (firstdriver != (MDRIVER *)0x0) {
    pMVar1 = firstdriver->next;
    pMVar3 = firstdriver;
    while (pMVar2 = pMVar1, pMVar2 != (MDRIVER *)0x0) {
      pMVar3 = pMVar2;
      pMVar1 = pMVar2->next;
    }
    pMVar3->next = drv;
    return;
  }
  firstdriver = drv;
  return;
}



----------------------------------------

// Function: _mm_unregisterdrivers @ 0894cf9c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _mm_unregisterdrivers(void)

{
  MDRIVER *pMVar1;
  
  while (firstdriver != (MDRIVER *)0x0) {
    pMVar1 = firstdriver->next;
    firstdriver->next = (MDRIVER *)0x0;
    firstdriver = pMVar1;
  }
  firstdriver = (MDRIVER *)0x0;
  return;
}



----------------------------------------

// Function: MikMod_RegisterDriver @ 0894cfc4

void MikMod_RegisterDriver(MDRIVER *drv)

{
  if ((drv != (MDRIVER *)0x0) && (drv->next == (MDRIVER *)0x0)) {
    _mm_registerdriver(drv);
    return;
  }
  return;
}



----------------------------------------

// Function: MD_SampleUnload @ 0894cfe8

void MD_SampleUnload(SWORD handle)

{
                    /* WARNING: Could not recover jumptable at 0x0894cff4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*md_driver->SampleUnload)(handle);
  return;
}



----------------------------------------

// Function: MikMod_RegisterPlayer @ 0894cffc

MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t player)

{
  _func_void *p_Var1;
  
  p_Var1 = md_player;
                    /* Unresolved local var: MikMod_player_t result@[???] */
  md_player = (_func_void *)player;
  return p_Var1;
}



----------------------------------------

// Function: MikMod_Update @ 0894d00c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_Update(void)

{
  if (isplaying != 0) {
    if ((pf == (MODULE *)0x0) || (pf->forbid == 0)) {
                    /* WARNING: Could not recover jumptable at 0x0894d054. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->Update)();
      return;
    }
    if (md_driver->Pause != (_func_void *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x0894d044. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->Pause)();
      return;
    }
  }
  return;
}



----------------------------------------

// Function: Voice_SetVolume_internal @ 0894d064

void Voice_SetVolume_internal(SBYTE voice,UWORD vol)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: ULONG tmp@[???] */
  iVar2 = (int)voice;
  uVar1 = (uint)vol;
  if ((iVar2 < 0) || ((int)(uint)md_numchn <= iVar2)) {
    return;
  }
  if (0x80 < md_musicvolume) {
    md_musicvolume = 0x80;
  }
  if (0x80 < md_sndfxvolume) {
    md_sndfxvolume = 0x80;
  }
  if (md_volume < 0x81) {
    iVar3 = uVar1 * md_volume;
    if ((int)(uint)md_sngchn <= iVar2) {
LAB_0894d0f8:
                    /* WARNING: Could not recover jumptable at 0x0894d118. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->VoiceSetVolume)
                (voice,(UWORD)(((uint)md_sndfxvolume * iVar3 & 0x3fffffff) >> 0xe));
      return;
    }
  }
  else {
    md_volume = 0x80;
    if ((int)(uint)md_sngchn <= iVar2) {
      iVar3 = uVar1 * 0x80;
      goto LAB_0894d0f8;
    }
    iVar3 = uVar1 * 0x80;
  }
                    /* WARNING: Could not recover jumptable at 0x0894d0ec. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*md_driver->VoiceSetVolume)(voice,(UWORD)(((uint)md_musicvolume * iVar3 & 0x3fffffff) >> 0xe));
  return;
}



----------------------------------------

// Function: Voice_SetVolume @ 0894d188

void Voice_SetVolume(SBYTE voice,UWORD vol)

{
  Voice_SetVolume_internal(voice,vol);
  return;
}



----------------------------------------

// Function: Voice_GetVolume @ 0894d194

UWORD Voice_GetVolume(SBYTE voice)

{
  UWORD UVar1;
  
                    /* Unresolved local var: UWORD result@[???] */
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
    UVar1 = (*md_driver->VoiceGetVolume)(voice);
    return UVar1;
  }
  return 0;
}



----------------------------------------

// Function: Voice_SetFrequency_internal @ 0894d1e8

void Voice_SetFrequency_internal(SBYTE voice,ULONG frq)

{
  uint uVar1;
  int iVar2;
  _func_void_UBYTE_ULONG *UNRECOVERED_JUMPTABLE;
  
  iVar2 = (int)voice;
  if ((iVar2 < 0) || ((int)(uint)md_numchn <= iVar2)) {
    return;
  }
  if (md_sample[iVar2] != (SAMPLE *)0x0) {
    uVar1 = (uint)md_sample[iVar2]->divfactor;
    if (uVar1 == 0) {
      UNRECOVERED_JUMPTABLE = md_driver->VoiceSetFrequency;
      goto LAB_0894d248;
    }
    frq = frq / uVar1;
    if (uVar1 == 0) {
      trap(7);
    }
  }
  UNRECOVERED_JUMPTABLE = md_driver->VoiceSetFrequency;
LAB_0894d248:
                    /* WARNING: Could not recover jumptable at 0x0894d248. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(voice,frq);
  return;
}



----------------------------------------

// Function: Voice_SetFrequency @ 0894d258

void Voice_SetFrequency(SBYTE voice,ULONG frq)

{
  uint uVar1;
  int iVar2;
  _func_void_UBYTE_ULONG *UNRECOVERED_JUMPTABLE;
  
  iVar2 = (int)voice;
  if ((iVar2 < 0) || ((int)(uint)md_numchn <= iVar2)) {
    return;
  }
  if (md_sample[iVar2] != (SAMPLE *)0x0) {
    uVar1 = (uint)md_sample[iVar2]->divfactor;
    if (uVar1 == 0) {
      UNRECOVERED_JUMPTABLE = md_driver->VoiceSetFrequency;
      goto LAB_0894d248;
    }
    frq = frq / uVar1;
    if (uVar1 == 0) {
      trap(7);
    }
  }
  UNRECOVERED_JUMPTABLE = md_driver->VoiceSetFrequency;
LAB_0894d248:
                    /* WARNING: Could not recover jumptable at 0x0894d248. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)(voice,frq);
  return;
}



----------------------------------------

// Function: Voice_GetFrequency @ 0894d260

ULONG Voice_GetFrequency(SBYTE voice)

{
  ULONG UVar1;
  
                    /* Unresolved local var: ULONG result@[???] */
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d290. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    UVar1 = (*md_driver->VoiceGetFrequency)(voice);
    return UVar1;
  }
  return 0;
}



----------------------------------------

// Function: Voice_SetPanning_internal @ 0894d298

/* WARNING: Removing unreachable block (ram,0x0894d31c) */

void Voice_SetPanning_internal(SBYTE voice,ULONG pan)

{
  short sVar1;
  uint uVar2;
  
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
    if (pan != 0x200) {
      uVar2 = (uint)md_pansep;
      if (0x80 < uVar2) {
        md_pansep = 0x80;
        uVar2 = 0x80;
      }
      sVar1 = (short)pan + -0x80;
      if ((md_mode & 0x400) != 0) {
        sVar1 = 0x7f - (short)pan;
      }
      pan = (int)((int)sVar1 * uVar2) / 0x80 + 0x80;
    }
                    /* WARNING: Could not recover jumptable at 0x0894d32c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*md_driver->VoiceSetPanning)(voice,pan);
    return;
  }
  return;
}



----------------------------------------

// Function: Voice_SetPanning @ 0894d33c

/* WARNING: Removing unreachable block (ram,0x0894d31c) */

void Voice_SetPanning(SBYTE voice,ULONG pan)

{
  short sVar1;
  uint uVar2;
  
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
    if (pan != 0x200) {
      uVar2 = (uint)md_pansep;
      if (0x80 < uVar2) {
        md_pansep = 0x80;
        uVar2 = 0x80;
      }
      sVar1 = (short)pan + -0x80;
      if ((md_mode & 0x400) != 0) {
        sVar1 = 0x7f - (short)pan;
      }
      pan = (int)((int)sVar1 * uVar2) / 0x80 + 0x80;
    }
                    /* WARNING: Could not recover jumptable at 0x0894d32c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*md_driver->VoiceSetPanning)(voice,pan);
    return;
  }
  return;
}



----------------------------------------

// Function: Voice_GetPanning @ 0894d344

ULONG Voice_GetPanning(SBYTE voice)

{
  ULONG UVar1;
  
                    /* Unresolved local var: ULONG result@[???] */
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d374. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    UVar1 = (*md_driver->VoiceGetPanning)(voice);
    return UVar1;
  }
  return 0x80;
}



----------------------------------------

// Function: Voice_Play_internal @ 0894d37c

void Voice_Play_internal(SBYTE voice,SAMPLE *s,ULONG start)

{
  ushort uVar1;
  int iVar2;
  ULONG in_stack_00000010;
  ULONG in_stack_00000014;
  UWORD in_stack_00000018;
  
                    /* Unresolved local var: ULONG repend@[???] */
  iVar2 = (int)voice;
  if ((-1 < iVar2) && (iVar2 < (int)(uint)md_numchn)) {
    uVar1 = s->flags;
    md_sample[iVar2] = s;
    if ((uVar1 & 0x100) != 0) {
                    /* WARNING: Could not recover jumptable at 0x0894d3d8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->VoicePlay)
                (voice,s->handle,start,s->length,in_stack_00000010,in_stack_00000014,
                 in_stack_00000018);
      return;
    }
                    /* WARNING: Could not recover jumptable at 0x0894d3f8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*md_driver->VoicePlay)
              (voice,s->handle,start,s->length,in_stack_00000010,in_stack_00000014,in_stack_00000018
              );
    return;
  }
  return;
}



----------------------------------------

// Function: Voice_Play @ 0894d408

void Voice_Play(SBYTE voice,SAMPLE *s,ULONG start)

{
  if (s->length < start) {
    return;
  }
  Voice_Play_internal(voice,s,start);
  return;
}



----------------------------------------

// Function: Voice_Stop_internal @ 0894d428

void Voice_Stop_internal(SBYTE voice)

{
  int iVar1;
  
  iVar1 = (int)voice;
  if ((-1 < iVar1) && (iVar1 < (int)(uint)md_numchn)) {
    if (iVar1 < (int)(uint)md_sngchn) {
                    /* WARNING: Could not recover jumptable at 0x0894d468. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->VoiceStop)(voice);
      return;
    }
    sfxinfo[iVar1 - (uint)md_sngchn] = '\0';
                    /* WARNING: Could not recover jumptable at 0x0894d488. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*md_driver->VoiceStop)(voice);
    return;
  }
  return;
}



----------------------------------------

// Function: Voice_Stop @ 0894d498

void Voice_Stop(SBYTE voice)

{
  int iVar1;
  
  iVar1 = (int)voice;
  if ((-1 < iVar1) && (iVar1 < (int)(uint)md_numchn)) {
    if (iVar1 < (int)(uint)md_sngchn) {
                    /* WARNING: Could not recover jumptable at 0x0894d468. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (*md_driver->VoiceStop)(voice);
      return;
    }
    sfxinfo[iVar1 - (uint)md_sngchn] = '\0';
                    /* WARNING: Could not recover jumptable at 0x0894d488. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*md_driver->VoiceStop)(voice);
    return;
  }
  return;
}



----------------------------------------

// Function: Voice_Stopped_internal @ 0894d4a0

BOOL Voice_Stopped_internal(SBYTE voice)

{
  BOOL BVar1;
  
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d4d0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    BVar1 = (*md_driver->VoiceStopped)(voice);
    return BVar1;
  }
  return 0;
}



----------------------------------------

// Function: Voice_Stopped @ 0894d4d8

BOOL Voice_Stopped(SBYTE voice)

{
  BOOL BVar1;
  
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d4d0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    BVar1 = (*md_driver->VoiceStopped)(voice);
    return BVar1;
  }
  return 0;
}



----------------------------------------

// Function: Voice_GetPosition @ 0894d4e0

SLONG Voice_GetPosition(SBYTE voice)

{
  SLONG SVar1;
  
                    /* Unresolved local var: SLONG result@[???] */
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d510. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    SVar1 = (*md_driver->VoiceGetPosition)(voice);
    return SVar1;
  }
  return 0;
}



----------------------------------------

// Function: Voice_RealVolume @ 0894d518

ULONG Voice_RealVolume(SBYTE voice)

{
  ULONG UVar1;
  
                    /* Unresolved local var: ULONG result@[???] */
  if ((-1 < voice) && ((int)voice < (int)(uint)md_numchn)) {
                    /* WARNING: Could not recover jumptable at 0x0894d548. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    UVar1 = (*md_driver->VoiceRealVolume)(voice);
    return UVar1;
  }
  return 0;
}



----------------------------------------

// Function: MikMod_EnableOutput_internal @ 0894d550

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MikMod_EnableOutput_internal(void)

{
  BOOL BVar1;
  
  MikMod_critical = 1;
  if (isplaying == 0) {
    BVar1 = (*md_driver->PlayStart)();
    if (BVar1 != 0) {
      return 1;
    }
    isplaying = 1;
  }
  MikMod_critical = 0;
  return 0;
}



----------------------------------------

// Function: MikMod_EnableOutput @ 0894d5c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MikMod_EnableOutput(void)

{
  BOOL BVar1;
  
  MikMod_critical = 1;
  if (isplaying == 0) {
    BVar1 = (*md_driver->PlayStart)();
    if (BVar1 != 0) {
      return 1;
    }
    isplaying = 1;
  }
  MikMod_critical = 0;
  return 0;
}



----------------------------------------

// Function: MikMod_DisableOutput_internal @ 0894d5cc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_DisableOutput_internal(void)

{
  if ((isplaying != 0) && (md_driver != (MDRIVER *)0x0)) {
                    /* WARNING: Could not recover jumptable at 0x0894d5ec. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    isplaying = 0;
    (*md_driver->PlayStop)();
    return;
  }
  return;
}



----------------------------------------

// Function: MikMod_DisableOutput @ 0894d5fc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_DisableOutput(void)

{
  if ((isplaying != 0) && (md_driver != (MDRIVER *)0x0)) {
                    /* WARNING: Could not recover jumptable at 0x0894d5ec. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    isplaying = 0;
    (*md_driver->PlayStop)();
    return;
  }
  return;
}



----------------------------------------

// Function: MikMod_Active_internal @ 0894d604

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MikMod_Active_internal(void)

{
  return isplaying;
}



----------------------------------------

// Function: MikMod_Active @ 0894d610

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MikMod_Active(void)

{
  return isplaying;
                    /* Unresolved local var: BOOL result@[???] */
}



----------------------------------------

// Function: Sample_Play_internal @ 0894d618

SBYTE Sample_Play_internal(SAMPLE *s,ULONG start,UBYTE flags)

{
  int iVar1;
  BOOL BVar2;
  byte *pbVar3;
  ULONG UVar4;
  UBYTE voice;
  
                    /* Unresolved local var: int orig@[???]
                       Unresolved local var: int c@[???] */
  iVar1 = sfxpool;
  if (md_sfxchn != '\0') {
    if (s->volume < 0x41) {
      pbVar3 = sfxinfo + sfxpool;
      if ((*pbVar3 & 1) != 0) goto LAB_0894d6a8;
LAB_0894d74c:
      iVar1 = sfxpool;
      *pbVar3 = flags;
      voice = (char)iVar1 + md_sngchn;
      Voice_Play_internal(voice,s,start);
      (*md_driver->VoiceSetVolume)(voice,(ushort)s->volume << 2);
      Voice_SetPanning_internal(voice,(int)s->panning);
      UVar4 = s->speed;
LAB_0894d7ac:
      (*md_driver->VoiceSetFrequency)(voice,UVar4);
      if (sfxpool + 1 < (int)(uint)md_sfxchn) {
        sfxpool = sfxpool + 1;
        return voice;
      }
      sfxpool = 0;
      return voice;
    }
    s->volume = '@';
    do {
      pbVar3 = sfxinfo + sfxpool;
      if ((*pbVar3 & 1) == 0) goto LAB_0894d74c;
LAB_0894d6a8:
      voice = (char)sfxpool + md_sngchn;
      BVar2 = (*md_driver->VoiceStopped)(voice);
      if (BVar2 != 0) {
        sfxinfo[sfxpool] = flags;
        Voice_Play_internal(voice,s,start);
        (*md_driver->VoiceSetVolume)(voice,(ushort)s->volume << 2);
        Voice_SetPanning_internal(voice,(int)s->panning);
        UVar4 = s->speed;
        goto LAB_0894d7ac;
      }
      sfxpool = sfxpool + 1;
      if ((int)(uint)md_sfxchn <= sfxpool) {
        sfxpool = 0;
      }
    } while (iVar1 != sfxpool);
  }
  return -1;
}



----------------------------------------

// Function: Sample_Play @ 0894d868

SBYTE Sample_Play(SAMPLE *s,ULONG start,UBYTE flags)

{
  SBYTE SVar1;
  
                    /* Unresolved local var: SBYTE result@[???] */
  SVar1 = Sample_Play_internal(s,start,flags);
  return SVar1;
}



----------------------------------------

// Function: MikMod_GetVersion @ 0894d884

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

long MikMod_GetVersion(void)

{
  return 0x30108;
}



----------------------------------------

// Function: MikMod_InitThreads @ 0894d890

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MikMod_InitThreads(void)

{
  if (MikMod_InitThreads::firstcall != 0) {
    MikMod_InitThreads::firstcall = 0;
  }
  return 0;
}



----------------------------------------

// Function: MikMod_Unlock @ 0894d8ac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_Unlock(void)

{
  return;
}



----------------------------------------

// Function: MikMod_Lock @ 0894d8b4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_Lock(void)

{
  return;
}



----------------------------------------

// Function: MD_GetAtom @ 0894d8bc

CHAR * MD_GetAtom(CHAR *atomname,CHAR *cmdline,BOOL implicit)

{
  char cVar1;
  char *pcVar2;
  size_t sVar3;
  char *pcVar4;
  char *pcVar5;
  
                    /* Unresolved local var: CHAR * ret@[???] */
  if ((cmdline != (CHAR *)0x0) && (pcVar2 = strstr(cmdline,atomname), pcVar2 != (char *)0x0)) {
    if ((cmdline != pcVar2) && (pcVar2[-1] != ',')) {
      return (CHAR *)0x0;
    }
    sVar3 = strlen(atomname);
    pcVar5 = pcVar2 + sVar3;
    cVar1 = *pcVar5;
    if (cVar1 != '=') {
      if ((cVar1 != ',') && (cVar1 != '\0')) {
        return (CHAR *)0x0;
      }
      if (implicit == 0) {
        return (CHAR *)0x0;
      }
      pcVar4 = _mm_malloc(((int)pcVar5 - (int)pcVar2) + 1);
      if (pcVar4 == (char *)0x0) {
        return (CHAR *)0x0;
      }
      strncpy(pcVar4,pcVar2,(int)pcVar5 - (int)pcVar2);
      return pcVar4;
    }
    pcVar4 = pcVar5 + 1;
    pcVar2 = pcVar4;
    if ((pcVar5[1] == '\0') || (pcVar5[1] == ',')) {
      pcVar5 = (char *)0x1;
    }
    else {
      do {
        pcVar2 = pcVar2 + 1;
        if (*pcVar2 == '\0') break;
      } while (*pcVar2 != ',');
      pcVar5 = pcVar2 + (1 - (int)pcVar4);
    }
    pcVar5 = _mm_malloc((size_t)pcVar5);
    if (pcVar5 != (char *)0x0) {
      strncpy(pcVar5,pcVar4,(int)pcVar2 - (int)pcVar4);
      return pcVar5;
    }
  }
                    /* Unresolved local var: CHAR * buf@[???]
                       Unresolved local var: CHAR * ptr@[???] */
  return (CHAR *)0x0;
}



----------------------------------------

// Function: MikMod_Exit_internal @ 0894da08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_Exit_internal(void)

{
  MikMod_DisableOutput_internal();
  (*md_driver->Exit)();
  md_driver = &drv_nos;
  md_sngchn = '\0';
  md_sfxchn = '\0';
  md_numchn = '\0';
  if (sfxinfo != (UBYTE *)0x0) {
    free(sfxinfo);
  }
  if (md_sample != (SAMPLE **)0x0) {
    free(md_sample);
  }
  initialized = 0;
  md_sample = (SAMPLE **)0x0;
  sfxinfo = (UBYTE *)0x0;
  return;
}



----------------------------------------

// Function: MikMod_Exit @ 0894daac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MikMod_Exit(void)

{
  MikMod_DisableOutput_internal();
  (*md_driver->Exit)();
  md_driver = &drv_nos;
  md_sngchn = '\0';
  md_sfxchn = '\0';
  md_numchn = '\0';
  if (sfxinfo != (UBYTE *)0x0) {
    free(sfxinfo);
  }
  if (md_sample != (SAMPLE **)0x0) {
    free(md_sample);
  }
  initialized = 0;
  md_sample = (SAMPLE **)0x0;
  sfxinfo = (UBYTE *)0x0;
  return;
}



----------------------------------------

// Function: _mm_init @ 0894dab4

BOOL _mm_init(CHAR *cmdline)

{
  UWORD UVar1;
  BOOL BVar2;
  CHAR *pCVar3;
  
                    /* Unresolved local var: UWORD t@[???] */
  MikMod_critical = 1;
  md_driver = firstdriver;
  if (md_device == 0) {
    if (firstdriver != (MDRIVER *)0x0) {
      UVar1 = 1;
      do {
        if ((md_driver->Version != (CHAR *)0x0) && (BVar2 = (*md_driver->IsPresent)(), BVar2 != 0))
        {
          if (md_driver != (MDRIVER *)0x0) goto LAB_0894dc84;
          break;
        }
        UVar1 = UVar1 + 1;
        md_driver = md_driver->next;
      } while (md_driver != (MDRIVER *)0x0);
    }
    MikMod_errno = 0xf;
  }
  else {
    if (firstdriver != (MDRIVER *)0x0) {
      UVar1 = 1;
      if (md_device != 1) {
        pCVar3 = firstdriver->Version;
        while( true ) {
          if (pCVar3 != (CHAR *)0x0) {
            UVar1 = UVar1 + 1;
          }
          md_driver = md_driver->next;
          if (md_driver == (MDRIVER *)0x0) goto LAB_0894dbc8;
          if (UVar1 == md_device) break;
          pCVar3 = md_driver->Version;
        }
      }
      if ((cmdline != (CHAR *)0x0) && (md_driver->CommandLine != (_func_void_CHAR_ptr *)0x0)) {
        (*md_driver->CommandLine)(cmdline);
      }
      BVar2 = (*md_driver->IsPresent)();
      UVar1 = md_device;
      if (BVar2 == 0) {
        MikMod_errno = 0xf;
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
        md_driver = &drv_nos;
        return 1;
      }
LAB_0894dc84:
      md_device = UVar1;
      BVar2 = (*md_driver->Init)();
      if (BVar2 == 0) {
        initialized = 1;
        MikMod_critical = 0;
        return 0;
      }
      (*md_driver->Exit)();
      MikMod_Exit_internal();
      if (_mm_errorhandler == (MikMod_handler_t)0x0) {
        return 1;
      }
      (*(code *)_mm_errorhandler)();
      return 1;
    }
LAB_0894dbc8:
    MikMod_errno = 0x10;
  }
  if ((code *)_mm_errorhandler != (code *)0x0) {
    (*(code *)_mm_errorhandler)();
  }
  md_driver = &drv_nos;
  return 1;
}



----------------------------------------

// Function: MikMod_Reset @ 0894dd04

BOOL MikMod_Reset(CHAR *cmdline)

{
  BOOL BVar1;
  int iVar2;
  
                    /* Unresolved local var: BOOL result@[???] */
  if (initialized == 0) {
    BVar1 = _mm_init(cmdline);
    return BVar1;
  }
  if ((md_driver->Reset == (_func_BOOL *)0x0) || (md_device != idevice)) {
    if (isplaying == 0) {
      (*md_driver->Exit)();
      iVar2 = _mm_init(cmdline);
    }
    else {
      (*md_driver->PlayStop)();
      (*md_driver->Exit)();
      iVar2 = _mm_init(cmdline);
    }
    if (iVar2 != 0) goto LAB_0894ddd8;
    if (isplaying != 0) {
      (*md_driver->PlayStart)();
      return 0;
    }
  }
  else {
    BVar1 = (*md_driver->Reset)();
    if (BVar1 != 0) {
LAB_0894ddd8:
      MikMod_Exit_internal();
      if ((MikMod_errno != 0) && (_mm_errorhandler != (MikMod_handler_t)0x0)) {
        (*(code *)_mm_errorhandler)();
        return 1;
      }
      return 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: MikMod_Init @ 0894de84

BOOL MikMod_Init(CHAR *cmdline)

{
  UWORD UVar1;
  BOOL BVar2;
  CHAR *pCVar3;
  
  MikMod_critical = 1;
                    /* Unresolved local var: BOOL result@[???] */
  md_driver = firstdriver;
  if (md_device == 0) {
    if (firstdriver != (MDRIVER *)0x0) {
      UVar1 = 1;
      do {
        if ((md_driver->Version != (CHAR *)0x0) && (BVar2 = (*md_driver->IsPresent)(), BVar2 != 0))
        {
          if (md_driver != (MDRIVER *)0x0) goto LAB_0894dc84;
          break;
        }
        UVar1 = UVar1 + 1;
        md_driver = md_driver->next;
      } while (md_driver != (MDRIVER *)0x0);
    }
    MikMod_errno = 0xf;
  }
  else {
    if (firstdriver != (MDRIVER *)0x0) {
      UVar1 = 1;
      if (md_device != 1) {
        pCVar3 = firstdriver->Version;
        while( true ) {
          if (pCVar3 != (CHAR *)0x0) {
            UVar1 = UVar1 + 1;
          }
          md_driver = md_driver->next;
          if (md_driver == (MDRIVER *)0x0) goto LAB_0894dbc8;
          if (UVar1 == md_device) break;
          pCVar3 = md_driver->Version;
        }
      }
      if ((cmdline != (CHAR *)0x0) && (md_driver->CommandLine != (_func_void_CHAR_ptr *)0x0)) {
        (*md_driver->CommandLine)(cmdline);
      }
      BVar2 = (*md_driver->IsPresent)();
      UVar1 = md_device;
      if (BVar2 == 0) {
        MikMod_errno = 0xf;
        if (_mm_errorhandler != (MikMod_handler_t)0x0) {
          (*(code *)_mm_errorhandler)();
        }
        md_driver = &drv_nos;
        return 1;
      }
LAB_0894dc84:
      md_device = UVar1;
      BVar2 = (*md_driver->Init)();
      if (BVar2 == 0) {
        initialized = 1;
        MikMod_critical = 0;
        return 0;
      }
      (*md_driver->Exit)();
      MikMod_Exit_internal();
      if (_mm_errorhandler == (MikMod_handler_t)0x0) {
        return 1;
      }
      (*(code *)_mm_errorhandler)();
      return 1;
    }
LAB_0894dbc8:
    MikMod_errno = 0x10;
  }
  if ((code *)_mm_errorhandler != (code *)0x0) {
    (*(code *)_mm_errorhandler)();
  }
  md_driver = &drv_nos;
  return 1;
}



----------------------------------------

// Function: MikMod_SetNumVoices_internal @ 0894de8c

BOOL MikMod_SetNumVoices_internal(int music,int sfx)

{
  bool bVar1;
  byte bVar2;
  byte bVar3;
  BOOL BVar4;
  bool bVar5;
  size_t nitems;
  uint uVar6;
  uint uVar7;
  
                    /* Unresolved local var: BOOL resume@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int oldchn@[???] */
  if ((music == 0) && (sfx == 0)) {
    return 1;
  }
  bVar1 = isplaying != 0;
  MikMod_critical = 1;
  if (bVar1) {
    MikMod_DisableOutput_internal();
    uVar7 = (uint)md_numchn;
  }
  else {
    uVar7 = 0;
  }
  if (sfxinfo != (UBYTE *)0x0) {
    free(sfxinfo);
  }
  if (md_sample != (SAMPLE **)0x0) {
    free(md_sample);
  }
  md_sample = (SAMPLE **)0x0;
  sfxinfo = (UBYTE *)0x0;
  if (music != -1) {
    md_sngchn = (UBYTE)music;
  }
  if (sfx != -1) {
    md_sfxchn = (UBYTE)sfx;
  }
                    /* Unresolved local var: int t@[???] */
  bVar2 = md_driver->HardVoiceLimit;
  bVar3 = md_sfxchn;
  if (((md_mode & 4) != 0) || (bVar3 = bVar2, bVar2 < md_sfxchn)) {
    md_sfxchn = bVar3;
  }
  if (((md_mode & 8) == 0) && (bVar2 < md_sngchn)) {
    md_sngchn = bVar2;
  }
  md_hardchn = md_sfxchn;
  if ((md_mode & 4) != 0) {
    md_hardchn = '\0';
  }
  if ((md_mode & 8) == 0) {
    md_hardchn = md_hardchn + md_sngchn;
  }
  bVar5 = false;
  while (bVar2 < md_hardchn) {
    while( true ) {
      bVar5 = (bool)(bVar5 ^ 1);
      if (bVar5) {
        md_hardchn = 0;
        if (((md_mode & 4) == 0) && (md_hardchn = md_sfxchn, 4 < md_sfxchn)) {
          md_sfxchn = md_sfxchn - 1;
          md_hardchn = md_sfxchn;
        }
      }
      else {
        if (((md_mode & 8) == 0) && (8 < md_sngchn)) {
          md_sngchn = md_sngchn - 1;
        }
        md_hardchn = md_sfxchn;
        if ((md_mode & 4) != 0) {
          md_hardchn = 0;
        }
      }
      if ((md_mode & 8) != 0) break;
      md_hardchn = md_sngchn + md_hardchn;
      if (md_hardchn <= bVar2) goto LAB_0894e028;
    }
  }
LAB_0894e028:
                    /* Unresolved local var: int t@[???] */
  bVar2 = md_driver->SoftVoiceLimit;
  if (((md_mode & 4) != 0) && (bVar2 < md_sfxchn)) {
    md_sfxchn = bVar2;
  }
  if (((md_mode & 8) != 0) && (bVar2 < md_sngchn)) {
    md_sngchn = bVar2;
  }
  if ((md_mode & 4) == 0) {
    md_softchn = '\0';
  }
  else {
    md_softchn = md_sfxchn;
  }
  if ((md_mode & 8) != 0) {
    md_softchn = md_softchn + md_sngchn;
  }
  bVar5 = false;
  while (bVar2 < md_softchn) {
    while( true ) {
      bVar5 = (bool)(bVar5 ^ 1);
      md_softchn = md_sfxchn;
      if (bVar5) {
        if (((md_mode & 4) != 0) && (md_softchn = 0, 4 < md_sfxchn)) {
          md_sfxchn = md_sfxchn - 1;
        }
      }
      else {
        if (((md_mode & 8) != 0) && (8 < md_sngchn)) {
          md_sngchn = md_sngchn - 1;
        }
        if ((md_mode & 4) != 0) {
          md_softchn = 0;
        }
      }
      if ((md_mode & 8) != 0) break;
      md_softchn = md_sngchn + md_softchn;
      if (md_softchn <= bVar2) goto LAB_0894e0f8;
    }
  }
LAB_0894e0f8:
  md_numchn = md_hardchn + md_softchn;
  BVar4 = (*md_driver->SetNumVoices)();
  if (BVar4 != 0) {
    MikMod_Exit_internal();
    if ((MikMod_errno != 0) && (_mm_errorhandler != (MikMod_handler_t)0x0)) {
      (*(code *)_mm_errorhandler)();
    }
    md_sngchn = '\0';
    md_sfxchn = '\0';
    md_hardchn = '\0';
    md_softchn = '\0';
    md_numchn = '\0';
    return 1;
  }
  nitems = (size_t)md_sfxchn;
  if (md_sngchn + nitems != 0) {
    md_sample = _mm_calloc(md_sngchn + nitems,4);
    nitems = (size_t)md_sfxchn;
  }
  if (nitems != 0) {
    sfxinfo = _mm_calloc(nitems,1);
  }
  uVar6 = uVar7;
  if (uVar7 < md_numchn) {
    do {
      Voice_Stop_internal((SBYTE)uVar7);
      uVar6 = uVar6 + 1;
      uVar7 = uVar7 + 1 & 0xff;
    } while ((int)uVar6 < (int)(uint)md_numchn);
  }
  sfxpool = 0;
  if (bVar1) {
    MikMod_EnableOutput_internal();
  }
  MikMod_critical = 0;
  return 0;
}



----------------------------------------

// Function: MikMod_SetNumVoices @ 0894e30c

BOOL MikMod_SetNumVoices(int music,int sfx)

{
  bool bVar1;
  byte bVar2;
  byte bVar3;
  BOOL BVar4;
  bool bVar5;
  size_t nitems;
  uint uVar6;
  uint uVar7;
  
  if ((music == 0) && (sfx == 0)) {
    return 1;
  }
  bVar1 = isplaying != 0;
  MikMod_critical = 1;
  if (bVar1) {
    MikMod_DisableOutput_internal();
    uVar7 = (uint)md_numchn;
  }
  else {
    uVar7 = 0;
  }
  if (sfxinfo != (UBYTE *)0x0) {
    free(sfxinfo);
  }
  if (md_sample != (SAMPLE **)0x0) {
    free(md_sample);
  }
  md_sample = (SAMPLE **)0x0;
  sfxinfo = (UBYTE *)0x0;
  if (music != -1) {
    md_sngchn = (UBYTE)music;
  }
  if (sfx != -1) {
    md_sfxchn = (UBYTE)sfx;
  }
  bVar2 = md_driver->HardVoiceLimit;
  bVar3 = md_sfxchn;
  if (((md_mode & 4) != 0) || (bVar3 = bVar2, bVar2 < md_sfxchn)) {
    md_sfxchn = bVar3;
  }
  if (((md_mode & 8) == 0) && (bVar2 < md_sngchn)) {
    md_sngchn = bVar2;
  }
  md_hardchn = md_sfxchn;
  if ((md_mode & 4) != 0) {
    md_hardchn = '\0';
  }
  if ((md_mode & 8) == 0) {
    md_hardchn = md_hardchn + md_sngchn;
  }
  bVar5 = false;
  while (bVar2 < md_hardchn) {
    while( true ) {
      bVar5 = (bool)(bVar5 ^ 1);
      if (bVar5) {
        md_hardchn = 0;
        if (((md_mode & 4) == 0) && (md_hardchn = md_sfxchn, 4 < md_sfxchn)) {
          md_sfxchn = md_sfxchn - 1;
          md_hardchn = md_sfxchn;
        }
      }
      else {
        if (((md_mode & 8) == 0) && (8 < md_sngchn)) {
          md_sngchn = md_sngchn - 1;
        }
        md_hardchn = md_sfxchn;
        if ((md_mode & 4) != 0) {
          md_hardchn = 0;
        }
      }
      if ((md_mode & 8) != 0) break;
      md_hardchn = md_sngchn + md_hardchn;
      if (md_hardchn <= bVar2) goto LAB_0894e028;
    }
  }
LAB_0894e028:
  bVar2 = md_driver->SoftVoiceLimit;
  if (((md_mode & 4) != 0) && (bVar2 < md_sfxchn)) {
    md_sfxchn = bVar2;
  }
  if (((md_mode & 8) != 0) && (bVar2 < md_sngchn)) {
    md_sngchn = bVar2;
  }
  if ((md_mode & 4) == 0) {
    md_softchn = '\0';
  }
  else {
    md_softchn = md_sfxchn;
  }
  if ((md_mode & 8) != 0) {
    md_softchn = md_softchn + md_sngchn;
  }
  bVar5 = false;
  while (bVar2 < md_softchn) {
    while( true ) {
      bVar5 = (bool)(bVar5 ^ 1);
      md_softchn = md_sfxchn;
      if (bVar5) {
        if (((md_mode & 4) != 0) && (md_softchn = 0, 4 < md_sfxchn)) {
          md_sfxchn = md_sfxchn - 1;
        }
      }
      else {
        if (((md_mode & 8) != 0) && (8 < md_sngchn)) {
          md_sngchn = md_sngchn - 1;
        }
        if ((md_mode & 4) != 0) {
          md_softchn = 0;
        }
      }
      if ((md_mode & 8) != 0) break;
      md_softchn = md_sngchn + md_softchn;
      if (md_softchn <= bVar2) goto LAB_0894e0f8;
    }
  }
LAB_0894e0f8:
  md_numchn = md_hardchn + md_softchn;
  BVar4 = (*md_driver->SetNumVoices)();
  if (BVar4 != 0) {
    MikMod_Exit_internal();
    if ((MikMod_errno != 0) && (_mm_errorhandler != (MikMod_handler_t)0x0)) {
      (*(code *)_mm_errorhandler)();
    }
    md_sngchn = '\0';
    md_sfxchn = '\0';
    md_hardchn = '\0';
    md_softchn = '\0';
    md_numchn = '\0';
    return 1;
  }
  nitems = (size_t)md_sfxchn;
  if (md_sngchn + nitems != 0) {
    md_sample = _mm_calloc(md_sngchn + nitems,4);
    nitems = (size_t)md_sfxchn;
  }
  if (nitems != 0) {
    sfxinfo = _mm_calloc(nitems,1);
  }
  uVar6 = uVar7;
  if (uVar7 < md_numchn) {
    do {
      Voice_Stop_internal((SBYTE)uVar7);
      uVar6 = uVar6 + 1;
      uVar7 = uVar7 + 1 & 0xff;
    } while ((int)uVar6 < (int)(uint)md_numchn);
  }
  sfxpool = 0;
  if (bVar1) {
    MikMod_EnableOutput_internal();
  }
  MikMod_critical = 0;
  return 0;
}



----------------------------------------

// Function: MD_SampleLoad @ 0894e314

SWORD MD_SampleLoad(SAMPLOAD *s,int type)

{
  SWORD SVar1;
  
                    /* Unresolved local var: SWORD result@[???] */
  if (type == 0) {
    type = (md_mode & 0xf) >> 3;
  }
  else if (type == 1) {
    type = (md_mode & 7) >> 2;
  }
  SL_Init(s);
  SVar1 = (*md_driver->SampleLoad)(s,type);
  SL_Exit(s);
  return SVar1;
}



----------------------------------------

// Function: MikMod_DriverFromAlias @ 0894e398

int MikMod_DriverFromAlias(CHAR *alias)

{
  char *s2;
  int iVar1;
  MDRIVER *pMVar2;
  int iVar3;
  
                    /* Unresolved local var: int rank@[???]
                       Unresolved local var: MDRIVER * cruise@[???] */
  if (firstdriver != (MDRIVER *)0x0) {
    iVar3 = 1;
    s2 = firstdriver->Alias;
    pMVar2 = firstdriver;
    while( true ) {
      if (s2 != (char *)0x0) {
        iVar1 = strcasecmp(alias,s2);
        if (iVar1 == 0) {
          return iVar3;
        }
        iVar3 = iVar3 + 1;
      }
      pMVar2 = pMVar2->next;
      if (pMVar2 == (MDRIVER *)0x0) break;
      s2 = pMVar2->Alias;
    }
  }
  return 0;
}



----------------------------------------

// Function: MikMod_InfoDriver @ 0894e410

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * MikMod_InfoDriver(void)

{
  char *pcVar1;
  size_t sVar2;
  char *fmt;
  MDRIVER *pMVar3;
  int iVar4;
  size_t size;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: MDRIVER * l@[???]
                       Unresolved local var: CHAR * list@[???] */
  size = 0;
  if (firstdriver == (MDRIVER *)0x0) {
    pcVar1 = (char *)0x0;
  }
  else {
    pcVar1 = firstdriver->Version;
    pMVar3 = firstdriver;
    while( true ) {
      iVar4 = 5;
      if (pcVar1 == (char *)0x0) {
        pMVar3 = pMVar3->next;
      }
      else {
        pMVar3 = pMVar3->next;
        if (pMVar3 == (MDRIVER *)0x0) {
          iVar4 = 4;
        }
        sVar2 = strlen(pcVar1);
        size = size + iVar4 + sVar2;
      }
      if (pMVar3 == (MDRIVER *)0x0) break;
      pcVar1 = pMVar3->Version;
    }
    pcVar1 = (char *)0x0;
    if ((size != 0) && (pcVar1 = _mm_malloc(size), pcVar1 != (char *)0x0)) {
      *pcVar1 = '\0';
      iVar4 = 1;
      pMVar3 = firstdriver;
      while (pMVar3 != (MDRIVER *)0x0) {
        if (pMVar3->Version == (CHAR *)0x0) {
          pMVar3 = pMVar3->next;
        }
        else {
          fmt = "%s%2d %s\n";
          if (pMVar3->next == (MDRIVER *)0x0) {
            fmt = "%s%2d %s";
          }
          sprintf(pcVar1,fmt,pcVar1,iVar4);
          pMVar3 = pMVar3->next;
        }
        iVar4 = iVar4 + 1;
      }
    }
  }
  return pcVar1;
}



----------------------------------------

// Function: RealSpeed @ 0894e518

ULONG RealSpeed(SAMPLOAD *s)

{
  uint uVar1;
  
  uVar1 = 1;
  if (s->scalefactor != 0) {
    uVar1 = s->scalefactor;
  }
  if (uVar1 == 0) {
    trap(7);
  }
  return s->sample->speed / uVar1;
}



----------------------------------------

// Function: SL_Sample16to8 @ 0894e540

void SL_Sample16to8(SAMPLOAD *s)

{
  ushort uVar1;
  
  uVar1 = s->outfmt & 0xfffe;
  s->outfmt = uVar1;
  s->sample->flags = s->sample->flags & 0xffc0 | uVar1;
  return;
}



----------------------------------------

// Function: SL_Sample8to16 @ 0894e564

void SL_Sample8to16(SAMPLOAD *s)

{
  ushort uVar1;
  
  uVar1 = s->outfmt | 1;
  s->outfmt = uVar1;
  s->sample->flags = s->sample->flags & 0xffc0 | uVar1;
  return;
}



----------------------------------------

// Function: SL_SampleSigned @ 0894e588

void SL_SampleSigned(SAMPLOAD *s)

{
  ushort uVar1;
  
  uVar1 = s->outfmt | 4;
  s->outfmt = uVar1;
  s->sample->flags = s->sample->flags & 0xffc0 | uVar1;
  return;
}



----------------------------------------

// Function: SL_SampleUnsigned @ 0894e5ac

void SL_SampleUnsigned(SAMPLOAD *s)

{
  ushort uVar1;
  
  uVar1 = s->outfmt & 0xfffb;
  s->outfmt = uVar1;
  s->sample->flags = s->sample->flags & 0xffc0 | uVar1;
  return;
}



----------------------------------------

// Function: SL_HalveSample @ 0894e5d0

void SL_HalveSample(SAMPLOAD *s,int factor)

{
  UBYTE UVar1;
  uint uVar2;
  SAMPLE *pSVar3;
  
  UVar1 = '\x02';
  if (factor < 1) {
    factor = 2;
  }
  else {
    UVar1 = (UBYTE)factor;
  }
  s->scalefactor = factor;
  s->sample->divfactor = UVar1;
  uVar2 = s->scalefactor;
  pSVar3 = s->sample;
  if (uVar2 == 0) {
    trap(7);
  }
  pSVar3->length = s->length / uVar2;
  if (uVar2 == 0) {
    trap(7);
  }
  pSVar3->loopstart = s->loopstart / uVar2;
  if (uVar2 == 0) {
    trap(7);
  }
  pSVar3->loopend = s->loopend / uVar2;
  return;
}



----------------------------------------

// Function: FreeSampleList @ 0894e648

void FreeSampleList(SAMPLOAD *s)

{
  SAMPLOAD *pSVar1;
  
  while (s != (SAMPLOAD *)0x0) {
    pSVar1 = s->next;
    free(s);
    s = pSVar1;
  }
  return;
}



----------------------------------------

// Function: DitherSamples @ 0894e678

BOOL DitherSamples(SAMPLOAD *samplist,int type)

{
  short sVar1;
  ushort uVar2;
  SAMPLOAD *pSVar3;
  SWORD SVar4;
  ULONG UVar5;
  ULONG UVar6;
  ULONG UVar7;
  SAMPLOAD *s;
  SAMPLOAD *pSVar8;
  SAMPLE *pSVar9;
  SAMPLE *pSVar10;
  uint uVar11;
  SAMPLOAD *s_00;
  
                    /* Unresolved local var: SAMPLOAD * c2smp@[???]
                       Unresolved local var: ULONG maxsize@[???]
                       Unresolved local var: ULONG speed@[???]
                       Unresolved local var: SAMPLOAD * s@[???] */
  if (samplist != (SAMPLOAD *)0x0) {
    UVar5 = MD_SampleSpace(type);
    s_00 = (SAMPLOAD *)0x0;
    s = samplist;
    if (UVar5 << 10 != 0) {
LAB_0894e7f0:
      while( true ) {
        uVar11 = 0;
        pSVar8 = samplist;
        do {
                    /* Unresolved local var: int total@[???] */
          pSVar9 = pSVar8->sample;
          pSVar9->flags = pSVar9->flags & 0xffc0 | pSVar8->outfmt;
          UVar6 = MD_SampleLength(type,pSVar9);
          pSVar8 = pSVar8->next;
          uVar11 = uVar11 + UVar6;
        } while (pSVar8 != (SAMPLOAD *)0x0);
        if (uVar11 <= UVar5 << 10) break;
        uVar2 = samplist->outfmt;
        pSVar8 = samplist;
        while( true ) {
          if ((uVar2 & 1) != 0) goto LAB_0894e8b8;
          pSVar8 = pSVar8->next;
          if (pSVar8 == (SAMPLOAD *)0x0) break;
          uVar2 = pSVar8->outfmt;
        }
        UVar6 = 0;
        pSVar8 = samplist;
        do {
          if (pSVar8->sample->length == 0) {
            pSVar3 = pSVar8->next;
          }
          else {
            UVar7 = RealSpeed(pSVar8);
            if (UVar6 < UVar7) {
              pSVar3 = pSVar8->next;
              UVar6 = UVar7;
              s_00 = pSVar8;
            }
            else {
              pSVar3 = pSVar8->next;
            }
          }
          pSVar8 = pSVar3;
        } while (pSVar8 != (SAMPLOAD *)0x0);
        if (s_00 != (SAMPLOAD *)0x0) {
          SL_HalveSample(s_00,2);
        }
      }
    }
    do {
      pSVar9 = s->sample;
      if (pSVar9->length == 0) {
        s = s->next;
      }
      else {
        if (pSVar9->seekpos == 0) {
          SVar4 = MD_SampleLoad(s,type);
          pSVar10 = s->sample;
          pSVar9->handle = SVar4;
          sVar1 = pSVar10->handle;
          pSVar10->flags = pSVar10->flags & 0xffc0 | s->outfmt;
        }
        else {
          (*s->reader->Seek)(s->reader,pSVar9->seekpos,0);
          pSVar10 = s->sample;
          SVar4 = MD_SampleLoad(s,type);
          pSVar9 = s->sample;
          pSVar10->handle = SVar4;
          sVar1 = pSVar9->handle;
          pSVar9->flags = pSVar9->flags & 0xffc0 | s->outfmt;
        }
        if (sVar1 < 0) {
          FreeSampleList(samplist);
          if (_mm_errorhandler != (MikMod_handler_t)0x0) {
            (*(code *)_mm_errorhandler)();
          }
          return 1;
        }
        s = s->next;
      }
    } while (s != (SAMPLOAD *)0x0);
    FreeSampleList(samplist);
  }
  return 0;
LAB_0894e8b8:
  SL_Sample16to8(pSVar8);
  goto LAB_0894e7f0;
}



----------------------------------------

// Function: SL_LoadSamples @ 0894e8c8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL SL_LoadSamples(void)

{
  BOOL BVar1;
  BOOL BVar2;
  
                    /* Unresolved local var: BOOL ok@[???] */
  MikMod_critical = 0;
  if ((musiclist == (SAMPLOAD *)0x0) && (sndfxlist == (SAMPLOAD *)0x0)) {
    BVar1 = 0;
  }
  else {
    BVar1 = DitherSamples(musiclist,0);
    if (BVar1 == 0) {
      BVar2 = DitherSamples(sndfxlist,1);
      BVar1 = 0;
      if (BVar2 != 0) {
        BVar1 = 1;
      }
    }
    else {
      BVar1 = 1;
    }
    sndfxlist = (SAMPLOAD *)0x0;
    musiclist = (SAMPLOAD *)0x0;
  }
  return BVar1;
}



----------------------------------------

// Function: SL_Exit @ 0894e95c

void SL_Exit(SAMPLOAD *s)

{
  if (0 < sl_rlength) {
    (*s->reader->Seek)(s->reader,sl_rlength,1);
  }
  if (sl_buffer != (SWORD *)0x0) {
    free(sl_buffer);
    sl_buffer = (SWORD *)0x0;
  }
  return;
}



----------------------------------------

// Function: SL_RegisterSample @ 0894e9b8

SAMPLOAD * SL_RegisterSample(SAMPLE *s,int type,MREADER *reader)

{
  ushort uVar1;
  SAMPLOAD *pSVar2;
  SAMPLOAD *pSVar3;
  ULONG UVar4;
  SAMPLOAD *pSVar5;
  SAMPLOAD **ppSVar6;
  
                    /* Unresolved local var: SAMPLOAD * news@[???]
                       Unresolved local var: SAMPLOAD * * samplist@[???]
                       Unresolved local var: SAMPLOAD * cruise@[???] */
  if (type == 0) {
    ppSVar6 = &musiclist;
    pSVar3 = musiclist;
  }
  else {
    if (type != 1) {
      return (SAMPLOAD *)0x0;
    }
    ppSVar6 = &sndfxlist;
    pSVar3 = sndfxlist;
  }
  pSVar2 = _mm_malloc(0x20);
  if (pSVar2 == (SAMPLOAD *)0x0) {
    return (SAMPLOAD *)0x0;
  }
  if (pSVar3 == (SAMPLOAD *)0x0) {
    *ppSVar6 = pSVar2;
    UVar4 = s->length;
  }
  else {
    do {
      pSVar5 = pSVar3;
      pSVar3 = pSVar5->next;
    } while (pSVar3 != (SAMPLOAD *)0x0);
    pSVar5->next = pSVar2;
    UVar4 = s->length;
  }
  uVar1 = s->flags;
  pSVar2->reader = reader;
  pSVar2->length = UVar4;
  UVar4 = s->loopstart;
  uVar1 = uVar1 & 0x3f;
  pSVar2->outfmt = uVar1;
  pSVar2->loopstart = UVar4;
  UVar4 = s->loopend;
  pSVar2->infmt = uVar1;
  pSVar2->sample = s;
  pSVar2->loopend = UVar4;
  return pSVar2;
}



----------------------------------------

// Function: SL_Init @ 0894eaac

BOOL SL_Init(SAMPLOAD *s)

{
  if ((sl_buffer == (SWORD *)0x0) && (sl_buffer = _mm_malloc(0x1000), sl_buffer == (SWORD *)0x0)) {
    return 0;
  }
  sl_rlength = s->length;
  if ((s->infmt & 1) != 0) {
    sl_rlength = (int)s->length >> 1;
  }
  sl_old = 0;
  return 1;
}



----------------------------------------

// Function: SL_Load @ 0894eb34

/* WARNING: Type propagation algorithm not settling */

BOOL SL_Load(void *buffer,SAMPLOAD *smp,ULONG length)

{
  undefined1 *puVar1;
  ushort uVar2;
  ushort uVar3;
  SWORD SVar4;
  char cVar5;
  bool bVar6;
  char cVar7;
  uint uVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  ushort *puVar12;
  int iVar13;
  SWORD *pSVar14;
  char *pcVar15;
  short *psVar16;
  uint uVar17;
  uint uVar18;
  uint uVar19;
  int iVar20;
  UWORD UVar21;
  SWORD *pSVar22;
  uint uVar23;
  uint uVar24;
  uint unaff_s2;
  uint uVar25;
  UWORD unaff_s4;
  uint unaff_s5;
  MREADER *reader;
  uint unaff_s7;
  SWORD *pSVar26;
  short local_68;
  undefined1 *local_54;
  SWORD *local_50;
  int local_48;
  uint local_44;
  
  uVar2 = smp->outfmt;
  iVar11 = smp->scalefactor;
  uVar3 = smp->infmt;
                    /* Unresolved local var: SBYTE * bptr@[???]
                       Unresolved local var: SWORD * wptr@[???]
                       Unresolved local var: int stodo@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: int result@[???]
                       Unresolved local var: int c_block@[???]
                       Unresolved local var: ITPACK status@[???]
                       Unresolved local var: UWORD incnt@[???] */
  reader = smp->reader;
  if (length == 0) {
    return 0;
  }
  local_48 = 0;
  local_54 = buffer;
  local_50 = buffer;
  local_44 = length;
LAB_0894eba8:
  do {
    uVar17 = 0x800;
    if (local_44 < 0x801) {
      uVar17 = local_44;
    }
    if ((uVar3 & 0x20) == 0) {
      if ((uVar3 & 1) == 0) {
                    /* Unresolved local var: SBYTE * src@[???]
                       Unresolved local var: SWORD * dest@[???] */
        (*reader->Read)(reader,sl_buffer,uVar17);
        if (0 < (int)uVar17) {
          pSVar14 = sl_buffer + uVar17;
          pcVar15 = (char *)((int)sl_buffer + uVar17);
          uVar23 = 0;
          do {
            pcVar15 = pcVar15 + -1;
            pSVar14 = pSVar14 + -1;
            uVar23 = uVar23 + 1;
            *pSVar14 = (short)*pcVar15 << 8;
          } while (uVar17 != uVar23);
        }
      }
      else if ((uVar3 & 8) == 0) {
        _mm_read_I_SWORDS(sl_buffer,uVar17,reader);
      }
      else {
        _mm_read_M_SWORDS(sl_buffer,uVar17,reader);
      }
      sl_rlength = sl_rlength - uVar17;
    }
    else {
      sl_rlength = 0;
      if (local_48 == 0) {
        if ((uVar3 & 1) == 0) {
          unaff_s4 = _mm_read_I_UWORD(reader);
          unaff_s7 = 9;
          local_48 = 0x8000;
        }
        else {
          unaff_s4 = _mm_read_I_UWORD(reader);
          local_48 = 0x4000;
          unaff_s7 = 0x11;
        }
        if ((uVar3 & 0x10) != 0) {
          sl_old = 0;
        }
        local_68 = 0;
        unaff_s5 = 0;
      }
      pSVar14 = sl_buffer;
      if ((uVar3 & 1) == 0) {
                    /* Unresolved local var: SWORD * dest@[???]
                       Unresolved local var: SWORD * end@[???]
                       Unresolved local var: UWORD x@[???]
                       Unresolved local var: UWORD y@[???]
                       Unresolved local var: UWORD needbits@[???]
                       Unresolved local var: UWORD havebits@[???]
                       Unresolved local var: UWORD new_count@[???]
                       Unresolved local var: UWORD bits@[???]
                       Unresolved local var: UWORD bufbits@[???]
                       Unresolved local var: SBYTE last@[???]
                       Unresolved local var: UBYTE buf@[???] */
        pSVar22 = sl_buffer + (uVar17 & 0xffff);
        local_68 = (short)(char)local_68;
        if (pSVar22 <= sl_buffer) {
          return 1;
        }
        bVar6 = false;
        uVar23 = unaff_s7;
        pSVar26 = sl_buffer;
        do {
          uVar25 = 3;
          cVar5 = (char)local_68;
          unaff_s7 = uVar23;
          if ((bVar6) || (uVar25 = uVar23, uVar23 != 0)) {
            uVar18 = 0;
            uVar24 = 0;
            do {
              uVar19 = uVar25;
              if (unaff_s5 < uVar25) {
                uVar19 = unaff_s5;
              }
              UVar21 = unaff_s4 - 1;
              uVar8 = (uint)(short)((unaff_s2 & (1 << (uVar19 & 0x1f)) - 1U) << (uVar24 & 0x1f));
              unaff_s2 = (int)unaff_s2 >> (uVar19 & 0x1f) & 0xff;
              if (unaff_s5 == 0) {
                uVar19 = uVar25;
                if (8 < uVar25) {
                  uVar19 = 8;
                }
                unaff_s5 = 8;
                uVar8 = 0;
                unaff_s2 = 0;
                unaff_s4 = UVar21;
                if (UVar21 != 0xffff) {
                  uVar10 = (*reader->Get)(reader);
                  uVar19 = uVar25;
                  if (8 < uVar25) {
                    uVar19 = 8;
                  }
                  unaff_s5 = 8;
                  uVar8 = (uint)(short)(((1 << (uVar19 & 0x1f)) - 1U & uVar10 & 0xff) <<
                                       (uVar24 & 0x1f));
                  unaff_s2 = (int)(uVar10 & 0xff) >> (uVar19 & 0x1f) & 0xff;
                }
              }
              uVar24 = uVar19 + uVar24 & 0xffff;
              uVar25 = uVar25 - uVar19 & 0xffff;
              uVar18 = uVar8 & 0xffff | uVar18;
              unaff_s5 = unaff_s5 - uVar19 & 0xffff;
            } while (uVar25 != 0);
            if (bVar6) {
              unaff_s7 = uVar18 + 1 & 0xffff;
              if (unaff_s7 < uVar23) {
                bVar6 = false;
              }
              else {
                bVar6 = false;
                unaff_s7 = unaff_s7 + 1 & 0xffff;
              }
              goto LAB_0894f1d8;
            }
            if (uVar23 < 7) goto LAB_0894f2c0;
            if (8 < uVar23) {
              if (uVar23 != 9) {
                MikMod_errno = 0xe;
                return 1;
              }
              cVar7 = (char)uVar18 + cVar5;
              if (0xff < uVar18) {
                unaff_s7 = uVar18 - 0xff & 0xffff;
                goto LAB_0894f1d8;
              }
              goto LAB_0894f2ec;
            }
            uVar25 = (0xff >> (9 - uVar23 & 0x1f)) - 4U & 0xffff;
            if ((uVar18 <= uVar25) || (uVar25 + 8 < uVar18)) {
              cVar7 = (char)uVar18 + cVar5;
              if (uVar23 != 7) goto LAB_0894f2ec;
              goto LAB_0894f2d4;
            }
            unaff_s7 = uVar18 - uVar25 & 0xffff;
            if (uVar23 <= unaff_s7) {
              unaff_s7 = unaff_s7 + 1 & 0xffff;
            }
          }
          else {
            uVar18 = 0;
LAB_0894f2c0:
            if (uVar18 == 1 << (uVar23 - 1 & 0x1f)) {
              bVar6 = true;
            }
            else {
LAB_0894f2d4:
              cVar7 = (char)((int)(char)(uVar18 << (8 - uVar23 & 0x1f)) >> (8 - uVar23 & 0x1f)) +
                      cVar5;
LAB_0894f2ec:
              local_68 = (short)cVar7;
              *pSVar26 = local_68 << 8;
              bVar6 = false;
              pSVar26 = pSVar26 + 1;
            }
          }
LAB_0894f1d8:
          iVar9 = (int)pSVar26 - (int)pSVar14;
          uVar23 = unaff_s7;
        } while (pSVar26 < pSVar22);
      }
      else {
                    /* Unresolved local var: SWORD * dest@[???]
                       Unresolved local var: SWORD * end@[???]
                       Unresolved local var: SLONG x@[???]
                       Unresolved local var: SLONG y@[???]
                       Unresolved local var: SLONG needbits@[???]
                       Unresolved local var: SLONG havebits@[???]
                       Unresolved local var: SLONG new_count@[???]
                       Unresolved local var: UWORD bits@[???]
                       Unresolved local var: UWORD bufbits@[???]
                       Unresolved local var: SWORD last@[???]
                       Unresolved local var: UBYTE buf@[???] */
        pSVar22 = sl_buffer + (uVar17 & 0xffff);
        if (pSVar22 <= sl_buffer) {
          return 1;
        }
        bVar6 = false;
        pSVar26 = sl_buffer;
        do {
          uVar23 = 4;
          if ((bVar6) || (uVar23 = unaff_s7, unaff_s7 != 0)) {
            uVar25 = 0;
            uVar24 = 0;
            do {
              uVar18 = unaff_s5 + uVar23;
              UVar21 = unaff_s4 - 1;
              uVar19 = ((1 << (uVar18 & 0x1f)) - 1U & unaff_s2) << (uVar24 & 0x1f);
              unaff_s2 = (int)unaff_s2 >> (uVar18 & 0x1f) & 0xff;
              if (unaff_s5 == 0) {
                uVar18 = uVar23 + 8;
                unaff_s5 = 8;
                uVar19 = 0;
                unaff_s2 = 0;
                unaff_s4 = UVar21;
                if (UVar21 != 0xffff) {
                  uVar8 = (*reader->Get)(reader);
                  uVar18 = uVar23 + 8;
                  unaff_s5 = 8;
                  uVar19 = (uVar8 & 0xff & (1 << (uVar18 & 0x1f)) - 1U) << (uVar24 & 0x1f);
                  unaff_s2 = (int)(uVar8 & 0xff) >> (uVar18 & 0x1f) & 0xff;
                }
              }
              uVar23 = uVar23 - uVar18;
              uVar24 = uVar24 + uVar18;
              uVar25 = uVar25 | uVar19;
              unaff_s5 = unaff_s5 - uVar18 & 0xffff;
            } while (uVar23 != 0);
            uVar23 = uVar25 + 1;
            if (bVar6) {
              if ((int)unaff_s7 <= (int)uVar23) {
                uVar23 = uVar25 + 2;
              }
              unaff_s7 = uVar23 & 0xffff;
              bVar6 = false;
              goto LAB_0894ed1c;
            }
            if (unaff_s7 < 7) goto LAB_0894ef78;
            if (0x10 < unaff_s7) {
              if (unaff_s7 != 0x11) {
                MikMod_errno = 0xe;
                return 1;
              }
              if (0xffff < (int)uVar25) {
                unaff_s7 = uVar25 + 1 & 0xffff;
                goto LAB_0894ed1c;
              }
              goto LAB_0894efa0;
            }
            iVar9 = 0xffff >> (0x11 - unaff_s7 & 0x1f);
            iVar13 = iVar9 + -8;
            if (((int)uVar25 <= iVar13) || (iVar9 + 8 < (int)uVar25)) {
              if (0xf < unaff_s7) goto LAB_0894efa0;
              goto LAB_0894ef8c;
            }
            uVar25 = uVar25 - iVar13;
            if ((int)unaff_s7 <= (int)uVar25) {
              uVar25 = uVar25 + 1;
            }
            unaff_s7 = uVar25 & 0xffff;
          }
          else {
            uVar25 = 0;
LAB_0894ef78:
            if (1 << (unaff_s7 - 1 & 0x1f) == uVar25) {
              bVar6 = true;
            }
            else {
LAB_0894ef8c:
              uVar25 = (int)(short)(uVar25 << (0x10 - unaff_s7 & 0x1f)) >> (0x10 - unaff_s7 & 0x1f);
LAB_0894efa0:
              bVar6 = false;
              local_68 = (short)uVar25 + local_68;
              *pSVar26 = local_68;
              pSVar26 = pSVar26 + 1;
            }
          }
LAB_0894ed1c:
        } while (pSVar26 < pSVar22);
        iVar9 = (int)pSVar26 - (int)pSVar14;
      }
      if (iVar9 >> 1 == 0) {
        return 1;
      }
      if (iVar9 >> 1 != uVar17) {
        MikMod_errno = 0xe;
        return 1;
      }
      local_48 = local_48 - uVar17;
    }
    if (((uVar3 & 0x10) != 0) && (0 < (int)uVar17)) {
      uVar23 = 0;
      pSVar14 = sl_buffer;
      do {
        uVar23 = uVar23 + 1;
        sl_old = sl_old + *pSVar14;
        *pSVar14 = sl_old;
        pSVar14 = pSVar14 + 1;
      } while (uVar17 != uVar23);
    }
    if ((((uVar3 ^ uVar2) & 4) != 0) && (0 < (int)uVar17)) {
      uVar23 = 0;
      puVar12 = (ushort *)sl_buffer;
      do {
        uVar23 = uVar23 + 1;
        *puVar12 = *puVar12 ^ 0x8000;
        puVar12 = puVar12 + 1;
      } while (uVar17 != uVar23);
    }
    pSVar14 = sl_buffer;
    if (iVar11 == 0) {
      local_44 = local_44 - uVar17;
      uVar23 = uVar17;
    }
    else {
                    /* Unresolved local var: int idx@[???]
                       Unresolved local var: SLONG scaleval@[???] */
      if (((int)uVar17 < 1) || (local_44 == 0)) {
        uVar23 = 0;
      }
      else {
        iVar9 = 0;
        uVar23 = 0;
        pSVar22 = sl_buffer;
        do {
          psVar16 = pSVar14 + iVar9;
          iVar20 = 0;
          iVar13 = iVar11;
          while( true ) {
            iVar9 = iVar9 + 1;
            iVar13 = iVar13 + -1;
            iVar20 = iVar20 + *psVar16;
            if (iVar13 == 0) break;
            psVar16 = psVar16 + 1;
            if ((int)uVar17 <= iVar9) {
              if (iVar11 - iVar13 == 0) {
                trap(7);
              }
              local_44 = local_44 - 1;
              pSVar14[uVar23] = (SWORD)(iVar20 / (iVar11 - iVar13));
              uVar23 = uVar23 + 1;
              goto LAB_0894ee8c;
            }
          }
          if (iVar11 == 0) {
            trap(7);
          }
          local_44 = local_44 - 1;
          uVar23 = uVar23 + 1;
          *pSVar22 = (SWORD)(iVar20 / iVar11);
        } while ((iVar9 < (int)uVar17) && (pSVar22 = pSVar22 + 1, local_44 != 0));
      }
    }
LAB_0894ee8c:
    if ((uVar2 & 1) == 0) {
      if (0 < (int)uVar23) {
        uVar17 = 0;
        pSVar14 = sl_buffer;
        do {
          puVar1 = (undefined1 *)((int)pSVar14 + 1);
          uVar17 = uVar17 + 1;
          pSVar14 = pSVar14 + 1;
          *local_54 = *puVar1;
          local_54 = local_54 + 1;
        } while (uVar23 != uVar17);
        if (local_44 == 0) {
          return 0;
        }
        goto LAB_0894eba8;
      }
    }
    else if (0 < (int)uVar23) {
      uVar17 = 0;
      pSVar14 = sl_buffer;
      do {
        SVar4 = *pSVar14;
        uVar17 = uVar17 + 1;
        pSVar14 = pSVar14 + 1;
        *local_50 = SVar4;
        local_50 = local_50 + 1;
      } while (uVar23 != uVar17);
    }
    if (local_44 == 0) {
      return 0;
    }
  } while( true );
}



----------------------------------------

// Function: NS_IsThere @ 0894f458

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL NS_IsThere(void)

{
  return 1;
}



----------------------------------------

// Function: NS_Update @ 0894f460

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void NS_Update(void)

{
  if (zerobuf != (SBYTE *)0x0) {
    VC_WriteBytes(zerobuf,0x8000);
    return;
  }
  return;
}



----------------------------------------

// Function: NS_Exit @ 0894f484

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void NS_Exit(void)

{
  VC_Exit();
  if (zerobuf != (SBYTE *)0x0) {
    free(zerobuf);
  }
  zerobuf = (SBYTE *)0x0;
  return;
}



----------------------------------------

// Function: NS_Init @ 0894f4c0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL NS_Init(void)

{
  BOOL BVar1;
  
  zerobuf = _mm_malloc(0x8000);
  BVar1 = VC_Init();
  return BVar1;
}



----------------------------------------

// Function: _mm_calloc @ 0894f4e4

void * _mm_calloc(size_t nitems,size_t size)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * d@[???] */
  pvVar1 = calloc(nitems,size);
  if (pvVar1 == (void *)0x0) {
    MikMod_errno = 2;
    if (_mm_errorhandler != (MikMod_handler_t)0x0) {
      (*(code *)_mm_errorhandler)();
      return (void *)0x0;
    }
  }
  return pvVar1;
}



----------------------------------------

// Function: _mm_malloc @ 0894f548

void * _mm_malloc(size_t size)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * d@[???] */
  pvVar1 = calloc(1,size);
  if (pvVar1 == (void *)0x0) {
    MikMod_errno = 2;
    if (_mm_errorhandler != (MikMod_handler_t)0x0) {
      (*(code *)_mm_errorhandler)();
      return (void *)0x0;
    }
  }
  return pvVar1;
}



----------------------------------------

// Function: VC_Init @ 0894f5b0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC_Init(void)

{
  BOOL BVar1;
  
  BVar1 = (*VC_Init_ptr)();
  return BVar1;
}



----------------------------------------

// Function: VC_Exit @ 0894f5c0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC_Exit(void)

{
  (*VC_Exit_ptr)();
  return;
}



----------------------------------------

// Function: VC_SetNumVoices @ 0894f5d0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC_SetNumVoices(void)

{
  BOOL BVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f5d8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (*VC_SetNumVoices_ptr)();
  return BVar1;
}



----------------------------------------

// Function: VC_SampleSpace @ 0894f5e0

ULONG VC_SampleSpace(int a)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f5e8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_SampleSpace_ptr)(a);
  return UVar1;
}



----------------------------------------

// Function: VC_SampleLength @ 0894f5f0

ULONG VC_SampleLength(int a,SAMPLE *b)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f5f8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_SampleLength_ptr)(a,b);
  return UVar1;
}



----------------------------------------

// Function: VC_PlayStart @ 0894f600

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC_PlayStart(void)

{
  BOOL BVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f608. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (*VC_PlayStart_ptr)();
  return BVar1;
}



----------------------------------------

// Function: VC_PlayStop @ 0894f610

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC_PlayStop(void)

{
                    /* WARNING: Could not recover jumptable at 0x0894f618. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_PlayStop_ptr)();
  return;
}



----------------------------------------

// Function: VC_SampleLoad @ 0894f620

SWORD VC_SampleLoad(SAMPLOAD *a,int b)

{
  SWORD SVar1;
  
  SVar1 = (*VC_SampleLoad_ptr)(a,b);
  return SVar1;
}



----------------------------------------

// Function: VC_SampleUnload @ 0894f644

void VC_SampleUnload(SWORD a)

{
                    /* WARNING: Could not recover jumptable at 0x0894f64c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_SampleUnload_ptr)(a);
  return;
}



----------------------------------------

// Function: VC_WriteBytes @ 0894f654

ULONG VC_WriteBytes(SBYTE *a,ULONG b)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f65c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_WriteBytes_ptr)(a,b);
  return UVar1;
}



----------------------------------------

// Function: VC_SilenceBytes @ 0894f664

ULONG VC_SilenceBytes(SBYTE *a,ULONG b)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f66c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_SilenceBytes_ptr)(a,b);
  return UVar1;
}



----------------------------------------

// Function: VC_VoiceSetVolume @ 0894f674

void VC_VoiceSetVolume(UBYTE a,UWORD b)

{
                    /* WARNING: Could not recover jumptable at 0x0894f680. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_VoiceSetVolume_ptr)(a,b);
  return;
}



----------------------------------------

// Function: VC_VoiceGetVolume @ 0894f688

UWORD VC_VoiceGetVolume(UBYTE a)

{
  UWORD UVar1;
  
  UVar1 = (*VC_VoiceGetVolume_ptr)(a);
  return UVar1;
}



----------------------------------------

// Function: VC_VoiceSetFrequency @ 0894f6ac

void VC_VoiceSetFrequency(UBYTE a,ULONG b)

{
                    /* WARNING: Could not recover jumptable at 0x0894f6b4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_VoiceSetFrequency_ptr)(a,b);
  return;
}



----------------------------------------

// Function: VC_VoiceGetFrequency @ 0894f6bc

ULONG VC_VoiceGetFrequency(UBYTE a)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f6c4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_VoiceGetFrequency_ptr)(a);
  return UVar1;
}



----------------------------------------

// Function: VC_VoiceSetPanning @ 0894f6cc

void VC_VoiceSetPanning(UBYTE a,ULONG b)

{
                    /* WARNING: Could not recover jumptable at 0x0894f6d4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_VoiceSetPanning_ptr)(a,b);
  return;
}



----------------------------------------

// Function: VC_VoiceGetPanning @ 0894f6dc

ULONG VC_VoiceGetPanning(UBYTE a)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f6e4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_VoiceGetPanning_ptr)(a);
  return UVar1;
}



----------------------------------------

// Function: VC_VoicePlay @ 0894f6ec

void VC_VoicePlay(UBYTE a,SWORD b,ULONG c,ULONG d,ULONG e,ULONG f,UWORD g)

{
                    /* WARNING: Could not recover jumptable at 0x0894f6fc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_VoicePlay_ptr)(a,b,c,d,e,f,g);
  return;
}



----------------------------------------

// Function: VC_VoiceStop @ 0894f704

void VC_VoiceStop(UBYTE a)

{
                    /* WARNING: Could not recover jumptable at 0x0894f70c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*VC_VoiceStop_ptr)(a);
  return;
}



----------------------------------------

// Function: VC_VoiceStopped @ 0894f714

BOOL VC_VoiceStopped(UBYTE a)

{
  BOOL BVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f71c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  BVar1 = (*VC_VoiceStopped_ptr)(a);
  return BVar1;
}



----------------------------------------

// Function: VC_VoiceGetPosition @ 0894f724

SLONG VC_VoiceGetPosition(UBYTE a)

{
  SLONG SVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f72c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  SVar1 = (*VC_VoiceGetPosition_ptr)(a);
  return SVar1;
}



----------------------------------------

// Function: VC_VoiceRealVolume @ 0894f734

ULONG VC_VoiceRealVolume(UBYTE a)

{
  ULONG UVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0894f73c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  UVar1 = (*VC_VoiceRealVolume_ptr)(a);
  return UVar1;
}



----------------------------------------

// Function: VC_SetupPointers @ 0894f744

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC_SetupPointers(void)

{
  if ((md_mode & 0x10) != 0) {
    VC_Init_ptr = VC2_Init;
    VC_Exit_ptr = VC2_Exit;
    VC_SetNumVoices_ptr = VC2_SetNumVoices;
    VC_SampleSpace_ptr = VC2_SampleSpace;
    VC_SampleLength_ptr = VC2_SampleLength;
    VC_PlayStart_ptr = VC2_PlayStart;
    VC_PlayStop_ptr = VC2_PlayStop;
    VC_SampleLoad_ptr = VC2_SampleLoad;
    VC_SampleUnload_ptr = VC2_SampleUnload;
    VC_WriteBytes_ptr = VC2_WriteBytes;
    VC_SilenceBytes_ptr = VC2_SilenceBytes;
    VC_VoiceSetVolume_ptr = VC2_VoiceSetVolume;
    VC_VoiceGetVolume_ptr = VC2_VoiceGetVolume;
    VC_VoiceSetFrequency_ptr = VC2_VoiceSetFrequency;
    VC_VoiceGetFrequency_ptr = VC2_VoiceGetFrequency;
    VC_VoiceSetPanning_ptr = VC2_VoiceSetPanning;
    VC_VoiceGetPanning_ptr = VC2_VoiceGetPanning;
    VC_VoicePlay_ptr = VC2_VoicePlay;
    VC_VoiceStop_ptr = VC2_VoiceStop;
    VC_VoiceStopped_ptr = VC2_VoiceStopped;
    VC_VoiceGetPosition_ptr = VC2_VoiceGetPosition;
    VC_VoiceRealVolume_ptr = VC2_VoiceRealVolume;
    return;
  }
  VC_Init_ptr = VC1_Init;
  VC_Exit_ptr = VC1_Exit;
  VC_SetNumVoices_ptr = VC1_SetNumVoices;
  VC_SampleSpace_ptr = VC1_SampleSpace;
  VC_SampleLength_ptr = VC1_SampleLength;
  VC_PlayStart_ptr = VC1_PlayStart;
  VC_PlayStop_ptr = VC1_PlayStop;
  VC_SampleLoad_ptr = VC1_SampleLoad;
  VC_SampleUnload_ptr = VC1_SampleUnload;
  VC_WriteBytes_ptr = VC1_WriteBytes;
  VC_SilenceBytes_ptr = VC1_SilenceBytes;
  VC_VoiceSetVolume_ptr = VC1_VoiceSetVolume;
  VC_VoiceGetVolume_ptr = VC1_VoiceGetVolume;
  VC_VoiceSetFrequency_ptr = VC1_VoiceSetFrequency;
  VC_VoiceGetFrequency_ptr = VC1_VoiceGetFrequency;
  VC_VoiceSetPanning_ptr = VC1_VoiceSetPanning;
  VC_VoiceGetPanning_ptr = VC1_VoiceGetPanning;
  VC_VoicePlay_ptr = VC1_VoicePlay;
  VC_VoiceStop_ptr = VC1_VoiceStop;
  VC_VoiceStopped_ptr = VC1_VoiceStopped;
  VC_VoiceGetPosition_ptr = VC1_VoiceGetPosition;
  VC_VoiceRealVolume_ptr = VC1_VoiceRealVolume;
  return;
}



----------------------------------------

// Function: adjust_amplification @ 0894fa1c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void adjust_amplification(void)

{
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
  __floatsidf(amplification);
  __divdf3(in_f12_13,in_f14_15);
  __muldf3(in_f12_13,in_f14_15);
  master_volume._0_4_ = extraout_v0;
  master_volume._4_4_ = extraout_v1;
  return;
}



----------------------------------------

// Function: adjust_master_volume @ 0894fa78

void adjust_master_volume(int32 vol)

{
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
  __floatsidf(vol * amplification);
  __divdf3(in_f12_13,in_f14_15);
  __muldf3(in_f12_13,in_f14_15);
  master_volume._0_4_ = extraout_v0;
  master_volume._4_4_ = extraout_v1;
  return;
}



----------------------------------------

// Function: reset_voices @ 0894fadc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void reset_voices(void)

{
  Voice *pVVar1;
  
                    /* Unresolved local var: int i@[???] */
  pVVar1 = voice;
  voice[0].status = '\0';
  while (pVVar1 = pVVar1 + 1, pVVar1 != (Voice *)&XG_System_chorus_type) {
    pVVar1->status = '\0';
  }
  return;
}



----------------------------------------

// Function: reset_controllers @ 0894fb04

void reset_controllers(int c)

{
  channel[c].volume = 0x5a;
  channel[c].expression = 0x7f;
  channel[c].pitchbend = 0x2000;
  channel[c].chorusdepth = 0;
  channel[c].sustain = 0;
  *(undefined4 *)&channel[c].pitchfactor = 0;
  *(undefined4 *)((int)&channel[c].pitchfactor + 4) = 0;
  channel[c].reverberation = 0;
  return;
}



----------------------------------------

// Function: select_sample @ 0894fb4c

void select_sample(int v,Instrument *ip)

{
  Sample *pSVar1;
  int iVar2;
  int iVar3;
  Sample *pSVar4;
  int iVar5;
  
                    /* Unresolved local var: int32 f@[???]
                       Unresolved local var: int32 cdiff@[???]
                       Unresolved local var: int32 diff@[???]
                       Unresolved local var: int32 midfreq@[???]
                       Unresolved local var: int s@[DW_OP_reg7(a3)]
                       Unresolved local var: int i@[???]
                       Unresolved local var: Sample * sp@[DW_OP_reg5(a1)]
                       Unresolved local var: Sample * closest@[???] */
  iVar3 = ip->samples;
  pSVar1 = ip->sample;
  if (iVar3 == 1) {
    voice[v].sample = pSVar1;
    return;
  }
  pSVar4 = pSVar1;
  if (0 < iVar3) {
    iVar5 = 0x7fffffff;
    iVar2 = 0;
    do {
      iVar2 = iVar2 + 1;
      if (iVar5 != 0) {
        pSVar4 = pSVar1;
        iVar5 = 0;
      }
      pSVar1 = pSVar1 + 1;
    } while (iVar3 != iVar2);
  }
  voice[v].sample = pSVar4;
  return;
}



----------------------------------------

// Function: recompute_freq @ 0894fc00

void recompute_freq(int v)

{
  byte bVar1;
  int32 *piVar2;
  SItype SVar3;
  undefined4 extraout_v0;
  int iVar4;
  undefined4 extraout_v1;
  int iVar5;
  Sample *pSVar6;
  SFtype arg_a;
  undefined4 in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int sign@[???]
                       Unresolved local var: int pb@[???]
                       Unresolved local var: double a@[???] */
  iVar5 = channel[voice[v].channel].pitchbend;
  if ((voice[v].sample)->sample_rate != 0) {
    if (voice[v].vibrato_control_ratio != 0) {
      piVar2 = voice[v].vibrato_sample_increment + 0x1f;
      iVar4 = 0x1f;
      do {
                    /* Unresolved local var: int i@[???] */
        iVar4 = iVar4 + -1;
        *piVar2 = 0;
        piVar2 = piVar2 + -1;
      } while (iVar4 != -1);
    }
    if (((iVar5 == 0x2000) || (iVar5 < 0)) || (0x3fff < iVar5)) {
      voice[v].frequency = voice[v].orig_frequency;
    }
    else {
      bVar1 = voice[v].channel;
      SVar3 = __nedf2((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
      if (SVar3 == 0) {
                    /* Unresolved local var: int32 i@[???] */
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
        *(undefined4 *)&channel[bVar1].pitchfactor = extraout_v0;
        *(undefined4 *)((int)&channel[bVar1].pitchfactor + 4) = extraout_v1;
      }
      if (iVar5 + -0x2000 < 1) {
        __floatsidf(voice[v].orig_frequency);
        __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
        SVar3 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
        voice[v].frequency = SVar3;
      }
      else {
        __floatsidf(voice[v].orig_frequency);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
        SVar3 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
        voice[v].frequency = SVar3;
      }
    }
    pSVar6 = voice[v].sample;
    __floatsidf(pSVar6->sample_rate);
    __floatsidf(voice[v].frequency);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __floatsidf(pSVar6->root_freq);
    __floatsidf(play_mode->rate);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    arg_a = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
    __extendsfdf2(arg_a);
    SVar3 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
    voice[v].sample_increment = SVar3;
  }
  return;
}



----------------------------------------

// Function: panf @ 0894ff48

int panf(int pan,int speaker,int separation)

{
  int iVar1;
  
                    /* Unresolved local var: int val@[???] */
  if (separation == 0) {
    trap(7);
  }
  iVar1 = 0x7f - 0 / separation;
  if (-1 < iVar1) {
    if (0x7f < iVar1) {
      iVar1 = 0x7f;
    }
    return expr_curve[iVar1];
  }
  return expr_curve[0];
}



----------------------------------------

// Function: recompute_amp @ 0894ffb4

void recompute_amp(int v)

{
  bool bVar1;
  byte bVar2;
  SItype SVar3;
  undefined4 extraout_v0;
  undefined4 extraout_v0_00;
  undefined4 extraout_v0_01;
  undefined4 extraout_v0_02;
  undefined4 extraout_v0_03;
  undefined4 extraout_v0_04;
  undefined4 extraout_v0_05;
  undefined4 extraout_v0_06;
  undefined4 extraout_v0_07;
  undefined4 extraout_v0_08;
  undefined4 extraout_v0_09;
  undefined4 extraout_v0_10;
  undefined4 extraout_v0_11;
  int iVar4;
  undefined4 extraout_v1;
  undefined4 extraout_v1_00;
  undefined4 extraout_v1_01;
  undefined4 extraout_v1_02;
  undefined4 extraout_v1_03;
  undefined4 extraout_v1_04;
  undefined4 extraout_v1_05;
  undefined4 extraout_v1_06;
  undefined4 extraout_v1_07;
  undefined4 extraout_v1_08;
  undefined4 extraout_v1_09;
  undefined4 extraout_v1_10;
  undefined4 extraout_v1_11;
  Voice *pVVar5;
  int32 pan;
  SFtype SVar6;
  undefined4 in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int32 tempamp@[???]
                       Unresolved local var: int chan@[???]
                       Unresolved local var: int panning@[???]
                       Unresolved local var: int vol@[???]
                       Unresolved local var: int expr@[???]
                       Unresolved local var: int vel@[???]
                       Unresolved local var: int drumpan@[???]
                       Unresolved local var: FLOAT_T curved_expression@[???]
                       Unresolved local var: FLOAT_T curved_volume@[???] */
  bVar2 = voice[v].channel;
  pan = voice[v].panning;
                    /* Unresolved local var: int note@[???] */
  if (((channel[bVar2].kit != 0) && (iVar4 = (int)(voice[v].sample)->note_to_use, 0 < iVar4)) &&
     (-1 < drumpanpot[bVar2][iVar4])) {
    pan = (int)drumvolume[bVar2][iVar4];
  }
  __floatsidf(vcurve[voice[v].velocity]);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar3 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
  iVar4 = num_ochannels;
  if (num_ochannels < 2) {
    pVVar5 = voice + v;
    voice[v].panned = 3;
LAB_08950170:
    __floatsidf(SVar3);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  }
  else {
    if (pan - 0x3dU < 7) {
      pVVar5 = voice + v;
      bVar1 = num_ochannels != 6;
      voice[v].panned = 3;
      if (bVar1) goto LAB_08950170;
    }
    else if (pan < 5) {
      pVVar5 = voice + v;
      voice[v].panned = 1;
    }
    else {
      if (pan < 0x7c) {
                    /* Unresolved local var: FLOAT_T refv@[???]
                       Unresolved local var: int wide_panning@[???] */
        __floatsidf(SVar3);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
        if (iVar4 == 4) {
          voice[v].panned = 0;
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].lfe_amp + 4) = extraout_v1_08;
          *(undefined4 *)&voice[v].lfe_amp = extraout_v0_08;
          iVar4 = panf(pan,0,0x5f);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].lr_amp + 4) = extraout_v1_09;
          *(undefined4 *)&voice[v].lr_amp = extraout_v0_09;
          iVar4 = panf(pan,0x20,0x5f);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].left_amp + 4) = extraout_v1_10;
          *(undefined4 *)&voice[v].left_amp = extraout_v0_10;
          *(undefined4 *)&voice[v].ce_amp = 0;
          *(undefined4 *)((int)&voice[v].ce_amp + 4) = 0;
          iVar4 = panf(pan,0x5f,0x5f);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)&voice[v].right_amp = extraout_v0_11;
          *(undefined4 *)((int)&voice[v].right_amp + 4) = extraout_v1_11;
          SVar3 = panf(pan,0x80,0x5f);
        }
        else {
          voice[v].panned = 0;
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
          __extendsfdf2(SVar6);
          *(undefined4 *)&voice[v].lfe_amp = extraout_v0_00;
          *(undefined4 *)((int)&voice[v].lfe_amp + 4) = extraout_v1_00;
          if (iVar4 != 6) {
            if (iVar4 != 2) {
              return;
            }
            *(undefined4 *)&voice[v].lr_amp = 0;
            *(undefined4 *)((int)&voice[v].lr_amp + 4) = 0;
            __floatsidf(0x80 - pan);
            __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
            __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
            SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
            __extendsfdf2(SVar6);
            *(undefined4 *)&voice[v].left_amp = extraout_v0_01;
            *(undefined4 *)((int)&voice[v].left_amp + 4) = extraout_v1_01;
            *(undefined4 *)&voice[v].ce_amp = 0;
            *(undefined4 *)((int)&voice[v].ce_amp + 4) = 0;
            __floatsidf(pan);
            __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
            __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
            SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
            __extendsfdf2(SVar6);
            *(undefined4 *)&voice[v].right_amp = extraout_v0_02;
            *(undefined4 *)((int)&voice[v].right_amp + 4) = extraout_v1_02;
            *(undefined4 *)&voice[v].rr_amp = 0;
            *(undefined4 *)((int)&voice[v].rr_amp + 4) = 0;
            return;
          }
          iVar4 = panf(pan,0,0x40);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].lr_amp + 4) = extraout_v1_03;
          *(undefined4 *)&voice[v].lr_amp = extraout_v0_03;
          iVar4 = panf(pan,0x20,0x40);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].left_amp + 4) = extraout_v1_04;
          *(undefined4 *)&voice[v].left_amp = extraout_v0_04;
          iVar4 = panf(pan,0x40,0x40);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)((int)&voice[v].ce_amp + 4) = extraout_v1_05;
          *(undefined4 *)&voice[v].ce_amp = extraout_v0_05;
          iVar4 = panf(pan,0x5f,0x40);
          __floatsidf(iVar4);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
          SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
          __extendsfdf2(SVar6);
          *(undefined4 *)&voice[v].right_amp = extraout_v0_06;
          *(undefined4 *)((int)&voice[v].right_amp + 4) = extraout_v1_06;
          SVar3 = panf(pan,0x80,0x40);
        }
        __floatsidf(SVar3);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar6),in_f14_15);
        SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar6));
        __extendsfdf2(SVar6);
        *(undefined4 *)&voice[v].rr_amp = extraout_v0_07;
        *(undefined4 *)((int)&voice[v].rr_amp + 4) = extraout_v1_07;
        return;
      }
      pVVar5 = voice + v;
      voice[v].panned = 2;
    }
    __floatsidf(SVar3);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  }
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar6 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
  __extendsfdf2(SVar6);
  *(undefined4 *)&pVVar5->left_amp = extraout_v0;
  *(undefined4 *)((int)&pVVar5->left_amp + 4) = extraout_v1;
  return;
}



----------------------------------------

// Function: kill_note @ 089507a8

void kill_note(int i)

{
  ControlMode *pCVar1;
  int iVar2;
  
  pCVar1 = ctl;
  iVar2 = voice[i].clone_voice;
  voice[i].status = '\x04';
  if (-1 < iVar2) {
    voice[iVar2].status = '\x04';
  }
  (*pCVar1->note)(i);
  return;
}



----------------------------------------

// Function: skip_to @ 089507f4

void skip_to(int32 until_time)

{
  byte bVar1;
  MidiEvent *pMVar2;
  int iVar3;
  MidiEvent *pMVar4;
  MidiEvent *pMVar5;
  int32 iVar6;
  int *piVar7;
  int c;
  
  if (until_time < current_sample) {
    current_sample = 0;
  }
  piVar7 = &channel[0].program;
  c = 0;
  do {
                    /* Unresolved local var: int i@[???] */
    reset_controllers(c);
    iVar3 = default_program;
    c = c + 1;
    piVar7[3] = -1;
    *piVar7 = iVar3;
    piVar7[0x10] = 2;
    ((Channel *)(piVar7 + -1))->bank = 0;
    piVar7[10] = 0x40;
    piVar7[0xb] = 0x40;
    piVar7[0xc] = 0x40;
    piVar7[0xd] = 0x40;
    piVar7[0xf] = 0;
    piVar7 = piVar7 + 0x16;
  } while (c != 0x10);
  reset_voices();
  pMVar2 = event_list;
  buffer_pointer = common_buffer;
  buffered_count = 0;
  current_event = event_list;
  if (until_time == 0) {
    (*ctl->reset)();
    return;
  }
  reset_voices();
  iVar6 = pMVar2->time;
  pMVar5 = pMVar2;
  if (iVar6 < until_time) {
    do {
      pMVar4 = pMVar5;
      switch(pMVar4->type + 0xfc) {
      case '\0':
        channel[pMVar4->channel].volume = (uint)pMVar4->a;
        break;
      case '\x01':
        channel[pMVar4->channel].panning = (uint)pMVar4->a;
        break;
      case '\x02':
        channel[pMVar4->channel].sustain = (uint)pMVar4->a;
        break;
      case '\x03':
        channel[pMVar4->channel].expression = (uint)pMVar4->a;
        break;
      case '\x04':
        channel[pMVar4->channel].pitchbend = (uint)pMVar4->a + (uint)pMVar4->b * 0x80;
        goto LAB_08950980;
      case '\x05':
        bVar1 = pMVar4->channel;
        if (channel[bVar1].kit == 0) {
          channel[bVar1].program = (uint)pMVar4->a;
        }
        else {
          channel[bVar1].bank = (uint)pMVar4->a;
        }
        break;
      case '\x06':
      case '\b':
      case '\n':
      case '\f':
      case '\x0f':
      case '\x10':
      case '\x11':
      case '\x12':
      case '\x13':
      case '\x14':
      case '\x15':
      case '\x16':
      case '\x17':
      case '\x18':
      case '\x19':
      case '\x1a':
      case '\x1b':
      case '\x1c':
      case '\x1d':
      case '\x1e':
      case '\x1f':
      case ' ':
      case '!':
      case '\"':
      case '#':
      case '$':
      case '%':
      case '&':
      case '\'':
      case '(':
      case ')':
      case '*':
      case '+':
      case ',':
      case '-':
      case '.':
      case '/':
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
      case ':':
      case ';':
      case '<':
      case '=':
      case '>':
      case '?':
      case '@':
      case 'A':
      case 'B':
      case 'G':
      case 'H':
      case 'I':
      case 'J':
      case 'K':
      case 'L':
      case 'M':
      case 'N':
      case 'O':
      case 'P':
      case 'Q':
      case 'R':
      case 'S':
      case 'T':
      case 'U':
      case 'V':
      case 'X':
      case 'Z':
      case '[':
      case '\\':
      case ']':
      case '^':
        break;
      case '\a':
        channel[pMVar4->channel].pitchsens = (uint)pMVar4->a;
LAB_08950980:
        bVar1 = pMVar4->channel;
        *(undefined4 *)&channel[bVar1].pitchfactor = 0;
        *(undefined4 *)((int)&channel[bVar1].pitchfactor + 4) = 0;
        break;
      case '\t':
        reset_controllers((uint)pMVar4->channel);
        iVar6 = pMVar4[1].time;
        goto LAB_0895099c;
      case '\v':
        channel[pMVar4->channel].bank = (uint)pMVar4->a;
        break;
      case '\r':
        if (pMVar4->a == '@') {
          channel[pMVar4->channel].sfx = 0x81;
          channel[pMVar4->channel].kit = 0;
        }
        else {
          channel[pMVar4->channel].sfx = 0;
          channel[pMVar4->channel].kit = (uint)pMVar4->a;
        }
        break;
      case '\x0e':
        adjust_master_volume((uint)pMVar4->a + (uint)pMVar4->b * 0x80);
        iVar6 = pMVar4[1].time;
        goto LAB_0895099c;
      case 'C':
        channel[pMVar4->channel].harmoniccontent = (uint)pMVar4->a;
        break;
      case 'D':
        channel[pMVar4->channel].releasetime = (uint)pMVar4->a;
        break;
      case 'E':
        channel[pMVar4->channel].attacktime = (uint)pMVar4->a;
        break;
      case 'F':
        channel[pMVar4->channel].brightness = (uint)pMVar4->a;
        break;
      case 'W':
        channel[pMVar4->channel].reverberation = (uint)pMVar4->a;
        break;
      case 'Y':
        channel[pMVar4->channel].chorusdepth = (uint)pMVar4->a;
        break;
      case '_':
        current_event = pMVar4;
        current_sample = iVar6;
        (*ctl->reset)();
        return;
      default:
        iVar6 = pMVar4[1].time;
        goto LAB_0895099c;
      }
      iVar6 = pMVar4[1].time;
LAB_0895099c:
      pMVar5 = pMVar4 + 1;
    } while (iVar6 < until_time);
    current_event = pMVar5;
    if (pMVar5 != pMVar2) {
      current_event = pMVar4;
    }
  }
  current_sample = until_time;
  (*ctl->reset)();
  return;
}



----------------------------------------

// Function: Timidity_Active @ 08950d10

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int Timidity_Active(void)

{
  return midi_playing;
}



----------------------------------------

// Function: Timidity_Stop @ 08950d1c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void Timidity_Stop(void)

{
  midi_playing = 0;
  return;
}



----------------------------------------

// Function: Timidity_FreeSong @ 08950d28

void Timidity_FreeSong(MidiSong *song)

{
  if (free_instruments_afterwards != 0) {
    free_instruments();
  }
  free(song->events);
  free(song);
  return;
}



----------------------------------------

// Function: Timidity_Start @ 08950d68

void Timidity_Start(MidiSong *song)

{
  load_missing_instruments();
  adjust_amplification();
  sample_count = song->samples;
  event_list = song->events;
  cut_notes = 0;
  lost_notes = 0;
  skip_to(0);
  midi_playing = 1;
  return;
}



----------------------------------------

// Function: Timidity_LoadSong @ 08950dd0

MidiSong * Timidity_LoadSong(char *midifile)

{
  MidiSong *sp;
  FILE *mfp;
  MidiEvent *pMVar1;
  int32 aiStack_18 [2];
  
                    /* Unresolved local var: MidiSong * song@[???]
                       Unresolved local var: int32 events@[???]
                       Unresolved local var: FILE * fp@[???] */
  sp = safe_malloc(8);
  sp->samples = 0;
  sp->events = (MidiEvent *)0x0;
  mfp = open_file(midifile,1,2);
  strcpy(midi_name,midifile);
  if (mfp != (FILE *)0x0) {
    pMVar1 = read_midi_file(mfp,aiStack_18,&sp->samples);
    sp->events = pMVar1;
    close_file(mfp);
  }
  if (sp->events == (MidiEvent *)0x0) {
    free(sp);
    sp = (MidiSong *)0x0;
  }
  return sp;
}



----------------------------------------

// Function: Timidity_SetVolume @ 08950e7c

void Timidity_SetVolume(int volume)

{
  uint8 uVar1;
  int v;
  Voice *pVVar2;
  
                    /* Unresolved local var: int i@[???] */
  if (volume < 0x321) {
    amplification = volume;
    if (volume < 0) {
      amplification = 0;
    }
  }
  else {
    amplification = 800;
  }
  adjust_amplification();
  if (0 < voices) {
    pVVar2 = voice;
    v = 0;
    do {
      uVar1 = pVVar2->status;
      while (pVVar2 = pVVar2 + 1, uVar1 != '\0') {
        recompute_amp(v);
        apply_envelope_to_amp(v);
        v = v + 1;
        if (voices <= v) goto LAB_08950f14;
        uVar1 = pVVar2->status;
      }
      v = v + 1;
    } while (v < voices);
  }
LAB_08950f14:
  (*ctl->master_volume)(amplification);
  return;
}



----------------------------------------

// Function: adjust_volume @ 08950f54

void adjust_volume(int c)

{
  byte bVar1;
  byte *pbVar2;
  int v;
  
                    /* Unresolved local var: int i@[???] */
  v = voices + -1;
  pbVar2 = (byte *)((int)drumvolume + voices * 0x1c8 + 0x641);
  if (v != -1) {
    bVar1 = *pbVar2;
    while( true ) {
      if (((uint)bVar1 == c) && ((byte)(pbVar2[-1] - 1) < 2)) {
        recompute_amp(v);
        apply_envelope_to_amp(v);
      }
      v = v + -1;
      pbVar2 = pbVar2 + -0x1c8;
      if (v == -1) break;
      bVar1 = *pbVar2;
    }
  }
  return;
}



----------------------------------------

// Function: finish_note @ 08951004

void finish_note(int i)

{
  int iVar1;
  
  while( true ) {
    if (((voice[i].sample)->modes & 0x40) == 0) {
      voice[i].status = '\x03';
                    /* Unresolved local var: int v@[???] */
      iVar1 = voice[i].clone_voice;
    }
    else {
      voice[i].status = '\x03';
      voice[i].envelope_stage = 3;
      recompute_envelope(i);
      apply_envelope_to_amp(i);
      (*ctl->note)(i);
      iVar1 = voice[i].clone_voice;
    }
    if (iVar1 < 0) break;
    voice[i].clone_voice = -1;
    i = iVar1;
  }
  return;
}



----------------------------------------

// Function: note_off @ 089510ec

void note_off(MidiEvent *e)

{
  int i;
  int iVar1;
  byte *pbVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int v@[???] */
  pbVar2 = (byte *)((int)drumvolume + voices * 0x1c8 + 0x641);
  i = voices;
  while( true ) {
    i = i + -1;
    if (i == -1) {
      return;
    }
    if (((pbVar2[-1] == 1) && ((uint)e->channel == (uint)*pbVar2)) && (pbVar2[1] == e->a)) break;
    pbVar2 = pbVar2 + -0x1c8;
  }
  if (channel[e->channel].sustain != 0) {
    iVar1 = voice[i].clone_voice;
    voice[i].status = '\x02';
    if ((-1 < iVar1) && (voice[iVar1].status == '\x01')) {
      voice[iVar1].status = '\x02';
    }
    (*ctl->note)(i);
    return;
  }
  finish_note(i);
  return;
}



----------------------------------------

// Function: clone_voice @ 089511d4

void clone_voice(Instrument *ip,int v,MidiEvent *e,int clone_type,int variationbank)

{
                    /* Unresolved local var: int w@[???]
                       Unresolved local var: int played_note@[???]
                       Unresolved local var: int chorus@[???]
                       Unresolved local var: int reverb@[???]
                       Unresolved local var: int milli@[???]
                       Unresolved local var: int chan@[???] */
  return;
}



----------------------------------------

// Function: start_note @ 089511dc

/* WARNING: Removing unreachable block (ram,0x089516a0) */
/* WARNING: Removing unreachable block (ram,0x08951600) */
/* WARNING: Removing unreachable block (ram,0x08951344) */
/* WARNING: Removing unreachable block (ram,0x08951650) */
/* WARNING: Removing unreachable block (ram,0x08951a10) */

void start_note(MidiEvent *e,int i)

{
  int32 *piVar1;
  bool bVar2;
  byte bVar3;
  uint8 uVar4;
  byte bVar5;
  int32 *piVar6;
  uint uVar7;
  int32 iVar8;
  int (*paiVar9) [5];
  byte bVar10;
  Sample *pSVar11;
  InstrumentLayer *pIVar12;
  int iVar13;
  int iVar14;
  uint uVar15;
  int iVar16;
  int iVar17;
  InstrumentLayer *pIVar18;
  _InstrumentLayer *p_Var19;
  Instrument *ip;
  byte *pbVar20;
  int iVar21;
  int iVar22;
  int unaff_s2;
  uint uVar23;
  Instrument *ip_00;
  int local_2c;
  
                    /* Unresolved local var: InstrumentLayer * lp@[???]
                       Unresolved local var: Instrument * ip@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int banknum@[???]
                       Unresolved local var: int ch@[???]
                       Unresolved local var: int played_note@[???]
                       Unresolved local var: int drumpan@[???]
                       Unresolved local var: int32 rt@[???]
                       Unresolved local var: int attacktime@[???]
                       Unresolved local var: int releasetime@[???]
                       Unresolved local var: int decaytime@[???]
                       Unresolved local var: int variationbank@[???]
                       Unresolved local var: int brightness@[???]
                       Unresolved local var: int harmoniccontent@[???]
                       Unresolved local var: int this_note@[???]
                       Unresolved local var: int this_velocity@[???]
                       Unresolved local var: int drumsflag@[???]
                       Unresolved local var: int this_prog@[???] */
  bVar3 = e->channel;
  uVar23 = (uint)e->a;
  uVar4 = e->b;
  iVar16 = channel[bVar3].program;
  iVar13 = channel[bVar3].sfx;
  iVar22 = channel[bVar3].kit;
  if (iVar13 == 0) {
    iVar13 = channel[bVar3].bank;
  }
  bVar2 = XG_System_On == 0;
  voice[i].velocity = uVar4;
  if (bVar2) {
    if (iVar22 == 0) goto LAB_08951284;
LAB_08951824:
    pIVar18 = drumset[iVar13]->tone[uVar23].layer;
    if (pIVar18 == (InstrumentLayer *)0x0) {
      pIVar18 = drumset[0]->tone[uVar23].layer;
      if (pIVar18 == (InstrumentLayer *)0x0) {
        return;
      }
      ip_00 = pIVar18->instrument;
    }
    else {
      ip_00 = pIVar18->instrument;
    }
    if (ip_00->type == 0) {
      if (ip_00->samples != 1) {
        (*ctl->cmsg)(1,1,"Strange: percussion instrument with %d samples!");
      }
      pSVar11 = ip_00->sample;
    }
    else {
      pSVar11 = ip_00->sample;
    }
    if (pSVar11->note_to_use == 0) {
LAB_0895198c:
      uVar7 = uVar23 & 0x7f;
      goto LAB_089512f8;
    }
    voice[i].orig_frequency = freq_table[pSVar11->note_to_use];
    local_2c = (int)drumpanpot[bVar3][pSVar11->note_to_use];
  }
  else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int newmap@[???]
                       Unresolved local var: int banknum@[???]
                       Unresolved local var: int this_note@[???]
                       Unresolved local var: int newbank@[???]
                       Unresolved local var: int newnote@[???] */
    if (iVar22 != 0) {
      if (iVar22 - 0x7eU < 2) {
        paiVar9 = xmap;
        iVar21 = 0;
        while (iVar17 = (*paiVar9)[0], iVar17 != 0) {
          if (iVar22 == 0x7f) {
            if (iVar17 == 1) {
              iVar17 = (*paiVar9)[1];
              goto LAB_08951954;
            }
          }
          else {
            if (iVar22 == 0x7e) {
              if (iVar17 != 0x80) goto LAB_08951960;
              iVar17 = (*paiVar9)[1];
            }
            else {
              iVar17 = (*paiVar9)[1];
            }
LAB_08951954:
            if ((iVar17 == iVar13) && (uVar23 == (*paiVar9)[3])) {
              iVar17 = xmap[iVar21][2];
              uVar7 = xmap[iVar21][4];
              if (((iVar13 != iVar17) || (uVar23 != uVar7)) &&
                 (((drumset[iVar17] != (ToneBank *)0x0 &&
                   (pIVar18 = drumset[iVar17]->tone[uVar7].layer, pIVar18 != (InstrumentLayer *)0x0)
                   ) && (pIVar18 != (InstrumentLayer *)0xffffffff)))) {
                iVar13 = iVar17;
                uVar23 = uVar7;
              }
              break;
            }
          }
LAB_08951960:
          iVar21 = iVar21 + 1;
          paiVar9 = paiVar9 + 1;
          if (iVar21 == 800) break;
        }
      }
      goto LAB_08951824;
    }
LAB_08951284:
    pIVar18 = default_instrument;
    if ((iVar16 == -1) ||
       (pIVar18 = tonebank[channel[bVar3].bank]->tone[iVar16].layer,
       pIVar18 != (InstrumentLayer *)0x0)) {
      ip_00 = pIVar18->instrument;
    }
    else {
      pIVar18 = tonebank[0]->tone[iVar16].layer;
      if (pIVar18 == (InstrumentLayer *)0x0) {
        return;
      }
      ip_00 = pIVar18->instrument;
    }
    uVar7 = (uint)ip_00->sample->note_to_use;
    if (uVar7 == 0) goto LAB_0895198c;
LAB_089512f8:
    local_2c = -1;
    voice[i].orig_frequency = freq_table[uVar7];
  }
                    /* Unresolved local var: Instrument * ip@[???]
                       Unresolved local var: InstrumentLayer * nlp@[???]
                       Unresolved local var: InstrumentLayer * bestvel@[???]
                       Unresolved local var: int diffvel@[???]
                       Unresolved local var: int midvel@[???]
                       Unresolved local var: int mindiff@[???] */
  bVar5 = pIVar18->hi;
  uVar7 = 500;
  pIVar12 = pIVar18;
  while( true ) {
    uVar15 = 0x7f;
    if (((uint)bVar5 + (uint)pIVar12->lo) / 2 != 0) {
      uVar15 = 200;
      if (((uint)pIVar12->lo <= (uint)voice[i].velocity) && ((uint)voice[i].velocity <= (uint)bVar5)
         ) {
        uVar15 = 0;
      }
    }
    if (uVar15 < uVar7) {
      p_Var19 = pIVar12->next;
    }
    else {
      p_Var19 = pIVar12->next;
      pIVar12 = pIVar18;
      uVar15 = uVar7;
    }
    if (p_Var19 == (_InstrumentLayer *)0x0) break;
    bVar5 = p_Var19->hi;
    pIVar18 = pIVar12;
    uVar7 = uVar15;
    pIVar12 = p_Var19;
  }
  ip = pIVar12->instrument;
  if (ip->right_sample == (Sample *)0x0) {
    voice[i].right_sample = (Sample *)0x0;
  }
  else {
    ip->sample = ip->right_sample;
    ip->samples = ip->right_samples;
    select_sample(i,ip);
    voice[i].right_sample = voice[i].sample;
  }
  ip->sample = ip->left_sample;
  ip->samples = ip->left_samples;
  select_sample(i,ip);
  pSVar11 = voice[i].sample;
  voice[i].starttime = e->time;
  iVar13 = voices;
  bVar5 = pSVar11->note_to_use;
  bVar10 = (byte)uVar23 & 0x7f;
  if ((bVar5 != 0) && (iVar22 != 0)) {
    bVar10 = bVar5;
  }
                    /* Unresolved local var: int j@[???] */
  pSVar11 = voice[i].sample;
  voice[i].status = '\x01';
  voice[i].note = bVar10;
  voice[i].velocity = uVar4;
  voice[i].channel = bVar3;
  voice[i].sample_offset = 0;
  voice[i].sample_increment = 0;
  voice[i].tremolo_phase = 0;
  voice[i].tremolo_phase_increment = pSVar11->tremolo_phase_increment;
  iVar8 = pSVar11->tremolo_sweep_increment;
  voice[i].tremolo_sweep_position = 0;
  voice[i].tremolo_sweep = iVar8;
  iVar8 = pSVar11->vibrato_sweep_increment;
  voice[i].vibrato_sweep_position = 0;
  voice[i].vibrato_sweep = iVar8;
  voice[i].vibrato_depth = (uint)pSVar11->vibrato_depth;
  iVar8 = pSVar11->vibrato_control_ratio;
  voice[i].vibrato_phase = 0;
  voice[i].vibrato_control_counter = 0;
  voice[i].vibrato_control_ratio = iVar8;
  voice[i].vibrato_delay = pSVar11->vibrato_delay;
  if (pSVar11->exclusiveClass != '\0') {
    iVar22 = iVar13 + -1;
    pbVar20 = (byte *)((int)drumvolume + iVar13 * 0x1c8 + 0x640);
    if (iVar22 != -1) {
      bVar5 = *pbVar20;
      while( true ) {
        if (((((bVar5 & 7) == 0) && (i != iVar22)) && (voice[i].channel == pbVar20[1])) &&
           ((*(char *)(*(int *)(pbVar20 + 8) + 0xe0) != '\0' &&
            (*(char *)(*(int *)(pbVar20 + 8) + 0xe1) == (voice[i].sample)->exclusiveClass)))) {
          kill_note(iVar22);
        }
        iVar22 = iVar22 + -1;
        pbVar20 = pbVar20 + -0x1c8;
        if (iVar22 == -1) break;
        bVar5 = *pbVar20;
      }
    }
  }
  iVar13 = 0;
  piVar6 = voice[i].vibrato_sample_increment;
  do {
    iVar13 = iVar13 + 1;
    *piVar6 = 0;
    piVar6 = piVar6 + 1;
  } while (iVar13 != 0x20);
  iVar21 = channel[bVar3].variationbank;
  iVar13 = channel[bVar3].attacktime;
  iVar22 = channel[bVar3].releasetime;
  if (iVar21 == 8) {
    iVar13 = 0x60;
    iVar17 = 0x40;
  }
  else {
    iVar17 = 0x20;
    if (iVar21 != 0xc) {
      iVar17 = 0x40;
    }
  }
  iVar14 = 0;
  pSVar11 = voice[i].sample;
  piVar6 = voice[i].envelope_rate;
  do {
    iVar14 = iVar14 + 1;
    *piVar6 = pSVar11->envelope_rate[0];
    piVar1 = pSVar11->envelope_offset;
    pSVar11 = (Sample *)&pSVar11->loop_end;
    piVar6[7] = *piVar1;
    piVar6 = piVar6 + 1;
  } while (iVar14 != 7);
  iVar8 = voice[i].envelope_rate[6];
  voice[i].echo_delay_count = iVar8;
  voice[i].echo_delay = iVar8;
  if ((iVar13 != 0x40) &&
     (iVar13 = voice[i].envelope_rate[0] + (voice[i].envelope_rate[0] * (0x40 - iVar13)) / 100,
     1000 < iVar13)) {
    voice[i].envelope_rate[0] = iVar13;
  }
  if ((iVar22 != 0x40) &&
     (iVar13 = voice[i].envelope_rate[3] + (voice[i].envelope_rate[3] * (0x40 - iVar22)) / 100,
     1000 < iVar13)) {
    voice[i].envelope_rate[3] = iVar13;
  }
  if ((iVar17 != 0x40) &&
     (iVar13 = voice[i].envelope_rate[2] + (voice[i].envelope_rate[2] * (0x40 - iVar17)) / 100,
     1000 < iVar13)) {
    voice[i].envelope_rate[2] = iVar13;
  }
  if (channel[bVar3].panning == -1) {
    voice[i].panning = (int)(voice[i].sample)->panning;
  }
  else {
    voice[i].panning = channel[bVar3].panning;
  }
  if (local_2c != -1) {
    voice[i].panning = local_2c;
  }
  if (iVar21 != 1) goto LAB_08951728;
                    /* Unresolved local var: int pan@[???]
                       Unresolved local var: int disturb@[???] */
  iVar13 = voice[i].panning;
  if (iVar16 < 0x15) {
                    /* Unresolved local var: int n@[???] */
    if ((int)(voice[i].velocity - 0x20) < 0) {
      iVar16 = 0;
    }
    else {
      iVar16 = voice[i].velocity + 0x20;
    }
    iVar13 = iVar16 + iVar13 / 2;
    iVar16 = 0;
    if (0x3f < iVar13) {
LAB_08951ab0:
      iVar13 = iVar13 - iVar16;
    }
  }
  else {
    iVar16 = (uint)(voice[i].velocity >> 5) + (voice[i].note & 7);
    if (0x3f < iVar13) goto LAB_08951ab0;
    iVar13 = iVar13 + iVar16;
  }
  voice[i].panning = iVar13 + 0x7f;
LAB_08951728:
  recompute_freq(i);
  recompute_amp(i);
  if (((voice[i].sample)->modes & 0x40) == 0) {
    voice[i].envelope_increment = 0;
  }
  else {
    voice[i].control_counter = 0;
    voice[i].envelope_stage = 0;
    voice[i].envelope_volume = 0;
    recompute_envelope(i);
  }
  apply_envelope_to_amp(i);
  voice[i].clone_voice = -1;
  voice[i].clone_type = '\0';
  clone_voice(ip_00,i,e,1,unaff_s2);
  clone_voice(ip_00,i,e,3,unaff_s2);
  clone_voice(ip_00,i,e,2,unaff_s2);
  (*ctl->note)(i);
  return;
}



----------------------------------------

// Function: do_compute_data @ 08951bac

void do_compute_data(uint32 count)

{
  uint8 uVar1;
  uint uVar2;
  Voice *pVVar3;
  int v;
  
                    /* Unresolved local var: int i@[???] */
  if (count == 0) {
    return;
  }
  memset(buffer_pointer,0,count * num_ochannels * 4);
  if (0 < voices) {
    pVVar3 = voice;
    v = 0;
    do {
      uVar1 = pVVar3->status;
      while (uVar1 != '\0') {
        if (pVVar3->sample_offset == 0) {
          uVar2 = pVVar3->echo_delay_count;
          if (uVar2 != 0) {
            if (uVar2 < count) {
              mix_voice(buffer_pointer + uVar2,v,count - uVar2);
              pVVar3->echo_delay_count = 0;
            }
            else {
              pVVar3->echo_delay_count = uVar2 - count;
            }
            break;
          }
        }
        pVVar3 = pVVar3 + 1;
        mix_voice(buffer_pointer,v,count);
        if (voices <= v + 1) goto LAB_08951ca0;
        v = v + 1;
        uVar1 = pVVar3->status;
      }
      v = v + 1;
      pVVar3 = pVVar3 + 1;
    } while (v < voices);
  }
LAB_08951ca0:
  current_sample = count + current_sample;
  return;
}



----------------------------------------

// Function: compute_data @ 08951ce4

int compute_data(void *stream,int32 count)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  int32 until_time;
  Voice *pVVar4;
  int iVar5;
  int local_38 [2];
  int32 local_30;
  void *local_2c;
  
                    /* Unresolved local var: int rc@[???]
                       Unresolved local var: int channels@[???] */
  iVar5 = num_ochannels;
  if ((play_mode->encoding & 1U) != 0) {
    iVar5 = 1;
  }
  local_2c = stream;
  if (count == 0) {
    if (buffered_count != 0) {
      (*s32tobuf)(stream,common_buffer,iVar5 * buffered_count);
    }
    buffered_count = 0;
    buffer_pointer = common_buffer;
    return 0;
  }
LAB_08951da8:
  if (count + buffered_count < AUDIO_BUFFER_SIZE) {
    if (count < 1) {
      return 0;
    }
    do_compute_data(count);
    buffer_pointer = buffer_pointer + count * iVar5;
    buffered_count = count + buffered_count;
    return 0;
  }
  do_compute_data(AUDIO_BUFFER_SIZE - buffered_count);
  iVar2 = AUDIO_BUFFER_SIZE;
  local_30 = buffered_count;
  bVar1 = false;
  (*s32tobuf)(local_2c,common_buffer,iVar5 * AUDIO_BUFFER_SIZE);
  buffer_pointer = common_buffer;
  buffered_count = 0;
  (*ctl->current_time)(current_sample);
LAB_08951e2c:
  iVar3 = (*ctl->read)(local_38);
                    /* Unresolved local var: int rc@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int did_skip@[???]
                       Unresolved local var: int32 val@[???] */
  switch(iVar3) {
  default:
    break;
  case 1:
  case 2:
  case 0xb:
  case 0xd:
    if (iVar3 != 0) {
      return iVar3;
    }
    goto LAB_08951d9c;
  case 3:
    if (current_sample < play_mode->rate << 1) {
      return 0xb;
    }
    return 8;
  case 4:
    until_time = local_38[0] + current_sample;
    if (sample_count <= until_time) {
      return 2;
    }
    goto LAB_08951e9c;
  case 5:
    if (local_38[0] < current_sample) {
      skip_to(current_sample - local_38[0]);
      bVar1 = true;
      goto LAB_08951e2c;
    }
switchD_08951e58_caseD_8:
    until_time = 0;
LAB_08951e9c:
    bVar1 = true;
    skip_to(until_time);
    goto LAB_08951e2c;
  case 6:
    if (local_38[0] < sample_count) {
      skip_to(local_38[0]);
      return iVar3;
    }
    return 2;
  case 8:
    goto switchD_08951e58_caseD_8;
  case 0xc:
    if ((local_38[0] < 1) && (amplification <= -local_38[0])) {
      amplification = 0;
    }
    else {
      amplification = local_38[0] + amplification;
      if (800 < amplification) {
        amplification = 800;
      }
    }
    adjust_amplification();
    if (0 < voices) {
      pVVar4 = voice;
      iVar3 = 0;
      do {
        while (pVVar4->status == '\0') {
          iVar3 = iVar3 + 1;
          pVVar4 = pVVar4 + 1;
          if (voices <= iVar3) goto LAB_08952004;
        }
        recompute_amp(iVar3);
        apply_envelope_to_amp(iVar3);
        iVar3 = iVar3 + 1;
        pVVar4 = pVVar4 + 1;
      } while (iVar3 < voices);
    }
LAB_08952004:
    (*ctl->master_volume)(amplification);
    goto LAB_08951e2c;
  }
  if (iVar3 == 0) goto code_r0x08951e68;
  goto LAB_08951e2c;
code_r0x08951e68:
  if (bVar1) {
    return 6;
  }
LAB_08951d9c:
  count = count - (iVar2 - local_30);
  goto LAB_08951da8;
}



----------------------------------------

// Function: Timidity_PlaySome @ 0895210c

/* WARNING: Type propagation algorithm not settling */

int Timidity_PlaySome(void *stream,int samples)

{
  bool bVar1;
  byte bVar2;
  char cVar3;
  byte bVar4;
  uint8 uVar5;
  ControlMode *pCVar6;
  MidiEvent *e;
  int iVar7;
  int iVar8;
  int32 iVar9;
  int32 iVar10;
  int iVar11;
  byte *pbVar12;
  uint8 *puVar13;
  char *pcVar14;
  int iVar15;
  uint uVar16;
  int iVar17;
  int iVar18;
  
                    /* Unresolved local var: int rc@[???]
                       Unresolved local var: int32 end_sample@[???] */
  if (midi_playing == 0) {
    return 0;
  }
  iVar11 = 0;
  iVar8 = samples + current_sample;
  while( true ) {
    if (iVar8 <= current_sample) {
      return iVar11;
    }
    iVar11 = current_event->time;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (iVar11 <= current_sample) break;
LAB_08952218:
    if (iVar8 < iVar11) {
      iVar11 = compute_data(stream,iVar8 - iVar10);
    }
    else {
      iVar11 = compute_data(stream,iVar11 - iVar10);
    }
    (*ctl->refresh)();
    if ((iVar11 != 0) && (iVar11 != 6)) {
      return iVar11;
    }
  }
LAB_08952184:
  iVar10 = current_sample;
  e = current_event;
  iVar11 = voices;
  switch(current_event->type) {
  case '\0':
  case '\n':
  case '\x10':
  case '\x13':
  case '\x14':
  case '\x15':
  case '\x16':
  case '\x17':
  case '\x18':
  case '\x19':
  case '\x1a':
  case '\x1b':
  case '\x1c':
  case '\x1d':
  case '\x1e':
  case '\x1f':
  case ' ':
  case '!':
  case '\"':
  case '#':
  case '$':
  case '%':
  case '&':
  case '\'':
  case '(':
  case ')':
  case '*':
  case '+':
  case ',':
  case '-':
  case '.':
  case '/':
  case '0':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
  case '7':
  case '8':
  case '9':
  case ':':
  case ';':
  case '<':
  case '=':
  case '>':
  case '?':
  case '@':
  case 'A':
  case 'B':
  case 'C':
  case 'D':
  case 'E':
  case 'F':
  case 'K':
  case 'L':
  case 'M':
  case 'N':
  case 'O':
  case 'P':
  case 'Q':
  case 'R':
  case 'S':
  case 'T':
  case 'U':
  case 'V':
  case 'W':
  case 'X':
  case 'Y':
  case 'Z':
  case '\\':
  case '^':
  case '_':
  case '`':
  case 'a':
  case 'b':
    goto switchD_089521a8_caseD_0;
  case '\x01':
    puVar13 = &current_event->b;
    current_event->a = current_event->a + channel[current_event->channel].transpose;
    if (*puVar13 == '\0') {
      note_off(e);
      iVar11 = current_event[1].time;
      current_event = current_event + 1;
      iVar9 = current_sample;
      iVar10 = current_sample;
      if (current_sample < iVar11) goto LAB_08952218;
    }
    else {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int lowest@[???]
                       Unresolved local var: int32 lv@[???]
                       Unresolved local var: int32 v@[???] */
      iVar15 = voices + -1;
      iVar11 = -1;
      pcVar14 = (char *)((int)drumvolume + voices * 0x1c8 + 0x640);
      if (iVar15 != -1) {
        cVar3 = *pcVar14;
        iVar17 = iVar11;
        while( true ) {
          iVar11 = iVar15;
          if (((cVar3 != '\0') && (iVar11 = iVar17, (uint)e->channel == (uint)(byte)pcVar14[1])) &&
             ((pcVar14[2] == e->a || (channel[e->channel].mono != 0)))) {
            kill_note(iVar15);
          }
          pcVar14 = pcVar14 + -0x1c8;
          iVar15 = iVar15 + -1;
          if (iVar15 == -1) break;
          cVar3 = *pcVar14;
          iVar17 = iVar11;
        }
      }
      if (iVar11 == iVar15) {
        pbVar12 = (byte *)((int)drumvolume + voices * 0x1c8 + 0x640);
        iVar17 = 0x7fffffff;
        iVar15 = voices;
        while (iVar15 = iVar15 + -1, iVar15 != -1) {
          iVar7 = iVar17;
          iVar18 = iVar11;
          if (((*pbVar12 & 0xfa) != 0) && (pbVar12[4] == 0)) {
            iVar7 = *(int *)(pbVar12 + 0x84);
            if (*(int *)(pbVar12 + 0x1c4) == 0) {
              iVar7 = iVar7 + *(int *)(pbVar12 + 0x88);
            }
            iVar18 = iVar15;
            if (iVar17 <= iVar7) {
              iVar7 = iVar17;
              iVar18 = iVar11;
            }
          }
          pbVar12 = pbVar12 + -0x1c8;
          iVar17 = iVar7;
          iVar11 = iVar18;
        }
        if (iVar11 == -1) {
          lost_notes = lost_notes + 1;
          goto switchD_089521a8_caseD_0;
        }
                    /* Unresolved local var: int cl@[???] */
        iVar15 = voice[iVar11].clone_voice;
        if (-1 < iVar15) {
          if (voice[iVar15].clone_type == '\x01') {
            voice[iVar15].status = '\0';
          }
          else if ((voice[iVar15].clone_type == '\0') && (voice[iVar11].clone_type == '\x01')) {
            voice[iVar15].status = '\0';
          }
          else if (iVar11 == voice[iVar15].clone_voice) {
            voice[iVar15].clone_voice = -1;
          }
        }
        pCVar6 = ctl;
        cut_notes = cut_notes + 1;
        voice[iVar11].status = '\0';
        (*pCVar6->note)(iVar11);
      }
      start_note(e,iVar11);
      iVar11 = current_event[1].time;
      current_event = current_event + 1;
      iVar9 = current_sample;
      iVar10 = current_sample;
      if (current_sample < iVar11) goto LAB_08952218;
    }
    goto LAB_08952184;
  case '\x02':
    current_event->a = current_event->a + channel[current_event->channel].transpose;
    note_off(e);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\x03':
                    /* Unresolved local var: int i@[???] */
    puVar13 = (uint8 *)((int)drumvolume + voices * 0x1c8 + 0x641);
    while (iVar11 = iVar11 + -1, iVar11 != -1) {
      if (puVar13[-1] == '\x01') {
        if (*puVar13 == current_event->channel) {
          if (puVar13[1] == current_event->a) {
            voice[iVar11].velocity = current_event->b;
            recompute_amp(iVar11);
            apply_envelope_to_amp(iVar11);
            break;
          }
          puVar13 = puVar13 + -0x1c8;
        }
        else {
          puVar13 = puVar13 + -0x1c8;
        }
      }
      else {
        puVar13 = puVar13 + -0x1c8;
      }
    }
  default:
switchD_089521a8_default:
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\x04':
    channel[current_event->channel].volume = (uint)current_event->a;
    adjust_volume((uint)e->channel);
    (*ctl->volume)((uint)current_event->channel,(uint)current_event->a);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\x05':
    bVar1 = adjust_panning_immediately != 0;
    channel[current_event->channel].panning = (uint)current_event->a;
    if (bVar1) {
                    /* Unresolved local var: int i@[???] */
      bVar4 = e->channel;
      iVar11 = voices + -1;
      pbVar12 = (byte *)((int)drumvolume + voices * 0x1c8 + 0x641);
      if (iVar11 != -1) {
        bVar2 = *pbVar12;
        while( true ) {
          if ((((uint)bVar4 == (uint)bVar2) && ((byte)(pbVar12[-1] - 1) < 2)) && (pbVar12[3] == 0))
          {
            *(int *)(pbVar12 + 0x1bf) = channel[bVar4].panning;
            recompute_amp(iVar11);
            apply_envelope_to_amp(iVar11);
          }
          pbVar12 = pbVar12 + -0x1c8;
          iVar11 = iVar11 + -1;
          if (iVar11 == -1) break;
          bVar2 = *pbVar12;
        }
      }
    }
    (*ctl->panning)((uint)current_event->channel,(uint)current_event->a);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\x06':
    channel[current_event->channel].sustain = (uint)current_event->a;
    if (e->a == '\0') {
                    /* Unresolved local var: int i@[???] */
      uVar5 = e->channel;
      iVar11 = voices + -1;
      pcVar14 = (char *)((int)drumvolume + voices * 0x1c8 + 0x640);
      if (iVar11 != -1) {
        cVar3 = *pcVar14;
        while( true ) {
          if ((cVar3 == '\x02') && (uVar5 == pcVar14[1])) {
            finish_note(iVar11);
          }
          pcVar14 = pcVar14 + -0x1c8;
          iVar11 = iVar11 + -1;
          if (iVar11 == -1) break;
          cVar3 = *pcVar14;
        }
      }
    }
    (*ctl->sustain)((uint)current_event->channel,(uint)current_event->a);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\a':
    channel[current_event->channel].expression = (uint)current_event->a;
    adjust_volume((uint)e->channel);
    (*ctl->expression)((uint)current_event->channel,(uint)current_event->a);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\b':
                    /* Unresolved local var: int i@[???] */
    channel[current_event->channel].pitchbend =
         (uint)current_event->a + (uint)current_event->b * 0x80;
    bVar4 = e->channel;
    iVar15 = iVar11 + -1;
    pcVar14 = (char *)((int)drumvolume + iVar11 * 0x1c8 + 0x640);
    *(undefined4 *)&channel[bVar4].pitchfactor = 0;
    *(undefined4 *)((int)&channel[bVar4].pitchfactor + 4) = 0;
    uVar5 = e->channel;
    if (iVar15 != -1) {
      cVar3 = *pcVar14;
      while( true ) {
        if ((cVar3 != '\0') && (uVar5 == pcVar14[1])) {
          recompute_freq(iVar15);
        }
        pcVar14 = pcVar14 + -0x1c8;
        iVar15 = iVar15 + -1;
        if (iVar15 == -1) break;
        cVar3 = *pcVar14;
      }
    }
    (*ctl->pitch_bend)((uint)e->channel,channel[e->channel].pitchbend);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\t':
    bVar4 = current_event->channel;
    if (channel[bVar4].kit == 0) {
      channel[bVar4].program = (uint)current_event->a;
    }
    else {
      channel[bVar4].bank = (uint)current_event->a;
    }
    (*ctl->program)((uint)e->channel,(uint)e->a);
switchD_089521a8_caseD_0:
    goto switchD_089521a8_default;
  case '\v':
    channel[current_event->channel].pitchsens = (uint)current_event->a;
    bVar4 = e->channel;
    *(undefined4 *)&channel[bVar4].pitchfactor = 0;
    *(undefined4 *)((int)&channel[bVar4].pitchfactor + 4) = 0;
    iVar11 = current_event[1].time;
    break;
  case '\f':
                    /* Unresolved local var: int i@[???] */
    uVar5 = current_event->channel;
    puVar13 = (uint8 *)((int)drumvolume + voices * 0x1c8 + 0x641);
    while (iVar11 = iVar11 + -1, iVar11 != -1) {
      if (uVar5 == *puVar13) {
        if (puVar13[-1] == '\0') {
          puVar13 = puVar13 + -0x1c8;
        }
        else if (puVar13[-1] == '\x04') {
          puVar13 = puVar13 + -0x1c8;
        }
        else {
          kill_note(iVar11);
          puVar13 = puVar13 + -0x1c8;
        }
      }
      else {
        puVar13 = puVar13 + -0x1c8;
      }
    }
    goto switchD_089521a8_default;
  case '\r':
    reset_controllers((uint)current_event->channel);
    uVar16 = (uint)e->channel;
    (*ctl->volume)(uVar16,channel[uVar16].volume);
    (*ctl->expression)(uVar16,channel[uVar16].expression);
    (*ctl->sustain)(uVar16,channel[uVar16].sustain);
    (*ctl->pitch_bend)(uVar16,channel[uVar16].pitchbend);
    iVar11 = current_event[1].time;
    current_event = current_event + 1;
    iVar9 = current_sample;
    iVar10 = current_sample;
    if (current_sample < iVar11) goto LAB_08952218;
    goto LAB_08952184;
  case '\x0e':
                    /* Unresolved local var: int i@[???] */
    uVar16 = (uint)current_event->channel;
    (*ctl->cmsg)(0,3,"All notes off on channel %d",uVar16);
    pcVar14 = (char *)((int)drumvolume + iVar11 * 0x1c8 + 0x640);
    while (pCVar6 = ctl, iVar11 = iVar11 + -1, iVar11 != -1) {
      if (*pcVar14 == '\x01') {
        if (uVar16 == (byte)pcVar14[1]) {
          if (channel[uVar16].sustain == 0) {
            finish_note(iVar11);
            pcVar14 = pcVar14 + -0x1c8;
          }
          else {
            *pcVar14 = '\x02';
            pcVar14 = pcVar14 + -0x1c8;
            (*pCVar6->note)(iVar11);
          }
        }
        else {
          pcVar14 = pcVar14 + -0x1c8;
        }
      }
      else {
        pcVar14 = pcVar14 + -0x1c8;
      }
    }
    goto switchD_089521a8_default;
  case '\x0f':
    channel[current_event->channel].bank = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case '\x11':
    if (current_event->a == '@') {
      channel[current_event->channel].sfx = 0x81;
      channel[e->channel].kit = 0;
      iVar11 = current_event[1].time;
    }
    else {
      channel[current_event->channel].sfx = 0;
      channel[e->channel].kit = (uint)e->a;
      iVar11 = current_event[1].time;
    }
    break;
  case '\x12':
    goto switchD_089521a8_caseD_12;
  case 'G':
    channel[current_event->channel].harmoniccontent = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case 'H':
    channel[current_event->channel].releasetime = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case 'I':
    channel[current_event->channel].attacktime = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case 'J':
    channel[current_event->channel].brightness = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case '[':
    channel[current_event->channel].reverberation = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case ']':
    channel[current_event->channel].chorusdepth = (uint)current_event->a;
    iVar11 = current_event[1].time;
    break;
  case 'c':
    if (play_mode->rate == 0) {
      trap(7);
    }
    (*ctl->cmsg)(0,1,"Playing time: ~%d seconds",iVar9 / play_mode->rate + 2);
    (*ctl->cmsg)(0,1,"Notes cut: %d",cut_notes);
    (*ctl->cmsg)(0,1,"Notes lost totally: %d",lost_notes);
    midi_playing = 0;
    return 0xe;
  }
  current_event = current_event + 1;
  iVar9 = iVar10;
  if (iVar10 < iVar11) goto LAB_08952218;
  goto LAB_08952184;
switchD_089521a8_caseD_12:
  adjust_master_volume((uint)current_event->a + (uint)current_event->b * 0x80);
  iVar11 = current_event[1].time;
  current_event = current_event + 1;
  iVar9 = current_sample;
  iVar10 = current_sample;
  if (current_sample < iVar11) goto LAB_08952218;
  goto LAB_08952184;
}



----------------------------------------

// Function: recompute_envelope @ 08953000

int recompute_envelope(int v)

{
  uint8 uVar1;
  Sample *pSVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  Voice *pVVar6;
  
                    /* Unresolved local var: int stage@[???] */
  pVVar6 = voice + v;
  iVar4 = voice[v].envelope_stage;
  while( true ) {
    if (5 < iVar4) {
                    /* Unresolved local var: int tmp@[???] */
      uVar1 = pVVar6->status;
      pVVar6->status = '\0';
      if (uVar1 == '\x04') {
        return 1;
      }
      (*ctl->note)(v);
      return 1;
    }
    if (((voice[v].sample)->modes & 0x40) == 0) {
      pSVar2 = voice[v].sample;
    }
    else if ((byte)(pVVar6->status - 1) < 2) {
      if (2 < iVar4) {
        voice[v].envelope_increment = 0;
        return 0;
      }
      pSVar2 = voice[v].sample;
    }
    else {
      pSVar2 = voice[v].sample;
    }
    voice[v].envelope_stage = iVar4 + 1;
    iVar5 = voice[v].envelope_volume;
    iVar3 = pSVar2->envelope_offset[iVar4];
    if (iVar5 != iVar3) break;
    iVar4 = voice[v].envelope_stage;
  }
  voice[v].envelope_target = iVar3;
  iVar4 = pSVar2->envelope_rate[iVar4];
  voice[v].envelope_increment = iVar4;
  if (iVar5 <= iVar3) {
    return 0;
  }
  voice[v].envelope_increment = -iVar4;
  return 0;
}



----------------------------------------

// Function: apply_envelope_to_amp @ 089530fc

void apply_envelope_to_amp(int v)

{
  byte bVar1;
  SFtype SVar2;
  SFtype SVar3;
  SFtype SVar4;
  SFtype SVar5;
  SFtype SVar6;
  SFtype SVar7;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: FLOAT_T lamp@[???]
                       Unresolved local var: FLOAT_T ramp@[???]
                       Unresolved local var: FLOAT_T lramp@[???]
                       Unresolved local var: FLOAT_T rramp@[???]
                       Unresolved local var: FLOAT_T ceamp@[???]
                       Unresolved local var: FLOAT_T lfeamp@[???]
                       Unresolved local var: int32 la@[???]
                       Unresolved local var: int32 ra@[???]
                       Unresolved local var: int32 lra@[???]
                       Unresolved local var: int32 rra@[???]
                       Unresolved local var: int32 cea@[???]
                       Unresolved local var: int32 lfea@[???] */
  if (voice[v].panned == 0) {
    if (voice[v].tremolo_phase_increment == 0) {
      bVar1 = (voice[v].sample)->modes;
    }
    else {
                    /* Unresolved local var: FLOAT_T tv@[???] */
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      bVar1 = (voice[v].sample)->modes;
    }
    if ((bVar1 & 0x40) != 0) {
                    /* Unresolved local var: FLOAT_T ev@[???] */
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
      __muldf3(in_f12_13,in_f14_15);
    }
    __muldf3(in_f12_13,in_f14_15);
    SVar2 = __truncdfsf2(in_f12_13);
    __muldf3(in_f12_13,in_f14_15);
    SVar3 = __truncdfsf2(in_f12_13);
    __muldf3(in_f12_13,in_f14_15);
    SVar4 = __truncdfsf2(in_f12_13);
    __muldf3(in_f12_13,in_f14_15);
    SVar5 = __truncdfsf2(in_f12_13);
    __muldf3(in_f12_13,in_f14_15);
    SVar6 = __truncdfsf2(in_f12_13);
    __muldf3(in_f12_13,in_f14_15);
    SVar7 = __truncdfsf2(in_f12_13);
    voice[v].lfe_mix = (int)SVar7 + 0x1fff;
    voice[v].lr_mix = (int)SVar4 + 0x1fff;
    voice[v].left_mix = (int)SVar2 + 0x1fff;
    voice[v].ce_mix = (int)SVar6 + 0x1fff;
    voice[v].right_mix = (int)SVar3 + 0x1fff;
    voice[v].rr_mix = (int)SVar5 + 0x1fff;
    return;
  }
  if (voice[v].tremolo_phase_increment == 0) {
    bVar1 = (voice[v].sample)->modes;
  }
  else {
    __muldf3(in_f12_13,in_f14_15);
    bVar1 = (voice[v].sample)->modes;
  }
  if ((bVar1 & 0x40) != 0) {
    __muldf3(in_f12_13,in_f14_15);
  }
  __muldf3(in_f12_13,in_f14_15);
  SVar2 = __truncdfsf2(in_f12_13);
  voice[v].left_mix = (int)SVar2 + 0x1fff;
  return;
}



----------------------------------------

// Function: update_signal @ 089535bc

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

int update_signal(int v)

{
  undefined4 extraout_v0;
  int iVar1;
  undefined4 extraout_v1;
  int iVar2;
  SItype arg_a;
  SFtype arg_a_00;
  undefined4 in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
  iVar1 = voice[v].envelope_increment;
  if (iVar1 != 0) {
    iVar2 = iVar1 + voice[v].envelope_volume;
    voice[v].envelope_volume = iVar2;
    if (iVar1 < 0) {
      if (voice[v].envelope_target < iVar2) goto LAB_08953670;
    }
    else if ((iVar1 == 0) || (iVar2 < voice[v].envelope_target)) goto LAB_08953670;
    voice[v].envelope_volume = voice[v].envelope_target;
    iVar1 = recompute_envelope(v);
    if (iVar1 != 0) {
      return 1;
    }
  }
LAB_08953670:
  if (voice[v].tremolo_phase_increment != 0) {
                    /* Unresolved local var: int32 depth@[???] */
    arg_a = (uint)(voice[v].sample)->tremolo_depth * 0x80;
    if (voice[v].tremolo_sweep != 0) {
      iVar1 = voice[v].tremolo_sweep + voice[v].tremolo_sweep_position;
      voice[v].tremolo_sweep_position = iVar1;
      if (iVar1 < 0x10000) {
        arg_a = arg_a * iVar1 >> 0x10;
      }
      else {
        voice[v].tremolo_sweep = 0;
      }
    }
    iVar1 = voice[v].tremolo_phase + voice[v].tremolo_phase_increment;
    voice[v].tremolo_phase = iVar1;
    __floatsidf(iVar1 >> 5);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    sin((double)CONCAT44(in_f13,in_f12));
    __adddf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __floatsidf(arg_a);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    arg_a_00 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
    __extendsfdf2(arg_a_00);
    __subdf3((FLO_type_conflict)CONCAT44(in_f13,arg_a_00),in_f14_15);
    *(undefined4 *)&voice[v].tremolo_volume = extraout_v0;
    *(undefined4 *)((int)&voice[v].tremolo_volume + 4) = extraout_v1;
  }
  apply_envelope_to_amp(v);
  return 0;
}



----------------------------------------

// Function: mix_voice @ 089537dc

void mix_voice(int32 *buf,int v,int32 c)

{
  short sVar1;
  bool bVar2;
  int32 iVar3;
  short *psVar4;
  resample_t *prVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int *piVar13;
  int32 iVar14;
  int32 iVar15;
  int iVar16;
  Voice *pVVar17;
  int iVar18;
  int iVar19;
  int32 local_30 [2];
  
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: int32 count@[???]
                       Unresolved local var: resample_t * sp@[???] */
  if (c < 0) {
    return;
  }
  pVVar17 = voice + v;
  local_30[0] = c;
  if (pVVar17->status != '\x04') {
    psVar4 = resample_voice(v,local_30);
    iVar14 = local_30[0];
    iVar10 = num_ochannels;
    iVar3 = control_ratio;
    if (local_30[0] < 0) {
      return;
    }
    if ((play_mode->encoding & 1U) != 0) {
      if (voice[v].envelope_increment == 0) {
        if (voice[v].tremolo_phase_increment == 0) {
                    /* Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: resample_t s@[???] */
          iVar10 = voice[v].left_mix;
          if (local_30[0] == 0) {
            return;
          }
          iVar6 = 0;
          do {
            sVar1 = *psVar4;
            iVar6 = iVar6 + 1;
            psVar4 = psVar4 + 1;
            *buf = *buf + iVar10 * sVar1;
            buf = buf + 1;
          } while (local_30[0] != iVar6);
          return;
        }
        iVar15 = voice[v].control_counter;
      }
      else {
        iVar15 = voice[v].control_counter;
      }
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: resample_t s@[???] */
      iVar10 = voice[v].left_mix;
      if (iVar15 == 0) {
        iVar10 = update_signal(v);
        if (iVar10 != 0) {
          return;
        }
        iVar10 = voice[v].left_mix;
        iVar15 = iVar3;
      }
      if (iVar14 == 0) {
        return;
      }
      iVar6 = iVar15;
      if (iVar15 < iVar14) {
        do {
          iVar11 = 0;
          if (iVar6 != 0) {
            do {
              sVar1 = *psVar4;
              iVar11 = iVar11 + 1;
              psVar4 = psVar4 + 1;
              *buf = *buf + iVar10 * sVar1;
              buf = buf + 1;
            } while (iVar6 != iVar11);
          }
          iVar15 = control_ratio;
          iVar10 = update_signal(v);
          iVar14 = iVar14 - iVar6;
          if (iVar10 != 0) {
            return;
          }
          iVar10 = voice[v].left_mix;
          if (iVar14 == 0) {
            return;
          }
          iVar6 = iVar15;
        } while (iVar15 < iVar14);
      }
      voice[v].control_counter = iVar15 - iVar14;
      if (iVar14 == 0) {
        return;
      }
      iVar6 = 0;
      do {
        sVar1 = *psVar4;
        iVar6 = iVar6 + 1;
        psVar4 = psVar4 + 1;
        *buf = *buf + iVar10 * sVar1;
        buf = buf + 1;
      } while (iVar6 != iVar14);
      return;
    }
    iVar6 = voice[v].panned;
    if (iVar6 != 0) {
      if (iVar6 == 3) {
        if (voice[v].envelope_increment == 0) {
          if (voice[v].tremolo_phase_increment == 0) {
                    /* Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: resample_t s@[???] */
            iVar6 = voice[v].left_mix;
            while (local_30[0] = local_30[0] + -1, local_30[0] != -1) {
              if (iVar10 == 2) {
                iVar11 = iVar6 * *psVar4;
                psVar4 = psVar4 + 1;
                *buf = *buf + iVar11;
                buf[1] = buf[1] + iVar11;
                buf = buf + 2;
              }
              else {
                iVar11 = iVar6 * *psVar4;
                if (iVar10 == 4) {
                  psVar4 = psVar4 + 1;
                  *buf = *buf + iVar11;
                  buf[1] = buf[1] + iVar11;
                  buf = buf + 4;
                }
                else if (iVar10 == 6) {
                  psVar4 = psVar4 + 1;
                  buf[4] = buf[4] + iVar11;
                  buf[5] = buf[5] + iVar11;
                  buf = buf + 6;
                }
                else {
                  psVar4 = psVar4 + 1;
                }
              }
            }
            return;
          }
          iVar10 = voice[v].control_counter;
        }
        else {
          iVar10 = voice[v].control_counter;
        }
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: resample_t s@[???] */
        iVar6 = voice[v].left_mix;
        if (iVar10 == 0) {
          iVar10 = update_signal(v);
          if (iVar10 != 0) {
            return;
          }
          iVar6 = voice[v].left_mix;
          iVar10 = iVar3;
        }
        if (iVar14 == 0) {
          return;
        }
        iVar11 = num_ochannels;
        iVar12 = iVar10;
        iVar18 = iVar10;
        if (iVar10 < iVar14) {
          do {
            while (iVar10 = control_ratio, iVar19 = num_ochannels, control_ratio = iVar10,
                  iVar12 + -1 != -1) {
              if (num_ochannels == 2) {
                iVar10 = iVar6 * *psVar4;
                num_ochannels = iVar11;
                *buf = *buf + iVar10;
                buf[1] = buf[1] + iVar10;
                buf = buf + 2;
              }
              else {
                iVar10 = iVar6 * *psVar4;
                if (num_ochannels == 4) {
                  num_ochannels = iVar11;
                  *buf = *buf + iVar10;
                  buf[2] = buf[2] + iVar10;
                  buf = buf + 4;
                }
                else {
                  bVar2 = num_ochannels == 6;
                  num_ochannels = iVar11;
                  if (bVar2) {
                    buf[4] = buf[4] + iVar10;
                    buf[5] = buf[5] + iVar10;
                    buf = buf + 6;
                  }
                }
              }
              psVar4 = psVar4 + 1;
              iVar11 = num_ochannels;
              iVar12 = iVar12 + -1;
              num_ochannels = iVar19;
            }
            num_ochannels = iVar11;
            iVar6 = update_signal(v);
            iVar14 = iVar14 - iVar18;
            if (iVar6 != 0) {
              return;
            }
            iVar6 = voice[v].left_mix;
            if (iVar14 == 0) {
              return;
            }
            iVar11 = num_ochannels;
            iVar12 = iVar10;
            iVar18 = iVar10;
          } while (iVar10 < iVar14);
        }
        iVar11 = num_ochannels;
        voice[v].control_counter = iVar10 - iVar14;
        while (iVar14 = iVar14 + -1, iVar14 != -1) {
          if (iVar11 == 2) {
            iVar10 = iVar6 * *psVar4;
            psVar4 = psVar4 + 1;
            *buf = *buf + iVar10;
            buf[1] = buf[1] + iVar10;
            buf = buf + 2;
          }
          else {
            iVar10 = iVar6 * *psVar4;
            if (iVar11 == 4) {
              psVar4 = psVar4 + 1;
              *buf = *buf + iVar10;
              buf[2] = buf[2] + iVar10;
              buf = buf + 4;
            }
            else if (iVar11 == 6) {
              psVar4 = psVar4 + 1;
              buf[4] = buf[4] + iVar10;
              buf[5] = buf[5] + iVar10;
              buf = buf + 6;
            }
            else {
              psVar4 = psVar4 + 1;
            }
          }
        }
        return;
      }
      if ((voice[v].envelope_increment == 0) && (voice[v].tremolo_phase_increment == 0)) {
        if (iVar6 != 2) {
                    /* Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: resample_t s@[???] */
          iVar6 = voice[v].left_mix;
          while( true ) {
            local_30[0] = local_30[0] + -1;
            if (local_30[0] == -1) break;
            iVar11 = (int)*psVar4;
            psVar4 = psVar4 + 1;
            if (iVar10 == 2) {
              *buf = *buf + iVar6 * iVar11;
              buf = buf + 2;
            }
            if (3 < iVar10) {
              *buf = *buf + (iVar6 >> 1) * iVar11;
              buf[2] = buf[2] + iVar6 * iVar11;
              buf = buf + 4;
            }
            if (iVar10 == 6) {
              buf[1] = buf[1] + iVar6 * iVar11;
              buf = buf + 2;
            }
          }
          return;
        }
                    /* Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: resample_t s@[???] */
        iVar6 = voice[v].left_mix;
        while( true ) {
          local_30[0] = local_30[0] + -1;
          if (local_30[0] == -1) break;
          iVar11 = (int)*psVar4;
          psVar4 = psVar4 + 1;
          if (iVar10 == 2) {
            buf[1] = buf[1] + iVar6 * iVar11;
            buf = buf + 2;
          }
          if (3 < iVar10) {
            buf[1] = buf[1] + (iVar6 >> 1) * iVar11;
            buf[3] = buf[3] + iVar6 * iVar11;
            buf = buf + 4;
          }
          if (iVar10 == 6) {
            buf[1] = buf[1] + iVar6 * iVar11;
            buf = buf + 2;
          }
        }
        return;
      }
      iVar15 = voice[v].control_counter;
      if (iVar6 == 2) {
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: resample_t s@[???] */
        iVar10 = voice[v].left_mix;
        if (iVar15 == 0) {
          iVar10 = update_signal(v);
          if (iVar10 != 0) {
            return;
          }
          iVar10 = voice[v].left_mix;
          iVar15 = iVar3;
        }
        if (iVar14 == 0) {
          return;
        }
        iVar6 = iVar15;
        if (iVar15 < iVar14) {
          do {
            iVar11 = num_ochannels;
            iVar12 = iVar6 + -1;
            while (iVar12 != -1) {
              while( true ) {
                iVar18 = (int)*psVar4;
                psVar4 = psVar4 + 1;
                if (iVar11 == 2) {
                  buf[1] = buf[1] + iVar10 * iVar18;
                  buf = buf + 2;
                }
                if (3 < iVar11) {
                  buf[1] = buf[1] + (iVar10 >> 1) * iVar18;
                  buf[3] = buf[3] + iVar10 * iVar18;
                  buf = buf + 4;
                }
                iVar12 = iVar12 + -1;
                if (iVar11 != 6) break;
                buf[1] = buf[1] + iVar10 * iVar18;
                buf = buf + 2;
                if (iVar12 == -1) goto LAB_089540e4;
              }
            }
LAB_089540e4:
            iVar15 = control_ratio;
            iVar10 = update_signal(v);
            iVar14 = iVar14 - iVar6;
            if (iVar10 != 0) {
              return;
            }
            iVar10 = voice[v].left_mix;
            if (iVar14 == 0) {
              return;
            }
            iVar6 = iVar15;
          } while (iVar15 < iVar14);
        }
        iVar6 = num_ochannels;
        voice[v].control_counter = iVar15 - iVar14;
        while( true ) {
          iVar14 = iVar14 + -1;
          if (iVar14 == -1) break;
          iVar11 = (int)*psVar4;
          psVar4 = psVar4 + 1;
          if (iVar6 == 2) {
            buf[1] = buf[1] + iVar10 * iVar11;
            buf = buf + 2;
          }
          if (3 < iVar6) {
            buf[1] = buf[1] + (iVar10 >> 1) * iVar11;
            buf[3] = buf[3] + iVar10 * iVar11;
            buf = buf + 4;
          }
          if (iVar6 == 6) {
            buf[1] = buf[1] + iVar10 * iVar11;
            buf = buf + 2;
          }
        }
        return;
      }
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: resample_t s@[???] */
      iVar10 = voice[v].left_mix;
      if (iVar15 == 0) {
        iVar10 = update_signal(v);
        if (iVar10 != 0) {
          return;
        }
        iVar10 = voice[v].left_mix;
        iVar15 = iVar3;
      }
      if (iVar14 == 0) {
        return;
      }
      iVar6 = iVar15;
      if (iVar15 < iVar14) {
        do {
          iVar11 = num_ochannels;
          iVar12 = iVar6 + -1;
          while (iVar12 != -1) {
            while( true ) {
              iVar18 = (int)*psVar4;
              psVar4 = psVar4 + 1;
              if (iVar11 == 2) {
                *buf = *buf + iVar18 * iVar10;
                buf = buf + 2;
              }
              if (3 < iVar11) {
                *buf = *buf + (iVar10 >> 1) * iVar18;
                buf[2] = buf[2] + iVar18 * iVar10;
                buf = buf + 4;
              }
              iVar12 = iVar12 + -1;
              if (iVar11 != 6) break;
              buf[1] = buf[1] + iVar18 * iVar10;
              buf = buf + 2;
              if (iVar12 == -1) goto LAB_08953e54;
            }
          }
LAB_08953e54:
          iVar15 = control_ratio;
          iVar10 = update_signal(v);
          iVar14 = iVar14 - iVar6;
          if (iVar10 != 0) {
            return;
          }
          iVar10 = voice[v].left_mix;
          if (iVar14 == 0) {
            return;
          }
          iVar6 = iVar15;
        } while (iVar15 < iVar14);
      }
      iVar6 = num_ochannels;
      voice[v].control_counter = iVar15 - iVar14;
      while( true ) {
        iVar14 = iVar14 + -1;
        if (iVar14 == -1) break;
        iVar11 = (int)*psVar4;
        psVar4 = psVar4 + 1;
        if (iVar6 == 2) {
          *buf = *buf + iVar11 * iVar10;
          buf = buf + 2;
        }
        if (3 < iVar6) {
          *buf = *buf + (iVar10 >> 1) * iVar11;
          buf[2] = buf[2] + iVar11 * iVar10;
          buf = buf + 4;
        }
        if (iVar6 == 6) {
          buf[1] = buf[1] + iVar11 * iVar10;
          buf = buf + 2;
        }
      }
      return;
    }
    if (voice[v].envelope_increment == 0) {
      if (voice[v].tremolo_phase_increment == 0) {
                    /* Unresolved local var: final_volume_t left_rear@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: final_volume_t center@[???]
                       Unresolved local var: final_volume_t right@[???]
                       Unresolved local var: final_volume_t right_rear@[???]
                       Unresolved local var: final_volume_t lfe@[???]
                       Unresolved local var: resample_t s@[???] */
        iVar16 = voice[v].lfe_mix;
        iVar12 = voice[v].lr_mix;
        iVar6 = voice[v].left_mix;
        iVar19 = voice[v].ce_mix;
        iVar11 = voice[v].right_mix;
        iVar18 = voice[v].rr_mix;
        while( true ) {
          local_30[0] = local_30[0] + -1;
          if (local_30[0] == -1) break;
          iVar8 = (int)*psVar4;
          psVar4 = psVar4 + 1;
          *buf = *buf + iVar6 * iVar8;
          buf[1] = buf[1] + iVar11 * iVar8;
          piVar13 = buf + 2;
          if (3 < iVar10) {
            *piVar13 = *piVar13 + iVar12 * iVar8;
            buf[3] = buf[3] + iVar18 * iVar8;
            piVar13 = buf + 4;
          }
          buf = piVar13;
          if (iVar10 == 6) {
            piVar13[1] = piVar13[1] + iVar16 * iVar8;
            *piVar13 = *piVar13 + iVar19 * iVar8;
            buf = piVar13 + 2;
          }
        }
        return;
      }
      iVar15 = voice[v].control_counter;
    }
    else {
      iVar15 = voice[v].control_counter;
    }
                    /* Unresolved local var: Voice * vp@[???]
                       Unresolved local var: final_volume_t left_rear@[???]
                       Unresolved local var: final_volume_t left@[???]
                       Unresolved local var: final_volume_t center@[???]
                       Unresolved local var: final_volume_t right@[???]
                       Unresolved local var: final_volume_t right_rear@[???]
                       Unresolved local var: final_volume_t lfe@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: resample_t s@[???] */
    iVar12 = voice[v].lr_mix;
    iVar6 = voice[v].left_mix;
    iVar19 = voice[v].ce_mix;
    iVar10 = voice[v].right_mix;
    iVar11 = voice[v].rr_mix;
    iVar18 = voice[v].lfe_mix;
    if (iVar15 == 0) {
      iVar10 = update_signal(v);
      if (iVar10 != 0) {
        return;
      }
      iVar12 = voice[v].lr_mix;
      iVar6 = voice[v].left_mix;
      iVar19 = voice[v].ce_mix;
      iVar10 = voice[v].right_mix;
      iVar11 = voice[v].rr_mix;
      iVar18 = voice[v].lfe_mix;
      iVar15 = iVar3;
    }
    if (iVar14 == 0) {
      return;
    }
    iVar16 = iVar15;
    if (iVar15 < iVar14) {
      do {
        iVar8 = num_ochannels;
        iVar9 = iVar16 + -1;
        while (iVar9 != -1) {
          while( true ) {
            iVar7 = (int)*psVar4;
            psVar4 = psVar4 + 1;
            *buf = *buf + iVar6 * iVar7;
            buf[1] = buf[1] + iVar10 * iVar7;
            piVar13 = buf + 2;
            if (3 < iVar8) {
              *piVar13 = *piVar13 + iVar12 * iVar7;
              buf[3] = buf[3] + iVar11 * iVar7;
              piVar13 = buf + 4;
            }
            iVar9 = iVar9 + -1;
            buf = piVar13;
            if (iVar8 != 6) break;
            piVar13[1] = piVar13[1] + iVar18 * iVar7;
            *piVar13 = *piVar13 + iVar19 * iVar7;
            buf = piVar13 + 2;
            if (iVar9 == -1) goto LAB_08953f70;
          }
        }
LAB_08953f70:
        iVar15 = control_ratio;
        iVar10 = update_signal(v);
        iVar14 = iVar14 - iVar16;
        if (iVar10 != 0) {
          return;
        }
        iVar12 = voice[v].lr_mix;
        iVar6 = voice[v].left_mix;
        iVar19 = voice[v].ce_mix;
        iVar10 = voice[v].right_mix;
        iVar11 = voice[v].rr_mix;
        iVar18 = voice[v].lfe_mix;
        if (iVar14 == 0) {
          return;
        }
        iVar16 = iVar15;
      } while (iVar15 < iVar14);
    }
    iVar16 = num_ochannels;
    voice[v].control_counter = iVar15 - iVar14;
    while( true ) {
      iVar14 = iVar14 + -1;
      if (iVar14 == -1) break;
      iVar8 = (int)*psVar4;
      psVar4 = psVar4 + 1;
      *buf = *buf + iVar6 * iVar8;
      buf[1] = buf[1] + iVar10 * iVar8;
      piVar13 = buf + 2;
      if (3 < iVar16) {
        *piVar13 = *piVar13 + iVar12 * iVar8;
        buf[3] = buf[3] + iVar11 * iVar8;
        piVar13 = buf + 4;
      }
      buf = piVar13;
      if (iVar16 == 6) {
        piVar13[1] = piVar13[1] + iVar18 * iVar8;
        *piVar13 = *piVar13 + iVar19 * iVar8;
        buf = piVar13 + 2;
      }
    }
    return;
  }
  if (0x13 < c) {
    local_30[0] = 0x14;
  }
  prVar5 = resample_voice(v,local_30);
  iVar10 = num_ochannels;
                    /* Unresolved local var: int32 left_rear@[???]
                       Unresolved local var: int32 left@[???]
                       Unresolved local var: int32 center@[???]
                       Unresolved local var: int32 right@[???]
                       Unresolved local var: int32 right_rear@[???]
                       Unresolved local var: int32 lfe@[???]
                       Unresolved local var: int32 li@[???]
                       Unresolved local var: int32 ri@[???]
                       Unresolved local var: resample_t s@[???] */
  iVar6 = voice[v].left_mix;
  if (local_30[0] == 0) {
    local_30[0] = 1;
  }
  if (local_30[0] == 0) {
    trap(7);
  }
  iVar11 = -(iVar6 / local_30[0]);
  if (iVar11 == 0) {
    iVar11 = -1;
  }
  if ((play_mode->encoding & 1U) == 0) {
    iVar12 = voice[v].panned;
    if (iVar12 == 0) {
      iVar12 = voice[v].right_mix;
      iVar18 = iVar12 / local_30[0];
      if (local_30[0] == 0) {
        trap(7);
      }
      iVar16 = voice[v].lr_mix;
      iVar19 = voice[v].ce_mix;
      iVar8 = voice[v].rr_mix;
      iVar9 = voice[v].lfe_mix;
      while( true ) {
        iVar6 = iVar6 + iVar11;
        iVar12 = iVar12 + -iVar18;
        local_30[0] = local_30[0] + -1;
        iVar16 = iVar16 + iVar11;
        iVar19 = iVar19 + iVar11;
        iVar8 = iVar8 + -iVar18;
        iVar9 = iVar9 + iVar11;
        if (local_30[0] == -1) break;
        iVar7 = (int)*prVar5;
        prVar5 = prVar5 + 1;
        *buf = *buf + iVar6 * iVar7;
        buf[1] = buf[1] + iVar12 * iVar7;
        piVar13 = buf + 2;
        if (3 < iVar10) {
          *piVar13 = *piVar13 + iVar16 * iVar7;
          buf[3] = buf[3] + iVar8 * iVar7;
          piVar13 = buf + 4;
        }
        buf = piVar13;
        if (iVar10 == 6) {
          piVar13[1] = piVar13[1] + iVar9 * iVar7;
          *piVar13 = *piVar13 + iVar19 * iVar7;
          buf = piVar13 + 2;
        }
      }
    }
    else {
      if (iVar12 == 3) {
        iVar6 = iVar11 + iVar6;
        while( true ) {
          local_30[0] = local_30[0] + -1;
          if (local_30[0] == -1) {
            pVVar17->status = '\0';
            return;
          }
          if (iVar6 < 0) break;
          if (iVar10 == 2) {
            iVar12 = *prVar5 * iVar6;
            prVar5 = prVar5 + 1;
            iVar6 = iVar6 + iVar11;
            *buf = *buf + iVar12;
            buf[1] = buf[1] + iVar12;
            buf = buf + 2;
          }
          else {
            iVar12 = *prVar5 * iVar6;
            if (iVar10 == 4) {
              prVar5 = prVar5 + 1;
              iVar6 = iVar6 + iVar11;
              *buf = *buf + iVar12;
              buf[1] = buf[1] + iVar12;
              buf = buf + 4;
            }
            else if (iVar10 == 6) {
              prVar5 = prVar5 + 1;
              iVar6 = iVar6 + iVar11;
              buf[4] = buf[4] + iVar12;
              buf[5] = buf[5] + iVar12;
              buf = buf + 6;
            }
            else {
              prVar5 = prVar5 + 1;
              iVar6 = iVar6 + iVar11;
            }
          }
        }
        pVVar17->status = '\0';
        return;
      }
      if (iVar12 == 1) {
        iVar6 = iVar11 + iVar6;
        while( true ) {
          local_30[0] = local_30[0] + -1;
          if (local_30[0] == -1) break;
          if (iVar6 < 0) {
            pVVar17->status = '\0';
            return;
          }
          sVar1 = *prVar5;
          prVar5 = prVar5 + 1;
          iVar12 = sVar1 * iVar6;
          iVar6 = iVar6 + iVar11;
          *buf = *buf + iVar12;
          piVar13 = buf + 2;
          if (3 < iVar10) {
            *piVar13 = *piVar13 + iVar12;
            piVar13 = buf + 4;
          }
          buf = piVar13;
          if (iVar10 == 6) {
            *piVar13 = *piVar13 + iVar12;
            piVar13[1] = piVar13[1] + iVar12;
            buf = piVar13 + 2;
          }
        }
      }
      else {
        if (iVar12 != 2) {
          pVVar17->status = '\0';
          return;
        }
        iVar6 = iVar11 + iVar6;
        while( true ) {
          local_30[0] = local_30[0] + -1;
          if (local_30[0] == -1) break;
          if (iVar6 < 0) {
            pVVar17->status = '\0';
            return;
          }
          sVar1 = *prVar5;
          prVar5 = prVar5 + 1;
          iVar12 = sVar1 * iVar6;
          iVar6 = iVar6 + iVar11;
          buf[1] = buf[1] + iVar12;
          piVar13 = buf + 2;
          if (3 < iVar10) {
            buf[3] = buf[3] + iVar12;
            piVar13 = buf + 4;
          }
          buf = piVar13;
          if (iVar10 == 6) {
            piVar13[1] = piVar13[1] + iVar12;
            *piVar13 = *piVar13 + iVar12;
            buf = piVar13 + 2;
          }
        }
      }
    }
  }
  else {
    if (local_30[0] + -1 == -1) {
      pVVar17->status = '\0';
      return;
    }
    iVar6 = iVar11 + iVar6;
    if (iVar6 < 0) {
      pVVar17->status = '\0';
      return;
    }
    iVar10 = iVar11 + iVar6;
    iVar12 = 0;
    do {
      iVar10 = iVar10 + iVar11;
      iVar18 = iVar6 * *prVar5;
      iVar6 = iVar6 + iVar11;
      prVar5 = prVar5 + 1;
      *buf = *buf + iVar18;
      buf = buf + 1;
      if (iVar12 == local_30[0] + -1) break;
      iVar12 = iVar12 + 1;
    } while (-1 < iVar10 - iVar11);
  }
  pVVar17->status = '\0';
  return;
}



----------------------------------------

// Function: Timidity_Error @ 0895489c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

char * Timidity_Error(void)

{
  return timidity_error;
}



----------------------------------------

// Function: read_config_file @ 089548a8

/* WARNING: Removing unreachable block (ram,0x0895511c) */

int read_config_file(char *name)

{
  char cVar1;
  ushort uVar2;
  int iVar3;
  FILE *fp;
  char *pcVar4;
  char *pcVar5;
  int iVar6;
  uint uVar7;
  ToneBank *pTVar8;
  size_t sVar9;
  char **ppcVar10;
  ToneBank **ppTVar11;
  char *s;
  char *local_45c [9];
  char acStack_438 [1024];
  int local_38;
  uint local_34;
  ToneBank *local_30;
  char *local_2c;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: char[1024] tmp@[???]
                       Unresolved local var: char *[10] w@[???]
                       Unresolved local var: char * cp@[???]
                       Unresolved local var: ToneBank * bank@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int line@[???]
                       Unresolved local var: int words@[???] */
  local_2c = name;
  if (read_config_file::rcf_count < 0x33) {
    fp = open_file(name,1,2);
    if (fp == (FILE *)0x0) {
      return -1;
    }
    local_30 = (ToneBank *)0x0;
    pTVar8 = local_30;
LAB_08954960:
    local_30 = pTVar8;
    pcVar4 = fgets(acStack_438,0x400,fp);
    if (pcVar4 != (char *)0x0) {
LAB_08954978:
      pcVar4 = strtok(acStack_438,&DAT_089e60b4);
      pTVar8 = local_30;
      if ((pcVar4 == (char *)0x0) || (iVar3 = 0, *pcVar4 == '#')) goto LAB_08954960;
      ppcVar10 = local_45c;
      do {
        pcVar5 = strtok((char *)0x0,&DAT_089e60b4);
        *ppcVar10 = pcVar5;
        iVar3 = iVar3 + 1;
        ppcVar10 = ppcVar10 + 1;
        if ((pcVar5 == (char *)0x0) || (*pcVar5 == '#')) break;
      } while (iVar3 != 10);
      iVar6 = strcmp(pcVar4,"map");
      pTVar8 = local_30;
      if (iVar6 == 0) goto LAB_08954960;
      iVar6 = strcmp(pcVar4,"dir");
      if (iVar6 == 0) {
        iVar6 = 1;
        if (iVar3 < 2) {
          pcVar4 = "%s: line %d: No directory given\n";
          goto LAB_08954f30;
        }
        ppcVar10 = local_45c;
        pcVar4 = local_45c[0];
        while( true ) {
          iVar6 = iVar6 + 1;
          ppcVar10 = ppcVar10 + 1;
          add_to_pathlist(pcVar4);
          if (iVar3 == iVar6) break;
          pcVar4 = *ppcVar10;
        }
        pcVar4 = fgets(acStack_438,0x400,fp);
        if (pcVar4 == (char *)0x0) {
          uVar2 = fp->_flags;
          goto LAB_08954a50;
        }
        goto LAB_08954978;
      }
      iVar6 = strcmp(pcVar4,"source");
      if (iVar6 != 0) {
        iVar6 = strcmp(pcVar4,"default");
        if (iVar6 == 0) {
          if (iVar3 != 2) {
            pcVar4 = "%s: line %d: Must specify exactly one patch name\n";
            goto LAB_08954f30;
          }
          strncpy(def_instr_name,local_45c[0],0xff);
          def_instr_name[0xff] = '\0';
          pTVar8 = local_30;
          goto LAB_08954960;
        }
        iVar6 = strcmp(pcVar4,"drumset");
        if (iVar6 == 0) {
          if (iVar3 < 2) {
            pcVar4 = "%s: line %d: No drum set number given\n";
            goto LAB_08954f30;
          }
          uVar7 = atoi(local_45c[0]);
          if (0x7f < uVar7) {
            pcVar4 = "%s: line %d: Drum set must be between 0 and 127\n";
            goto LAB_08954f30;
          }
          ppTVar11 = drumset + uVar7;
          pTVar8 = *ppTVar11;
        }
        else {
          iVar6 = strcmp(pcVar4,"bank");
          if (iVar6 != 0) {
            if ((iVar3 < 2) || (9 < (byte)(*pcVar4 - 0x30U))) {
              pcVar4 = "%s: line %d: syntax error\n";
              goto LAB_08954f30;
            }
            uVar7 = atoi(pcVar4);
            pTVar8 = local_30;
            local_34 = uVar7;
            if (0x7f < uVar7) {
              pcVar4 = "%s: line %d: Program must be between 0 and 127\n";
              goto LAB_08954f30;
            }
            if (local_30 == (ToneBank *)0x0) {
              pcVar4 = "%s: line %d: Must specify tone bank or drum set before assignment\n";
              goto LAB_08954f30;
            }
            pcVar4 = local_30->tone[uVar7].name;
            if (pcVar4 != (char *)0x0) {
              free(pcVar4);
            }
            pcVar4 = local_45c[0];
            sVar9 = strlen(local_45c[0]);
            pcVar5 = safe_malloc(sVar9 + 1);
            pTVar8->tone[uVar7].name = pcVar5;
            strcpy(pcVar5,pcVar4);
            pTVar8->tone[uVar7].note = -1;
            pTVar8->tone[uVar7].strip_tail = -1;
            pTVar8->tone[uVar7].strip_envelope = -1;
            pTVar8->tone[uVar7].strip_loop = -1;
            pTVar8->tone[uVar7].pan = -1;
            pTVar8->tone[uVar7].amp = -1;
            pTVar8 = local_30;
            if (2 < iVar3) {
              ppcVar10 = local_45c;
              local_38 = 2;
              goto LAB_08954d5c;
            }
            goto LAB_08954960;
          }
          if (iVar3 < 2) {
            pcVar4 = "%s: line %d: No bank number given\n";
            goto LAB_08954f30;
          }
          uVar7 = atoi(local_45c[0]);
          if (0x7f < uVar7) {
            pcVar4 = "%s: line %d: Tone bank must be between 0 and 127\n";
            goto LAB_08954f30;
          }
          ppTVar11 = tonebank + uVar7;
          pTVar8 = *ppTVar11;
        }
        if (pTVar8 == (ToneBank *)0x0) {
          pTVar8 = safe_malloc(0x1804);
          *ppTVar11 = pTVar8;
          memset(pTVar8,0,0x1804);
          pTVar8 = *ppTVar11;
        }
        goto LAB_08954960;
      }
      iVar6 = 1;
      if (iVar3 < 2) {
        pcVar4 = "%s: line %d: No file name given\n";
        goto LAB_08954f30;
      }
      ppcVar10 = local_45c;
      do {
        iVar6 = iVar6 + 1;
        read_config_file::rcf_count = read_config_file::rcf_count + 1;
        read_config_file(*ppcVar10);
        ppcVar10 = ppcVar10 + 1;
        read_config_file::rcf_count = read_config_file::rcf_count + -1;
        pTVar8 = local_30;
      } while (iVar3 != iVar6);
      goto LAB_08954960;
    }
    uVar2 = fp->_flags;
LAB_08954a50:
    if ((uVar2 & 0x40) == 0) {
      close_file(fp);
      return 0;
    }
    (*ctl->cmsg)(2,0,"Can\'t read from %s\n",local_2c);
    close_file(fp);
    iVar3 = -2;
  }
  else {
    (*ctl->cmsg)(2,0,"Probable source loop in configuration files");
    iVar3 = -1;
  }
  return iVar3;
  while (local_38 = local_38 + 1, pTVar8 = local_30, iVar3 != local_38) {
LAB_08954d5c:
    ppcVar10 = ppcVar10 + 1;
    pcVar5 = *ppcVar10;
    pcVar4 = strchr(pcVar5,0x3d);
    if (pcVar4 == (char *)0x0) {
LAB_08955064:
      (*ctl->cmsg)(2,0,"%s: line %d: bad patch option %s\n",local_2c);
      return -2;
    }
    *pcVar4 = '\0';
    s = pcVar4 + 1;
    iVar6 = strcmp(pcVar5,"amp");
    if (iVar6 == 0) {
      uVar7 = atoi(s);
      if ((800 < uVar7) || (9 < (byte)(pcVar4[1] - 0x30U))) {
        (*ctl->cmsg)(2,0,"%s: line %d: amplification must be between 0 and %d\n",local_2c);
        return -2;
      }
      local_30->tone[local_34].amp = uVar7;
    }
    else {
      iVar6 = strcmp(pcVar5,"note");
      if (iVar6 == 0) {
        uVar7 = atoi(s);
        if ((0x7f < uVar7) || (9 < (byte)(pcVar4[1] - 0x30U))) {
          pcVar4 = "%s: line %d: note must be between 0 and 127\n";
          goto LAB_08954f30;
        }
        local_30->tone[local_34].note = uVar7;
      }
      else {
        iVar6 = strcmp(pcVar5,"pan");
        if (iVar6 == 0) {
          iVar6 = strcmp(s,"center");
          uVar7 = 0x40;
          if (iVar6 != 0) {
            iVar6 = strcmp(s,"left");
            uVar7 = 0;
            if (iVar6 == 0) {
              cVar1 = *s;
LAB_08954ef0:
              if ((cVar1 != 0x2d) && (9 < ((int)cVar1 - 0x30U & 0xff))) {
LAB_08954f10:
                pcVar4 = 
                "%s: line %d: panning must be left, right, center, or between -100 and 100\n";
LAB_08954f30:
                (*ctl->cmsg)(2,0,pcVar4,local_2c);
                return -2;
              }
            }
            else {
              iVar6 = strcmp(s,"right");
              uVar7 = 0x7f;
              if (iVar6 != 0) {
                iVar6 = atoi(s);
                uVar7 = (iVar6 * 100 + 10000) / 0x9d;
                if (0x7f < uVar7) goto LAB_08954f10;
                if (uVar7 == 0) {
                  cVar1 = *s;
                  goto LAB_08954ef0;
                }
              }
            }
          }
          local_30->tone[local_34].pan = uVar7;
        }
        else {
          iVar6 = strcmp(pcVar5,"keep");
          if (iVar6 == 0) {
            iVar6 = strcmp(s,"env");
            if (iVar6 == 0) {
              local_30->tone[local_34].strip_envelope = 0;
            }
            else {
              iVar6 = strcmp(s,"loop");
              if (iVar6 != 0) {
                pcVar4 = "%s: line %d: keep must be env or loop\n";
                goto LAB_08954f30;
              }
              local_30->tone[local_34].strip_loop = 0;
            }
          }
          else {
            iVar6 = strcmp(pcVar5,"strip");
            if (iVar6 != 0) goto LAB_08955064;
            iVar6 = strcmp(s,"env");
            if (iVar6 == 0) {
              local_30->tone[local_34].strip_envelope = 1;
            }
            else {
              iVar6 = strcmp(s,"loop");
              if (iVar6 == 0) {
                local_30->tone[local_34].strip_loop = 1;
              }
              else {
                iVar6 = strcmp(s,"tail");
                if (iVar6 != 0) {
                  pcVar4 = "%s: line %d: strip must be env, loop, or tail\n";
                  goto LAB_08954f30;
                }
                local_30->tone[local_34].strip_tail = 1;
              }
            }
          }
        }
      }
    }
  }
  goto LAB_08954960;
}



----------------------------------------

// Function: Timidity_Init @ 089551cc

/* WARNING: Removing unreachable block (ram,0x08955390) */

int Timidity_Init(int rate,int format,int channels,int samples)

{
  PlayMode *pPVar1;
  int iVar2;
  
  iVar2 = read_config_file("timidity.cfg");
  pPVar1 = play_mode;
  if (-1 < iVar2) {
    if (channels < 1) {
      return -1;
    }
    if (channels == 3) {
      return -1;
    }
    if (channels == 5) {
      return -1;
    }
    if (channels < 7) {
      play_mode->rate = rate;
      num_ochannels = channels;
      pPVar1->encoding = 0;
      if ((format & 0xffU) == 0x10) {
        pPVar1->encoding = 4;
      }
      if ((format & 0x8000U) != 0) {
        pPVar1->encoding = pPVar1->encoding | 2;
      }
      if (channels == 1) {
        pPVar1->encoding = pPVar1->encoding | 1;
      }
      if (format == 0x1010) {
        s32tobuf = s32tou16x;
      }
      else if (format < 0x1011) {
        if (format == 8) {
          s32tobuf = s32tou8;
        }
        else {
          if (format != 0x10) {
LAB_089552d4:
            (*ctl->cmsg)(2,0,"Unsupported audio format");
            return -1;
          }
          s32tobuf = s32tou16;
        }
      }
      else if (format == 0x8010) {
        s32tobuf = s32tos16;
      }
      else if (format == 0x9010) {
        s32tobuf = s32tos16x;
      }
      else {
        if (format != 0x8008) goto LAB_089552d4;
        s32tobuf = s32tos8;
      }
      AUDIO_BUFFER_SIZE = samples;
      resample_buffer = safe_malloc(samples * 2 + 100);
      common_buffer = safe_malloc(AUDIO_BUFFER_SIZE * num_ochannels * 4);
      init_tables();
      iVar2 = (*ctl->open)(0,0);
      if (iVar2 != 0) {
        (*ctl->cmsg)(2,0,"Couldn\'t open %s\n",ctl->id_name);
        return -1;
      }
      if (control_ratio == 0) {
        control_ratio = play_mode->rate / 1000;
        if (control_ratio < 1) {
          control_ratio = 1;
        }
        else if (0xff < control_ratio) {
          control_ratio = 0xff;
        }
      }
      if (def_instr_name[0] == '\0') {
        return 0;
      }
      set_default_instrument(def_instr_name);
      return 0;
    }
  }
  return -1;
}



----------------------------------------

// Function: s32tos8 @ 0895548c

void s32tos8(void *dp,int32 *lp,int32 c)

{
  char *pcVar1;
  
                    /* Unresolved local var: int8 * cp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  if (c != 0) {
    pcVar1 = (char *)(c + (int)dp);
    do {
      *(char *)dp = (char)(*lp >> 0x15) + -1;
      dp = (void *)((int)dp + 1);
      lp = lp + 1;
    } while (dp != pcVar1);
  }
  return;
}



----------------------------------------

// Function: s32tou8 @ 089554cc

void s32tou8(void *dp,int32 *lp,int32 c)

{
  byte *pbVar1;
  
                    /* Unresolved local var: uint8 * cp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  if (c != 0) {
    pbVar1 = (byte *)(c + (int)dp);
    do {
      *(byte *)dp = (char)(*lp >> 0x15) - 1U ^ 0x80;
      dp = (void *)((int)dp + 1);
      lp = lp + 1;
    } while (dp != pbVar1);
  }
  return;
}



----------------------------------------

// Function: s32tos16 @ 08955510

void s32tos16(void *dp,int32 *lp,int32 c)

{
  int iVar1;
  int iVar2;
  
                    /* Unresolved local var: int16 * sp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  iVar2 = 0;
  if (c != 0) {
    do {
      iVar1 = *lp;
      iVar2 = iVar2 + 1;
      lp = lp + 1;
      *(short *)dp = (short)(iVar1 >> 0xd) + -1;
      dp = (void *)((int)dp + 2);
    } while (iVar2 != c);
  }
  return;
}



----------------------------------------

// Function: s32tou16 @ 0895554c

void s32tou16(void *dp,int32 *lp,int32 c)

{
  int iVar1;
  int iVar2;
  
                    /* Unresolved local var: uint16 * sp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  iVar2 = 0;
  if (c != 0) {
    do {
      iVar1 = *lp;
      iVar2 = iVar2 + 1;
      lp = lp + 1;
      *(ushort *)dp = (short)(iVar1 >> 0xd) - 1U ^ 0x8000;
      dp = (void *)((int)dp + 2);
    } while (iVar2 != c);
  }
  return;
}



----------------------------------------

// Function: s32tos16x @ 0895558c

void s32tos16x(void *dp,int32 *lp,int32 c)

{
  ushort uVar1;
  int iVar2;
  int iVar3;
  
                    /* Unresolved local var: int16 * sp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  iVar3 = 0;
  if (c != 0) {
    do {
      iVar2 = *lp;
      iVar3 = iVar3 + 1;
      lp = lp + 1;
      uVar1 = (short)(iVar2 >> 0xd) - 1;
      *(ushort *)dp = uVar1 * 0x100 | uVar1 >> 8;
      dp = (void *)((int)dp + 2);
    } while (iVar3 != c);
  }
  return;
}



----------------------------------------

// Function: s32tou16x @ 089555dc

void s32tou16x(void *dp,int32 *lp,int32 c)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  
                    /* Unresolved local var: uint16 * sp@[DW_OP_reg4(a0)]
                       Unresolved local var: int32 l@[???] */
  iVar3 = 0;
  if (c != 0) {
    do {
      iVar1 = *lp;
      iVar3 = iVar3 + 1;
      lp = lp + 1;
      uVar2 = (iVar1 >> 0xd) - 1U ^ 0xffff8000;
      *(ushort *)dp = (ushort)((uVar2 & 0xff) << 8) | (ushort)(uVar2 >> 8) & 0xff;
      dp = (void *)((int)dp + 2);
    } while (iVar3 != c);
  }
  return;
}



----------------------------------------

// Function: s32toulaw @ 08955630

void s32toulaw(void *dp,int32 *lp,int32 c)

{
  uint8 *puVar1;
  
                    /* Unresolved local var: uint8 * up@[???]
                       Unresolved local var: int32 l@[???] */
  if (c != 0) {
    puVar1 = (uint8 *)(c + (int)dp);
    do {
      *(uint8 *)dp = _l2u[*(short *)((int)lp + 2) + -1];
      dp = (void *)((int)dp + 1);
      lp = lp + 1;
    } while (dp != puVar1);
  }
  return;
}



----------------------------------------

// Function: pre_resample @ 08955680

/* WARNING: Removing unreachable block (ram,0x089556c0) */
/* WARNING: Removing unreachable block (ram,0x089556fc) */
/* WARNING: Removing unreachable block (ram,0x08955a70) */

void pre_resample(Sample *sp)

{
  short sVar1;
  SItype SVar2;
  short *psVar3;
  SItype SVar4;
  short *psVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  short *psVar9;
  int arg_a;
  SFtype in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  uint uVar10;
  short *local_68;
  int local_5c;
  uint local_54;
  
                    /* Unresolved local var: double a@[???]
                       Unresolved local var: double xdiff@[???]
                       Unresolved local var: int32 incr@[???]
                       Unresolved local var: int32 ofs@[???]
                       Unresolved local var: int32 newlen@[???]
                       Unresolved local var: int32 count@[???]
                       Unresolved local var: int16 * src@[???]
                       Unresolved local var: resample_t * newdata@[???]
                       Unresolved local var: resample_t * dest@[???]
                       Unresolved local var: int16 v1@[???]
                       Unresolved local var: int16 v2@[???]
                       Unresolved local var: int16 v3@[???]
                       Unresolved local var: int16 v4@[???]
                       Unresolved local var: int16 * vptr@[???] */
  psVar5 = sp->data;
  (*ctl->cmsg)(0,2," * pre-resampling for note %d (%s%d)",(int)sp->note_to_use);
  __floatsidf(sp->sample_rate);
  __floatsidf(freq_table[sp->note_to_use]);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  __floatsidf(sp->root_freq);
  __floatsidf(play_mode->rate);
  __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar2 = __ledf2((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  if (SVar2 < 1) {
    return;
  }
  __floatsidf(sp->data_length);
  __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar2 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
  if (SVar2 < 0) {
    return;
  }
  local_5c = SVar2 >> 0xc;
  if (0x100000 < local_5c) {
    return;
  }
  psVar3 = safe_malloc(SVar2 >> 0xb);
  uVar10 = (sp->data_length + -0x1000) / (local_5c + -1);
  if (local_5c + -1 == 0) {
    trap(7);
  }
  if (local_5c == 2) {
    local_5c = -1;
    local_68 = psVar3;
    local_54 = uVar10;
  }
  else {
    local_5c = local_5c + -3;
    local_68 = psVar3 + 1;
    *psVar3 = *psVar5;
    local_54 = uVar10;
    if (local_5c == 0) goto LAB_08955ab8;
  }
  do {
    local_5c = local_5c + -1;
    uVar6 = local_54 + uVar10;
    psVar9 = psVar5 + ((int)local_54 >> 0xc);
    __floatsidf(local_54 & 0xfff);
    arg_a = (int)*psVar9;
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    in_f12 = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
    __extendsfdf2(in_f12);
    __floatsidf(arg_a);
    iVar8 = (int)psVar9[-1];
    __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    iVar7 = (int)psVar9[1];
    sVar1 = psVar9[2];
    __floatsidf((iVar8 * -2 + arg_a * -3 + iVar7 * 6) - (int)sVar1);
    __floatsidf((iVar7 + iVar8 + arg_a * -2) * 3);
    __floatsidf((int)sVar1 + ((arg_a - iVar7) * 3 - iVar8));
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __adddf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __adddf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __adddf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    SVar4 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
    *local_68 = (short)SVar4;
    local_68 = local_68 + 1;
    local_54 = uVar6;
  } while (local_5c != 0);
LAB_08955ab8:
  if ((local_54 & 0xfff) == 0) {
    *local_68 = psVar5[(int)local_54 >> 0xc];
  }
  else {
    sVar1 = psVar5[(int)local_54 >> 0xc];
    *local_68 = (short)((local_54 & 0xfff) *
                        ((int)(psVar5 + ((int)local_54 >> 0xc))[1] - (int)sVar1) >> 0xc) + sVar1;
  }
  sp->data_length = SVar2;
  __floatsidf(sp->loop_start);
  __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar2 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
  sp->loop_start = SVar2;
  __floatsidf(sp->loop_end);
  __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
  SVar2 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,in_f12));
  sp->loop_end = SVar2;
  free(sp->data);
  sp->sample_rate = 0;
  sp->data = psVar3;
  return;
}



----------------------------------------

// Function: update_vibrato @ 08955bcc

int32 update_vibrato(Voice *vp,int sign)

{
  int iVar1;
  int iVar2;
  int iVar3;
  Sample *pSVar4;
  SItype SVar5;
  SFtype arg_a;
  undefined4 in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int32 depth@[???]
                       Unresolved local var: int phase@[???]
                       Unresolved local var: int pb@[???]
                       Unresolved local var: double a@[???] */
  iVar1 = vp->vibrato_phase;
  iVar2 = iVar1 + 1;
  vp->vibrato_phase = iVar2;
  if (iVar1 < 0x3f) {
    if (iVar2 < 0x10) {
      iVar2 = 0xf - iVar2;
    }
    else if (iVar2 < 0x30) {
      iVar2 = iVar1 + -0xf;
    }
    else {
      iVar2 = 0x4f - iVar2;
    }
  }
  else {
    iVar2 = 0xf;
    vp->vibrato_phase = 0;
  }
  iVar1 = vp->vibrato_sample_increment[iVar2];
  if (iVar1 == 0) {
    pSVar4 = vp->sample;
    iVar1 = vp->vibrato_sweep;
    SVar5 = (uint)pSVar4->vibrato_depth * 0x80;
    if (iVar1 != 0) {
      iVar3 = iVar1 + vp->vibrato_sweep_position;
      vp->vibrato_sweep_position = iVar3;
      if (iVar3 < 0x10000) {
        SVar5 = SVar5 * iVar3 >> 0x10;
      }
      else {
        iVar1 = 0;
        vp->vibrato_sweep = 0;
      }
    }
    __floatsidf(pSVar4->sample_rate);
    __floatsidf(vp->frequency);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __floatsidf(pSVar4->root_freq);
    __floatsidf(play_mode->rate);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __divdf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    arg_a = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
    __extendsfdf2(arg_a);
    __floatsidf(vp->vibrato_phase << 4);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    sin((double)CONCAT44(in_f13,arg_a));
    __floatsidf(SVar5);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    SVar5 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
    if (SVar5 < 0) {
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
      __divdf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    }
    else {
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    }
    if (iVar1 == 0) {
      SVar5 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
      vp->vibrato_sample_increment[iVar2] = SVar5;
    }
    SVar5 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
    return SVar5;
  }
  if (sign != 0) {
    iVar1 = -iVar1;
  }
  return iVar1;
}



----------------------------------------

// Function: resample_voice @ 08955f1c

resample_t * resample_voice(int v,int32 *countptr)

{
  byte bVar1;
  short sVar2;
  bool bVar3;
  resample_t *prVar4;
  ControlMode *pCVar5;
  short *psVar6;
  int iVar7;
  uint uVar8;
  Sample *pSVar9;
  resample_t *prVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  sample_t *psVar14;
  uint uVar15;
  int iVar16;
  int iVar17;
  uint uVar18;
  int iVar19;
  int32 iVar20;
  Voice *vp;
  int32 iVar21;
  
                    /* Unresolved local var: int32 ofs@[???]
                       Unresolved local var: uint8 modes@[???]
                       Unresolved local var: Voice * vp@[???] */
  pCVar5 = ctl;
  vp = voice + v;
  pSVar9 = voice[v].sample;
  if (pSVar9->sample_rate == 0) {
    iVar7 = voice[v].sample_offset >> 0xc;
    if (*countptr < (pSVar9->data_length >> 0xc) - iVar7) {
      voice[v].sample_offset = voice[v].sample_offset + *countptr * 0x1000;
    }
    else {
      vp->status = '\0';
      (*pCVar5->note)(v);
      pSVar9 = voice[v].sample;
      *countptr = (pSVar9->data_length >> 0xc) - iVar7;
    }
    return pSVar9->data + iVar7;
  }
  bVar1 = pSVar9->modes;
  if (voice[v].vibrato_control_ratio == 0) {
    if (((bVar1 & 4) == 0) || (((bVar1 & 0x40) == 0 && (1 < (byte)(vp->status - 1))))) {
      uVar15 = pSVar9->data_length;
      uVar18 = voice[v].sample_offset;
      trap(7);
      iVar12 = *countptr;
      iVar7 = (int)(uVar15 - uVar18) / 0 + 1;
      psVar14 = pSVar9->data;
      if (iVar12 < iVar7) {
        iVar19 = 0;
        iVar7 = iVar12;
      }
      else {
        iVar19 = iVar12 - iVar7;
      }
      prVar10 = resample_buffer;
      if (0 < iVar7) {
        iVar12 = 0;
        do {
          psVar6 = psVar14 + ((int)uVar18 >> 0xc);
          sVar2 = *psVar6;
          iVar12 = iVar12 + 1;
          *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * (uVar18 & 0xfff) >> 0xc) + sVar2;
          prVar10 = prVar10 + 1;
        } while (iVar7 != iVar12);
      }
      if ((int)uVar15 <= (int)uVar18) {
        if (uVar15 == uVar18) {
          *prVar10 = psVar14[(int)uVar18 >> 0xc];
        }
        pCVar5 = ctl;
        vp->status = '\0';
        (*pCVar5->note)(v);
        *countptr = (*countptr - iVar19) + -1;
      }
      voice[v].sample_offset = uVar18;
      return resample_buffer;
    }
    if ((bVar1 & 8) != 0) {
      iVar17 = pSVar9->loop_start;
                    /* Unresolved local var: sample_t v1@[???]
                       Unresolved local var: sample_t v2@[???]
                       Unresolved local var: int32 ofs@[???]
                       Unresolved local var: int32 incr@[???]
                       Unresolved local var: int32 le@[???]
                       Unresolved local var: int32 ls@[???]
                       Unresolved local var: resample_t * dest@[???]
                       Unresolved local var: sample_t * src@[???]
                       Unresolved local var: int32 le2@[???]
                       Unresolved local var: int32 ls2@[???]
                       Unresolved local var: int32 i@[???] */
      uVar15 = voice[v].sample_offset;
      iVar19 = pSVar9->loop_end;
      iVar12 = *countptr;
      psVar14 = pSVar9->data;
      iVar7 = voice[v].sample_increment;
      prVar10 = resample_buffer;
      prVar4 = resample_buffer;
      if ((int)uVar15 <= iVar17) {
        if (iVar7 == 0) {
          trap(7);
        }
        iVar13 = (int)(iVar17 - uVar15) / iVar7 + 1;
        iVar16 = iVar12 - iVar13;
        if (iVar12 < iVar13) {
          iVar16 = 0;
          iVar13 = iVar12;
        }
        iVar11 = 0;
        iVar12 = iVar16;
        if (iVar13 != 0) {
          do {
            psVar6 = psVar14 + ((int)uVar15 >> 0xc);
            sVar2 = *psVar6;
            uVar18 = uVar15 & 0xfff;
            iVar11 = iVar11 + 1;
            uVar15 = uVar15 + iVar7;
            *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * uVar18 >> 0xc) + sVar2;
            prVar10 = prVar10 + 1;
            prVar4 = resample_buffer;
          } while (iVar13 != iVar11);
        }
      }
      while (resample_buffer = prVar4, iVar12 != 0) {
        iVar13 = iVar19;
        if (iVar7 < 1) {
          iVar13 = iVar17;
        }
        if (iVar7 == 0) {
          trap(7);
        }
        iVar13 = (int)(iVar13 - uVar15) / iVar7 + 1;
        if (iVar12 < iVar13) {
          iVar16 = 0;
        }
        else {
          iVar16 = iVar12 - iVar13;
          iVar12 = iVar13;
        }
        if (iVar12 != 0) {
          iVar13 = 0;
          do {
            psVar6 = psVar14 + ((int)uVar15 >> 0xc);
            sVar2 = *psVar6;
            uVar18 = uVar15 & 0xfff;
            iVar13 = iVar13 + 1;
            uVar15 = iVar7 + uVar15;
            *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * uVar18 >> 0xc) + sVar2;
            prVar10 = prVar10 + 1;
          } while (iVar13 != iVar12);
        }
        iVar12 = iVar16;
        prVar4 = resample_buffer;
        if ((int)uVar15 < iVar19) {
          if ((int)uVar15 <= iVar17) {
            uVar15 = iVar17 * 2 - uVar15;
            iVar7 = -iVar7;
          }
        }
        else {
          uVar15 = iVar19 * 2 - uVar15;
          iVar7 = -iVar7;
        }
      }
      voice[v].sample_offset = uVar15;
      voice[v].sample_increment = iVar7;
      return prVar4;
    }
                    /* Unresolved local var: sample_t v1@[???]
                       Unresolved local var: sample_t v2@[???]
                       Unresolved local var: int32 ofs@[???]
                       Unresolved local var: int32 incr@[???]
                       Unresolved local var: int32 le@[???]
                       Unresolved local var: int32 ll@[???]
                       Unresolved local var: resample_t * dest@[???]
                       Unresolved local var: sample_t * src@[???]
                       Unresolved local var: int32 i@[???] */
    iVar19 = pSVar9->loop_end;
    iVar7 = pSVar9->loop_start;
    uVar15 = voice[v].sample_offset;
    psVar14 = pSVar9->data;
    iVar12 = voice[v].sample_increment;
    if ((int)uVar15 < 0) {
      return resample_buffer;
    }
    iVar17 = *countptr;
    prVar10 = resample_buffer;
    prVar4 = resample_buffer;
    if (iVar19 < 0) {
      return resample_buffer;
    }
    while (resample_buffer = prVar4, iVar17 != 0) {
      if (iVar19 <= (int)uVar15) {
        uVar15 = uVar15 - (iVar19 - iVar7);
      }
      if (iVar12 == 0) {
        trap(7);
      }
      iVar13 = (int)(iVar19 - uVar15) / iVar12 + 1;
      iVar16 = iVar17 - iVar13;
      if (iVar17 < iVar13) {
        iVar16 = 0;
        iVar13 = iVar17;
      }
      iVar17 = iVar16;
      if ((0 < iVar13) && (iVar13 != 0)) {
        iVar16 = 0;
        do {
          iVar11 = (int)uVar15 >> 0xc;
          sVar2 = psVar14[iVar11];
          uVar18 = uVar15 & 0xfff;
          iVar16 = iVar16 + 1;
          uVar15 = iVar12 + uVar15;
          *prVar10 = (short)(((int)(psVar14 + iVar11)[1] - (int)sVar2) * uVar18 >> 0xc) + sVar2;
          prVar10 = prVar10 + 1;
          prVar4 = resample_buffer;
        } while (iVar13 != iVar16);
      }
    }
    voice[v].sample_offset = uVar15;
    return prVar4;
  }
  if (((bVar1 & 4) == 0) || (((bVar1 & 0x40) == 0 && (1 < (byte)(vp->status - 1))))) {
    uVar18 = pSVar9->data_length;
    psVar14 = pSVar9->data;
    uVar15 = voice[v].sample_offset;
    iVar7 = *countptr;
    iVar20 = voice[v].vibrato_control_counter;
    iVar21 = 0;
    prVar10 = resample_buffer;
    do {
      iVar7 = iVar7 + -1;
      if (iVar7 == -1) goto LAB_08956428;
      iVar20 = iVar20 + -1;
      if (iVar20 == -1) {
        iVar20 = voice[v].vibrato_control_ratio;
        iVar21 = update_vibrato(vp,0);
      }
      psVar6 = psVar14 + ((int)uVar15 >> 0xc);
      sVar2 = *psVar6;
      uVar8 = uVar15 & 0xfff;
      uVar15 = uVar15 + iVar21;
      *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * uVar8 >> 0xc) + sVar2;
      prVar10 = prVar10 + 1;
    } while ((int)uVar15 < (int)uVar18);
    if (uVar18 == uVar15) {
      *prVar10 = psVar14[(int)uVar15 >> 0xc];
    }
    pCVar5 = ctl;
    vp->status = '\0';
    (*pCVar5->note)(v);
    *countptr = (*countptr - iVar7) + -1;
LAB_08956428:
    voice[v].sample_offset = uVar15;
    voice[v].vibrato_control_counter = iVar20;
    voice[v].sample_increment = iVar21;
    return resample_buffer;
  }
  if ((bVar1 & 8) == 0) {
                    /* Unresolved local var: sample_t v1@[???]
                       Unresolved local var: sample_t v2@[???]
                       Unresolved local var: int32 ofs@[???]
                       Unresolved local var: int32 incr@[???]
                       Unresolved local var: int32 le@[???]
                       Unresolved local var: int32 ll@[???]
                       Unresolved local var: resample_t * dest@[???]
                       Unresolved local var: sample_t * src@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: int32 i@[???]
                       Unresolved local var: int vibflag@[???] */
    iVar12 = pSVar9->loop_start;
    iVar19 = *countptr;
    iVar17 = pSVar9->loop_end;
    psVar14 = pSVar9->data;
    uVar15 = voice[v].sample_offset;
    iVar21 = voice[v].sample_increment;
    iVar7 = voice[v].vibrato_control_counter;
    if (iVar19 != 0) {
      bVar3 = false;
      prVar10 = resample_buffer;
      iVar13 = iVar7;
      do {
        if (iVar17 <= (int)uVar15) {
          uVar15 = uVar15 - (iVar17 - iVar12);
        }
        if (iVar21 == 0) {
          trap(7);
        }
        iVar16 = (int)(iVar17 - uVar15) / iVar21 + 1 + iVar19;
        if (iVar13 < iVar16) {
          bVar3 = true;
          iVar7 = iVar13;
        }
        else {
          iVar7 = iVar13 - iVar16;
          iVar13 = iVar16;
        }
        iVar19 = iVar19 - iVar13;
        if (iVar13 != 0) {
          iVar16 = 0;
          do {
            iVar11 = (int)uVar15 >> 0xc;
            sVar2 = psVar14[iVar11];
            uVar18 = uVar15 & 0xfff;
            iVar16 = iVar16 + 1;
            uVar15 = uVar15 + iVar21;
            *prVar10 = (short)(((int)(psVar14 + iVar11)[1] - (int)sVar2) * uVar18 >> 0xc) + sVar2;
            prVar10 = prVar10 + 1;
          } while (iVar13 != iVar16);
        }
        if (bVar3) {
          iVar7 = voice[v].vibrato_control_ratio;
          iVar21 = update_vibrato(vp,0);
          bVar3 = false;
        }
        iVar13 = iVar7;
      } while (iVar19 != 0);
    }
    prVar10 = resample_buffer;
    voice[v].sample_offset = uVar15;
    voice[v].vibrato_control_counter = iVar7;
    voice[v].sample_increment = iVar21;
    return prVar10;
  }
  iVar7 = *countptr;
                    /* Unresolved local var: sample_t v1@[???]
                       Unresolved local var: sample_t v2@[???]
                       Unresolved local var: int32 ofs@[???]
                       Unresolved local var: int32 incr@[???]
                       Unresolved local var: int32 le@[???]
                       Unresolved local var: int32 ls@[???]
                       Unresolved local var: resample_t * dest@[???]
                       Unresolved local var: sample_t * src@[???]
                       Unresolved local var: int cc@[???]
                       Unresolved local var: int32 le2@[???]
                       Unresolved local var: int32 ls2@[???]
                       Unresolved local var: int32 i@[???]
                       Unresolved local var: int vibflag@[???] */
  iVar19 = pSVar9->loop_start;
  iVar17 = pSVar9->loop_end;
  psVar14 = pSVar9->data;
  uVar18 = voice[v].sample_offset;
  uVar15 = voice[v].sample_increment;
  iVar12 = voice[v].vibrato_control_counter;
  if (iVar7 != 0) {
    bVar3 = false;
    iVar13 = iVar12;
    prVar10 = resample_buffer;
    do {
      if (iVar19 < (int)uVar18) goto LAB_0895654c;
      if (uVar15 == 0) {
        trap(7);
      }
      iVar16 = (int)(iVar19 - uVar18) / (int)uVar15 + 1 + iVar7;
      if (iVar13 < iVar16) {
        bVar3 = true;
        iVar12 = iVar13;
      }
      else {
        iVar12 = iVar13 - iVar16;
        iVar13 = iVar16;
      }
      iVar7 = iVar7 - iVar13;
      if (iVar13 != 0) {
        iVar16 = 0;
        do {
          psVar6 = psVar14 + ((int)uVar18 >> 0xc);
          sVar2 = *psVar6;
          uVar8 = uVar18 & 0xfff;
          iVar16 = iVar16 + 1;
          uVar18 = uVar18 + uVar15;
          *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * uVar8 >> 0xc) + sVar2;
          prVar10 = prVar10 + 1;
        } while (iVar13 != iVar16);
      }
      if (bVar3) {
        iVar12 = voice[v].vibrato_control_ratio;
        uVar15 = update_vibrato(vp,0);
        bVar3 = false;
      }
      iVar13 = iVar12;
    } while (iVar7 != 0);
  }
LAB_089565f8:
  prVar10 = resample_buffer;
  voice[v].sample_offset = uVar18;
  voice[v].vibrato_control_counter = iVar12;
  voice[v].sample_increment = uVar15;
  return prVar10;
LAB_0895654c:
  do {
    iVar12 = iVar17;
    if ((int)uVar15 < 1) {
      iVar12 = iVar19;
    }
    if (uVar15 == 0) {
      trap(7);
    }
    iVar16 = (int)(iVar12 - uVar18) / (int)uVar15 + 1 + iVar7;
    if (iVar13 < iVar16) {
      bVar3 = true;
      iVar12 = iVar13;
    }
    else {
      iVar12 = iVar13 - iVar16;
      iVar13 = iVar16;
    }
    iVar7 = iVar7 - iVar13;
    if (iVar13 != 0) {
      iVar16 = 0;
      do {
        psVar6 = psVar14 + ((int)uVar18 >> 0xc);
        sVar2 = *psVar6;
        uVar8 = uVar18 & 0xfff;
        iVar16 = iVar16 + 1;
        uVar18 = uVar15 + uVar18;
        *prVar10 = (short)(((int)psVar6[1] - (int)sVar2) * uVar8 >> 0xc) + sVar2;
        prVar10 = prVar10 + 1;
      } while (iVar16 != iVar13);
    }
    if (bVar3) {
      iVar12 = voice[v].vibrato_control_ratio;
      uVar15 = update_vibrato(vp,uVar15 >> 0x1f);
    }
    if ((int)uVar18 < iVar17) {
      if ((int)uVar18 <= iVar19) {
        uVar15 = -uVar15;
        uVar18 = iVar19 * 2 - uVar18;
      }
    }
    else {
      uVar18 = iVar17 * 2 - uVar18;
      uVar15 = -uVar15;
    }
    bVar3 = false;
    iVar13 = iVar12;
  } while (iVar7 != 0);
  goto LAB_089565f8;
}



----------------------------------------

// Function: safe_malloc @ 08956834

void * safe_malloc(size_t count)

{
  void *pvVar1;
  char *pcVar2;
  
                    /* Unresolved local var: void * p@[???] */
  if (count < 0x200001) {
    pvVar1 = malloc(count);
    if (pvVar1 != (void *)0x0) {
      return pvVar1;
    }
    pcVar2 = "Sorry. Couldn\'t malloc %d bytes.";
  }
  else {
    pcVar2 = "Strange, I feel like allocating %d bytes. This must be a bug.";
  }
  (*ctl->cmsg)(3,0,pcVar2,count);
  (*ctl->close)();
                    /* WARNING: Subroutine does not return */
  exit(10);
}



----------------------------------------

// Function: add_to_pathlist @ 089568c8

void add_to_pathlist(char *s)

{
  PathList *pPVar1;
  size_t sVar2;
  char *dst0;
  
                    /* Unresolved local var: PathList * plp@[???] */
  pPVar1 = safe_malloc(8);
  sVar2 = strlen(s);
  dst0 = safe_malloc(sVar2 + 1);
  pPVar1->path = dst0;
  strcpy(dst0,s);
  pPVar1->next = pathlist;
  pathlist = pPVar1;
  return;
}



----------------------------------------

// Function: skip @ 0895692c

void skip(FILE *fp,size_t len)

{
  size_t sVar1;
  int *piVar2;
  size_t count;
  _func_int_int_int_char_ptr_varargs *p_Var3;
  undefined1 auStack_420 [1024];
  
                    /* Unresolved local var: size_t c@[???]
                       Unresolved local var: char[1024] tmp@[???] */
  while (len != 0) {
    count = 0x400;
    if (len < 0x401) {
      count = len;
    }
    len = len - count;
    sVar1 = fread(auStack_420,1,count,fp);
    if (count != sVar1) {
      p_Var3 = ctl->cmsg;
      piVar2 = __errno();
      strerror(*piVar2);
      (*p_Var3)(2,0,"%s: skip: %s",current_filename);
    }
  }
  return;
}



----------------------------------------

// Function: close_file @ 089569f0

void close_file(FILE *fp)

{
  _fclose_r(_impure_ptr,fp);
  return;
}



----------------------------------------

// Function: try_to_open @ 089569f8

FILE * try_to_open(char *name,int decompress,int noise_mode)

{
  FILE *pFVar1;
  
                    /* Unresolved local var: FILE * fp@[???] */
  pFVar1 = fopen(name,"rb");
  return pFVar1;
}



----------------------------------------

// Function: open_file @ 08956a04

FILE * open_file(char *name,int decompress,int noise_mode)

{
  FILE *pFVar1;
  PathList *pPVar2;
  size_t sVar3;
  int *piVar4;
  char cVar5;
  char *__s;
  _func_int_int_int_char_ptr_varargs *p_Var6;
  FILE *pFVar7;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: PathList * plp@[???]
                       Unresolved local var: int l@[???] */
  pPVar2 = pathlist;
  if ((name == (char *)0x0) || (*name == '\0')) {
    (*ctl->cmsg)(2,0,"Attempted to open nameless file.");
    pFVar7 = (FILE *)0x0;
  }
  else {
    strncpy(current_filename,name,0x3ff);
    current_filename[0x3ff] = '\0';
    (*ctl->cmsg)(0,3,"Trying to open %s",current_filename);
    pFVar7 = try_to_open(current_filename,decompress,noise_mode);
    if (pFVar7 == (FILE *)0x0) {
      if (noise_mode == 0) {
        cVar5 = *name;
      }
      else {
        piVar4 = __errno();
        if (*piVar4 != 2) {
          p_Var6 = ctl->cmsg;
          piVar4 = __errno();
          strerror(*piVar4);
          (*p_Var6)(2,0,"%s: %s",current_filename);
          return (FILE *)0x0;
        }
        cVar5 = *name;
      }
      if (cVar5 != '/') {
        while (pPVar2 != (PathList *)0x0) {
          current_filename[0] = '\0';
          __s = pPVar2->path;
          sVar3 = strlen(__s);
          if ((sVar3 != 0) &&
             (strcpy(current_filename,__s), *(char *)((int)&resample_buffer + sVar3 + 3) != '/')) {
            sVar3 = strlen(PTR_current_filename_089e6578);
            cVar5 = DAT_089e07cd;
            current_filename[sVar3] = DAT_089e07cc;
            current_filename[sVar3 + 1] = cVar5;
          }
          strcat(current_filename,name);
          (*ctl->cmsg)(0,3,"Trying to open %s",current_filename);
          pFVar1 = try_to_open(current_filename,decompress,noise_mode);
          if (pFVar1 != (FILE *)0x0) {
            return pFVar1;
          }
          if (noise_mode == 0) {
            pPVar2 = pPVar2->next;
          }
          else {
            piVar4 = __errno();
            if (*piVar4 != 2) {
              p_Var6 = ctl->cmsg;
              piVar4 = __errno();
              strerror(*piVar4);
              (*p_Var6)(2,0,"%s: %s",current_filename);
              return (FILE *)0x0;
            }
            pPVar2 = pPVar2->next;
          }
        }
      }
      current_filename[0] = '\0';
      if (1 < noise_mode) {
        p_Var6 = ctl->cmsg;
        piVar4 = __errno();
        strerror(*piVar4);
        (*p_Var6)(2,0,"%s: %s",name);
      }
    }
  }
  return pFVar7;
}



----------------------------------------

// Function: convert_envelope_rate_attack @ 08956cf0

int32 convert_envelope_rate_attack(uint8 rate,uint8 fastness)

{
                    /* Unresolved local var: int32 r@[???] */
  if (play_mode->rate == 0) {
    trap(7);
  }
  return ((int)(((rate & 0x3f) << ((rate ^ 0xc0) >> 6) * 3) * 0xac44) / play_mode->rate) *
         control_ratio * 0x400;
}



----------------------------------------

// Function: convert_envelope_rate @ 08956d50

int32 convert_envelope_rate(uint8 rate)

{
  int iVar1;
  
                    /* Unresolved local var: int32 r@[???] */
  iVar1 = 10;
  if (fast_decay == 0) {
    iVar1 = 9;
  }
  if (play_mode->rate == 0) {
    trap(7);
  }
  return ((int)(((rate & 0x3f) << ((rate ^ 0xc0) >> 6) * 3) * 0xac44) / play_mode->rate) *
         control_ratio << iVar1;
}



----------------------------------------

// Function: convert_envelope_offset @ 08956dc4

int32 convert_envelope_offset(uint8 offset)

{
  return (uint)offset << 0x16;
}



----------------------------------------

// Function: convert_tremolo_sweep @ 08956dd0

int32 convert_tremolo_sweep(uint8 sweep)

{
  int iVar1;
  int32 iVar2;
  
  iVar2 = 0;
  if ((sweep != '\0') &&
     (iVar1 = (uint)sweep * play_mode->rate, iVar2 = (control_ratio * 0x260000) / iVar1, iVar1 == 0)
     ) {
    trap(7);
  }
  return iVar2;
}



----------------------------------------

// Function: convert_vibrato_sweep @ 08956e20

int32 convert_vibrato_sweep(uint8 sweep,int32 vib_control_ratio)

{
  SItype SVar1;
  SFtype arg_a;
  undefined4 in_f12;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  
  SVar1 = 0;
  if (sweep != '\0') {
    __floatsidf(vib_control_ratio);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,in_f12),in_f14_15);
    arg_a = __truncdfsf2((DFtype)CONCAT44(in_f13,in_f12));
    __extendsfdf2(arg_a);
    __floatsidf((uint)sweep * play_mode->rate);
    __divdf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    SVar1 = __fixdfsi((FLO_type_conflict)CONCAT44(in_f13,arg_a));
  }
  return SVar1;
}



----------------------------------------

// Function: convert_tremolo_rate @ 08956ee8

int32 convert_tremolo_rate(uint8 rate)

{
  int iVar1;
  
  iVar1 = play_mode->rate * 0x26;
  if (iVar1 == 0) {
    trap(7);
  }
  return (int)((uint)rate * control_ratio * 0x400 * 0x20) / iVar1;
}



----------------------------------------

// Function: convert_vibrato_rate @ 08956f30

int32 convert_vibrato_rate(uint8 rate)

{
  if (rate == '\0') {
    trap(7);
  }
  return (play_mode->rate * 0x26) / (int)((uint)rate << 6);
}



----------------------------------------

// Function: free_layer @ 08956f64

void free_layer(InstrumentLayer *lp)

{
  void *pvVar1;
  Sample *pSVar2;
  int iVar3;
  Instrument *aptr;
  int iVar4;
  _InstrumentLayer *p_Var5;
  int iVar6;
  
                    /* Unresolved local var: InstrumentLayer * next@[???] */
  current_patch_memory = current_patch_memory - lp->size;
  do {
    aptr = lp->instrument;
                    /* Unresolved local var: Sample * sp@[???]
                       Unresolved local var: int i@[???] */
    p_Var5 = lp->next;
    if (aptr != (Instrument *)0x0) {
      if (aptr->contents == (uchar *)0x0) {
        iVar3 = aptr->samples;
        iVar4 = 0;
        if (iVar3 < 1) goto LAB_08956fb0;
        pSVar2 = aptr->sample;
        iVar6 = 0;
        do {
          iVar4 = iVar4 + 1;
          pvVar1 = *(void **)((int)pSVar2->modulation_offset + iVar6 + 0x44);
          if (pvVar1 != (void *)0x0) {
            free(pvVar1);
            iVar3 = aptr->samples;
            pSVar2 = aptr->sample;
          }
          iVar6 = iVar4 * 0xf8;
        } while (iVar4 < iVar3);
        free(pSVar2);
        if (aptr->contents == (uchar *)0x0) {
          iVar3 = aptr->right_samples;
          goto LAB_08957074;
        }
        pSVar2 = aptr->right_sample;
      }
      else {
LAB_08956fb0:
        free(aptr->sample);
        if (aptr->contents == (uchar *)0x0) {
          iVar3 = aptr->right_samples;
LAB_08957074:
          iVar4 = 0;
          if (0 < iVar3) {
            pSVar2 = aptr->right_sample;
            iVar6 = 0;
            do {
              iVar4 = iVar4 + 1;
              pvVar1 = *(void **)((int)pSVar2->modulation_offset + iVar6 + 0x44);
              if (pvVar1 != (void *)0x0) {
                free(pvVar1);
                iVar3 = aptr->right_samples;
                pSVar2 = aptr->right_sample;
              }
              iVar6 = iVar4 * 0xf8;
            } while (iVar4 < iVar3);
            goto LAB_08956fcc;
          }
        }
        pSVar2 = aptr->right_sample;
      }
LAB_08956fcc:
      if (pSVar2 != (Sample *)0x0) {
        free(pSVar2);
      }
      free(aptr);
    }
    free(lp);
    lp = p_Var5;
    if (p_Var5 == (_InstrumentLayer *)0x0) {
      return;
    }
  } while( true );
}



----------------------------------------

// Function: free_old_bank @ 089570c4

void free_old_bank(int dr,int b,int how_old)

{
  ToneBank *pTVar1;
  InstrumentLayer *pIVar2;
  undefined *puVar3;
  int iVar4;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: ToneBank * bank@[???] */
  if (dr == 0) {
    pTVar1 = tonebank[b];
  }
  else {
    pTVar1 = drumset[b];
  }
  iVar4 = 0;
  do {
    pIVar2 = pTVar1->tone[0].layer;
    if (((pIVar2 != (InstrumentLayer *)0x0) && (pTVar1->tone[0].last_used < how_old)) &&
       (pIVar2 != (InstrumentLayer *)0xffffffff)) {
      puVar3 = &DAT_089e6770;
      if (dr == 0) {
        puVar3 = &DAT_089e6778;
      }
      (*ctl->cmsg)(0,3,"Unloading %s %s[%d,%d] - last used %d.",puVar3);
      free_layer(pTVar1->tone[0].layer);
      pTVar1->tone[0].layer = (InstrumentLayer *)0x0;
      pTVar1->tone[0].last_used = -1;
    }
    iVar4 = iVar4 + 1;
    pTVar1 = (ToneBank *)&pTVar1->tone[0].strip_tail;
  } while (iVar4 != 0x80);
  return;
}



----------------------------------------

// Function: free_bank @ 089571e8

void free_bank(int dr,int b)

{
  InstrumentLayer *lp;
  ToneBank *pTVar1;
  int iVar2;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: ToneBank * bank@[???] */
  if (dr == 0) {
    pTVar1 = tonebank[b];
  }
  else {
    pTVar1 = drumset[b];
  }
  iVar2 = 0;
  do {
    lp = pTVar1->tone[0].layer;
    iVar2 = iVar2 + 1;
    if ((lp != (InstrumentLayer *)0x0) && (lp != (InstrumentLayer *)0xffffffff)) {
      free_layer(lp);
      pTVar1->tone[0].last_used = -1;
      pTVar1->tone[0].layer = (InstrumentLayer *)0x0;
    }
    pTVar1 = (ToneBank *)&pTVar1->tone[0].strip_tail;
  } while (iVar2 != 0x80);
  return;
}



----------------------------------------

// Function: free_instruments @ 08957288

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void free_instruments(void)

{
  ToneBank *pTVar1;
  int b;
  ToneBank **ppTVar2;
  ToneBank **ppTVar3;
  
                    /* Unresolved local var: int i@[???] */
  ppTVar3 = tonebank + 0x7f;
  ppTVar2 = drumset + 0x7f;
  pTVar1 = tonebank[0x7f];
  b = 0x7f;
  while( true ) {
    ppTVar3 = ppTVar3 + -1;
    if (pTVar1 != (ToneBank *)0x0) {
      free_bank(0,b);
    }
    pTVar1 = *ppTVar2;
    ppTVar2 = ppTVar2 + -1;
    if (pTVar1 != (ToneBank *)0x0) {
      free_bank(1,b);
    }
    if (b + -1 == -1) break;
    pTVar1 = *ppTVar3;
    b = b + -1;
  }
  return;
}



----------------------------------------

// Function: load_instrument @ 08957318

/* WARNING: Removing unreachable block (ram,0x08957bd8) */
/* WARNING: Removing unreachable block (ram,0x08957cb4) */
/* WARNING: Removing unreachable block (ram,0x08958054) */
/* WARNING: Removing unreachable block (ram,0x08958064) */
/* WARNING: Removing unreachable block (ram,0x08958280) */
/* WARNING: Removing unreachable block (ram,0x089582dc) */
/* WARNING: Removing unreachable block (ram,0x08957d54) */
/* WARNING: Removing unreachable block (ram,0x08957d74) */
/* WARNING: Removing unreachable block (ram,0x08957da8) */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

InstrumentLayer *
load_instrument(char *name,int font_type,int percussion,int panning,int amp,int cfg_tuning,
               int note_to_use,int strip_loop,int strip_envelope,int strip_tail,int bank,int gm_num,
               int sf_ix)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  uint8 uVar4;
  short sVar5;
  sample_t sVar6;
  ControlMode *pCVar7;
  InstrumentLayer *pIVar8;
  byte bVar9;
  FILE *fp;
  size_t sVar10;
  int iVar11;
  InstrumentLayer *aptr;
  Instrument *aptr_00;
  uint uVar12;
  Sample *pSVar13;
  size_t sVar14;
  size_t sVar15;
  _func_int_int_int_char_ptr_varargs *p_Var16;
  int32 iVar17;
  sample_t *psVar18;
  undefined4 extraout_v0;
  USItype UVar19;
  short *psVar20;
  undefined4 extraout_v0_00;
  uint *puVar21;
  int iVar22;
  undefined4 extraout_v1;
  short *psVar23;
  undefined4 extraout_v1_00;
  ushort *puVar24;
  sample_t *psVar25;
  char *pcVar26;
  byte *pbVar27;
  int iVar28;
  uint *puVar29;
  int in_t0;
  int iVar30;
  undefined4 uVar31;
  int in_t1;
  undefined4 uVar32;
  int in_t2;
  int in_t3;
  InstrumentLayer *pIVar33;
  byte *pbVar34;
  uint uVar35;
  uint8 *puVar36;
  char **ppcVar37;
  Sample *unaff_s3;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  int local_res0;
  int local_res4;
  byte local_9b8;
  byte local_9b7;
  ushort local_9b6;
  int32 local_9b4;
  uint local_9b0 [36];
  uint local_920 [40];
  uint local_880;
  uint8 local_87a [5];
  byte local_875;
  uint8 local_874;
  uint8 local_873;
  uint8 local_872;
  uint8 local_871;
  uint8 local_870;
  uint8 local_86f;
  byte local_82e;
  undefined1 auStack_823 [58];
  byte local_7e9;
  byte local_7e8;
  byte local_7e7 [45];
  byte local_7ba;
  byte local_7b9 [825];
  Sample aSStack_480 [4];
  uint *local_80;
  int local_7c;
  uint local_78;
  uint local_74;
  int local_70;
  uint local_6c;
  int local_68;
  int local_64;
  int local_60;
  uint local_5c;
  int local_58;
  InstrumentLayer *local_54;
  char *local_50;
  int local_4c;
  int local_48;
  int local_44;
  int local_40;
  int local_3c;
  int local_38;
  uint *local_30;
  
                    /* Unresolved local var: InstrumentLayer * lp@[???]
                       Unresolved local var: InstrumentLayer * lastlp@[???]
                       Unresolved local var: InstrumentLayer * headlp@[???]
                       Unresolved local var: Instrument * ip@[???]
                       Unresolved local var: FILE * fp@[???]
                       Unresolved local var: uint8[1024] tmp@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int noluck@[???]
                       Unresolved local var: int sf2flag@[???]
                       Unresolved local var: int right_samples@[???]
                       Unresolved local var: int stereo_channels@[???]
                       Unresolved local var: int stereo_layer@[???]
                       Unresolved local var: int[19][4] vlayer_list@[???]
                       Unresolved local var: int vlayer@[???]
                       Unresolved local var: int vlayer_count@[???] */
  if (name != (char *)0x0) {
    local_50 = name;
    local_4c = percussion;
    local_48 = panning;
    local_44 = in_t0;
    local_40 = in_t1;
    local_3c = in_t2;
    local_38 = in_t3;
    fp = open_file(name,1,1);
    if (fp == (FILE *)0x0) {
      pcVar26 = ".pat";
      ppcVar37 = load_instrument::patch_ext + 1;
      unaff_s3 = aSStack_480;
      do {
        while( true ) {
          sVar14 = strlen(local_50);
          sVar15 = strlen(pcVar26);
                    /* Unresolved local var: char[1024] path@[???] */
          if (0x3ff < sVar14 + sVar15) break;
          strcpy((char *)unaff_s3,local_50);
          strcat((char *)unaff_s3,pcVar26);
          fp = open_file((char *)unaff_s3,1,1);
          if (fp != (FILE *)0x0) goto LAB_08957378;
          pcVar26 = *ppcVar37;
          ppcVar37 = ppcVar37 + 1;
          if (pcVar26 == (char *)0x0) goto LAB_089576fc;
        }
        pcVar26 = *ppcVar37;
        ppcVar37 = ppcVar37 + 1;
      } while (pcVar26 != (char *)0x0);
LAB_089576fc:
      pcVar26 = "Instrument `%s\' can\'t be found.";
    }
    else {
LAB_08957378:
      local_30 = &local_880;
      sVar10 = fread(local_30,1,0xef,fp);
      if ((sVar10 == 0xef) &&
         ((iVar11 = memcmp(&local_880,"GF1PATCH110",0x16), iVar11 == 0 ||
          (iVar11 = memcmp(&local_880,"GF1PATCH100",0x16), iVar11 == 0)))) {
        iVar11 = memcmp(auStack_823,"SF2EXT",6);
        if (iVar11 == 0) {
          local_5c = 1;
          local_6c = (uint)local_7e8;
        }
        else {
          local_5c = 0;
        }
        local_5c = (uint)(iVar11 == 0);
        if (local_82e < 2) {
          if (local_7e9 < 2) {
            puVar21 = local_9b0;
            if ((local_5c == 0) || (puVar29 = local_9b0, (int)local_6c < 1)) {
              do {
                puVar29 = local_30;
                *puVar21 = 0;
                puVar21[1] = 0;
                puVar21[2] = 0;
                puVar21[3] = 0;
                puVar21 = puVar21 + 4;
              } while (puVar21 != puVar29);
              local_9b0[2] = (uint)local_7ba;
              local_9b0[1] = 0x7f;
              local_9b0[0] = 0;
              local_9b0[3] = 0;
              local_6c = 1;
            }
            else {
              pbVar27 = local_7e7;
              do {
                bVar9 = *pbVar27;
                bVar1 = pbVar27[1];
                bVar2 = pbVar27[2];
                bVar3 = pbVar27[3];
                pbVar27 = pbVar27 + 4;
                *puVar29 = (uint)bVar9;
                puVar29[1] = (uint)bVar1;
                puVar29[2] = (uint)bVar2;
                puVar29[3] = (uint)bVar3;
                puVar29 = puVar29 + 4;
              } while (pbVar27 != local_7e7 + 0x24);
              pbVar27 = local_7b9;
              puVar21 = local_920;
              do {
                bVar9 = *pbVar27;
                bVar1 = pbVar27[1];
                bVar2 = pbVar27[2];
                bVar3 = pbVar27[3];
                pbVar27 = pbVar27 + 4;
                *puVar21 = (uint)bVar9;
                puVar21[1] = (uint)bVar1;
                puVar21[2] = (uint)bVar2;
                puVar21[3] = (uint)bVar3;
                puVar21 = puVar21 + 4;
              } while (pbVar27 != local_7b9 + 0x28);
            }
            local_80 = local_9b0;
            local_60 = 1;
            local_68 = 0;
            pIVar33 = (InstrumentLayer *)0x0;
            do {
              aptr = safe_malloc(0x10);
              aptr->size = 0x10;
              aptr->lo = (uint8)*local_80;
              aptr->hi = (uint8)local_80[1];
              aptr_00 = safe_malloc(0x20);
              aptr->instrument = aptr_00;
              aptr->next = (_InstrumentLayer *)0x0;
              aptr->size = aptr->size + 0x20;
              pIVar8 = aptr;
              if (pIVar33 != (InstrumentLayer *)0x0) {
                pIVar33->next = aptr;
                pIVar8 = local_54;
              }
              local_54 = pIVar8;
              if (local_5c == 0) {
                aptr_00->type = 0;
              }
              else {
                aptr_00->type = 1;
              }
              uVar12 = local_80[2];
              aptr_00->samples = uVar12;
              pSVar13 = safe_malloc(uVar12 * 0xf8);
              iVar11 = aptr->size;
              aptr_00->left_sample = pSVar13;
              aptr_00->sample = pSVar13;
              aptr->size = iVar11 + aptr_00->samples * 0xf8;
              aptr_00->left_samples = aptr_00->samples;
              uVar12 = local_80[3];
              aptr_00->right_samples = uVar12;
              if (uVar12 == 0) {
                aptr_00->right_sample = (Sample *)0x0;
              }
              else {
                local_60 = 2;
                pSVar13 = safe_malloc(uVar12 * 0xf8);
                iVar11 = aptr->size;
                aptr_00->right_sample = pSVar13;
                aptr->size = iVar11 + uVar12 * 0xf8;
              }
              pCVar7 = ctl;
              aptr_00->contents = (uchar *)0x0;
              if (local_4c == 0) {
                pcVar26 = "";
              }
              else {
                pcVar26 = "   ";
              }
              local_68 = local_68 + 1;
              (*pCVar7->cmsg)(0,2,"%s%s[%d,%d] %s(%d-%d layer %d of %d)",pcVar26);
              if (0 < local_60) {
                local_64 = 0;
                do {
                  if (local_64 == 0) {
                    local_70 = aptr_00->left_samples;
                  }
                  else if (local_64 == 1) {
                    local_70 = aptr_00->right_samples;
                  }
                  if (0 < local_70) {
                    local_58 = 0;
                    local_7c = 0;
                    do {
                    /* Unresolved local var: uint8 fractions@[???]
                       Unresolved local var: int32 tmplong@[???]
                       Unresolved local var: uint16 tmpshort@[???]
                       Unresolved local var: uint16 sample_volume@[???]
                       Unresolved local var: uint8 tmpchar@[???]
                       Unresolved local var: Sample * sp@[???]
                       Unresolved local var: uint8 sf2delay@[???] */
                      skip(fp,7);
                      sVar10 = fread(&local_9b8,1,1,fp);
                      if (sVar10 != 1) {
LAB_089583a4:
                        (*ctl->cmsg)(2,0,"Error reading sample %d",local_58);
                        if (local_64 == 1) {
                          iVar11 = 0;
                          if (0 < local_58) {
                            iVar22 = 0;
                            do {
                              iVar11 = iVar11 + 1;
                              free(*(void **)((int)aptr_00->right_sample->modulation_offset +
                                             iVar22 + 0x44));
                              iVar22 = iVar11 * 0xf8;
                            } while (iVar11 != local_58);
                          }
                          free(aptr_00->right_sample);
                          local_58 = aptr_00->left_samples;
                        }
                        iVar11 = 0;
                        if (0 < local_58) {
                          iVar22 = 0;
                          do {
                            iVar11 = iVar11 + 1;
                            free(*(void **)((int)aptr_00->left_sample->modulation_offset +
                                           iVar22 + 0x44));
                            iVar22 = iVar11 * 0xf8;
                          } while (local_58 != iVar11);
                        }
                        local_54 = (InstrumentLayer *)0x0;
                        free(aptr_00->left_sample);
                        free(aptr_00);
                        free(aptr);
                        return local_54;
                      }
                      if (local_64 == 0) {
                        unaff_s3 = (Sample *)
                                   ((int)aptr_00->left_sample->envelope_rate + local_7c + -0x20);
                      }
                      else if (local_64 == 1) {
                        unaff_s3 = (Sample *)
                                   ((int)aptr_00->right_sample->envelope_rate + local_7c + -0x20);
                      }
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->data_length = local_9b4;
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->loop_start = local_9b4;
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->loop_end = local_9b4;
                      sVar10 = fread(&local_9b6,2,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->sample_rate = (uint)local_9b6;
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->low_freq = local_9b4;
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->high_freq = local_9b4;
                      sVar10 = fread(&local_9b4,4,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->root_freq = local_9b4;
                      skip(fp,2);
                      sVar10 = fread(&local_9b7,1,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      local_880._0_1_ = local_9b7;
                      if (local_48 == -1) {
                        unaff_s3->panning = local_9b7 * '\b' + 4 & 0x7f;
                      }
                      else {
                        unaff_s3->panning = (byte)local_48 & 0x7f;
                      }
                      unaff_s3->reverberation = '\0';
                      unaff_s3->chorusdepth = '\0';
                      unaff_s3->exclusiveClass = '\0';
                      iVar11 = local_40;
                      *(undefined4 *)&unaff_s3->resonance = 0;
                      *(undefined4 *)((int)&unaff_s3->resonance + 4) = 0;
                      unaff_s3->cutoff_freq = 0;
                      unaff_s3->keyToModEnvHold = 0;
                      unaff_s3->keyToModEnvDecay = 0;
                      unaff_s3->keyToVolEnvHold = 0;
                      unaff_s3->keyToVolEnvDecay = 0;
                      if (iVar11 != 0) {
                    /* Unresolved local var: double tune_factor@[???] */
                        __floatsidf(iVar11);
                        __divdf3(in_f12_13,in_f14_15);
                        pow(in_f12_13,in_f14_15);
                        __floatsidf(unaff_s3->root_freq);
                        __muldf3(in_f12_13,in_f14_15);
                        UVar19 = __fixunsdfsi(in_f12_13);
                        unaff_s3->root_freq = UVar19;
                      }
                      sVar10 = fread(&local_880,1,0x12,fp);
                      if (sVar10 != 0x12) goto LAB_089583a4;
                      if ((local_873 == '\0') || (local_872 == '\0')) {
                        unaff_s3->tremolo_depth = '\0';
                        unaff_s3->tremolo_phase_increment = 0;
                        p_Var16 = ctl->cmsg;
                        unaff_s3->tremolo_sweep_increment = 0;
                        (*p_Var16)(0,3," * no tremolo");
                      }
                      else {
                        iVar17 = convert_tremolo_sweep(local_874);
                        unaff_s3->tremolo_sweep_increment = iVar17;
                        iVar17 = convert_tremolo_rate(local_873);
                        unaff_s3->tremolo_phase_increment = iVar17;
                        unaff_s3->tremolo_depth = local_872;
                        (*ctl->cmsg)(0,3," * tremolo: sweep %d, phase %d, depth %d",
                                     unaff_s3->tremolo_sweep_increment);
                      }
                      if ((local_870 == '\0') || (local_86f == '\0')) {
                        unaff_s3->vibrato_depth = '\0';
                        unaff_s3->vibrato_control_ratio = 0;
                        p_Var16 = ctl->cmsg;
                        unaff_s3->vibrato_sweep_increment = 0;
                        (*p_Var16)(0,3," * no vibrato");
                      }
                      else {
                        iVar17 = convert_vibrato_rate(local_870);
                        unaff_s3->vibrato_control_ratio = iVar17;
                        iVar17 = convert_vibrato_sweep(local_871,iVar17);
                        unaff_s3->vibrato_sweep_increment = iVar17;
                        unaff_s3->vibrato_depth = local_86f;
                        (*ctl->cmsg)(0,3," * vibrato: sweep %d, ctl %d, depth %d",iVar17);
                      }
                      sVar10 = fread(&local_9b7,1,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->modes = local_9b7;
                      sVar10 = fread(&local_9b6,2,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->freq_center = (uint8)local_9b6;
                      sVar10 = fread(&local_9b6,2,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      unaff_s3->freq_scale = (uint)local_9b6;
                      if (local_5c == 0) {
                        skip(fp,0x24);
                        if (local_3c == -1) {
                          unaff_s3->note_to_use = '\0';
                        }
                        else {
                          unaff_s3->note_to_use = (int8)local_3c;
                        }
                      }
                      else {
                        sVar10 = fread(&local_9b6,2,1,fp);
                        if (sVar10 != 1) goto LAB_089583a4;
                        local_74 = (uint)local_9b6;
                        sVar10 = fread(&local_9b7,1,1,fp);
                        if ((sVar10 != 1) ||
                           (local_78 = (uint)local_9b7, sVar10 = fread(&local_9b7,1,1,fp),
                           sVar10 != 1)) goto LAB_089583a4;
                        unaff_s3->exclusiveClass = local_9b7;
                        skip(fp,0x20);
                        if (local_3c == -1) {
                          unaff_s3->note_to_use = '\0';
                        }
                        else {
                          unaff_s3->note_to_use = (int8)local_3c;
                        }
                      }
                      if ((unaff_s3->modes & 4) != 0) {
                        unaff_s3->modes = unaff_s3->modes | 0x20;
                      }
                      if ((local_38 == 1) && ((unaff_s3->modes & 0x3c) != 0)) {
                        (*ctl->cmsg)(0,3," - Removing loop and/or sustain");
                        unaff_s3->modes = unaff_s3->modes & 0xc3;
                      }
                      if (local_res0 == 1) {
                        if ((unaff_s3->modes & 0x40) == 0) {
                          bVar9 = unaff_s3->modes;
                        }
                        else {
                          (*ctl->cmsg)(0,3," - Removing envelope");
                          bVar9 = unaff_s3->modes;
                        }
                        unaff_s3->modes = bVar9 & 0xbf;
                      }
                      else if (local_res0 != 0) {
                        bVar9 = unaff_s3->modes;
                        if ((bVar9 & 0x1c) == 0) {
                          unaff_s3->modes = bVar9 & 0x9f;
                          (*ctl->cmsg)(0,3," - No loop, removing sustain and envelope");
                        }
                        else {
                          iVar11 = memcmp(&local_880,"??????",6);
                          if ((iVar11 == 0) || (99 < local_875)) {
                            unaff_s3->modes = bVar9 & 0xbf;
                            (*ctl->cmsg)(0,3," - Weirdness, removing envelope");
                          }
                          else if ((bVar9 & 0x20) == 0) {
                            unaff_s3->modes = bVar9 & 0xbf;
                            (*ctl->cmsg)(0,3," - No sustain, removing envelope");
                          }
                        }
                      }
                      iVar11 = 0;
                      puVar36 = local_87a;
                      unaff_s3->attenuation = '\0';
                      pSVar13 = unaff_s3;
                      do {
                        while (2 < iVar11) {
                          iVar11 = iVar11 + 1;
                          iVar17 = convert_envelope_rate(puVar36[-6]);
                          pSVar13->envelope_rate[0] = iVar17;
                          uVar4 = *puVar36;
                          puVar36 = puVar36 + 1;
                          iVar17 = convert_envelope_offset(uVar4);
                          pSVar13->envelope_offset[0] = iVar17;
                          pSVar13 = (Sample *)&pSVar13->loop_end;
                          if (iVar11 == 6) goto LAB_08957b98;
                        }
                        iVar11 = iVar11 + 1;
                        iVar17 = convert_envelope_rate_attack(puVar36[-6],'\v');
                        pSVar13->envelope_rate[0] = iVar17;
                        uVar4 = *puVar36;
                        puVar36 = puVar36 + 1;
                        iVar17 = convert_envelope_offset(uVar4);
                        pSVar13->envelope_offset[0] = iVar17;
                        pSVar13 = (Sample *)&pSVar13->loop_end;
                      } while (iVar11 != 6);
LAB_08957b98:
                      if (local_5c == 0) {
                        unaff_s3->envelope_rate[6] = 0;
                      }
                      else {
                        if (5 < local_78) {
                          local_78 = 5;
                        }
                        unaff_s3->envelope_rate[6] = (int)(local_78 * play_mode->rate) / 1000;
                      }
                      unaff_s3->envelope_offset[6] = 0;
                      iVar11 = 0;
                      pSVar13 = unaff_s3;
                      do {
                        iVar11 = iVar11 + 1;
                        pSVar13->modulation_rate[0] = pSVar13->envelope_rate[0];
                        pSVar13->modulation_offset[0] = pSVar13->envelope_offset[0];
                        pSVar13 = (Sample *)&pSVar13->loop_end;
                      } while (iVar11 != 6);
                      iVar11 = unaff_s3->data_length;
                      unaff_s3->modulation_offset[6] = 0;
                      unaff_s3->modulation_rate[6] = 0;
                      *(undefined4 *)&unaff_s3->modEnvToFilterFc = 0;
                      *(undefined4 *)((int)&unaff_s3->modEnvToFilterFc + 4) = 0;
                      *(undefined4 *)&unaff_s3->modEnvToPitch = 0;
                      *(undefined4 *)((int)&unaff_s3->modEnvToPitch + 4) = 0;
                      unaff_s3->lfo_sweep_increment = 0;
                      unaff_s3->lfo_phase_increment = 0;
                      *(undefined4 *)&unaff_s3->modLfoToFilterFc = 0;
                      *(undefined4 *)((int)&unaff_s3->modLfoToFilterFc + 4) = 0;
                      unaff_s3->vibrato_delay = 0;
                      if (0x200001 < iVar11) goto LAB_089583a4;
                      psVar18 = safe_malloc(iVar11 + 1);
                      iVar11 = aptr->size;
                      sVar10 = unaff_s3->data_length;
                      unaff_s3->data = psVar18;
                      aptr->size = sVar10 + iVar11 + 1;
                      sVar10 = fread(psVar18,sVar10,1,fp);
                      if (sVar10 != 1) goto LAB_089583a4;
                      bVar9 = unaff_s3->modes;
                      if ((bVar9 & 1) == 0) {
                        iVar11 = unaff_s3->data_length;
                    /* Unresolved local var: int32 i@[???]
                       Unresolved local var: uint8 * cp@[???]
                       Unresolved local var: uint16 * tmp@[???]
                       Unresolved local var: uint16 * newdta@[???] */
                        pbVar27 = (byte *)unaff_s3->data;
                        psVar20 = safe_malloc(iVar11 * 2 + 2);
                        if (iVar11 != 0) {
                          pbVar34 = pbVar27 + iVar11;
                          psVar23 = psVar20;
                          do {
                            bVar9 = *pbVar27;
                            pbVar27 = pbVar27 + 1;
                            *psVar23 = (ushort)bVar9 << 8;
                            psVar23 = psVar23 + 1;
                          } while (pbVar27 != pbVar34);
                        }
                        psVar18 = unaff_s3->data;
                        unaff_s3->data = psVar20;
                        free(psVar18);
                        bVar9 = unaff_s3->modes;
                        unaff_s3->data_length = unaff_s3->data_length << 1;
                        unaff_s3->loop_start = unaff_s3->loop_start << 1;
                        unaff_s3->loop_end = unaff_s3->loop_end << 1;
                      }
                      if ((bVar9 & 2) != 0) {
                    /* Unresolved local var: int32 i@[???]
                       Unresolved local var: int16 * tmp@[???] */
                        iVar11 = unaff_s3->data_length / 2;
                        puVar24 = (ushort *)unaff_s3->data;
                        if (iVar11 != 0) {
                          iVar22 = 0;
                          do {
                            iVar22 = iVar22 + 1;
                            *puVar24 = *puVar24 ^ 0x8000;
                            puVar24 = puVar24 + 1;
                          } while (iVar11 != iVar22);
                          bVar9 = unaff_s3->modes;
                        }
                      }
                      if ((bVar9 & 0x10) != 0) {
                    /* Unresolved local var: int32 t@[???] */
                        (*ctl->cmsg)(1,0,"Reverse loop in %s",local_50);
                        iVar11 = unaff_s3->data_length;
                    /* Unresolved local var: int16 s@[???]
                       Unresolved local var: int16 * ep@[???] */
                        iVar22 = (iVar11 / 2) / 2;
                        psVar18 = unaff_s3->data;
                        if (iVar22 != 0) {
                          psVar25 = psVar18 + iVar11 / 2;
                          iVar28 = 0;
                          do {
                            sVar6 = *psVar18;
                            iVar28 = iVar28 + 1;
                            *psVar18 = *psVar25;
                            *psVar25 = sVar6;
                            psVar18 = psVar18 + 1;
                            psVar25 = psVar25 + -1;
                          } while (iVar22 != iVar28);
                        }
                        iVar22 = unaff_s3->loop_start;
                        unaff_s3->loop_start = iVar11 - unaff_s3->loop_end;
                        unaff_s3->loop_end = iVar11 - iVar22;
                        unaff_s3->modes = unaff_s3->modes & 0xef | 4;
                      }
                      if (antialiasing_allowed == 0) {
                        if (local_44 != -1) goto LAB_08957d18;
LAB_08958000:
                        if (local_5c != 0) {
                          __floatsidf(local_74);
                          goto LAB_08957d2c;
                        }
                    /* Unresolved local var: uint32 i@[???]
                       Unresolved local var: uint32 numsamps@[???]
                       Unresolved local var: uint32 higher@[???]
                       Unresolved local var: uint32 highcount@[???]
                       Unresolved local var: int16 maxamp@[???]
                       Unresolved local var: int16 a@[???]
                       Unresolved local var: int16 * tmp@[???] */
                        psVar20 = unaff_s3->data;
                        iVar28 = unaff_s3->data_length / 2;
                        iVar11 = 0;
                        iVar22 = 0;
                        if (iVar28 != 0) {
                          sVar5 = *psVar20;
                          psVar23 = psVar20;
                          while( true ) {
                            iVar30 = (int)sVar5;
                            iVar11 = iVar11 + 1;
                            psVar23 = psVar23 + 1;
                            if (iVar30 < 0) {
                              iVar30 = (int)-sVar5;
                            }
                            iVar22 = iVar30 + iVar22;
                            if (iVar11 == iVar28) break;
                            sVar5 = *psVar23;
                          }
                        }
                        uVar12 = 0;
                        uVar35 = 0;
                        iVar11 = 0;
                        while (iVar28 != iVar11) {
                          while( true ) {
                            sVar5 = *psVar20;
                            iVar30 = (int)sVar5;
                            iVar11 = iVar11 + 1;
                            psVar20 = psVar20 + 1;
                            if (iVar30 < 0) {
                              iVar30 = (int)-sVar5;
                            }
                            if (iVar30 <= (iVar22 * 3) / 4) break;
                            uVar12 = uVar12 + iVar30;
                            uVar35 = uVar35 + 1;
                            if (iVar28 == iVar11) goto LAB_0895831c;
                          }
                        }
LAB_0895831c:
                        uVar31 = DAT_089e6598;
                        uVar32 = DAT_089e659c;
                        if (uVar35 != 0) {
                          if (uVar35 == 0) {
                            trap(7);
                          }
                          __floatsidf(uVar12 / uVar35);
                          if ((int)(uVar12 / uVar35) < 0) {
                            __adddf3(in_f12_13,in_f14_15);
                          }
                          __divdf3(in_f12_13,in_f14_15);
                          uVar31 = extraout_v0_00;
                          uVar32 = extraout_v1_00;
                        }
                        *(undefined4 *)&unaff_s3->volume = uVar31;
                        p_Var16 = ctl->cmsg;
                        *(undefined4 *)((int)&unaff_s3->volume + 4) = uVar32;
                        (*p_Var16)(0,3," * volume comp: %f");
                        iVar11 = unaff_s3->data_length;
                      }
                      else {
                        antialiasing(unaff_s3,play_mode->rate);
                        if (local_44 == -1) goto LAB_08958000;
LAB_08957d18:
                        __floatsidf(local_44);
LAB_08957d2c:
                        __divdf3(in_f12_13,in_f14_15);
                        *(undefined4 *)&unaff_s3->volume = extraout_v0;
                        *(undefined4 *)((int)&unaff_s3->volume + 4) = extraout_v1;
                        iVar11 = unaff_s3->data_length;
                      }
                      iVar30 = unaff_s3->loop_start;
                      psVar18 = unaff_s3->data;
                      iVar22 = unaff_s3->loop_end;
                      psVar25 = psVar18 + iVar11 / 2;
                      iVar28 = iVar11 / 2 << 0xc;
                    /* Unresolved local var: int ls@[???]
                       Unresolved local var: int le@[???]
                       Unresolved local var: int se@[???] */
                      iVar11 = iVar28 >> 0xc;
                      *psVar25 = psVar25[-1];
                      unaff_s3->data_length = iVar28;
                      uVar12 = iVar30 / 2 << 0xc;
                      unaff_s3->loop_start = uVar12;
                      iVar22 = iVar22 / 2 << 0xc;
                      unaff_s3->loop_end = iVar22;
                      if (1 < iVar11) {
                        psVar18 = psVar18 + iVar11;
                        sVar5 = psVar18[-1];
                        while ((sVar5 == 0 && (iVar11 = iVar11 + -1, iVar11 != 1))) {
                          sVar5 = psVar18[-2];
                          psVar18 = psVar18 + -1;
                        }
                      }
                      iVar22 = (iVar22 >> 0xc) + iVar11;
                      if (iVar22 <= (int)uVar12 >> 0xc) {
                        unaff_s3->modes = unaff_s3->modes & 0xfb;
                      }
                      unaff_s3->data_length = iVar11 << 0xc;
                      unaff_s3->loop_start = uVar12 | (local_9b8 & 0xf) << 8;
                      unaff_s3->loop_end = iVar22 * 0x1000 | (uint)(local_9b8 >> 4) << 8;
                      if ((unaff_s3->note_to_use != '\0') && ((unaff_s3->modes & 4) == 0)) {
                        pre_resample(unaff_s3);
                      }
                      if (local_res4 == 1) {
                        (*ctl->cmsg)(0,3," - Stripping tail");
                        unaff_s3->data_length = unaff_s3->loop_end;
                      }
                      local_58 = local_58 + 1;
                      local_7c = local_7c + 0xf8;
                    } while (local_70 != local_58);
                  }
                  local_64 = local_64 + 1;
                } while (local_60 != local_64);
              }
              local_80 = local_80 + 4;
              pIVar33 = aptr;
              if ((int)local_6c <= local_68) {
                close_file(fp);
                return local_54;
              }
            } while( true );
          }
          pcVar26 = "Can\'t handle instruments with %d layers";
        }
        else {
          pcVar26 = "Can\'t handle patches with %d instruments";
        }
        (*ctl->cmsg)(2,0,pcVar26);
        return (InstrumentLayer *)0x0;
      }
      pcVar26 = "%s: not an instrument";
    }
    (*ctl->cmsg)(2,0,pcVar26,local_50);
  }
  return (InstrumentLayer *)0x0;
}



----------------------------------------

// Function: set_default_instrument @ 089585c8

int set_default_instrument(char *name)

{
  InstrumentLayer *pIVar1;
  int iVar2;
  int unaff_s0;
  int unaff_s1;
  int unaff_s2;
  int unaff_retaddr;
  int in_stack_00000000;
  int in_stack_00000004;
  int in_stack_00000008;
  int in_stack_ffffffec;
  
                    /* Unresolved local var: InstrumentLayer * lp@[???] */
  pIVar1 = load_instrument(name,0,0,-1,-1,in_stack_ffffffec,unaff_s0,unaff_s1,unaff_s2,unaff_retaddr
                           ,in_stack_00000000,in_stack_00000004,in_stack_00000008);
  iVar2 = -1;
  if (pIVar1 != (InstrumentLayer *)0x0) {
    if (default_instrument != (InstrumentLayer *)0x0) {
      free_layer(default_instrument);
    }
    iVar2 = 0;
    default_program = -1;
    default_instrument = pIVar1;
  }
  return iVar2;
}



----------------------------------------

// Function: fill_bank @ 08958664

int fill_bank(int dr,int b)

{
  InstrumentLayer **ppIVar1;
  uint gm_num;
  InstrumentLayer **note_to_use;
  ToneBank *pTVar2;
  InstrumentLayer *pIVar3;
  ToneBank *pTVar4;
  char *pcVar5;
  int iVar6;
  int iVar7;
  int unaff_s0;
  int iVar8;
  ToneBank **ppTVar9;
  ToneBank **ppTVar10;
  int iVar11;
  int in_stack_ffffffbc;
  InstrumentLayer **strip_loop;
  int strip_envelope;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int errors@[???]
                       Unresolved local var: ToneBank * bank@[???] */
  if (dr == 0) {
    pTVar4 = tonebank[b];
  }
  else {
    pTVar4 = drumset[b];
  }
  if (pTVar4 == (ToneBank *)0x0) {
    if (dr == 0) {
      pcVar5 = "tone bank";
    }
    else {
      pcVar5 = "drumset";
    }
    (*ctl->cmsg)(2,0,"Huh. Tried to load instruments in non-existent %s %d",pcVar5);
    strip_envelope = 0;
  }
  else {
    strip_loop = &standard_tonebank.tone[0].layer;
    gm_num = (uint)(b != 0);
    iVar11 = 0;
    note_to_use = &standard_drumset.tone[0].layer;
    strip_envelope = 0;
    do {
      while (pTVar4->tone[0].layer == (InstrumentLayer *)0xffffffff) {
        pcVar5 = pTVar4->tone[0].name;
        if (pcVar5 == (char *)0x0) {
          if (dr == 0) {
            pcVar5 = "tone bank";
          }
          else {
            pcVar5 = "drum set";
          }
          if (b == 0) {
            (*ctl->cmsg)(1,gm_num,"No instrument mapped to %s %d, program %d%s",pcVar5);
          }
          else {
            (*ctl->cmsg)(1,gm_num,"No instrument mapped to %s %d, program %d%s");
            if (dr == 0) {
              pIVar3 = *strip_loop;
              ppIVar1 = strip_loop;
            }
            else {
              pIVar3 = *note_to_use;
              ppIVar1 = note_to_use;
            }
            if (pIVar3 == (InstrumentLayer *)0x0) {
              *ppIVar1 = (InstrumentLayer *)0xffffffff;
            }
          }
          pTVar4->tone[0].layer = (InstrumentLayer *)0x0;
          strip_envelope = strip_envelope + 1;
          break;
        }
        iVar6 = pTVar4->tone[0].font_type;
        iVar7 = pTVar4->tone[0].pan;
        if (pTVar4->tone[0].strip_envelope == -1) {
          if (dr != 0) goto LAB_08958950;
LAB_08958770:
          pIVar3 = load_instrument(pcVar5,iVar6,(uint)(dr != 0),iVar7,pTVar4->tone[0].sf_ix,
                                   in_stack_ffffffbc,(int)note_to_use,(int)strip_loop,strip_envelope
                                   ,dr,b,gm_num,unaff_s0);
          pTVar4->tone[0].layer = pIVar3;
        }
        else {
          if (dr == 0) goto LAB_08958770;
LAB_08958950:
          pIVar3 = load_instrument(pcVar5,iVar6,(uint)(dr != 0),iVar7,pTVar4->tone[0].sf_ix,
                                   in_stack_ffffffbc,(int)note_to_use,(int)strip_loop,strip_envelope
                                   ,dr,b,gm_num,unaff_s0);
          pTVar4->tone[0].layer = pIVar3;
        }
        if (pIVar3 == (InstrumentLayer *)0x0) {
          (*ctl->cmsg)(2,0,"Couldn\'t load instrument %s (%s %d, program %d)",pTVar4->tone[0].name);
          strip_envelope = strip_envelope + 1;
          break;
        }
        pTVar4->tone[0].last_used = current_tune_number;
        current_patch_memory = pIVar3->size + current_patch_memory;
        if (max_patch_memory != 0) {
LAB_089588a8:
          if (last_tune_purged < current_tune_number) {
            iVar6 = last_tune_purged + 1;
            if (current_patch_memory <= max_patch_memory) break;
            ppTVar10 = tonebank + 0x81;
            ppTVar9 = drumset + 0x81;
            pTVar2 = tonebank[0x81];
            iVar7 = 0x81;
            last_tune_purged = iVar6;
            while( true ) {
              while( true ) {
                ppTVar10 = ppTVar10 + -1;
                if (pTVar2 != (ToneBank *)0x0) {
                  free_old_bank(0,iVar7,iVar6);
                }
                pTVar2 = *ppTVar9;
                iVar8 = iVar7 + -1;
                ppTVar9 = ppTVar9 + -1;
                if (pTVar2 == (ToneBank *)0x0) break;
                free_old_bank(1,iVar7,iVar6);
                if (iVar8 == -1) goto LAB_089588a8;
                pTVar2 = *ppTVar10;
                iVar7 = iVar8;
              }
                    /* Unresolved local var: int i@[???] */
              if (iVar8 == -1) break;
              pTVar2 = *ppTVar10;
              iVar7 = iVar8;
            }
            goto LAB_089588a8;
          }
        }
        if (current_patch_memory <= max_patch_memory) break;
        (*ctl->cmsg)(2,0,"Not enough memory to load instrument %s (%s %d, program %d)",
                     pTVar4->tone[0].name);
        iVar11 = iVar11 + 1;
        strip_envelope = strip_envelope + 1;
        free_layer(pTVar4->tone[0].layer);
        note_to_use = note_to_use + 0xc;
        strip_loop = strip_loop + 0xc;
        pTVar4->tone[0].layer = (InstrumentLayer *)0x0;
        pTVar4->tone[0].last_used = -1;
        pTVar4 = (ToneBank *)&pTVar4->tone[0].strip_tail;
        if (iVar11 == 0x80) {
          return strip_envelope;
        }
      }
      iVar11 = iVar11 + 1;
      note_to_use = note_to_use + 0xc;
      strip_loop = strip_loop + 0xc;
      pTVar4 = (ToneBank *)&pTVar4->tone[0].strip_tail;
    } while (iVar11 != 0x80);
  }
  return strip_envelope;
}



----------------------------------------

// Function: load_missing_instruments @ 08958b2c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int load_missing_instruments(void)

{
  int iVar1;
  ToneBank *pTVar2;
  int b;
  ToneBank **ppTVar3;
  ToneBank **ppTVar4;
  int iVar5;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int errors@[???] */
  ppTVar4 = tonebank + 0x81;
  ppTVar3 = drumset + 0x81;
  iVar5 = 0;
  pTVar2 = tonebank[0x81];
  b = 0x81;
  while( true ) {
    ppTVar4 = ppTVar4 + -1;
    if (pTVar2 != (ToneBank *)0x0) {
      iVar1 = fill_bank(0,b);
      iVar5 = iVar5 + iVar1;
    }
    pTVar2 = *ppTVar3;
    ppTVar3 = ppTVar3 + -1;
    if (pTVar2 != (ToneBank *)0x0) {
      iVar1 = fill_bank(1,b);
      iVar5 = iVar5 + iVar1;
    }
    if (b + -1 == -1) break;
    pTVar2 = *ppTVar4;
    b = b + -1;
  }
  current_tune_number = current_tune_number + 1;
  return iVar5;
}



----------------------------------------

// Function: compute_sample_increment @ 08958be4

void compute_sample_increment(int32 tempo,int32 divisions)

{
  uint uVar1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double a@[???] */
  __floatsidf(tempo);
  __floatsidf(play_mode->rate);
  __muldf3(in_f12_13,in_f14_15);
  __muldf3(in_f12_13,in_f14_15);
  __floatsidf(divisions);
  __divdf3(in_f12_13,in_f14_15);
  uVar1 = __fixdfsi(in_f12_13);
  sample_increment = (int)uVar1 >> 0x10;
  sample_correction = uVar1 & 0xffff;
  (*ctl->cmsg)(0,3,"Samples per delta-t: %d (correction %d)");
  return;
}



----------------------------------------

// Function: getvl @ 08958cc4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int32 getvl(void)

{
  int iVar1;
  int iVar2;
  byte local_18 [8];
  
                    /* Unresolved local var: int32 l@[???]
                       Unresolved local var: uint8 c@[???] */
  iVar2 = 0;
  do {
    fread(local_18,1,1,fp);
    iVar1 = iVar2 + (local_18[0] & 0x7f);
    iVar2 = iVar1 * 0x80;
  } while ((char)local_18[0] < '\0');
  return iVar1;
}



----------------------------------------

// Function: free_midi_list @ 08958d20

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void free_midi_list(void)

{
  MidiEventList *aptr;
  MidiEventList *pMVar1;
  
                    /* Unresolved local var: MidiEventList * meep@[???]
                       Unresolved local var: MidiEventList * next@[???] */
  aptr = evlist;
  if (evlist != (MidiEventList *)0x0) {
    do {
      pMVar1 = aptr->next;
      free(aptr);
      aptr = pMVar1;
    } while (pMVar1 != (MidiEventList *)0x0);
    evlist = (MidiEventList *)0x0;
  }
  return;
}



----------------------------------------

// Function: read_track @ 08958d64

int read_track(int append)

{
  char cVar1;
  char cVar2;
  byte bVar3;
  MidiEventList *pMVar4;
  ControlMode *pCVar5;
  FILE *fp;
  uint8 uVar6;
  size_t sVar7;
  int iVar8;
  int32 iVar9;
  char *buf;
  void *buf_00;
  size_t sVar10;
  undefined1 *puVar11;
  int *piVar12;
  MidiEventList *pMVar13;
  SItype SVar14;
  char (*pacVar15) [128];
  uint uVar16;
  MidiEventList *pMVar17;
  _func_int_int_int_char_ptr_varargs *p_Var18;
  uint8 uVar19;
  byte bVar20;
  undefined *puVar21;
  uint uVar22;
  MidiEventList *pMVar23;
  uint uVar24;
  uint uVar25;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  byte local_50;
  byte local_4f;
  byte local_4e;
  byte local_4d;
  uint8 local_4c [4];
  uint local_48;
  undefined1 auStack_44 [4];
  uint local_40;
  uint local_3c;
  uint local_38;
  uint local_34;
  uint local_30;
  uint local_2c;
  
                    /* Unresolved local var: MidiEventList * meep@[???]
                       Unresolved local var: MidiEventList * next@[???]
                       Unresolved local var: MidiEventList * new@[???]
                       Unresolved local var: int32 len@[???]
                       Unresolved local var: char[4] tmp@[???] */
  pMVar23 = evlist;
  if ((append == 0) || (evlist == (MidiEventList *)0x0)) {
    at = 0;
  }
  else {
    for (pMVar13 = evlist->next; pMVar13 != (MidiEventList *)0x0; pMVar13 = pMVar13->next) {
      pMVar23 = pMVar13;
    }
    at = (pMVar23->event).time;
  }
  sVar7 = fread(auStack_44,1,4,::fp);
  if ((sVar7 != 4) || (sVar7 = fread(&local_48,4,1,::fp), sVar7 != 1)) {
    (*ctl->cmsg)(2,0,"%s: Can\'t read track header.",current_filename);
    return -1;
  }
  local_48 = local_48 << 0x18 | (local_48 & 0xff00) << 8 | local_48 >> 8 & 0xff00 | local_48 >> 0x18
  ;
  iVar8 = memcmp(auStack_44,&DAT_089e69b8,4);
  uVar16 = XG_System_variation_type;
  if (iVar8 != 0) {
    (*ctl->cmsg)(2,0,"%s: Corrupt MIDI file.",current_filename);
    return -2;
  }
switchD_08958f40_caseD_5:
  XG_System_variation_type = uVar16;
  iVar9 = getvl();
                    /* Unresolved local var: uint8 me@[???]
                       Unresolved local var: uint8 type@[???]
                       Unresolved local var: uint8 a@[???]
                       Unresolved local var: uint8 b@[???]
                       Unresolved local var: uint8 c@[???]
                       Unresolved local var: int32 len@[???]
                       Unresolved local var: MidiEventList * new@[???] */
  at = iVar9 + at;
  sVar7 = fread(&local_50,1,1,::fp);
  uVar16 = (uint)local_50;
  if (sVar7 != 1) {
    p_Var18 = ctl->cmsg;
    piVar12 = __errno();
    strerror(*piVar12);
    (*p_Var18)(2,0,"%s: read_midi_event: %s",current_filename);
    return -2;
  }
  if ((uVar16 == 0xf0) || (uVar16 == 0xf7)) {
    sVar7 = getvl();
    fp = ::fp;
                    /* Unresolved local var: int32 sret@[???]
                       Unresolved local var: uint8 sysa@[???]
                       Unresolved local var: uint8 sysb@[???]
                       Unresolved local var: uint8 syschan@[???] */
    buf = safe_malloc(sVar7);
    sVar10 = fread(buf,1,sVar7,fp);
                    /* Unresolved local var: uchar * s@[???]
                       Unresolved local var: int id@[???]
                       Unresolved local var: int model@[???]
                       Unresolved local var: int ch@[???]
                       Unresolved local var: int port@[???]
                       Unresolved local var: int adhi@[???]
                       Unresolved local var: int adlo@[???]
                       Unresolved local var: int cd@[???]
                       Unresolved local var: int dta@[???]
                       Unresolved local var: int dtb@[???]
                       Unresolved local var: int dtc@[???] */
    if ((sVar7 != sVar10) || (sVar7 < 5)) {
LAB_08959320:
      free(buf);
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    }
    if ((curr_track == curr_title_track) && (1 < track_info)) {
      title[0] = '\0';
    }
    cVar1 = *buf;
    uVar16 = (uint)(byte)buf[1];
    cVar2 = buf[2];
    uVar25 = (uint)(byte)buf[3];
    uVar22 = (uint)(byte)buf[4];
    if (cVar1 == '~') {
      if (((uVar16 == 0x7f) && (cVar2 == '\t')) && (uVar25 == 1)) goto code_r0x0895966c;
LAB_0895923c:
      local_3c = uVar22 & 0xf;
      if (sVar7 < 8) goto LAB_08959320;
      local_34 = (uVar16 & 3) << 4;
      uVar24 = (uint)(byte)buf[7];
      local_40 = local_3c | local_34;
      local_34 = local_3c | local_34;
      local_30 = (uint)(byte)buf[5];
      local_2c = (uint)(byte)buf[6];
      if (sVar7 == 8) {
        local_38 = 0xffffffff;
      }
      else {
        local_38 = (uint)(byte)buf[8];
      }
      free(buf);
      pCVar5 = ctl;
      uVar16 = XG_System_variation_type;
      if (cVar1 != 'C') {
        if ((((cVar1 == 'A') && (cVar2 == 'B')) && (uVar25 == 0x12)) &&
           ((uVar22 == 0x40 && (-1 < (int)local_38)))) {
          if ((local_30 == 0) && (local_2c == 0x7f)) {
            if ((uVar24 == 0) && (local_38 == 0x41)) {
              (*ctl->cmsg)(8,1,"GS System On",sVar7);
              GS_System_On = 1;
              uVar16 = XG_System_variation_type;
            }
          }
          else if ((local_2c == 0x15) && ((local_30 & 0xf0) == 0x10)) {
                    /* Unresolved local var: int chan@[???] */
            uVar16 = local_30 & 0xf;
            if (uVar16 == 0) {
              uVar16 = 9;
            }
            else if (uVar16 < 10) {
              uVar16 = uVar16 - 1;
            }
            channel[uVar16].kit = uVar24;
            uVar16 = XG_System_variation_type;
          }
          else if (local_30 == 1) {
            if (local_2c == 0x30) {
              switch(uVar24) {
              case 0:
                XG_System_reverb_type = 0x10;
                break;
              case 1:
                XG_System_reverb_type = 0x11;
                break;
              case 2:
                XG_System_reverb_type = 0x12;
                break;
              case 3:
                XG_System_reverb_type = 8;
                break;
              case 4:
                XG_System_reverb_type = 9;
                break;
              case 5:
                XG_System_reverb_type = 0x20;
                break;
              case 6:
                XG_System_reverb_type = 0x88;
                break;
              case 7:
                XG_System_reverb_type = 0x90;
              }
            }
            else if (local_2c == 0x38) {
              switch(uVar24) {
              case 0:
                XG_System_chorus_type = 8;
                break;
              case 1:
                XG_System_chorus_type = 9;
                break;
              case 2:
                XG_System_chorus_type = 10;
                break;
              case 3:
                XG_System_chorus_type = 0xc;
                break;
              case 4:
              case 6:
              case 7:
                XG_System_chorus_type = -1;
                break;
              case 5:
                XG_System_chorus_type = 0x18;
              }
            }
          }
        }
        goto switchD_08958f40_caseD_5;
      }
      if (cVar2 != 'L') goto switchD_08958f40_caseD_5;
      if (uVar25 == 0) {
        if (((uVar22 == 0) && (local_30 == 0x7e)) && (local_2c == 0)) {
          (*ctl->cmsg)(8,1,"XG System On",sVar7);
          XG_System_On = 1;
          uVar16 = XG_System_variation_type;
        }
        goto switchD_08958f40_caseD_5;
      }
      if (uVar25 == 2) {
        if (uVar22 == 1) {
          if (uVar24 == 8) {
            uVar24 = 3;
          }
          if (local_30 == 0x20) {
            XG_System_chorus_type = uVar24 + (local_2c - 0x40) * 8;
          }
          else {
            uVar16 = local_2c;
            if ((local_30 != 0x40) && (uVar16 = XG_System_variation_type, local_30 == 0)) {
              XG_System_reverb_type = uVar24 + local_2c * 8;
            }
          }
        }
        goto switchD_08958f40_caseD_5;
      }
      if ((uVar25 != 8) || (0x28 < (int)local_30)) goto switchD_08958f40_caseD_5;
      bVar20 = (byte)local_2c & 0x7f;
      switch(local_30) {
      default:
        goto switchD_08958f40_caseD_5;
      case 1:
        uVar6 = '\0';
        uVar19 = '\x11';
        break;
      case 2:
        uVar6 = '\0';
        uVar19 = '\x0f';
        break;
      case 3:
        uVar6 = '\0';
        uVar19 = '\t';
        break;
      case 8:
        channel[local_40].transpose = (byte)local_2c - 0x40;
        (*pCVar5->cmsg)(8,3,"transpose channel %d by %d",local_3c + 1);
        uVar16 = XG_System_variation_type;
        goto switchD_08958f40_caseD_5;
      case 0xb:
        uVar6 = '\0';
        uVar19 = '\x04';
        break;
      case 0xe:
        uVar6 = '\0';
        uVar19 = '\x05';
        break;
      case 0x12:
        uVar6 = '\0';
        uVar19 = ']';
        break;
      case 0x13:
        uVar6 = '\0';
        uVar19 = '[';
        break;
      case 0x18:
        uVar6 = '\0';
        uVar19 = 'J';
        break;
      case 0x19:
        uVar19 = 'G';
        uVar6 = '\0';
      }
    }
    else {
      local_3c = uVar22 & 0xf;
      if ((((cVar1 != '\x7f') || (sVar7 != 7)) || (uVar16 != 0x7f)) ||
         ((cVar2 != '\x04' || (uVar25 != 1)))) goto LAB_0895923c;
      (*ctl->cmsg)(8,3,"Master Volume %d",uVar22 + (uint)(byte)buf[5] * 0x80);
      free(buf);
      uVar6 = buf[5];
      bVar20 = buf[4];
      local_34 = local_3c & 0xff;
      uVar19 = '\x12';
    }
    pMVar13 = safe_malloc(0xc);
    iVar9 = at;
    (pMVar13->event).type = uVar19;
    (pMVar13->event).time = iVar9;
    (pMVar13->event).a = bVar20;
    (pMVar13->event).channel = (uint8)local_34;
    (pMVar13->event).b = uVar6;
    pMVar13->next = (void *)0x0;
    goto LAB_08958fac;
  }
  if (uVar16 == 0xff) {
    fread(&local_4f,1,1,::fp);
    sVar7 = getvl();
    uVar16 = (uint)local_4f;
    if ((uVar16 - 1 & 0xff) < 0xf) {
      uVar22 = 0;
      if (uVar16 < 8) {
        uVar22 = uVar16;
      }
      puVar21 = (&label_3072)[uVar22];
      buf_00 = safe_malloc(sVar7 + 1);
      sVar10 = fread(buf_00,1,sVar7,::fp);
                    /* Unresolved local var: char * s@[???] */
      puVar11 = (undefined1 *)((int)buf_00 + sVar7);
      if (sVar7 == sVar10) {
        *puVar11 = 0;
        while (sVar7 = sVar7 - 1, sVar7 != 0xffffffff) {
          if ((char)puVar11[-1] < ' ') {
            puVar11[-1] = 0x2e;
          }
          puVar11 = puVar11 + -1;
        }
        (*ctl->cmsg)(8,1,"%s%s",puVar21);
      }
      free(buf_00);
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    }
    if (uVar16 == 0x2f) {
      return 0;
    }
    if (uVar16 == 0x51) {
      fread(&local_4e,1,1,::fp);
      fread(&local_4d,1,1,::fp);
      fread(local_4c,1,1,::fp);
      pMVar13 = safe_malloc(0xc);
      iVar9 = at;
      (pMVar13->event).type = '\n';
      (pMVar13->event).time = iVar9;
      (pMVar13->event).channel = local_4c[0];
      pMVar13->next = (void *)0x0;
      (pMVar13->event).a = local_4e;
      (pMVar13->event).b = local_4d;
      goto LAB_08958fac;
    }
    if (uVar16 == 0x21) {
      if (sVar7 == 1) {
        fread(&midi_port_number,1,1,::fp);
        uVar16 = midi_port_number & 0xf;
        if (midi_port_number == -1) {
          (*ctl->cmsg)(2,0,"Warning: \"%s\": Short midi file.",midi_name);
          return -2;
        }
        if (uVar16 != 0) {
          midi_port_number = uVar16;
          (*ctl->cmsg)(0,1,"(MIDI port number %d)");
          uVar16 = midi_port_number;
        }
        midi_port_number = uVar16 & 3;
        uVar16 = XG_System_variation_type;
        goto switchD_08958f40_caseD_5;
      }
    }
    else {
      (*ctl->cmsg)(0,3,"(Meta event type 0x%02x, length %ld)");
    }
    skip(::fp,sVar7);
    uVar16 = XG_System_variation_type;
    goto switchD_08958f40_caseD_5;
  }
  local_4e = local_50;
  if ((char)local_50 < '\0') {
    lastchan_3057 = local_50 & 0xf;
    laststatus_3056 = (byte)((uVar16 << 0x19) >> 0x1d);
    fread(&local_4e,1,1,::fp);
    local_4e = local_4e & 0x7f;
  }
  uVar16 = XG_System_variation_type;
  switch(laststatus_3056) {
  case 0:
    fread(&local_4d,1,1,::fp);
    local_4d = local_4d & 0x7f;
    pMVar13 = safe_malloc(0xc);
    uVar6 = '\x02';
    break;
  case 1:
    fread(&local_4d,1,1,::fp);
    local_4d = local_4d & 0x7f;
    if ((curr_track == curr_title_track) && (1 < track_info)) {
      title[0] = '\0';
    }
    pMVar13 = safe_malloc(0xc);
    uVar6 = '\x01';
    break;
  case 2:
    fread(&local_4d,1,1,::fp);
    local_4d = local_4d & 0x7f;
    pMVar13 = safe_malloc(0xc);
    uVar6 = '\x03';
    break;
  case 3:
    fread(&local_4d,1,1,::fp);
    bVar20 = local_4d & 0x7f;
                    /* Unresolved local var: int control@[???] */
    local_4d = local_4d & 0x7f;
    switch(local_4e) {
    case 0:
      if (XG_System_On == 0) {
        uVar6 = '\x0f';
      }
      else {
        uVar6 = '\x11';
      }
      break;
    default:
      (*ctl->cmsg)(0,3,"(Control %d: %d)");
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    case 6:
      if (nrpn_3058 == '\0') {
        if (CONCAT11(rpn_msb_3059[lastchan_3057],rpn_lsb_3060[lastchan_3057]) == 0) {
          uVar6 = '\v';
          goto LAB_08959840;
        }
        if (CONCAT11(rpn_msb_3059[lastchan_3057],rpn_lsb_3060[lastchan_3057]) == 0x7f7f) {
          pMVar13 = safe_malloc(0xc);
          iVar9 = at;
          (pMVar13->event).type = '\v';
          bVar20 = lastchan_3057;
          (pMVar13->event).time = iVar9;
          (pMVar13->event).channel = bVar20;
          (pMVar13->event).a = '\x02';
          (pMVar13->event).b = '\0';
          pMVar13->next = (void *)0x0;
          goto LAB_08958fac;
        }
        (*ctl->cmsg)(0,3,"(Data entry (MSB) for RPN %02x,%02x: %ld)");
        uVar16 = XG_System_variation_type;
        goto switchD_08958f40_caseD_5;
      }
      uVar16 = (uint)lastchan_3057;
      bVar3 = rpn_msb_3059[uVar16];
      if (bVar3 == 1) {
        uVar6 = 'J';
        if (rpn_lsb_3060[uVar16] != ' ') {
          if (rpn_lsb_3060[uVar16] == '!') {
            uVar6 = 'G';
          }
          else {
            uVar6 = 0xff;
          }
        }
      }
      else if (bVar3 == 0x1c) {
        if (bVar20 == 0) {
          iVar8 = rand();
          __floatsidf(iVar8);
          __muldf3(in_f12_13,in_f14_15);
          __divdf3(in_f12_13,in_f14_15);
          SVar14 = __fixdfsi(in_f12_13);
          uVar16 = (uint)lastchan_3057;
          local_4d = (byte)SVar14;
        }
        uVar6 = 0xff;
        drumpanpot[uVar16][(byte)rpn_lsb_3060[uVar16] & 0x7f] = local_4d;
      }
      else {
        if (bVar3 < 0x1d) {
          if (bVar3 != 0x1a) {
            uVar6 = 0xff;
            goto LAB_08959b04;
          }
          uVar22 = (uint)(byte)rpn_lsb_3060[uVar16];
          pacVar15 = drumvolume;
        }
        else if (bVar3 == 0x1d) {
          uVar22 = (uint)(byte)rpn_lsb_3060[uVar16];
          pacVar15 = drumreverberation;
        }
        else {
          if (bVar3 != 0x1e) {
            uVar6 = 0xff;
            goto LAB_08959b04;
          }
          uVar22 = (uint)(byte)rpn_lsb_3060[uVar16];
          pacVar15 = drumchorusdepth;
        }
        uVar6 = 0xff;
        pacVar15[uVar16][uVar22 & 0x7f] = local_4d;
      }
LAB_08959b04:
      (*ctl->cmsg)(0,3,"(Data entry (MSB) for NRPN %02x,%02x: %ld)",
                   (uint)(byte)rpn_msb_3059[lastchan_3057]);
      goto LAB_08959840;
    case 7:
      uVar6 = '\x04';
      break;
    case 10:
      uVar6 = '\x05';
      break;
    case 0xb:
      uVar6 = '\a';
      break;
    case 0x20:
      uVar6 = '\x0f';
      uVar16 = XG_System_variation_type;
      if (XG_System_On == 0) goto switchD_08958f40_caseD_5;
      break;
    case 0x40:
      uVar6 = '\x06';
      break;
    case 0x47:
      uVar6 = 'G';
      break;
    case 0x48:
      uVar6 = 'H';
      break;
    case 0x49:
      uVar6 = 'I';
      break;
    case 0x4a:
      uVar6 = 'J';
      break;
    case 0x5b:
      uVar6 = '[';
      break;
    case 0x5d:
      uVar6 = ']';
      break;
    case 0x62:
      nrpn_3058 = '\x01';
      rpn_lsb_3060[lastchan_3057] = local_4d;
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    case 99:
      nrpn_3058 = '\x01';
      rpn_msb_3059[lastchan_3057] = local_4d;
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    case 100:
      rpn_msb_3059[lastchan_3057] = local_4d;
      nrpn_3058 = '\0';
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    case 0x65:
      rpn_lsb_3060[lastchan_3057] = local_4d;
      nrpn_3058 = '\0';
      uVar16 = XG_System_variation_type;
      goto switchD_08958f40_caseD_5;
    case 0x78:
      uVar6 = '\f';
      break;
    case 0x79:
      uVar6 = '\r';
      break;
    case 0x7b:
      uVar6 = '\x0e';
LAB_08959840:
      uVar16 = XG_System_variation_type;
      if (uVar6 == 0xff) goto switchD_08958f40_caseD_5;
    }
    pMVar13 = safe_malloc(0xc);
    iVar9 = at;
    (pMVar13->event).type = uVar6;
    bVar20 = lastchan_3057;
    (pMVar13->event).time = iVar9;
    (pMVar13->event).channel = bVar20;
    (pMVar13->event).b = '\0';
    pMVar13->next = (void *)0x0;
    (pMVar13->event).a = local_4d;
    goto LAB_08958fac;
  case 4:
    local_4e = local_4e & 0x7f;
    pMVar13 = safe_malloc(0xc);
    iVar9 = at;
    (pMVar13->event).type = '\t';
    bVar20 = lastchan_3057;
    (pMVar13->event).time = iVar9;
    (pMVar13->event).channel = bVar20;
    (pMVar13->event).b = '\0';
    pMVar13->next = (void *)0x0;
    (pMVar13->event).a = local_4e;
    goto LAB_08958fac;
  case 5:
    goto switchD_08958f40_caseD_5;
  case 6:
    fread(&local_4d,1,1,::fp);
    local_4d = local_4d & 0x7f;
    pMVar13 = safe_malloc(0xc);
    uVar6 = '\b';
    break;
  default:
    (*ctl->cmsg)(2,0,"*** Can\'t happen: status 0x%02X, channel 0x%02X");
    uVar16 = XG_System_variation_type;
    goto switchD_08958f40_caseD_5;
  }
  iVar9 = at;
  (pMVar13->event).type = uVar6;
  bVar20 = lastchan_3057;
  (pMVar13->event).time = iVar9;
  (pMVar13->event).channel = bVar20;
  pMVar13->next = (void *)0x0;
  (pMVar13->event).a = local_4e;
  (pMVar13->event).b = local_4d;
LAB_08958fac:
  if (pMVar13 == (MidiEventList *)0xffffffff) {
    return 0;
  }
  pMVar17 = pMVar23->next;
  if (pMVar17 != (MidiEventList *)0x0) {
    iVar8 = (pMVar17->event).time;
    while ((pMVar4 = pMVar17, pMVar17 = pMVar4, iVar8 < (pMVar13->event).time &&
           (pMVar17 = pMVar4->next, pMVar23 = pMVar4, pMVar17 != (MidiEventList *)0x0))) {
      iVar8 = (pMVar17->event).time;
    }
  }
  pMVar13->next = pMVar17;
  pMVar23->next = pMVar13;
  event_count = event_count + 1;
  pMVar23 = pMVar13;
  uVar16 = XG_System_variation_type;
  goto switchD_08958f40_caseD_5;
code_r0x0895966c:
  (*ctl->cmsg)(8,1,"GM System On",sVar7);
  GM_System_On = uVar25;
  free(buf);
  uVar16 = XG_System_variation_type;
  goto switchD_08958f40_caseD_5;
}



----------------------------------------

// Function: read_midi_file @ 08959ef8

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x0895a87c) */

MidiEvent * read_midi_file(FILE *mfp,int32 *count,int32 *sp)

{
  byte bVar1;
  bool bVar2;
  uint8 uVar3;
  uint8 uVar4;
  uint8 uVar5;
  uint8 uVar6;
  size_t sVar7;
  int *piVar8;
  MidiEventList *pMVar9;
  int *piVar10;
  MidiEvent *pMVar11;
  int iVar12;
  uint uVar13;
  int iVar14;
  int *piVar15;
  ToneBank *pTVar16;
  uint uVar17;
  int (*paiVar18) [5];
  uint uVar19;
  undefined4 *puVar20;
  undefined4 *puVar21;
  uint uVar22;
  int iVar23;
  char *pcVar24;
  undefined4 *puVar25;
  int32 iVar26;
  uint uVar27;
  _func_int_int_int_char_ptr_varargs *p_Var28;
  MidiEvent *pMVar29;
  int iVar30;
  byte bVar31;
  ushort local_190;
  ushort local_18e;
  ushort local_18c [2];
  uint local_188;
  undefined1 auStack_184 [4];
  uint local_180 [16];
  int local_140 [16];
  uint local_100 [16];
  uint local_c0 [16];
  uint local_80 [16];
  int local_40;
  undefined4 local_3c;
  uint local_38;
  int32 *local_34;
  int32 *local_30;
  
                    /* Unresolved local var: int32 len@[???]
                       Unresolved local var: int32 divisions@[???]
                       Unresolved local var: int16 format@[???]
                       Unresolved local var: int16 tracks@[???]
                       Unresolved local var: int16 divisions_tmp@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: char[4] tmp@[???] */
  at = 0;
  GS_System_On = 0;
  GM_System_On = 0;
  XG_System_variation_type = 0;
  XG_System_reverb_type = 0;
  XG_System_chorus_type = 0;
  event_count = 0;
  evlist = (MidiEventList *)0x0;
  XG_System_On = 0;
  fp = mfp;
  local_34 = count;
  local_30 = sp;
  memset(drumvolume,-1,0x800);
  memset(drumchorusdepth,-1,0x800);
  memset(drumreverberation,-1,0x800);
  memset(drumpanpot,-1,0x800);
  iVar26 = drumchannels;
  piVar8 = &channel[0].brightness;
  uVar19 = 0;
  do {
    iVar14 = 0x7f;
    if ((1 << (uVar19 & 0x1f) & iVar26) == 0) {
      iVar14 = 0;
    }
    uVar19 = uVar19 + 1;
    piVar8[1] = iVar14;
    *piVar8 = 0x40;
    piVar8[-3] = 0x40;
    piVar8[-6] = 0;
    piVar8[-4] = 0;
    piVar8[-5] = 0;
    *(char *)(piVar8 + 6) = '\0';
    piVar8 = piVar8 + 0x16;
  } while (uVar19 != 0x10);
  do {
    sVar7 = fread(auStack_184,1,4,fp);
    if ((sVar7 != 4) || (sVar7 = fread(&local_188,4,1,fp), sVar7 != 1)) {
      if ((fp->_flags & 0x40U) != 0) {
        p_Var28 = ctl->cmsg;
        piVar8 = __errno();
        strerror(*piVar8);
        (*p_Var28)(2,0,"%s: %s",current_filename);
        return (MidiEvent *)0x0;
      }
LAB_0895a0dc:
      (*ctl->cmsg)(2,0,"%s: Not a MIDI file!",current_filename);
      return (MidiEvent *)0x0;
    }
    uVar19 = local_188 << 0x18 | (local_188 & 0xff00) << 8 |
             local_188 >> 8 & 0xff00 | local_188 >> 0x18;
    local_188 = uVar19;
    iVar14 = memcmp(auStack_184,&DAT_089e3c90,4);
    if (iVar14 != 0) {
      iVar14 = memcmp(auStack_184,&DAT_089e3cc4,4);
      if ((iVar14 != 0) || ((int)uVar19 < 6)) goto LAB_0895a0dc;
      fread(&local_190,2,1,fp);
      fread(&local_18e,2,1,fp);
      fread(local_18c,2,1,fp);
      local_18e = local_18e << 8 | local_18e >> 8;
      local_18c[0] = local_18c[0] << 8 | local_18c[0] >> 8;
      track_info = (int)(short)local_18e;
      local_190 = local_190 << 8 | local_190 >> 8;
      local_38 = (uint)(short)local_18c[0];
      curr_title_track = -1;
      curr_track = 0;
      if ((int)local_38 < 0) {
        local_38 = -((int)local_38 / 0x100) * (local_38 & 0xff);
      }
      if (6 < (int)local_188) {
        (*ctl->cmsg)(1,0,"%s: MIDI file header size %ld bytes",current_filename);
        skip(fp,local_188 - 6);
      }
      if (2 < local_190) {
        (*ctl->cmsg)(2,0,"%s: Unknown MIDI file format %d",current_filename);
        return (MidiEvent *)0x0;
      }
      (*ctl->cmsg)(0,1,"Format: %d  Tracks: %d  Divisions: %d",(int)(short)local_190);
      pMVar9 = safe_malloc(0xc);
      evlist = pMVar9;
      (pMVar9->event).type = '\0';
      (pMVar9->event).time = 0;
      event_count = event_count + 1;
      pMVar9->next = (void *)0x0;
      if (local_190 == 1) {
        iVar14 = 0;
        if ((short)local_18e < 1) goto LAB_0895a328;
        break;
      }
      if (local_190 == 2) {
        iVar14 = 0;
        if ((short)local_18e < 1) goto LAB_0895a328;
        goto LAB_0895a59c;
      }
      if (local_190 != 0) goto LAB_0895a328;
      iVar14 = read_track(0);
      if (iVar14 != 0) goto LAB_0895a5ac;
      curr_track = curr_track + 1;
      goto LAB_0895a328;
    }
    fread(auStack_184,1,0xc,fp);
  } while( true );
  while (iVar14 < (short)local_18e) {
    iVar14 = iVar14 + 1;
    iVar30 = read_track(0);
    if (iVar30 != 0) goto LAB_0895a5ac;
  }
  goto LAB_0895a328;
  while (curr_track = curr_track + 1, iVar14 < (short)local_18e) {
LAB_0895a59c:
    iVar14 = iVar14 + 1;
    iVar30 = read_track(1);
    if (iVar30 != 0) {
LAB_0895a5ac:
      free_midi_list();
      return (MidiEvent *)0x0;
    }
  }
LAB_0895a328:
  piVar8 = &channel[0].kit;
  iVar14 = 0;
  do {
    puVar20 = (undefined4 *)((int)local_180 + iVar14);
    puVar21 = (undefined4 *)((int)local_140 + iVar14);
    puVar25 = (undefined4 *)((int)local_100 + iVar14);
    piVar10 = (int *)((int)local_c0 + iVar14);
    piVar15 = (int *)((int)local_80 + iVar14);
    iVar14 = iVar14 + 4;
    *piVar10 = *piVar8;
    *puVar20 = 0;
    *puVar21 = 0;
    *puVar25 = 0;
    *piVar15 = default_program;
    piVar8 = piVar8 + 0x16;
  } while (iVar14 != 0x40);
  compute_sample_increment(500000,local_38);
  pMVar11 = safe_malloc(event_count * 8 + 8);
  pMVar29 = pMVar11;
  if (event_count < 1) {
    iVar26 = 1;
  }
  else {
    iVar30 = 0;
    local_40 = 0;
    local_3c = 0;
    uVar19 = 2;
    bVar31 = 2;
    pMVar9 = evlist;
    iVar14 = 0;
    do {
      (*ctl->cmsg)(0,4,"%6d: ch %2d: event %d (%d,%d)",(pMVar9->event).time);
      bVar1 = (pMVar9->event).type;
      if (bVar1 == 10) {
        compute_sample_increment
                  ((uint)(pMVar9->event).channel +
                   ((uint)(pMVar9->event).a * 0x100 + (uint)(pMVar9->event).b) * 0x100,local_38);
        bVar2 = true;
      }
      else {
        uVar22 = (uint)(pMVar9->event).channel;
        bVar2 = true;
        if ((1 << (uVar22 & 0x1f) & quietchannels) == 0) {
          if (bVar1 == 0xf) {
            bVar2 = true;
            if (local_c0[uVar22] == 0) {
              uVar17 = (uint)(pMVar9->event).a;
              if (((XG_System_On == 0) || (uVar17 == 0)) || (0x2f < uVar17)) {
                if (tonebank[uVar17] == (ToneBank *)0x0) {
                  (*ctl->cmsg)(1,1,"Tone bank %d is undefined");
                  uVar22 = (uint)(pMVar9->event).channel;
                  uVar17 = 0;
                  (pMVar9->event).a = '\0';
                }
              }
              else {
                p_Var28 = ctl->cmsg;
                channel[uVar22].variationbank = uVar17;
                (*p_Var28)(1,1,"XG variation bank %d",(uint)(pMVar9->event).a);
                uVar22 = (uint)(pMVar9->event).channel;
                uVar17 = 0;
                (pMVar9->event).a = '\0';
              }
              if (uVar17 == local_180[uVar22]) {
                bVar2 = true;
              }
              else {
                bVar2 = false;
                local_180[uVar22] = uVar17;
              }
            }
          }
          else if (bVar1 < 0x10) {
            if (bVar1 == 1) {
              uVar17 = local_c0[uVar22];
              bVar31 = uVar19 != 0;
              uVar19 = (uint)bVar31;
              if (uVar17 == 0) {
                    /* Unresolved local var: int chan@[???]
                       Unresolved local var: int banknum@[???] */
                if (local_140[uVar22] == 0) {
                  uVar17 = local_180[uVar22];
                }
                else {
                  uVar17 = 0x81;
                }
                uVar22 = local_80[uVar22];
                if (uVar22 == 0xffffffff) goto LAB_0895a45c;
                if (((XG_System_On != 0) && (uVar17 == 0x81)) &&
                   ((tonebank[0x81] == (ToneBank *)0x0 && (tonebank[0x78] != (ToneBank *)0x0)))) {
                  uVar17 = 0x78;
                }
                pTVar16 = tonebank[uVar17];
                if (pTVar16->tone[uVar22].layer == (InstrumentLayer *)0x0) {
                  pTVar16->tone[uVar22].layer = (InstrumentLayer *)0xffffffff;
                }
                else {
                  pTVar16->tone[uVar22].last_used = current_tune_number;
                }
                bVar1 = (pMVar9->event).channel;
                bVar2 = false;
                if (channel[bVar1].name == (char *)0x0) {
                  channel[bVar1].name = tonebank[uVar17]->tone[uVar22].name;
                }
              }
              else {
                uVar27 = local_100[uVar22];
                uVar22 = (uint)(pMVar9->event).a;
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int newmap@[???]
                       Unresolved local var: int banknum@[???]
                       Unresolved local var: int this_note@[???]
                       Unresolved local var: int newbank@[???]
                       Unresolved local var: int newnote@[???] */
                if ((XG_System_On != 0) && (uVar17 - 0x7e < 2)) {
                  paiVar18 = xmap;
                  iVar23 = 0;
                  while (iVar12 = (*paiVar18)[0], iVar12 != 0) {
                    if (uVar17 == 0x7f) {
                      if (iVar12 == 1) {
                        uVar13 = (*paiVar18)[1];
                        goto LAB_0895abb0;
                      }
                    }
                    else {
                      if (uVar17 == 0x7e) {
                        if (iVar12 != 0x80) goto LAB_0895abbc;
                        uVar13 = (*paiVar18)[1];
                      }
                      else {
                        uVar13 = (*paiVar18)[1];
                      }
LAB_0895abb0:
                      if ((uVar27 == uVar13) && (uVar22 == (*paiVar18)[3])) {
                        uVar17 = *(uint *)(PTR_xmap_089e6ffc + iVar23 * 0x14 + 8);
                        if (((uVar27 != uVar17) ||
                            (uVar22 != *(uint *)(PTR_xmap_089e6ffc + iVar23 * 0x14 + 0x10))) &&
                           (*(int *)(PTR_drumset_089e7000 + uVar17 * 4) != 0)) {
                          uVar22 = *(uint *)(PTR_xmap_089e6ffc + iVar23 * 0x14 + 0x10);
                          uVar27 = uVar17;
                        }
                        break;
                      }
                    }
LAB_0895abbc:
                    iVar23 = iVar23 + 1;
                    paiVar18 = paiVar18 + 1;
                    if (iVar23 == 800) break;
                  }
                }
                pTVar16 = drumset[uVar27];
                if (pTVar16->tone[uVar22].layer == (InstrumentLayer *)0x0) {
                  pTVar16->tone[uVar22].layer = (InstrumentLayer *)0xffffffff;
                }
                else {
                  pTVar16->tone[uVar22].last_used = current_tune_number;
                }
                bVar1 = (pMVar9->event).channel;
                bVar2 = false;
                if (channel[bVar1].name == (char *)0x0) {
                  channel[bVar1].name = drumset[uVar27]->name;
LAB_0895a45c:
                  bVar2 = false;
                }
              }
            }
            else {
              if (bVar1 != 9) goto LAB_0895a45c;
              if (local_c0[uVar22] == 0) {
                uVar17 = (uint)(pMVar9->event).a;
                if (local_80[uVar22] != 0xffffffff) {
                  if (uVar17 == local_80[uVar22]) {
                    bVar2 = true;
                  }
                  else {
                    bVar2 = false;
                    local_80[uVar22] = uVar17;
                  }
                  goto LAB_0895a460;
                }
LAB_0895a5ec:
                bVar2 = true;
              }
              else {
                if (local_c0[uVar22] == 0x7e) {
                  if ((pMVar9->event).a == '\0') {
                    if (drumset[0x80] == (ToneBank *)0x0) goto LAB_0895ac80;
                    local_100[uVar22] = 0x80;
                  }
                  else {
                    if (drumset[0x81] == (ToneBank *)0x0) {
LAB_0895ac80:
                      pcVar24 = "XG SFX drum set is undefined";
LAB_0895a5dc:
                      (*ctl->cmsg)(1,1,pcVar24);
                      goto LAB_0895a5ec;
                    }
                    local_100[uVar22] = 0x81;
                    local_c0[uVar22] = 0x7d;
                  }
                }
                uVar22 = (uint)(pMVar9->event).a;
                if (drumset[uVar22] == (ToneBank *)0x0) {
                  (*ctl->cmsg)(1,1,"Drum set %d is undefined");
                  uVar22 = 0;
                  if (drumset[0] == (ToneBank *)0x0) goto LAB_0895a5ec;
                  (pMVar9->event).a = '\0';
                }
                bVar1 = (pMVar9->event).channel;
                if (uVar22 == local_100[bVar1]) {
                  bVar2 = true;
                }
                else {
                  bVar2 = false;
                  local_100[bVar1] = uVar22;
                }
              }
            }
          }
          else if (bVar1 == 0x47) {
            bVar2 = false;
            channel[uVar22].harmoniccontent = (uint)(pMVar9->event).a;
          }
          else if (bVar1 == 0x4a) {
            bVar2 = false;
            channel[uVar22].brightness = (uint)(pMVar9->event).a;
          }
          else {
            bVar2 = false;
            if (bVar1 == 0x11) {
              uVar17 = (uint)(pMVar9->event).a;
              if ((uVar17 == 0) || (uVar17 == 0x7f)) {
                if (uVar17 == local_c0[uVar22]) {
                  bVar2 = true;
                }
                else {
                  bVar2 = false;
                  local_c0[uVar22] = uVar17;
                }
              }
              else if (uVar17 == 0x7e) {
                if (drumset[0x80] == (ToneBank *)0x0) {
                  (*ctl->cmsg)(1,1,"XG rhythm kit %d is undefined",0x7e);
                  bVar2 = true;
                }
                else {
                  bVar2 = false;
                  local_c0[uVar22] = 0x7e;
                  local_100[uVar22] = 0x80;
                }
              }
              else if (uVar17 == 0x40) {
                bVar2 = true;
                if (local_c0[uVar22] == 0) {
                  if (tonebank[0x81] == (ToneBank *)0x0) {
                    if (tonebank[0x78] == (ToneBank *)0x0) {
                      pcVar24 = "XG Sfx bank is undefined";
                      goto LAB_0895a5dc;
                    }
                    iVar23 = local_140[uVar22];
                  }
                  else {
                    iVar23 = local_140[uVar22];
                  }
                  if (iVar23 == 0x40) {
                    bVar2 = true;
                  }
                  else {
                    bVar2 = false;
                    local_140[uVar22] = 0x40;
                  }
                }
              }
              else {
                (*ctl->cmsg)(1,1,"XG kit %d is impossible");
                bVar2 = true;
              }
            }
          }
        }
      }
LAB_0895a460:
      iVar26 = (pMVar9->event).time;
      if (iVar26 == iVar14) {
        if ((bVar31 ^ 1) == 0) {
          uVar19 = 0;
          bVar31 = 0;
        }
      }
      else {
        if (bVar31 == 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
          halt_baddata();
        }
        if ((bVar31 ^ 1) == 0) {
          uVar19 = 0;
          bVar31 = 0;
        }
      }
      if (!bVar2) {
        uVar3 = (pMVar9->event).channel;
        uVar4 = (pMVar9->event).type;
        uVar5 = (pMVar9->event).a;
        uVar6 = (pMVar9->event).b;
        pMVar29->time = 0;
        local_40 = local_40 + 1;
        pMVar29->channel = uVar3;
        pMVar29->type = uVar4;
        pMVar29->a = uVar5;
        pMVar29->b = uVar6;
        iVar26 = (pMVar9->event).time;
        pMVar29 = pMVar29 + 1;
      }
      iVar30 = iVar30 + 1;
      pMVar9 = pMVar9->next;
      iVar14 = iVar26;
    } while (iVar30 < event_count);
    iVar26 = local_40 + 1;
  }
  pMVar29->type = 'c';
  pMVar29->time = 0;
  free_midi_list();
  *local_34 = iVar26;
  *local_30 = 0;
  return pMVar11;
}



----------------------------------------

// Function: Mix_LoadAIFF_RW @ 0895acc0

SDL_AudioSpec *
Mix_LoadAIFF_RW(SDL_RWops *src,int freesrc,SDL_AudioSpec *spec,Uint8 **audio_buf,Uint32 *audio_len)

{
  uint uVar1;
  size_t nbytes;
  bool bVar2;
  Uint16 UVar3;
  Uint32 UVar4;
  Uint32 UVar5;
  _func_int_SDL_RWops_ptr_int_int *p_Var6;
  Uint32 UVar7;
  int iVar8;
  undefined2 extraout_var;
  undefined2 extraout_var_00;
  undefined2 extraout_var_01;
  Uint8 *pUVar9;
  size_t *in_t0;
  int iVar10;
  char local_60;
  byte local_5f;
  byte local_5e;
  byte local_5d;
  byte local_5c;
  byte local_5b;
  uint local_50;
  Uint32 local_4c;
  int local_48;
  int local_44;
  int local_40;
  int local_3c;
  int local_38;
  int local_34;
  Uint8 **local_30;
  size_t *local_2c;
  
                    /* Unresolved local var: int was_error@[???]
                       Unresolved local var: int found_SSND@[???]
                       Unresolved local var: int found_COMM@[???]
                       Unresolved local var: int found_VHDR@[???]
                       Unresolved local var: int found_BODY@[???]
                       Unresolved local var: long start@[???]
                       Unresolved local var: Uint32 chunk_type@[???]
                       Unresolved local var: Uint32 chunk_length@[???]
                       Unresolved local var: long next_chunk@[???]
                       Unresolved local var: Uint32 FORMchunk@[???]
                       Unresolved local var: Uint32 AIFFmagic@[???]
                       Unresolved local var: Uint32 offset@[???]
                       Unresolved local var: Uint32 blocksize@[???]
                       Unresolved local var: Uint16 channels@[???]
                       Unresolved local var: Uint32 numsamples@[???]
                       Unresolved local var: Uint16 samplesize@[???]
                       Unresolved local var: Uint8[10] sane_freq@[???]
                       Unresolved local var: Uint32 frequency@[???] */
  local_34 = freesrc;
  local_30 = audio_buf;
  if (src != (SDL_RWops *)0x0) {
    local_2c = in_t0;
    UVar4 = SDL_ReadLE32(src);
    UVar5 = SDL_ReadBE32(src);
    if ((UVar5 == 0x46464941) ||
       ((UVar5 = SDL_ReadLE32(src), UVar4 == 0x4d524f46 &&
        ((UVar5 == 0x46464941 || (UVar5 == 0x58565338)))))) {
      bVar2 = false;
      iVar10 = 0;
      local_38 = 0;
      local_3c = 0;
      local_40 = 0;
      local_44 = 0;
      local_48 = 0;
      local_4c = 0;
      local_50 = 0;
      do {
        UVar4 = SDL_ReadLE32(src);
        UVar7 = SDL_ReadBE32(src);
        iVar8 = (*src->seek)(src,0,1);
        if (UVar7 == 0) break;
        if (UVar4 == 0x4d4d4f43) {
          UVar3 = SDL_ReadBE16(src);
          local_48 = CONCAT22(extraout_var,UVar3);
          local_4c = SDL_ReadBE32(src);
          UVar3 = SDL_ReadBE16(src);
          local_50 = CONCAT22(extraout_var_00,UVar3);
          (*src->read)(src,&local_60,10,1);
          if (((local_60 != '@') || (0x1c < local_5f)) ||
             (iVar10 = (int)((uint)local_5e << 0x17 | (uint)local_5d << 0xf |
                            (uint)local_5c << 7 | (uint)(local_5b >> 1)) >> (0x1d - local_5f & 0x1f)
             , iVar10 == 0)) {
            SDL_SetError("Bad AIFF sample frequency");
            bVar2 = true;
            goto LAB_0895ad54;
          }
          local_3c = 1;
        }
        else if (UVar4 < 0x4d4d4f44) {
          if (UVar4 == 0x444e5353) {
            UVar4 = SDL_ReadBE32(src);
            SDL_ReadBE32(src);
            local_44 = (*src->seek)(src,0,1);
            local_44 = UVar4 + local_44;
            local_38 = 1;
          }
        }
        else if (UVar4 == 0x52444856) {
          SDL_ReadBE32(src);
          SDL_ReadBE32(src);
          SDL_ReadBE32(src);
          UVar3 = SDL_ReadBE16(src);
          iVar10 = CONCAT22(extraout_var_01,UVar3);
          bVar2 = true;
          local_48 = 1;
          local_50 = 8;
        }
        else if (UVar4 == 0x59444f42) {
          local_44 = (*src->seek)(src,0,1);
          local_40 = 1;
          local_4c = UVar7;
        }
        iVar8 = UVar7 + iVar8;
        if ((UVar7 & 1) != 0) {
          iVar8 = iVar8 + 1;
        }
        if (UVar5 == 0x46464941) {
          if (local_38 == 0) {
            p_Var6 = src->seek;
          }
          else {
            if (local_3c != 0) {
              spec->format = 0;
              spec->channels = '\0';
              spec->silence = '\0';
              goto LAB_0895af90;
            }
            p_Var6 = src->seek;
          }
        }
        else {
          if (UVar5 != 0x58565338) {
            spec->format = 0;
            spec->channels = '\0';
            spec->silence = '\0';
            goto LAB_0895af90;
          }
          if (bVar2) {
            if (local_40 != 0) {
              spec->format = 0;
              spec->channels = '\0';
              spec->silence = '\0';
              goto LAB_0895af90;
            }
            p_Var6 = src->seek;
          }
          else {
            p_Var6 = src->seek;
          }
        }
        iVar8 = (*p_Var6)(src,iVar8,0);
      } while (iVar8 != 1);
      if (UVar5 == 0x46464941) {
        if (local_38 == 0) {
          SDL_SetError("Bad AIFF (no SSND chunk)");
          bVar2 = true;
          goto LAB_0895ad54;
        }
        if (local_3c == 0) {
          SDL_SetError("Bad AIFF (no COMM chunk)");
          bVar2 = true;
          goto LAB_0895ad54;
        }
        spec->format = 0;
        spec->channels = '\0';
        spec->silence = '\0';
      }
      else if (UVar5 == 0x58565338) {
        if (!bVar2) {
          SDL_SetError("Bad 8SVX (no VHDR chunk)");
          bVar2 = true;
          goto LAB_0895ad54;
        }
        if (local_40 == 0) {
          SDL_SetError("Bad 8SVX (no BODY chunk)");
          bVar2 = true;
          goto LAB_0895ad54;
        }
        spec->format = 0;
        spec->channels = '\0';
        spec->silence = '\0';
      }
      else {
        spec->format = 0;
        spec->channels = '\0';
        spec->silence = '\0';
      }
LAB_0895af90:
      spec->samples = 0;
      spec->padding = 0;
      spec->size = 0;
      spec->callback = (_func_void_void_ptr_Uint8_ptr_int *)0x0;
      spec->userdata = (void *)0x0;
      spec->freq = iVar10;
      if (local_50 == 8) {
        spec->format = 0x8008;
      }
      else {
        if (local_50 != 0x10) {
          SDL_SetError("Unsupported AIFF samplesize");
          bVar2 = true;
          goto LAB_0895ad54;
        }
        spec->format = 0x9010;
      }
      uVar1 = (local_50 & 0x7ffff) >> 3;
      spec->channels = (Uint8)local_48;
      spec->samples = 0x1000;
      nbytes = local_48 * local_4c * uVar1;
      *local_2c = nbytes;
      pUVar9 = malloc(nbytes);
      *local_30 = pUVar9;
      if (pUVar9 == (Uint8 *)0x0) {
        SDL_SetError("Out of memory");
        return (SDL_AudioSpec *)0x0;
      }
      (*src->seek)(src,local_44,0);
      iVar10 = (*src->read)(src,*local_30,*local_2c,1);
      if (iVar10 != 1) {
        SDL_SetError("Unable to read audio data");
        return (SDL_AudioSpec *)0x0;
      }
      bVar2 = false;
      *local_2c = *local_2c & -uVar1;
      goto LAB_0895ad54;
    }
    SDL_SetError("Unrecognized file type (not AIFF nor 8SVX)");
  }
  bVar2 = true;
LAB_0895ad54:
  if (local_34 == 0) {
    if (bVar2) {
      spec = (SDL_AudioSpec *)0x0;
    }
  }
  else if (src == (SDL_RWops *)0x0) {
    if (bVar2) {
      spec = (SDL_AudioSpec *)0x0;
    }
  }
  else {
    (*src->close)(src);
    if (bVar2) {
      spec = (SDL_AudioSpec *)0x0;
    }
  }
  return spec;
}



----------------------------------------

// Function: voc_get_block @ 0895b1e0

int voc_get_block(SDL_RWops *src,vs_t *v,SDL_AudioSpec *spec)

{
  Uint32 UVar1;
  int iVar2;
  USItype UVar3;
  _func_int_SDL_RWops_ptr_void_ptr_int_int *p_Var4;
  uint uVar5;
  uint uVar6;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  byte local_38;
  char local_37;
  ushort local_36;
  ushort local_34;
  undefined1 local_32;
  undefined1 local_31;
  undefined1 local_30;
  Uint32 local_2c;
  undefined1 auStack_28 [8];
  
                    /* Unresolved local var: Uint8[3] bits24@[???]
                       Unresolved local var: Uint8 uc@[???]
                       Unresolved local var: Uint8 block@[???]
                       Unresolved local var: Uint32 sblen@[???]
                       Unresolved local var: Uint16 new_rate_short@[???]
                       Unresolved local var: Uint32 new_rate_long@[???]
                       Unresolved local var: Uint8[6] trash@[???]
                       Unresolved local var: Uint16 period@[???]
                       Unresolved local var: uint i@[???] */
  v->silent = 0;
LAB_0895b214:
  UVar1 = v->rest;
LAB_0895b218:
  if ((((UVar1 != 0) || (iVar2 = (*src->read)(src,&local_37,1,1), iVar2 != 1)) || (local_37 == '\0')
      ) || (iVar2 = (*src->read)(src,&local_32,3,1), iVar2 != 1)) {
    return 1;
  }
  uVar6 = (uint)CONCAT12(local_30,CONCAT11(local_31,local_32));
  switch(local_37) {
  case '\x01':
    iVar2 = (*src->read)(src,&local_38,1,1);
    if (iVar2 != 1) {
      return 0;
    }
    uVar5 = (uint)local_38;
    if (v->has_extended == 0) {
      if (uVar5 == 0) goto LAB_0895b6c4;
      if ((v->rate != 0xffffffff) && (v->rate != uVar5)) goto LAB_0895b6d8;
      v->rate = uVar5;
      __floatsidf(0x100 - uVar5);
      if ((int)(0x100 - uVar5) < 0) {
        __adddf3(in_f12_13,in_f14_15);
      }
      __divdf3(in_f12_13,in_f14_15);
      UVar3 = __fixunsdfsi(in_f12_13);
      spec->freq = UVar3 & 0xffff;
      v->channels = '\x01';
    }
    iVar2 = (*src->read)(src,&local_38,1,1);
    if (iVar2 != 1) {
      return 0;
    }
    if (local_38 == 0) {
      v->size = 1;
      v->rest = uVar6 - 2;
      v->has_extended = 0;
      return 1;
    }
    goto LAB_0895b6e8;
  case '\x02':
    v->rest = uVar6;
    return 1;
  case '\x03':
    iVar2 = (*src->read)(src,&local_34,2,1);
    if (iVar2 != 1) {
      return 0;
    }
    iVar2 = (*src->read)(src,&local_38,1,1);
    if (iVar2 == 1) {
      uVar6 = (uint)local_38;
      if (uVar6 == 0) {
        SDL_SetError("VOC silence sample rate is zero");
        return 0;
      }
      uVar5 = v->rate;
      if (uVar5 == 0xffffffff) {
        v->rate = uVar6;
      }
      else if (uVar5 == uVar6) {
        v->rate = uVar6;
      }
      else {
        if (0x100 - uVar5 == 0) {
          trap(7);
        }
        local_34 = (ushort)(((uint)local_34 * (0x100 - uVar6)) / (0x100 - uVar5));
      }
      v->silent = 1;
      v->rest = (uint)local_34;
      return 1;
    }
    return 0;
  case '\x04':
    iVar2 = (*src->read)(src,auStack_28,1,2);
    if (iVar2 != 2) {
      return 0;
    }
  default:
    uVar5 = 0;
    if (uVar6 == 0) break;
    do {
      iVar2 = (*src->read)(src,auStack_28,1,1);
      uVar5 = uVar5 + 1;
      if (iVar2 != 1) {
        return 0;
      }
    } while (uVar6 != uVar5);
    UVar1 = v->rest;
    goto LAB_0895b218;
  case '\x06':
  case '\a':
    uVar5 = 0;
    if (uVar6 != 0) goto code_r0x0895b5a4;
    break;
  case '\b':
    p_Var4 = src->read;
    v->has_extended = 1;
    iVar2 = (*p_Var4)(src,&local_36,2,1);
    if (iVar2 != 1) {
      return 0;
    }
    uVar6 = (uint)local_36;
    if (uVar6 == 0) {
      SDL_SetError("VOC sample rate is zero");
      return 0;
    }
    if (v->rate == 0xffffffff) {
      p_Var4 = src->read;
    }
    else {
      if (v->rate != uVar6) {
LAB_0895b6d8:
        SDL_SetError("VOC sample rate codes differ");
        return 0;
      }
      p_Var4 = src->read;
    }
    v->rate = uVar6;
    iVar2 = (*p_Var4)(src,&local_38,1,1);
    if (iVar2 != 1) {
      return 0;
    }
    if (local_38 != 0) {
LAB_0895b6e8:
      SDL_SetError("VOC decoder only interprets 8-bit data");
      return 0;
    }
    iVar2 = (*src->read)(src,&local_38,1,1);
    if (iVar2 != 1) {
      return 0;
    }
    if (local_38 == 0) {
      UVar1 = v->rate;
    }
    else {
      spec->channels = '\x02';
      UVar1 = v->rate;
    }
    if (0x10000 - UVar1 == 0) {
      trap(7);
    }
    if (spec->channels == 0) {
      trap(7);
    }
    spec->freq = (256000000 / (0x10000 - UVar1)) / (uint)spec->channels;
    break;
  case '\t':
    iVar2 = (*src->read)(src,&local_2c,4,1);
    if (iVar2 != 1) {
      return 0;
    }
    if (local_2c != 0) {
      if (v->rate == 0xffffffff) {
        p_Var4 = src->read;
      }
      else {
        if (local_2c != v->rate) goto LAB_0895b6d8;
        p_Var4 = src->read;
      }
      v->rate = local_2c;
      spec->freq = local_2c;
      iVar2 = (*p_Var4)(src,&local_38,1,1);
      if (iVar2 != 1) {
        return 0;
      }
      if (local_38 == 8) {
        v->size = 1;
      }
      else {
        if (local_38 != 0x10) {
          SDL_SetError("VOC with unknown data size");
          return 0;
        }
        v->size = 2;
      }
      iVar2 = (*src->read)(src,&v->channels,1,1);
      if (iVar2 == 1) {
        iVar2 = (*src->read)(src,auStack_28,1,6);
        if (iVar2 == 6) {
          v->rest = uVar6 - 0xc;
          return 1;
        }
        return 0;
      }
      return 0;
    }
LAB_0895b6c4:
    SDL_SetError("VOC Sample rate is zero?");
    return 0;
  }
  goto LAB_0895b214;
code_r0x0895b5a4:
  do {
    iVar2 = (*src->read)(src,auStack_28,1,1);
    uVar5 = uVar5 + 1;
    if (iVar2 != 1) {
      return 0;
    }
  } while (uVar6 != uVar5);
  UVar1 = v->rest;
  goto LAB_0895b218;
}



----------------------------------------

// Function: Mix_LoadVOC_RW @ 0895b7b8

/* WARNING: Removing unreachable block (ram,0x0895baa4) */

SDL_AudioSpec *
Mix_LoadVOC_RW(SDL_RWops *src,int freesrc,SDL_AudioSpec *spec,Uint8 **audio_buf,Uint32 *audio_len)

{
  bool bVar1;
  Uint16 UVar2;
  int iVar3;
  _func_int_SDL_RWops_ptr_int_int *p_Var4;
  uint uVar5;
  Uint8 *pUVar6;
  Uint32 UVar7;
  size_t sVar8;
  size_t *in_t0;
  ushort local_68;
  undefined1 auStack_66 [22];
  vs_t local_50;
  
                    /* Unresolved local var: vs_t v@[???]
                       Unresolved local var: int was_error@[???]
                       Unresolved local var: int samplesize@[???]
                       Unresolved local var: Uint8 * fillptr@[???]
                       Unresolved local var: void * ptr@[???] */
  if (src == (SDL_RWops *)0x0) {
    return (SDL_AudioSpec *)0x0;
  }
  if ((audio_buf != (Uint8 **)0x0) && (in_t0 != (size_t *)0x0)) {
                    /* Unresolved local var: Uint8[20] signature@[???]
                       Unresolved local var: Uint16 datablockofs@[???] */
    (*src->seek)(src,0,0);
    iVar3 = (*src->read)(src,auStack_66,0x14,1);
    if (iVar3 == 1) {
      iVar3 = memcmp(auStack_66,&DAT_089e71ac,0x14);
      if (iVar3 == 0) {
        iVar3 = (*src->read)(src,&local_68,2,1);
        if ((iVar3 == 1) && (uVar5 = (*src->seek)(src,(int)local_68,0), uVar5 == local_68)) {
          local_50.rate = 0xffffffff;
          local_50.rest = 0;
          local_50.has_extended = 0;
          *audio_buf = (Uint8 *)0x0;
          *in_t0 = 0;
          spec->freq = 0;
          spec->format = 0;
          spec->channels = '\0';
          spec->silence = '\0';
          spec->samples = 0;
          spec->padding = 0;
          spec->size = 0;
          spec->callback = (_func_void_void_ptr_Uint8_ptr_int *)0x0;
          spec->userdata = (void *)0x0;
          iVar3 = voc_get_block(src,&local_50,spec);
          if (iVar3 != 0) {
            if (local_50.rate == 0xffffffff) {
              SDL_SetError("VOC data had no sound!");
              bVar1 = true;
              if (freesrc == 0) {
                p_Var4 = src->seek;
                goto LAB_0895b894;
              }
              goto LAB_0895b84c;
            }
            UVar2 = 0x8010;
            if (local_50.size != 2) {
              UVar2 = 8;
            }
            spec->format = UVar2;
            if (spec->channels == '\0') {
              spec->channels = local_50.channels;
            }
            *in_t0 = local_50.rest;
            pUVar6 = malloc(local_50.rest);
            *audio_buf = pUVar6;
            if (pUVar6 != (Uint8 *)0x0) {
              do {
                    /* Unresolved local var: int done@[???]
                       Unresolved local var: Uint8 silence@[???] */
                if ((local_50.rest == 0) &&
                   ((iVar3 = voc_get_block(src,&local_50,spec), iVar3 == 0 || (local_50.rest == 0)))
                   ) {
LAB_0895ba90:
                  uVar5 = *in_t0;
                  bVar1 = false;
                  if (local_50.size == 0) {
                    trap(7);
                  }
                  spec->samples = (Uint16)(uVar5 / local_50.size);
                  *in_t0 = uVar5 & -(((byte)spec->format / 8) * (uint)spec->channels);
                  if (freesrc != 0) goto LAB_0895b84c;
                  p_Var4 = src->seek;
                  goto LAB_0895b894;
                }
                if (local_50.silent == 0) {
                  UVar7 = (*src->read)(src,pUVar6,1,local_50.rest);
                  local_50.rest = local_50.rest - UVar7;
                  if (local_50.size == 2) {
                    UVar7 = (int)UVar7 >> 1;
                  }
                }
                else {
                  iVar3 = 0x80;
                  if (local_50.size == 2) {
                    iVar3 = 0;
                  }
                  memset(pUVar6,iVar3,local_50.rest);
                  UVar7 = local_50.rest;
                  local_50.rest = 0;
                }
                if ((int)UVar7 < 1) goto LAB_0895ba90;
                iVar3 = voc_get_block(src,&local_50,spec);
                if (iVar3 == 0) break;
                sVar8 = *in_t0;
                pUVar6 = *audio_buf;
                *in_t0 = sVar8 + local_50.rest;
                pUVar6 = realloc(pUVar6,sVar8 + local_50.rest);
                if (pUVar6 == (Uint8 *)0x0) goto LAB_0895baec;
                sVar8 = *in_t0;
                *audio_buf = pUVar6;
                pUVar6 = pUVar6 + (sVar8 - local_50.rest);
              } while( true );
            }
          }
        }
      }
      else {
        SDL_SetError("Unrecognized file type (not VOC)");
      }
    }
  }
  bVar1 = true;
  if (freesrc == 0) {
    p_Var4 = src->seek;
LAB_0895b894:
    (*p_Var4)(src,0,0);
    goto joined_r0x0895b858;
  }
LAB_0895b84c:
  (*src->close)(src);
joined_r0x0895b858:
  if (bVar1) {
    return (SDL_AudioSpec *)0x0;
  }
  return spec;
LAB_0895baec:
  bVar1 = true;
  free(*audio_buf);
  *audio_buf = (Uint8 *)0x0;
  *in_t0 = 0;
  if (freesrc == 0) {
    p_Var4 = src->seek;
    goto LAB_0895b894;
  }
  goto LAB_0895b84c;
}



----------------------------------------

// Function: sdl_read_func @ 0895bb28

size_t sdl_read_func(void *ptr,size_t size,size_t nmemb,void *datasource)

{
  size_t sVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0895bb44. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  sVar1 = (**(code **)((int)datasource + 4))(datasource,ptr,size,nmemb);
  return sVar1;
}



----------------------------------------

// Function: sdl_seek_func @ 0895bb4c

int sdl_seek_func(void *datasource,ogg_int64_t offset,int whence)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0895bb54. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (**(code **)datasource)(datasource,(int)offset);
  return iVar1;
}



----------------------------------------

// Function: sdl_close_func_freesrc @ 0895bb5c

int sdl_close_func_freesrc(void *datasource)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0895bb60. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (**(code **)((int)datasource + 0xc))();
  return iVar1;
}



----------------------------------------

// Function: sdl_close_func_nofreesrc @ 0895bb68

int sdl_close_func_nofreesrc(void *datasource)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0895bb70. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (**(code **)datasource)(datasource,0,0);
  return iVar1;
}



----------------------------------------

// Function: sdl_tell_func @ 0895bb78

long sdl_tell_func(void *datasource)

{
  long lVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0895bb80. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  lVar1 = (**(code **)datasource)(datasource,0,1);
  return lVar1;
}



----------------------------------------

// Function: Mix_LoadOGG_RW @ 0895bb88

/* WARNING: Removing unreachable block (ram,0x0895bda0) */

SDL_AudioSpec *
Mix_LoadOGG_RW(SDL_RWops *src,int freesrc,SDL_AudioSpec *spec,Uint8 **audio_buf,Uint32 *audio_len)

{
  int iVar1;
  Uint8 *pUVar2;
  size_t *in_t0;
  size_t sVar3;
  undefined4 local_160;
  code *local_15c;
  code *local_158;
  code *local_154;
  code *local_150;
  undefined1 auStack_148 [296];
  
                    /* Unresolved local var: OggVorbis_File vf@[???]
                       Unresolved local var: ov_callbacks callbacks@[???]
                       Unresolved local var: vorbis_info * info@[???]
                       Unresolved local var: Uint8 * buf@[???]
                       Unresolved local var: int bitstream@[???]
                       Unresolved local var: long samplesize@[???]
                       Unresolved local var: long samples@[???]
                       Unresolved local var: int read@[???]
                       Unresolved local var: int to_read@[???]
                       Unresolved local var: int must_close@[???]
                       Unresolved local var: int was_error@[???] */
  if (src == (SDL_RWops *)0x0) {
    return (SDL_AudioSpec *)0x0;
  }
  local_160 = 0xffffffff;
  if ((audio_buf != (Uint8 **)0x0) && (in_t0 != (size_t *)0x0)) {
    if (freesrc == 0) {
      local_154 = sdl_close_func_nofreesrc;
    }
    else {
      local_154 = sdl_close_func_freesrc;
    }
    local_150 = sdl_tell_func;
    local_158 = sdl_seek_func;
    local_15c = sdl_read_func;
    iVar1 = ov_open_callbacks(src,auStack_148,0,0);
    if (iVar1 == 0) {
      iVar1 = ov_info(auStack_148,0xffffffff);
      *in_t0 = 0;
      *audio_buf = (Uint8 *)0x0;
      spec->format = 0;
      spec->channels = '\0';
      spec->silence = '\0';
      spec->freq = 0;
      spec->samples = 0;
      spec->padding = 0;
      spec->size = 0;
      spec->callback = (_func_void_void_ptr_Uint8_ptr_int *)0x0;
      spec->userdata = (void *)0x0;
      spec->channels = (Uint8)*(undefined4 *)(iVar1 + 4);
      spec->freq = *(int *)(iVar1 + 8);
      spec->format = 0x8010;
      spec->samples = 0x1000;
      iVar1 = ov_pcm_total(auStack_148,0xffffffff);
      sVar3 = (uint)spec->channels * 2 * iVar1;
      spec->size = sVar3;
      *in_t0 = sVar3;
      pUVar2 = malloc(sVar3);
      *audio_buf = pUVar2;
      if (pUVar2 == (Uint8 *)0x0) {
        return (SDL_AudioSpec *)0x0;
      }
      sVar3 = *in_t0;
      iVar1 = ov_read(auStack_148,pUVar2,sVar3,&local_160);
      while (0 < iVar1) {
        pUVar2 = pUVar2 + iVar1;
        sVar3 = sVar3 - iVar1;
        iVar1 = ov_read(auStack_148,pUVar2,sVar3,&local_160);
      }
      ov_clear(auStack_148);
      *in_t0 = *in_t0 & -(((byte)spec->format / 8) * (uint)spec->channels);
      return spec;
    }
    SDL_SetError("OGG bitstream is not valid Vorbis stream!");
  }
  if (freesrc == 0) {
    (*src->seek)(src,0,0);
    return (SDL_AudioSpec *)0x0;
  }
  (*src->close)(src);
  return (SDL_AudioSpec *)0x0;
}



----------------------------------------

// Function: LoadMidiString @ 0895be14

void LoadMidiString(MREADER *modreader,CHAR *dest)

{
  int iVar1;
  char *pcVar2;
  CHAR CVar3;
  
                    /* Unresolved local var: CHAR * cur@[???]
                       Unresolved local var: CHAR * last@[???] */
  (*modreader->Read)(modreader,dest,0x20);
  iVar1 = (int)*dest;
  pcVar2 = dest;
  if (iVar1 == 0) {
    *dest = '\0';
    return;
  }
  do {
                    /* Unresolved local var: int __x@[???] */
    CVar3 = (CHAR)iVar1;
    if ((__ctype_ptr[iVar1] & 7U) != 0) {
      if ((__ctype_ptr[iVar1] & 2U) != 0) {
        CVar3 = CVar3 + -0x20;
      }
      *dest = CVar3;
      dest = dest + 1;
    }
    iVar1 = (int)pcVar2[1];
    pcVar2 = pcVar2 + 1;
  } while (iVar1 != 0);
  *dest = '\0';
  return;
}



----------------------------------------

// Function: IT_LoadTitle @ 0895bea8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * IT_LoadTitle(void)

{
  BOOL BVar1;
  CHAR *pCVar2;
  CHAR aCStack_28 [32];
  
                    /* Unresolved local var: CHAR[26] s@[???] */
  (*modreader->Seek)(modreader,4,0);
  BVar1 = (*modreader->Read)(modreader,aCStack_28,0x1a);
  pCVar2 = (CHAR *)0x0;
  if (BVar1 != 0) {
    pCVar2 = DupStr(aCStack_28,0x1a,0);
  }
  return pCVar2;
}



----------------------------------------

// Function: IT_Init @ 0895bf14

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL IT_Init(void)

{
  mh = _mm_malloc(0xbc);
  if (mh != (ITHEADER *)0x0) {
    poslookup = _mm_malloc(0x100);
    if (poslookup != (UBYTE *)0x0) {
      itpat = _mm_malloc(64000);
      if (itpat != (ITNOTE *)0x0) {
        mask = _mm_malloc(0x40);
        if (mask != (UBYTE *)0x0) {
          last = _mm_malloc(0x140);
          return (uint)(last != (ITNOTE *)0x0);
        }
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: IT_LoadMidiConfiguration @ 0895bfb4

void IT_LoadMidiConfiguration(MREADER *modreader)

{
  UBYTE UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  int iVar3;
  int iVar4;
  FILTER *pFVar5;
  byte bVar6;
  uint uVar7;
  UBYTE *pUVar8;
  char acStack_48 [5];
  char local_43;
  char local_42;
  char local_41;
  
                    /* Unresolved local var: int i@[???] */
  pUVar8 = filtermacros;
  memset(filtermacros,0,0x10);
  memset(filtersettings,0,0x200);
  if (modreader == (MREADER *)0x0) {
    filtermacros[0] = 0x80;
    pFVar5 = filtersettings + 0x80;
    iVar3 = 0x80;
    do {
      iVar4 = iVar3 << 3;
      iVar3 = iVar3 + 1;
      pFVar5->inf = (UBYTE)iVar4;
      pFVar5->filter = 0x81;
      pFVar5 = pFVar5 + 1;
    } while (iVar3 != 0x90);
  }
  else {
                    /* Unresolved local var: UWORD dat@[???]
                       Unresolved local var: CHAR[33] midiline@[???] */
    UVar2 = _mm_read_I_UWORD(modreader);
    (*modreader->Seek)(modreader,CONCAT22(extraout_var,UVar2) * 8 + 0x120,1);
    do {
      while( true ) {
        LoadMidiString(modreader,acStack_48);
        iVar3 = strncmp(acStack_48,"F0F00",5);
        if ((iVar3 != 0) || (1 < (byte)(local_43 - 0x30U))) break;
        *pUVar8 = local_43 - 0x30U | 0x80;
        pUVar8 = pUVar8 + 1;
        if ((BOOL *)pUVar8 == &filters) goto LAB_0895c0a0;
      }
      pUVar8 = pUVar8 + 1;
    } while ((BOOL *)pUVar8 != &filters);
LAB_0895c0a0:
    pUVar8 = &filtersettings[0x80].inf;
    do {
      while( true ) {
        LoadMidiString(modreader,acStack_48);
        iVar3 = strncmp(acStack_48,"F0F00",5);
        if ((iVar3 != 0) || (1 < (byte)(local_43 - 0x30U))) break;
        uVar7 = 0;
        ((FILTER *)(pUVar8 + -1))->filter = local_43 - 0x30U | 0x80;
        if (local_42 != 0) {
          uVar7 = (int)local_42 - 0x30U & 0xffff;
        }
        bVar6 = (byte)uVar7;
        if (local_41 != '\0') {
          bVar6 = (byte)(uVar7 << 4) | local_41 - 0x30U;
        }
        *pUVar8 = bVar6;
        pUVar8 = pUVar8 + 2;
        if (pUVar8 == &activemacro) goto LAB_0895c140;
      }
      pUVar8 = pUVar8 + 2;
    } while (pUVar8 != &activemacro);
  }
LAB_0895c140:
  UVar1 = filtermacros[0];
  activemacro = '\0';
  pFVar5 = filtersettings;
  iVar3 = 0;
  do {
    pFVar5->inf = (UBYTE)iVar3;
    iVar3 = iVar3 + 1;
    pFVar5->filter = UVar1;
    pFVar5 = pFVar5 + 1;
  } while (iVar3 != 0x80);
  return;
}



----------------------------------------

// Function: IT_Load @ 0895c1c8

/* WARNING: Control flow encountered bad instruction data */

BOOL IT_Load(BOOL curious)

{
  bool bVar1;
  undefined *puVar2;
  int iVar3;
  MREADER *pMVar4;
  UBYTE UVar5;
  byte bVar6;
  UWORD UVar7;
  int iVar8;
  ULONG UVar9;
  BOOL BVar10;
  int *piVar11;
  uint uVar12;
  CHAR *pCVar13;
  undefined2 extraout_var;
  UBYTE *pUVar14;
  uint uVar15;
  undefined4 uVar16;
  byte *pbVar17;
  int iVar18;
  undefined4 uVar19;
  ITHEADER *pIVar20;
  SBYTE *pSVar21;
  INSTRUMENT *pIVar22;
  undefined4 uVar23;
  uint uVar24;
  SWORD SVar25;
  ITHEADER *pIVar26;
  ushort *puVar27;
  INSTRUMENT *pIVar28;
  SAMPLE *pSVar29;
  int iVar30;
  int iVar31;
  ushort uVar32;
  UWORD *pUVar33;
  char *pcVar34;
  ITNOTE *pIVar35;
  int iVar36;
  UWORD *pUVar37;
  ITNOTE *pIVar38;
  ITNOTE IStack_3b0;
  CHAR aCStack_3a8 [12];
  undefined1 local_39c;
  UBYTE local_39b;
  byte local_39a;
  UBYTE local_399;
  byte local_398;
  CHAR aCStack_397 [29];
  ushort local_37a;
  ULONG local_378;
  ULONG local_374;
  ULONG local_370;
  ULONG local_36c;
  ULONG local_368;
  ULONG local_364;
  ULONG local_360;
  UBYTE local_35c;
  UBYTE local_35b;
  char local_35a;
  UBYTE local_359;
  CHAR aCStack_354 [12];
  undefined1 local_348;
  byte local_347;
  byte local_346;
  UBYTE local_345;
  UBYTE local_344;
  UBYTE local_343;
  UBYTE local_342;
  byte local_341;
  byte local_340;
  UBYTE local_33f;
  UBYTE local_33e;
  UBYTE local_33d;
  UBYTE local_33c;
  byte local_33b;
  byte local_33a;
  UBYTE local_339;
  UBYTE local_338;
  UBYTE local_337;
  UBYTE local_336;
  byte local_332;
  byte local_331;
  UWORD local_330;
  char local_32e;
  UBYTE local_32d;
  UBYTE local_32c;
  byte local_32b;
  UWORD local_32a;
  char local_328;
  UBYTE local_327;
  UBYTE local_326;
  UBYTE local_325;
  ushort local_324;
  CHAR aCStack_322 [26];
  undefined1 auStack_308 [6];
  UWORD local_302 [120];
  ushort auStack_212 [100];
  UWORD local_14a [12];
  UWORD local_131 [12];
  UWORD local_118 [25];
  char local_e6 [25];
  char cStack_cd;
  UWORD local_cc [25];
  char local_9a [25];
  char cStack_81;
  UWORD local_80 [28];
  int local_48;
  UBYTE **local_44;
  int local_40;
  int local_3c;
  ITNOTE *local_38;
  UWORD *local_30;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: int lp@[???]
                       Unresolved local var: INSTRUMENT * d@[???]
                       Unresolved local var: SAMPLE * q@[???]
                       Unresolved local var: BOOL compressed@[???] */
  numtrk = 0;
  filters = 0;
  _mm_read_I_ULONG(modreader);
  _mm_read_string(mh->songname,0x1a,modreader);
  (*modreader->Read)(modreader,mh->blank01,2);
  pIVar20 = mh;
  UVar7 = _mm_read_I_UWORD(modreader);
  pMVar4 = modreader;
  pIVar26 = mh;
  pIVar20->ordnum = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar20 = mh;
  pIVar26->insnum = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar26 = mh;
  pIVar20->smpnum = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar20 = mh;
  pIVar26->patnum = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar26 = mh;
  pIVar20->cwt = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar20 = mh;
  pIVar26->cmwt = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar20->flags = UVar7;
  pIVar20 = mh;
  UVar7 = _mm_read_I_UWORD(pMVar4);
  pMVar4 = modreader;
  pIVar20->special = UVar7;
  pIVar20 = mh;
  iVar8 = (*pMVar4->Get)(pMVar4);
  pIVar20->globvol = (UBYTE)iVar8;
  pIVar20 = mh;
  iVar8 = (*modreader->Get)(modreader);
  pIVar20->mixvol = (UBYTE)iVar8;
  pIVar20 = mh;
  iVar8 = (*modreader->Get)(modreader);
  pIVar20->initspeed = (UBYTE)iVar8;
  pIVar20 = mh;
  iVar8 = (*modreader->Get)(modreader);
  pIVar20->inittempo = (UBYTE)iVar8;
  pIVar20 = mh;
  iVar8 = (*modreader->Get)(modreader);
  pIVar20->pansep = (UBYTE)iVar8;
  pIVar20 = mh;
  iVar8 = (*modreader->Get)(modreader);
  pIVar20->zerobyte = (UBYTE)iVar8;
  pIVar20 = mh;
  UVar7 = _mm_read_I_UWORD(modreader);
  pMVar4 = modreader;
  pIVar20->msglength = UVar7;
  pIVar20 = mh;
  UVar9 = _mm_read_I_ULONG(pMVar4);
  pMVar4 = modreader;
  pIVar26 = mh;
  pIVar20->msgoffset = UVar9;
  (*pMVar4->Read)(pMVar4,pIVar26->blank02,4);
  (*modreader->Read)(modreader,mh->pantable,0x40);
  (*modreader->Read)(modreader,mh->voltable,0x40);
  BVar10 = (*modreader->Eof)(modreader);
  if (BVar10 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  of.songname = DupStr(mh->songname,0x1a,0);
  of.reppos = 0;
  of.numpat = mh->patnum;
  of.numins = mh->insnum;
  of.flags = of.flags | 0x120;
  of.numsmp = mh->smpnum;
  of.initspeed = mh->initspeed;
  of.inittempo = (UWORD)mh->inittempo;
  of.initvolume = mh->globvol;
  UVar5 = mh->songname[0x19] + '\x01';
  if (mh->songname[0x19] == '\0') {
    UVar7 = mh->cwt;
    if (2 < (ushort)(UVar7 - 0x217)) goto LAB_0895c624;
    uVar32 = mh->cmwt;
LAB_0895c480:
    iVar8 = 4;
    iVar18 = 5;
  }
  else {
    UVar7 = mh->cwt;
    of.numvoices = UVar5;
    if ((ushort)(UVar7 - 0x217) < 3) {
      uVar32 = mh->cmwt;
      goto LAB_0895c480;
    }
LAB_0895c624:
    iVar8 = 2;
    if (UVar7 < 0x215) {
      iVar8 = 4;
      if (mh->cmwt < 0x214) {
        iVar8 = 0;
      }
      of.modtype = strdup(*(char **)((int)IT_Version + iVar8));
      pIVar20 = mh;
      iVar8 = 0xf;
      if (0x213 < mh->cmwt) {
        iVar8 = 0x1a;
      }
      of.modtype[iVar8] = (char)(mh->cwt >> 8) + '0';
      iVar8 = 0x11;
      if (0x213 < pIVar20->cmwt) {
        iVar8 = 0x1c;
      }
      of.modtype[iVar8] = ((byte)pIVar20->cwt >> 4) + 0x30;
      iVar8 = 0x12;
      if (0x213 < pIVar20->cmwt) {
        iVar8 = 0x1d;
      }
      of.modtype[iVar8] = ((byte)pIVar20->cwt & 0xf) + 0x30;
      goto LAB_0895c4ac;
    }
    uVar32 = mh->cmwt;
    iVar18 = 3;
  }
  if (0x213 < uVar32) {
    iVar8 = iVar18;
  }
  of.modtype = strdup(IT_Version[iVar8]);
LAB_0895c4ac:
  pIVar20 = mh;
  if ((mh->flags & 8) == 0) {
    uVar32 = mh->cwt;
  }
  else {
    of.flags = of.flags | 3;
    uVar32 = mh->cwt;
  }
  if ((uVar32 < 0x106) || ((mh->flags & 0x10) == 0)) {
    old_effect = 0;
  }
  else {
    old_effect = 1;
  }
  pIVar26 = mh;
  pUVar33 = of.panning;
  do {
    while( true ) {
      pUVar37 = pUVar33;
      uVar32 = pIVar26->pantable[0] & 0x7f;
      pIVar26->pantable[0] = (UBYTE)uVar32;
      if (0x3f < uVar32) break;
      *pUVar37 = uVar32 << 2;
LAB_0895c534:
      pIVar26 = (ITHEADER *)(pIVar26->songname + 1);
      pUVar33 = pUVar37 + 1;
      if (pUVar37 + 1 == (UWORD *)of.chanvol) goto LAB_0895c580;
    }
    if (uVar32 == 0x40) {
      *pUVar37 = 0xff;
      goto LAB_0895c534;
    }
    if (uVar32 == 100) {
      *pUVar37 = 0x200;
      goto LAB_0895c534;
    }
    if (uVar32 != 0x7f) {
      MikMod_errno = 9;
      return 0;
    }
    *pUVar37 = 0x80;
    pIVar26 = (ITHEADER *)(pIVar26->songname + 1);
    pUVar33 = pUVar37 + 1;
  } while (pUVar37 + 1 != (UWORD *)of.chanvol);
LAB_0895c580:
  pUVar37 = pUVar37 + 1;
  pIVar26 = (ITHEADER *)pIVar20->voltable;
  do {
    uVar16 = *(undefined4 *)(pIVar26->songname + 4);
    uVar19 = *(undefined4 *)(pIVar26->songname + 8);
    uVar23 = *(undefined4 *)(pIVar26->songname + 0xc);
    *(undefined4 *)pUVar37 = *(undefined4 *)pIVar26->songname;
    *(undefined4 *)(pUVar37 + 2) = uVar16;
    *(undefined4 *)(pUVar37 + 4) = uVar19;
    pIVar26 = (ITHEADER *)(pIVar26->songname + 0x10);
    *(undefined4 *)(pUVar37 + 6) = uVar23;
    pUVar37 = pUVar37 + 8;
  } while (pIVar26 != pIVar20 + 1);
  BVar10 = AllocPositions((uint)mh->ordnum);
  if (BVar10 == 0) {
    return 0;
  }
  origpositions = _mm_calloc((uint)mh->ordnum,2);
  if (origpositions == (UWORD *)0x0) {
    return 0;
  }
  iVar8 = 0;
  if (mh->ordnum != 0) {
    do {
      pUVar37 = origpositions + iVar8;
      iVar36 = iVar8 + 1;
      iVar18 = (*modreader->Get)(modreader);
      pUVar33 = origpositions;
      pIVar20 = mh;
      *pUVar37 = (ushort)iVar18 & 0xff;
      uVar32 = pUVar33[iVar8];
      if ((pIVar20->patnum < uVar32) && (uVar32 < 0xfe)) {
        pUVar33[iVar8] = 0xff;
      }
      iVar8 = iVar36;
    } while (iVar36 < (int)(uint)pIVar20->ordnum);
  }
  BVar10 = (*modreader->Eof)(modreader);
  if (BVar10 == 0) {
    poslookupcnt = (UBYTE)mh->ordnum;
    S3MIT_CreateOrders(curious);
    paraptr = _mm_malloc(((uint)mh->insnum + (uint)mh->smpnum + (uint)of.numpat) * 4);
    if (paraptr == (ULONG *)0x0) {
      return 0;
    }
    _mm_read_I_ULONGS(paraptr,(uint)mh->insnum + (uint)mh->smpnum + (uint)of.numpat,modreader);
    BVar10 = (*modreader->Eof)(modreader);
    if (BVar10 == 0) {
      if (0x215 < mh->cmwt) {
        if ((mh->special & 8) == 0) {
          IT_LoadMidiConfiguration((MREADER *)0x0);
        }
        else {
          IT_LoadMidiConfiguration(modreader);
          BVar10 = (*modreader->Eof)(modreader);
          if (BVar10 != 0) {
            MikMod_errno = 9;
            return 0;
          }
        }
        filters = 1;
      }
      if ((((mh->special & 1) != 0) && (0x103 < mh->cwt)) && (mh->msglength != 0)) {
        (*modreader->Seek)(modreader,mh->msgoffset,0);
        BVar10 = ReadComment(mh->msglength);
        if (BVar10 == 0) {
          return 0;
        }
      }
      if ((mh->flags & 4) == 0) {
        of.numins = of.numsmp;
      }
      BVar10 = AllocSamples();
      if ((BVar10 != 0) && (piVar11 = AllocLinear(), piVar11 != (int *)0x0)) {
        pIVar20 = mh;
        if (mh->smpnum != 0) {
          iVar8 = 0;
          pSVar29 = of.samples;
          do {
            (*modreader->Seek)(modreader,paraptr[iVar8 + (uint)pIVar20->insnum] + 4,0);
            _mm_read_string(aCStack_3a8,0xc,modreader);
            iVar18 = (*modreader->Get)(modreader);
            local_39c = (undefined1)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_39b = (UBYTE)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_39a = (byte)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_399 = (UBYTE)iVar18;
            _mm_read_string(aCStack_397,0x1a,modreader);
            iVar18 = (*modreader->Get)(modreader);
            local_37a = (ushort)iVar18 & 0xff;
            iVar18 = (*modreader->Get)(modreader);
            local_398 = (byte)iVar18;
            local_378 = _mm_read_I_ULONG(modreader);
            local_374 = _mm_read_I_ULONG(modreader);
            local_370 = _mm_read_I_ULONG(modreader);
            local_36c = _mm_read_I_ULONG(modreader);
            local_368 = _mm_read_I_ULONG(modreader);
            local_364 = _mm_read_I_ULONG(modreader);
            local_360 = _mm_read_I_ULONG(modreader);
            iVar18 = (*modreader->Get)(modreader);
            local_35c = (UBYTE)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_35b = (UBYTE)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_35a = (char)iVar18;
            iVar18 = (*modreader->Get)(modreader);
            local_359 = (UBYTE)iVar18;
            BVar10 = (*modreader->Eof)(modreader);
            if (BVar10 != 0) {
              MikMod_errno = 10;
              return 0;
            }
            if (0x7ffff < local_36c) {
              MikMod_errno = 10;
              return 0;
            }
            if (0xfffffff < local_378) {
              MikMod_errno = 10;
              return 0;
            }
            if (0xfffffff < local_374) {
              MikMod_errno = 10;
              return 0;
            }
            if (0xfffffff < local_370) {
              MikMod_errno = 10;
              return 0;
            }
            pCVar13 = DupStr(aCStack_397,0x1a,0);
            pSVar29->samplename = pCVar13;
            pSVar29->speed = local_36c >> 1;
            if ((local_398 & 0x7f) == 0x40) {
              SVar25 = 0xff;
            }
            else {
              SVar25 = (local_398 & 0x7f) << 2;
            }
                    /* Unresolved local var: ITSAMPLE s@[???] */
            pSVar29->panning = SVar25;
            pSVar29->length = local_378;
            pSVar29->loopstart = local_374;
            pSVar29->loopend = local_370;
            pSVar29->volume = local_399;
            pSVar29->globvol = local_39b;
            uVar32 = of.flags & 2;
            pSVar29->seekpos = local_360;
            if (uVar32 != 0) {
              UVar9 = speed_to_finetune(local_36c,iVar8);
              pSVar29->speed = UVar9;
            }
            if ((char)local_398 < '\0') {
              pSVar29->flags = pSVar29->flags | 0x1000;
            }
            if (local_35a != '\0') {
              pSVar29->vibflags = pSVar29->vibflags | 1;
              pSVar29->vibtype = local_359;
              pSVar29->vibsweep = local_35a << 1;
              pSVar29->vibdepth = local_35b;
              pSVar29->vibrate = local_35c;
            }
            if ((local_39a & 2) != 0) {
              pSVar29->flags = pSVar29->flags | 1;
            }
            if (((local_39a & 8) != 0) && (0x213 < mh->cwt)) {
              pSVar29->flags = pSVar29->flags | 0x20;
            }
            if ((local_39a & 0x10) != 0) {
              pSVar29->flags = pSVar29->flags | 0x100;
            }
            if ((local_39a & 0x40) != 0) {
              pSVar29->flags = pSVar29->flags | 0x200;
            }
            pIVar20 = mh;
            if (mh->cwt < 0x200) {
              uVar12 = (uint)mh->smpnum;
            }
            else {
              if ((local_37a & 1) != 0) {
                pSVar29->flags = pSVar29->flags | 4;
              }
              if ((local_37a & 4) == 0) {
                uVar12 = (uint)pIVar20->smpnum;
              }
              else {
                pSVar29->flags = pSVar29->flags | 0x10;
                uVar12 = (uint)pIVar20->smpnum;
              }
            }
            iVar8 = iVar8 + 1;
            pSVar29 = pSVar29 + 1;
          } while (iVar8 < (int)uVar12);
        }
        if ((pIVar20->flags & 4) == 0) {
          if ((of.flags & 2) != 0) {
            BVar10 = AllocInstruments();
            pIVar20 = mh;
            if (BVar10 == 0) {
              return 0;
            }
            of.flags = of.flags | 4;
            iVar8 = 0;
            pIVar28 = of.instruments;
            if (mh->smpnum != 0) {
              do {
                iVar18 = 0;
                pIVar22 = pIVar28;
                do {
                  uVar12 = (uint)*(ushort *)((int)pIVar28->samplenumber + iVar18);
                  if (uVar12 < of.numsmp) {
                    iVar36 = (uint)pIVar22->samplenote[0] + noteindex[uVar12];
                    UVar5 = '\0';
                    if (-1 < iVar36) {
                      UVar5 = (char)iVar36 + 0xff;
                    }
                    pIVar22->samplenote[0] = UVar5;
                  }
                  else {
                    pIVar22->samplenote[0] = 0xff;
                  }
                    /* Unresolved local var: int note@[???] */
                  iVar18 = iVar18 + 2;
                  pIVar22 = (INSTRUMENT *)((int)&pIVar22->insname + 1);
                } while (iVar18 != 0xf0);
                iVar8 = iVar8 + 1;
                pIVar28 = pIVar28 + 1;
              } while (iVar8 < (int)(uint)pIVar20->smpnum);
            }
          }
        }
        else {
          BVar10 = AllocInstruments();
          if (BVar10 == 0) {
            return 0;
          }
          of.flags = of.flags | 0xc;
          if (mh->insnum != 0) {
            iVar8 = 0;
            pIVar28 = of.instruments;
            local_30 = local_131;
            do {
              (*modreader->Seek)(modreader,paraptr[iVar8] + 4,0);
              _mm_read_string(aCStack_354,0xc,modreader);
              iVar18 = (*modreader->Get)(modreader);
              local_348 = (undefined1)iVar18;
              if (mh->cwt < 0x200) {
                iVar18 = (*modreader->Get)(modreader);
                local_347 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_345 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_344 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_343 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_342 = (UBYTE)iVar18;
                _mm_read_I_UWORD(modreader);
                local_330 = _mm_read_I_UWORD(modreader);
                iVar18 = (*modreader->Get)(modreader);
                local_32b = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_32e = (char)iVar18;
              }
              else {
                iVar18 = (*modreader->Get)(modreader);
                local_32b = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_32c = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_32d = (UBYTE)iVar18;
                local_330 = _mm_read_I_UWORD(modreader);
                iVar18 = (*modreader->Get)(modreader);
                local_328 = (char)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_327 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_332 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_331 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_326 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_325 = (UBYTE)iVar18;
              }
              local_32a = _mm_read_I_UWORD(modreader);
              iVar18 = (*modreader->Get)(modreader);
              local_324 = (ushort)iVar18 & 0xff;
              (*modreader->Get)(modreader);
              _mm_read_string(aCStack_322,0x1a,modreader);
              (*modreader->Read)(modreader,auStack_308,6);
              _mm_read_I_UWORDS(local_302,0x78,modreader);
              if (mh->cwt < 0x200) {
                pUVar33 = local_14a;
                (*modreader->Read)(modreader,auStack_212,200);
                do {
                  iVar18 = (*modreader->Get)(modreader);
                  *(char *)pUVar33 = (char)iVar18;
                  iVar18 = (*modreader->Get)(modreader);
                  *(char *)((int)pUVar33 + 0x19) = (char)iVar18;
                  pUVar33 = (UWORD *)((int)pUVar33 + 1);
                } while (pUVar33 != local_30);
              }
              else {
                pUVar37 = local_131;
                iVar18 = (*modreader->Get)(modreader);
                local_347 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_346 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_345 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_344 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_343 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_342 = (UBYTE)iVar18;
                pUVar33 = local_118;
                do {
                  iVar18 = (*modreader->Get)(modreader);
                  *(char *)pUVar37 = (char)iVar18;
                  pUVar37 = (UWORD *)((int)pUVar37 + 1);
                  UVar7 = _mm_read_I_UWORD(modreader);
                  *pUVar33 = UVar7;
                  pUVar33 = pUVar33 + 1;
                } while (pUVar37 != local_118);
                pcVar34 = local_e6;
                pUVar33 = local_cc;
                (*modreader->Get)(modreader);
                iVar18 = (*modreader->Get)(modreader);
                local_341 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_340 = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_33f = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_33e = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_33d = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_33c = (UBYTE)iVar18;
                do {
                  iVar18 = (*modreader->Get)(modreader);
                  *pcVar34 = (char)iVar18;
                  pcVar34 = pcVar34 + 1;
                  UVar7 = _mm_read_I_UWORD(modreader);
                  *pUVar33 = UVar7;
                  pUVar33 = pUVar33 + 1;
                } while (pcVar34 != &cStack_cd);
                pcVar34 = local_9a;
                pUVar33 = local_80;
                (*modreader->Get)(modreader);
                iVar18 = (*modreader->Get)(modreader);
                local_33b = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_33a = (byte)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_339 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_338 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_337 = (UBYTE)iVar18;
                iVar18 = (*modreader->Get)(modreader);
                local_336 = (UBYTE)iVar18;
                do {
                  iVar18 = (*modreader->Get)(modreader);
                  *pcVar34 = (char)iVar18;
                  pcVar34 = pcVar34 + 1;
                  UVar7 = _mm_read_I_UWORD(modreader);
                  *pUVar33 = UVar7;
                  pUVar33 = pUVar33 + 1;
                } while (pcVar34 != &cStack_81);
                (*modreader->Get)(modreader);
              }
              BVar10 = (*modreader->Eof)(modreader);
              if (BVar10 != 0) {
                MikMod_errno = 10;
                return 0;
              }
              pIVar28->volflg = pIVar28->volflg | 8;
              pCVar13 = DupStr(aCStack_322,0x1a,0);
              pIVar28->insname = pCVar13;
              pIVar28->nnatype = local_32b & 3;
              pIVar20 = mh;
              if (mh->cwt < 0x200) {
                pIVar28->volfade = local_330 << 6;
                if (local_32e != '\0') {
                  pIVar28->dct = '\x01';
                  pIVar28->dca = '\0';
                }
                if ((local_347 & 1) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 1;
                }
                if ((local_347 & 2) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 4;
                }
                if ((local_347 & 4) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 2;
                }
                pIVar28->volbeg = local_345;
                pIVar28->volend = local_344;
                pIVar28->volsusbeg = local_343;
                pIVar28->volsusend = local_342;
                if ((local_347 & 1) != 0) {
                  iVar18 = 0;
                  do {
                    uVar12 = (uint)pIVar28->volpts;
                    iVar18 = iVar18 + 1;
                    if (*(char *)((int)local_14a + uVar12) == -1) break;
                    pIVar28->volenv[uVar12].val = (ushort)*(byte *)((int)local_131 + uVar12) << 2;
                    pIVar28->volenv[pIVar28->volpts].pos =
                         (ushort)*(byte *)((int)local_14a + (uint)pIVar28->volpts);
                    pIVar28->volpts = pIVar28->volpts + '\x01';
                  } while (iVar18 != 0x19);
                }
              }
              else {
                if ((local_331 & 0x7f) == 0x40) {
                  SVar25 = 0xff;
                }
                else {
                  SVar25 = (local_331 & 0x7f) << 2;
                }
                pIVar28->panning = SVar25;
                if (-1 < (char)local_331) {
                  pIVar28->flags = pIVar28->flags | 1;
                }
                if (-1 < local_328) {
                  pIVar28->pitpansep = local_328 << 2;
                  pIVar28->pitpancenter = local_327;
                  pIVar28->flags = pIVar28->flags | 2;
                }
                pIVar28->globvol = local_332 >> 1;
                pIVar28->volfade = local_330 << 5;
                pIVar28->dct = local_32c;
                pIVar28->dca = local_32d;
                if (0x203 < pIVar20->cwt) {
                  pIVar28->rvolvar = local_326;
                  pIVar28->rpanvar = local_325;
                }
                if ((local_347 & 1) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 1;
                }
                if ((local_347 & 2) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 4;
                }
                if ((local_347 & 4) != 0) {
                  pIVar28->volflg = pIVar28->volflg | 2;
                }
                pIVar28->volpts = local_346;
                pIVar28->volbeg = local_345;
                pIVar28->volend = local_344;
                pIVar28->volsusbeg = local_343;
                pIVar28->volsusend = local_342;
                if (local_346 != 0) {
                  iVar18 = 0;
                  pUVar33 = local_118;
                  pIVar22 = pIVar28;
                  do {
                    UVar7 = *pUVar33;
                    iVar18 = iVar18 + 1;
                    pUVar33 = pUVar33 + 1;
                    pIVar22->volenv[0].pos = UVar7;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_346);
                }
                if (((pIVar28->volflg & 1) != 0) && (pIVar28->volpts < 2)) {
                  pIVar28->volflg = pIVar28->volflg & 0xfe;
                }
                if (local_346 != 0) {
                  iVar18 = 0;
                  pIVar22 = pIVar28;
                  do {
                    pbVar17 = (byte *)((int)local_131 + iVar18);
                    iVar18 = iVar18 + 1;
                    pIVar22->volenv[0].val = (ushort)*pbVar17 << 2;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_346);
                }
                if ((local_341 & 1) != 0) {
                  pIVar28->panflg = pIVar28->panflg | 1;
                }
                if ((local_341 & 2) != 0) {
                  pIVar28->panflg = pIVar28->panflg | 4;
                }
                if ((local_341 & 4) != 0) {
                  pIVar28->panflg = pIVar28->panflg | 2;
                }
                pIVar28->panpts = local_340;
                pIVar28->panbeg = local_33f;
                pIVar28->panend = local_33e;
                pIVar28->pansusbeg = local_33d;
                pIVar28->pansusend = local_33c;
                if (local_340 != 0) {
                  iVar18 = 0;
                  pUVar33 = local_cc;
                  pIVar22 = pIVar28;
                  do {
                    UVar7 = *pUVar33;
                    iVar18 = iVar18 + 1;
                    pUVar33 = pUVar33 + 1;
                    pIVar22->panenv[0].pos = UVar7;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_340);
                }
                if (((pIVar28->panflg & 1) != 0) && (pIVar28->panpts < 2)) {
                  pIVar28->panflg = pIVar28->panflg & 0xfe;
                }
                if (local_340 != 0) {
                  iVar18 = 0;
                  pIVar22 = pIVar28;
                  do {
                    SVar25 = 0xff;
                    if (local_e6[iVar18] != ' ') {
                      SVar25 = (local_e6[iVar18] + 0x20) * 4;
                    }
                    pIVar22->panenv[0].val = SVar25;
                    iVar18 = iVar18 + 1;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_340);
                }
                if ((local_33b & 1) != 0) {
                  pIVar28->pitflg = pIVar28->pitflg | 1;
                }
                if ((local_33b & 2) != 0) {
                  pIVar28->pitflg = pIVar28->pitflg | 4;
                }
                if ((local_33b & 4) != 0) {
                  pIVar28->pitflg = pIVar28->pitflg | 2;
                }
                pIVar28->pitpts = local_33a;
                pIVar28->pitbeg = local_339;
                pIVar28->pitend = local_338;
                pIVar28->pitsusbeg = local_337;
                pIVar28->pitsusend = local_336;
                if (local_33a != 0) {
                  iVar18 = 0;
                  pUVar33 = local_80;
                  pIVar22 = pIVar28;
                  do {
                    UVar7 = *pUVar33;
                    iVar18 = iVar18 + 1;
                    pUVar33 = pUVar33 + 1;
                    pIVar22->pitenv[0].pos = UVar7;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_33a);
                }
                if (((pIVar28->pitflg & 1) != 0) && (pIVar28->pitpts < 2)) {
                  pIVar28->pitflg = pIVar28->pitflg & 0xfe;
                }
                iVar18 = 0;
                pIVar22 = pIVar28;
                if (local_33a != 0) {
                  do {
                    pcVar34 = local_9a + iVar18;
                    iVar18 = iVar18 + 1;
                    pIVar22->pitenv[0].val = *pcVar34 + 0x20;
                    pIVar22 = (INSTRUMENT *)&pIVar22->flags;
                  } while (iVar18 < (int)(uint)local_33a);
                }
                if ((char)local_33b < '\0') {
                  pIVar28->pitflg = pIVar28->pitflg & 0xfe;
                  local_338 = '\0';
                  local_339 = '\0';
                  local_33a = 0;
                }
              }
              pUVar33 = pIVar28->samplenumber;
              puVar27 = local_302;
              pIVar22 = pIVar28;
              do {
                pIVar22->samplenote[0] = (UBYTE)*puVar27;
                uVar32 = (*puVar27 >> 8) - 1;
                if (*puVar27 >> 8 == 0) {
                  *pUVar33 = 0xffff;
LAB_0895d7e0:
                  pIVar22->samplenote[0] = 0xff;
                }
                else {
                  *pUVar33 = uVar32;
                  if ((uint)of.numsmp <= (uint)uVar32) goto LAB_0895d7e0;
                  if ((of.flags & 2) != 0) {
                    /* Unresolved local var: int note@[???] */
                    iVar18 = (uint)pIVar22->samplenote[0] + noteindex[uVar32];
                    UVar5 = '\0';
                    if (-1 < iVar18) {
                      UVar5 = (char)iVar18 + 0xff;
                    }
                    pIVar22->samplenote[0] = UVar5;
                  }
                }
                puVar27 = puVar27 + 1;
                pIVar22 = (INSTRUMENT *)((int)&pIVar22->insname + 1);
                pUVar33 = pUVar33 + 1;
              } while (puVar27 != auStack_212);
              iVar8 = iVar8 + 1;
              pIVar28 = pIVar28 + 1;
            } while (iVar8 < (int)(uint)pIVar20->insnum);
          }
        }
        of.numchn = '\0';
        memset(remap,-1,0x40);
        iVar8 = 0;
        if (of.numpat != 0) {
          do {
            if (paraptr[(uint)mh->insnum + iVar8 + (uint)mh->smpnum] != 0) {
              (*modreader->Seek)(modreader,paraptr[(uint)mh->insnum + iVar8 + (uint)mh->smpnum],0);
              _mm_read_I_UWORD(modreader);
              UVar7 = _mm_read_I_UWORD(modreader);
              uVar12 = (uint)UVar7;
              if (0x100 < CONCAT22(extraout_var,UVar7)) {
                MikMod_errno = 7;
                return 0;
              }
              _mm_read_I_ULONG(modreader);
              iVar18 = 0;
                    /* Unresolved local var: int row@[???]
                       Unresolved local var: int flag@[???]
                       Unresolved local var: int ch@[???] */
              do {
                uVar15 = (*modreader->Get)(modreader);
                uVar24 = uVar15 & 0xff;
                if (uVar24 == 0xffffffff) {
                  MikMod_errno = 7;
                  return 0;
                }
                if (uVar24 == 0) {
                  iVar18 = iVar18 + 1;
                  bVar1 = iVar18 < (int)uVar12;
                }
                else {
                  uVar24 = uVar24 - 1 & 0x3f;
                  remap[uVar24] = '\0';
                  if ((uVar15 & 0x80) != 0) {
                    pUVar14 = mask + uVar24;
                    iVar36 = (*modreader->Get)(modreader);
                    *pUVar14 = (UBYTE)iVar36;
                  }
                  if ((mask[uVar24] & 1) == 0) {
                    bVar6 = mask[uVar24];
                  }
                  else {
                    (*modreader->Get)(modreader);
                    bVar6 = mask[uVar24];
                  }
                  if ((bVar6 & 2) != 0) {
                    (*modreader->Get)(modreader);
                  }
                  if ((mask[uVar24] & 4) != 0) {
                    (*modreader->Get)(modreader);
                  }
                  if ((mask[uVar24] & 8) == 0) {
                    bVar1 = iVar18 < (int)uVar12;
                  }
                  else {
                    (*modreader->Get)(modreader);
                    (*modreader->Get)(modreader);
                    bVar1 = iVar18 < (int)uVar12;
                  }
                }
              } while (bVar1);
            }
            iVar8 = iVar8 + 1;
          } while (iVar8 < (int)(uint)of.numpat);
        }
        pSVar21 = remap;
        bVar6 = remap[0];
        while( true ) {
          if (bVar6 == 0) {
            *pSVar21 = of.numchn;
            of.numchn = of.numchn + 1;
          }
          pSVar21 = pSVar21 + 1;
          if ((UBYTE *)pSVar21 == filtermacros) break;
          bVar6 = *pSVar21;
        }
        of.numtrk = of.numpat * of.numchn;
        if ((of.numvoices != '\0') && (of.numvoices < of.numchn)) {
          of.numvoices = of.numchn;
        }
        BVar10 = AllocPatterns();
        if ((BVar10 != 0) && (BVar10 = AllocTracks(), BVar10 != 0)) {
          iVar8 = 0;
          if (of.numpat != 0) {
            iVar18 = 0;
            do {
              if (paraptr[(uint)mh->insnum + iVar8 + (uint)mh->smpnum] == 0) {
                *(undefined2 *)((int)of.pattrows + iVar18) = 0x40;
                puVar2 = PTR_of_089e7334;
                if (of.numchn != '\0') {
                  iVar36 = 0;
                  do {
                    /* Unresolved local var: int k@[???] */
                    iVar30 = 0;
                    UniReset();
                    do {
                      iVar30 = iVar30 + 1;
                      UniNewline();
                      iVar3 = numtrk;
                    } while (iVar30 != 0x40);
                    iVar30 = *(int *)(puVar2 + 0x110);
                    iVar36 = iVar36 + 1;
                    iVar31 = numtrk * 4;
                    pUVar14 = UniDup();
                    *(UBYTE **)(iVar31 + iVar30) = pUVar14;
                    numtrk = iVar3 + 1;
                  } while (iVar36 < (int)(uint)(byte)puVar2[0xe]);
                }
              }
              else {
                (*modreader->Seek)(modreader,paraptr[(uint)mh->insnum + iVar8 + (uint)mh->smpnum],0)
                ;
                local_40 = 0;
                _mm_read_I_UWORD(modreader);
                pUVar33 = of.pattrows;
                UVar7 = _mm_read_I_UWORD(modreader);
                pMVar4 = modreader;
                *(UWORD *)(iVar18 + (int)pUVar33) = UVar7;
                _mm_read_I_ULONG(pMVar4);
                local_38 = itpat;
                uVar12 = (uint)*(ushort *)((int)of.pattrows + iVar18);
                memset(itpat,0xff,64000);
                do {
                  uVar15 = (*modreader->Get)(modreader);
                  uVar24 = uVar15 & 0xff;
                  if (uVar24 == 0xffffffff) {
                    MikMod_errno = 7;
                    return 0;
                  }
                  if (uVar24 == 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
                    halt_baddata();
                  }
                  iVar36 = (int)remap[uVar24 - 1 & 0x3f];
                  if (iVar36 == -1) {
                    iVar36 = -1;
                    pIVar35 = &IStack_3b0;
                    pIVar38 = &IStack_3b0;
                  }
                  else {
                    pIVar35 = last + iVar36;
                    pIVar38 = local_38 + iVar36;
                  }
                  if ((uVar15 & 0x80) != 0) {
                    pUVar14 = mask + iVar36;
                    iVar30 = (*modreader->Get)(modreader);
                    *pUVar14 = (UBYTE)iVar30;
                  }
                  if ((mask[iVar36] & 1) != 0) {
                    uVar15 = (*modreader->Get)(modreader);
                    pIVar38->note = (UBYTE)uVar15;
                    pIVar35->note = (UBYTE)uVar15;
                    if ((uVar15 & 0xff) == 0xff) {
                      pIVar38->note = 0xfd;
                      pIVar35->note = 0xfd;
                    }
                  }
                  if ((mask[iVar36] & 2) == 0) {
                    bVar6 = mask[iVar36];
                  }
                  else {
                    iVar30 = (*modreader->Get)(modreader);
                    pIVar38->ins = (UBYTE)iVar30;
                    pIVar35->ins = (UBYTE)iVar30;
                    bVar6 = mask[iVar36];
                  }
                  if ((bVar6 & 4) != 0) {
                    iVar30 = (*modreader->Get)(modreader);
                    pIVar38->volpan = (UBYTE)iVar30;
                    pIVar35->volpan = (UBYTE)iVar30;
                  }
                  if ((mask[iVar36] & 8) != 0) {
                    iVar30 = (*modreader->Get)(modreader);
                    pIVar38->cmd = (UBYTE)iVar30;
                    pIVar35->cmd = (UBYTE)iVar30;
                    iVar30 = (*modreader->Get)(modreader);
                    pIVar38->inf = (UBYTE)iVar30;
                    pIVar35->inf = (UBYTE)iVar30;
                  }
                  pbVar17 = mask + iVar36;
                  bVar6 = *pbVar17;
                  if ((bVar6 & 0x10) != 0) {
                    pIVar38->note = pIVar35->note;
                    bVar6 = *pbVar17;
                  }
                  if ((bVar6 & 0x20) != 0) {
                    pIVar38->ins = pIVar35->ins;
                    bVar6 = *pbVar17;
                  }
                  if ((bVar6 & 0x40) == 0) {
                    bVar6 = *pbVar17;
                  }
                  else {
                    pIVar38->volpan = pIVar35->volpan;
                    bVar6 = *pbVar17;
                  }
                  if ((char)bVar6 < '\0') {
                    UVar5 = pIVar35->cmd;
                    pIVar38->inf = pIVar35->inf;
                    pIVar38->cmd = UVar5;
                  }
                } while (local_40 < (int)uVar12);
                if (of.numchn != '\0') {
                  local_3c = 0;
                  do {
                    iVar36 = local_3c;
                    pIVar35 = itpat;
                    local_48 = numtrk;
                    local_44 = of.tracks + numtrk;
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: UBYTE note@[???]
                       Unresolved local var: UBYTE ins@[???]
                       Unresolved local var: UBYTE volpan@[???] */
                    UniReset();
                    uVar15 = 0;
                    if (uVar12 != 0) {
                      do {
                        pIVar38 = pIVar35 + iVar36 + uVar15 * of.numchn;
                        bVar6 = pIVar38->note;
                        uVar24 = (uint)pIVar38->volpan;
                        uVar32 = (ushort)pIVar38->ins;
                        if (bVar6 != 0xff) {
                          if (bVar6 == 0xfd) {
                            UniWriteByte('\x1c');
                          }
                          else if (bVar6 == 0xfe) {
                            UniPTEffect('\f',0xff);
                            uVar24 = 0xff;
                          }
                          else {
                            UniEffect(1,(ushort)bVar6);
                          }
                        }
                        if ((uVar32 - 1 & 0xff) < 99) {
                          UniEffect(2,uVar32 - 1);
                        }
                        else if (uVar32 == 0xfd) {
                          UniWriteByte('\x1c');
                        }
                        else if (uVar32 != 0xff) goto LAB_0895e160;
                        UVar5 = (UBYTE)uVar24;
                        if (uVar24 < 0x41) {
                          UniVolEffect(1,UVar5);
                        }
                        else if (uVar24 < 0x4b) {
                          UniVolEffect(3,UVar5 * '\x10' + 0xff);
                        }
                        else if (uVar24 < 0x55) {
                          UniVolEffect(3,UVar5 + 0xa5);
                        }
                        else if (uVar24 < 0x5f) {
                          UniVolEffect(3,(UVar5 + 0xab) * '\x10');
                        }
                        else if (uVar24 < 0x69) {
                          UniVolEffect(3,UVar5 + 0xa1);
                        }
                        else if (uVar24 < 0x73) {
                          UniVolEffect(4,UVar5 + 0x97);
                        }
                        else if (uVar24 < 0x7d) {
                          UniVolEffect(5,UVar5 + 0x8d);
                        }
                        else {
                          if (-1 < (char)UVar5) {
LAB_0895e160:
                            MikMod_errno = 7;
                            *local_44 = (UBYTE *)0x0;
                            numtrk = local_48 + 1;
                            return 0;
                          }
                          if (uVar24 < 0xc1) {
                            if (uVar24 == 0xc0) {
                              UVar5 = 0xff;
                            }
                            else {
                              UVar5 = (UBYTE)((uVar24 & 0x3f) << 2);
                            }
                            UniVolEffect(2,UVar5);
                          }
                          else if (uVar24 < 0xcb) {
                            UniVolEffect(6,"ImpulseTracker  .  "[uVar24 + 7]);
                          }
                          else if (uVar24 < 0xd5) {
                            UniVolEffect(7,UVar5 + '5');
                          }
                          else if ((uVar24 != 0xef) && (uVar24 != 0xff)) goto LAB_0895e160;
                        }
                        iVar30 = uVar15 * of.numchn;
                        uVar15 = uVar15 + 1;
                        S3MIT_ProcessCmd(pIVar35[iVar36 + iVar30].cmd,pIVar35[iVar36 + iVar30].inf,
                                         old_effect | 2);
                        UniNewline();
                      } while (uVar15 != uVar12);
                    }
                    pUVar14 = UniDup();
                    numtrk = local_48 + 1;
                    *local_44 = pUVar14;
                    if (pUVar14 == (UBYTE *)0x0) {
                      return 0;
                    }
                    local_3c = local_3c + 1;
                  } while (local_3c < (int)(uint)of.numchn);
                }
              }
              iVar8 = iVar8 + 1;
              iVar18 = iVar18 + 2;
            } while (iVar8 < (int)(uint)of.numpat);
          }
          return 1;
        }
      }
      return 0;
    }
  }
  MikMod_errno = 9;
  return 0;
}



----------------------------------------

// Function: IT_Cleanup @ 0895e2d0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void IT_Cleanup(void)

{
  FreeLinear();
  if (mh != (ITHEADER *)0x0) {
    free(mh);
  }
  mh = (ITHEADER *)0x0;
  if (poslookup != (UBYTE *)0x0) {
    free(poslookup);
  }
  poslookup = (UBYTE *)0x0;
  if (itpat != (ITNOTE *)0x0) {
    free(itpat);
  }
  itpat = (ITNOTE *)0x0;
  if (mask != (UBYTE *)0x0) {
    free(mask);
  }
  mask = (UBYTE *)0x0;
  if (last != (ITNOTE *)0x0) {
    free(last);
  }
  last = (ITNOTE *)0x0;
  if (paraptr != (ULONG *)0x0) {
    free(paraptr);
  }
  paraptr = (ULONG *)0x0;
  if (origpositions != (UWORD *)0x0) {
    free(origpositions);
  }
  origpositions = (UWORD *)0x0;
  return;
}



----------------------------------------

// Function: IT_Test @ 0895e3a0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL IT_Test(void)

{
  BOOL BVar1;
  int iVar2;
  uint uVar3;
  undefined1 auStack_10 [8];
  
                    /* Unresolved local var: UBYTE[4] id@[???] */
  BVar1 = (*modreader->Read)(modreader,auStack_10,4);
  uVar3 = 0;
  if (BVar1 != 0) {
    iVar2 = memcmp(auStack_10,&DAT_089e7264,4);
    uVar3 = (uint)(iVar2 == 0);
  }
  return uVar3;
}



----------------------------------------

// Function: S3M_LoadTitle @ 0895e3f4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * S3M_LoadTitle(void)

{
  BOOL BVar1;
  CHAR *pCVar2;
  CHAR aCStack_28 [32];
  
                    /* Unresolved local var: CHAR[28] s@[???] */
  (*modreader->Seek)(modreader,0,0);
  BVar1 = (*modreader->Read)(modreader,aCStack_28,0x1c);
  pCVar2 = (CHAR *)0x0;
  if (BVar1 != 0) {
    pCVar2 = DupStr(aCStack_28,0x1c,0);
  }
  return pCVar2;
}



----------------------------------------

// Function: S3M_Test @ 0895e460

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL S3M_Test(void)

{
  BOOL BVar1;
  int iVar2;
  uint uVar3;
  undefined1 auStack_10 [8];
  
                    /* Unresolved local var: UBYTE[4] id@[???] */
  (*modreader->Seek)(modreader,0x2c,0);
  BVar1 = (*modreader->Read)(modreader,auStack_10,4);
  uVar3 = 0;
  if (BVar1 != 0) {
    iVar2 = memcmp(auStack_10,&DAT_089e735c,4);
    uVar3 = (uint)(iVar2 == 0);
  }
  return uVar3;
}



----------------------------------------

// Function: S3M_Init @ 0895e4d0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL S3M_Init(void)

{
  s3mbuf = _mm_malloc(0x2800);
  if (s3mbuf != (S3MNOTE *)0x0) {
    mh = _mm_malloc(0x60);
    if (mh != (S3MHEADER *)0x0) {
      poslookup = _mm_malloc(0x100);
      if (poslookup != (UBYTE *)0x0) {
        memset(poslookup,-1,0x100);
        return 1;
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: S3M_Load @ 0895e550

BOOL S3M_Load(BOOL curious)

{
  byte bVar1;
  byte bVar2;
  ushort uVar3;
  uint uVar4;
  S3MHEADER *pSVar5;
  UWORD *pUVar6;
  MREADER *pMVar7;
  UBYTE UVar8;
  UWORD UVar9;
  int iVar10;
  BOOL BVar11;
  int iVar12;
  CHAR *pCVar13;
  uint uVar14;
  UBYTE *pUVar15;
  SBYTE *pSVar16;
  UBYTE dat;
  S3MHEADER *pSVar17;
  UWORD *pUVar18;
  SAMPLE *pSVar19;
  uint uVar20;
  S3MNOTE *pSVar21;
  int iVar22;
  S3MNOTE SStack_b8;
  byte local_b3 [35];
  undefined1 local_90;
  CHAR aCStack_8f [12];
  undefined1 local_83;
  UWORD local_82;
  uint local_80;
  uint local_7c;
  uint local_78;
  UBYTE local_74;
  undefined1 local_73;
  undefined1 local_72;
  byte local_71;
  ULONG local_70;
  undefined1 auStack_6c [12];
  CHAR aCStack_60 [28];
  CHAR aCStack_44 [4];
  int local_40;
  int local_3c;
  int local_38;
  int local_34;
  UBYTE **local_30;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: int track@[???]
                       Unresolved local var: SAMPLE * q@[???]
                       Unresolved local var: UBYTE[32] pan@[???] */
  _mm_read_string(mh->songname,0x1c,modreader);
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->t1a = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->type = (UBYTE)iVar10;
  (*modreader->Read)(modreader,mh->unused1,2);
  pSVar5 = mh;
  UVar9 = _mm_read_I_UWORD(modreader);
  pMVar7 = modreader;
  pSVar17 = mh;
  pSVar5->ordnum = UVar9;
  UVar9 = _mm_read_I_UWORD(pMVar7);
  pMVar7 = modreader;
  pSVar5 = mh;
  pSVar17->insnum = UVar9;
  UVar9 = _mm_read_I_UWORD(pMVar7);
  pMVar7 = modreader;
  pSVar17 = mh;
  pSVar5->patnum = UVar9;
  UVar9 = _mm_read_I_UWORD(pMVar7);
  pMVar7 = modreader;
  pSVar5 = mh;
  pSVar17->flags = UVar9;
  UVar9 = _mm_read_I_UWORD(pMVar7);
  pMVar7 = modreader;
  pSVar5->tracker = UVar9;
  pSVar5 = mh;
  UVar9 = _mm_read_I_UWORD(pMVar7);
  pMVar7 = modreader;
  pCVar13 = mh->scrm;
  pSVar5->fileformat = UVar9;
  _mm_read_string(pCVar13,4,pMVar7);
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->mastervol = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->initspeed = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->inittempo = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->mastermult = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->ultraclick = (UBYTE)iVar10;
  pSVar5 = mh;
  iVar10 = (*modreader->Get)(modreader);
  pSVar5->pantable = (UBYTE)iVar10;
  (*modreader->Read)(modreader,mh->unused2,8);
  pSVar5 = mh;
  UVar9 = _mm_read_I_UWORD(modreader);
  pMVar7 = modreader;
  pSVar17 = mh;
  pSVar5->special = UVar9;
  (*pMVar7->Read)(pMVar7,pSVar17->channels,0x20);
  BVar11 = (*modreader->Eof)(modreader);
  if (BVar11 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  of.songname = DupStr(mh->songname,0x1c,0);
  of.numpat = mh->patnum;
  of.reppos = 0;
  of.numins = mh->insnum;
  of.initspeed = mh->initspeed;
  of.inittempo = (UWORD)mh->inittempo;
  of.initvolume = mh->mastervol << 1;
  of.numsmp = of.numins;
  if ((mh->tracker == 0x1300) || ((mh->flags & 0x40) != 0)) {
    of.flags = of.flags | 0x110;
    iVar10 = AllocPositions((uint)mh->ordnum);
  }
  else {
    of.flags = of.flags | 0x100;
    iVar10 = AllocPositions((uint)mh->ordnum);
  }
  if (iVar10 == 0) {
    return 0;
  }
  origpositions = _mm_calloc((uint)mh->ordnum,2);
  if (origpositions == (UWORD *)0x0) {
    return 0;
  }
  if (mh->ordnum != 0) {
    iVar10 = 0;
    do {
      pUVar18 = origpositions + iVar10;
      iVar22 = iVar10 + 1;
      iVar12 = (*modreader->Get)(modreader);
      pUVar6 = origpositions;
      pSVar5 = mh;
      *pUVar18 = (ushort)iVar12 & 0xff;
      uVar3 = pUVar6[iVar10];
      if ((pSVar5->patnum <= uVar3) && (uVar3 < 0xfe)) {
        pUVar6[iVar10] = 0xff;
      }
      iVar10 = iVar22;
    } while (iVar22 < (int)(uint)pSVar5->ordnum);
  }
  BVar11 = (*modreader->Eof)(modreader);
  if (BVar11 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  poslookupcnt = (UBYTE)mh->ordnum;
  S3MIT_CreateOrders(curious);
  paraptr = _mm_malloc(((uint)of.numins + (uint)of.numpat) * 2);
  if (paraptr == (UWORD *)0x0) {
    return 0;
  }
  _mm_read_I_UWORDS(paraptr,(uint)of.numins + (uint)of.numpat,modreader);
  if (mh->pantable == 0xfc) {
    (*modreader->Read)(modreader,local_b3,0x20);
  }
  BVar11 = (*modreader->Eof)(modreader);
  if (BVar11 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  BVar11 = AllocSamples();
  if (BVar11 == 0) {
    return 0;
  }
  if (of.numins != 0) {
    iVar10 = 0;
    pSVar19 = of.samples;
    do {
      (*modreader->Seek)(modreader,(uint)paraptr[iVar10] << 4,0);
      iVar12 = (*modreader->Get)(modreader);
      local_90 = (undefined1)iVar12;
      _mm_read_string(aCStack_8f,0xc,modreader);
      iVar12 = (*modreader->Get)(modreader);
      local_83 = (undefined1)iVar12;
      local_82 = _mm_read_I_UWORD(modreader);
      local_80 = _mm_read_I_ULONG(modreader);
      local_7c = _mm_read_I_ULONG(modreader);
      local_78 = _mm_read_I_ULONG(modreader);
      iVar12 = (*modreader->Get)(modreader);
      local_74 = (UBYTE)iVar12;
      iVar12 = (*modreader->Get)(modreader);
      local_73 = (undefined1)iVar12;
      iVar12 = (*modreader->Get)(modreader);
      local_72 = (undefined1)iVar12;
      iVar12 = (*modreader->Get)(modreader);
      local_71 = (byte)iVar12;
      local_70 = _mm_read_I_ULONG(modreader);
      (*modreader->Read)(modreader,auStack_6c,0xc);
      _mm_read_string(aCStack_60,0x1c,modreader);
      _mm_read_string(aCStack_44,4,modreader);
      BVar11 = (*modreader->Eof)(modreader);
      if (BVar11 != 0) {
        MikMod_errno = 10;
        return 0;
      }
      pCVar13 = DupStr(aCStack_60,0x1c,0);
      pSVar19->samplename = pCVar13;
      pSVar19->speed = local_70;
      pSVar19->length = local_80;
      uVar14 = local_80;
      if (local_7c <= local_80) {
        uVar14 = local_7c;
      }
      pSVar19->loopstart = uVar14;
      uVar14 = local_80;
      if (local_78 <= local_80) {
        uVar14 = local_78;
      }
      pSVar19->loopend = uVar14;
      pSVar19->volume = local_74;
      pSVar19->seekpos = (uint)CONCAT12(local_83,local_82) << 4;
      if ((local_71 & 1) != 0) {
        pSVar19->flags = pSVar19->flags | 0x100;
      }
      if ((local_71 & 4) != 0) {
        pSVar19->flags = pSVar19->flags | 1;
      }
      if (mh->fileformat == 1) {
        pSVar19->flags = pSVar19->flags | 4;
      }
      iVar12 = memcmp(aCStack_44,&DAT_089e7364,4);
      if (iVar12 != 0) {
        pSVar19->length = 0;
      }
      iVar10 = iVar10 + 1;
      pSVar19 = pSVar19 + 1;
    } while (iVar10 < (int)(uint)of.numins);
  }
  of.numchn = '\0';
  memset(remap,-1,0x20);
  if (of.numpat != 0) {
    iVar10 = 0;
    do {
      (*modreader->Seek)(modreader,(uint)paraptr[iVar10 + (uint)of.numins] * 0x10 + 2,0);
      iVar12 = 0;
      do {
        uVar14 = (*modreader->Get)(modreader);
        BVar11 = (*modreader->Eof)(modreader);
        uVar20 = uVar14 & 0xff;
        if (BVar11 != 0) {
          MikMod_errno = 7;
          return 0;
        }
        if (uVar20 == 0) {
          iVar12 = iVar12 + 1;
        }
        else {
                    /* Unresolved local var: int row@[???]
                       Unresolved local var: int flag@[???]
                       Unresolved local var: int ch@[???] */
          if (mh->channels[uVar14 & 0x1f] < 0x20) {
            remap[uVar14 & 0x1f] = '\0';
          }
          uVar4 = uVar14;
          if ((uVar14 & 0x20) != 0) {
            (*modreader->Get)(modreader);
            (*modreader->Get)(modreader);
            uVar4 = uVar20;
          }
          if ((uVar4 & 0x40) != 0) {
            (*modreader->Get)(modreader);
            uVar14 = uVar20;
          }
          if ((uVar14 & 0x80) != 0) {
            (*modreader->Get)(modreader);
            (*modreader->Get)(modreader);
          }
        }
      } while (iVar12 < 0x40);
      iVar10 = iVar10 + 1;
    } while (iVar10 < (int)(uint)of.numpat);
  }
  uVar3 = mh->tracker;
  uVar14 = (uint)(uVar3 >> 0xc);
  if ((uVar14 == 0) || (3 < uVar14)) {
    of.modtype = strdup("Unknown tracker x.xx (S3M format)");
    iVar10 = 0xc;
LAB_0895eda8:
    pSVar5 = mh;
    iVar10 = *(int *)((int)numeric + iVar10);
    of.modtype[iVar10] = (byte)(((uint)mh->tracker << 0x14) >> 0x1c) + 0x30;
    of.modtype[iVar10 + 2] = ((byte)pSVar5->tracker >> 4) + 0x30;
    of.modtype[iVar10 + 3] = ((byte)pSVar5->tracker & 0xf) + 0x30;
  }
  else {
    if (uVar3 < 0x3217) {
      iVar12 = uVar14 - 1;
      if (uVar3 != 0x3216) {
        iVar10 = iVar12 * 4;
        of.modtype = strdup(S3M_Version[iVar12]);
        if (3 < iVar12) goto LAB_0895ee04;
        goto LAB_0895eda8;
      }
      iVar10 = 4;
    }
    else {
      iVar10 = 5;
    }
    of.modtype = strdup(S3M_Version[iVar10]);
  }
LAB_0895ee04:
  pSVar16 = remap;
  UVar8 = remap[0];
  while( true ) {
    if (UVar8 == '\0') {
      *pSVar16 = of.numchn;
      of.numchn = of.numchn + '\x01';
    }
    pSVar5 = mh;
    pSVar16 = pSVar16 + 1;
    if (pSVar16 == remap + 0x20) break;
    UVar8 = *pSVar16;
  }
  pSVar16 = remap;
  pSVar17 = mh;
  do {
    if (pSVar17->channels[0] < 0x20) {
      iVar10 = (int)*pSVar16;
      if (iVar10 != -1) {
        if (pSVar17->channels[0] < 8) {
          of.panning[iVar10] = 0x20;
        }
        else {
          of.panning[iVar10] = 0xd0;
        }
      }
    }
    pSVar16 = pSVar16 + 1;
    pSVar17 = (S3MHEADER *)(pSVar17->songname + 1);
  } while (pSVar16 != remap + 0x20);
  if (pSVar5->pantable == 0xfc) {
    pSVar16 = remap;
    iVar10 = 0;
    do {
      iVar12 = iVar10 + 1;
      if (((local_b3[iVar10] & 0x20) != 0) && (pSVar5->channels[iVar10] < 0x20)) {
        if (*pSVar16 != -1) {
          of.panning[*pSVar16] = (local_b3[iVar10] & 0xf) << 4;
        }
      }
      pSVar16 = pSVar16 + 1;
      iVar10 = iVar12;
    } while (iVar12 != 0x20);
  }
  of.numtrk = of.numpat * of.numchn;
  BVar11 = AllocTracks();
  if ((BVar11 == 0) || (BVar11 = AllocPatterns(), BVar11 == 0)) {
    return 0;
  }
  if (of.numpat == 0) {
    return 1;
  }
  local_40 = 0;
  local_38 = 0;
  while( true ) {
    iVar10 = 0;
    (*modreader->Seek)(modreader,(uint)paraptr[(uint)of.numins + local_40] * 0x10 + 2,0);
    memset(s3mbuf,0xff,0x2800);
    do {
      uVar14 = (*modreader->Get)(modreader);
      BVar11 = (*modreader->Eof)(modreader);
      if (BVar11 != 0) {
        MikMod_errno = 7;
        return 0;
      }
      if ((uVar14 & 0xff) == 0) {
        iVar10 = iVar10 + 1;
      }
      else {
        pSVar21 = &SStack_b8;
        if (remap[uVar14 & 0x1f] != -1) {
          pSVar21 = s3mbuf + remap[uVar14 & 0x1f] * 0x40 + iVar10;
        }
        if ((uVar14 & 0x20) != 0) {
          iVar12 = (*modreader->Get)(modreader);
          pSVar21->note = (UBYTE)iVar12;
          iVar12 = (*modreader->Get)(modreader);
          pSVar21->ins = (UBYTE)iVar12;
        }
        if ((uVar14 & 0x40) != 0) {
          uVar20 = (*modreader->Get)(modreader);
          pSVar21->vol = (UBYTE)uVar20;
          if (0x40 < (uVar20 & 0xff)) {
            pSVar21->vol = '@';
          }
        }
        if ((uVar14 & 0x80) != 0) {
          iVar12 = (*modreader->Get)(modreader);
          pSVar21->cmd = (UBYTE)iVar12;
          iVar12 = (*modreader->Get)(modreader);
          pSVar21->inf = (UBYTE)iVar12;
        }
      }
    } while (iVar10 < 0x40);
    if (of.numchn != '\0') break;
LAB_0895f270:
    local_40 = local_40 + 1;
    if ((int)(uint)of.numpat <= local_40) {
      return 1;
    }
  }
  local_34 = 0;
  local_3c = local_38 << 2;
LAB_0895f158:
                    /* Unresolved local var: int t@[???] */
  iVar10 = 0;
  local_30 = of.tracks;
  pSVar21 = s3mbuf + local_34 * 0x40;
  UniReset();
                    /* Unresolved local var: UBYTE note@[???]
                       Unresolved local var: UBYTE ins@[???]
                       Unresolved local var: UBYTE vol@[???] */
  bVar1 = pSVar21->ins;
  do {
    bVar2 = pSVar21->note;
    UVar8 = pSVar21->vol;
    if ((bVar1 - 1 & 0xff) < 0xfe) {
      UniEffect(2,bVar1 - 1);
    }
    if (bVar2 == 0xff) {
LAB_0895f1e8:
      dat = UVar8;
      if (UVar8 != 0xff) goto LAB_0895f1f4;
    }
    else {
      dat = '\0';
      if (bVar2 != 0xfe) {
        UniEffect(1,(ushort)(bVar2 >> 4) * 0xc + (bVar2 & 0xf));
        goto LAB_0895f1e8;
      }
LAB_0895f1f4:
      UniPTEffect('\f',dat);
    }
    iVar10 = iVar10 + 1;
    S3MIT_ProcessCmd(pSVar21->cmd,pSVar21->inf,1);
    UniNewline();
    if (iVar10 == 0x40) break;
    bVar1 = pSVar21[1].ins;
    pSVar21 = pSVar21 + 1;
  } while( true );
  pUVar15 = UniDup();
  *(UBYTE **)((int)local_30 + local_3c) = pUVar15;
  if (pUVar15 == (UBYTE *)0x0) {
    return 0;
  }
  local_34 = local_34 + 1;
  local_3c = local_3c + 4;
  local_38 = local_38 + 1;
  if ((int)(uint)of.numchn <= local_34) goto LAB_0895f270;
  goto LAB_0895f158;
}



----------------------------------------

// Function: S3M_Cleanup @ 0895f2d4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void S3M_Cleanup(void)

{
  if (s3mbuf != (S3MNOTE *)0x0) {
    free(s3mbuf);
  }
  s3mbuf = (S3MNOTE *)0x0;
  if (paraptr != (UWORD *)0x0) {
    free(paraptr);
  }
  paraptr = (UWORD *)0x0;
  if (poslookup != (UBYTE *)0x0) {
    free(poslookup);
  }
  poslookup = (UBYTE *)0x0;
  if (mh != (S3MHEADER *)0x0) {
    free(mh);
  }
  mh = (S3MHEADER *)0x0;
  if (origpositions != (UWORD *)0x0) {
    free(origpositions);
  }
  origpositions = (UWORD *)0x0;
  return;
}



----------------------------------------

// Function: MixReverb_Normal @ 0895f370

void MixReverb_Normal(SLONG *srce,SLONG count)

{
  SLONG *pSVar1;
  SLONG *pSVar2;
  SLONG *pSVar3;
  SLONG *pSVar4;
  SLONG *pSVar5;
  SLONG *pSVar6;
  SLONG *pSVar7;
  SLONG *pSVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  int iVar16;
  SLONG *pSVar17;
  int iVar18;
  int iVar19;
  SLONG *pSVar20;
  SLONG *pSVar21;
  SLONG *pSVar22;
  SLONG *pSVar23;
  SLONG *pSVar24;
  SLONG *pSVar25;
  uint uVar26;
  int iVar27;
  uint uVar28;
  uint uVar29;
  uint uVar30;
  uint uVar31;
  uint uVar32;
  uint uVar33;
  uint uVar34;
  uint uVar35;
  
  iVar16 = RVc8;
  iVar15 = RVc7;
  iVar14 = RVc6;
  iVar13 = RVc5;
  iVar12 = RVc4;
  iVar11 = RVc3;
  iVar10 = RVc2;
  iVar9 = RVc1;
  pSVar8 = RVbufL8;
  pSVar7 = RVbufL7;
  pSVar6 = RVbufL6;
  pSVar5 = RVbufL5;
  pSVar4 = RVbufL4;
  pSVar3 = RVbufL3;
  pSVar2 = RVbufL2;
                    /* Unresolved local var: uint speedup@[???]
                       Unresolved local var: int ReverbPct@[DW_OP_reg25(t9)]
                       Unresolved local var: uint loc1@[???]
                       Unresolved local var: uint loc2@[???]
                       Unresolved local var: uint loc3@[???]
                       Unresolved local var: uint loc4@[???]
                       Unresolved local var: uint loc5@[???]
                       Unresolved local var: uint loc6@[???]
                       Unresolved local var: uint loc7@[???]
                       Unresolved local var: uint loc8@[???] */
  pSVar1 = RVbufL1;
  iVar27 = (uint)md_reverb * 4 + 0x3a;
  if (count != 0) {
    uVar28 = RVRindex % (uint)RVc1;
    if (RVc1 == 0) {
      trap(7);
    }
    iVar19 = RVRindex + count + -1;
    uVar26 = RVRindex + 1;
    uVar29 = RVRindex % (uint)RVc2;
    if (RVc2 == 0) {
      trap(7);
    }
    uVar30 = RVRindex % (uint)RVc3;
    if (RVc3 == 0) {
      trap(7);
    }
    uVar31 = RVRindex % (uint)RVc4;
    if (RVc4 == 0) {
      trap(7);
    }
    uVar32 = RVRindex % (uint)RVc5;
    if (RVc5 == 0) {
      trap(7);
    }
    uVar33 = RVRindex % (uint)RVc6;
    if (RVc6 == 0) {
      trap(7);
    }
    uVar34 = RVRindex % (uint)RVc7;
    if (RVc7 == 0) {
      trap(7);
    }
    uVar35 = RVRindex % (uint)RVc8;
    if (RVc8 == 0) {
      trap(7);
    }
    do {
      pSVar17 = pSVar1 + uVar28;
      iVar18 = *srce >> 3;
      pSVar20 = pSVar2 + uVar29;
      pSVar21 = pSVar3 + uVar30;
      pSVar22 = pSVar4 + uVar31;
      pSVar23 = pSVar5 + uVar32;
      *pSVar17 = iVar18 + (iVar27 * *pSVar17 >> 7);
      pSVar17 = pSVar6 + uVar33;
      uVar28 = uVar26 % (uint)iVar9;
      if (iVar9 == 0) {
        trap(7);
      }
      pSVar24 = pSVar7 + uVar34;
      pSVar25 = pSVar8 + uVar35;
      uVar29 = uVar26 % (uint)iVar10;
      if (iVar10 == 0) {
        trap(7);
      }
      *pSVar20 = iVar18 + (iVar27 * *pSVar20 >> 7);
      uVar30 = uVar26 % (uint)iVar11;
      if (iVar11 == 0) {
        trap(7);
      }
      *pSVar21 = iVar18 + (iVar27 * *pSVar21 >> 7);
      uVar31 = uVar26 % (uint)iVar12;
      if (iVar12 == 0) {
        trap(7);
      }
      *pSVar22 = iVar18 + (iVar27 * *pSVar22 >> 7);
      uVar32 = uVar26 % (uint)iVar13;
      if (iVar13 == 0) {
        trap(7);
      }
      *pSVar23 = iVar18 + (iVar27 * *pSVar23 >> 7);
      uVar33 = uVar26 % (uint)iVar14;
      if (iVar14 == 0) {
        trap(7);
      }
      *pSVar17 = iVar18 + (iVar27 * *pSVar17 >> 7);
      uVar34 = uVar26 % (uint)iVar15;
      if (iVar15 == 0) {
        trap(7);
      }
      *pSVar24 = iVar18 + (iVar27 * *pSVar24 >> 7);
      uVar35 = uVar26 % (uint)iVar16;
      if (iVar16 == 0) {
        trap(7);
      }
      uVar26 = uVar26 + 1;
      *pSVar25 = iVar18 + (iVar27 * *pSVar25 >> 7);
      *srce = *srce + (((((((pSVar1[uVar28] - pSVar2[uVar29]) + pSVar3[uVar30]) - pSVar4[uVar31]) +
                         pSVar5[uVar32]) - pSVar6[uVar33]) + pSVar7[uVar34]) - pSVar8[uVar35]);
      srce = srce + 1;
    } while (iVar19 + 2U != uVar26);
    RVRindex = iVar19 + 1;
  }
  return;
}



----------------------------------------

// Function: MixReverb_Stereo @ 0895f800

void MixReverb_Stereo(SLONG *srce,SLONG count)

{
  SLONG *pSVar1;
  SLONG *pSVar2;
  SLONG *pSVar3;
  SLONG *pSVar4;
  SLONG *pSVar5;
  SLONG *pSVar6;
  SLONG *pSVar7;
  SLONG *pSVar8;
  SLONG *pSVar9;
  SLONG *pSVar10;
  SLONG *pSVar11;
  SLONG *pSVar12;
  SLONG *pSVar13;
  SLONG *pSVar14;
  SLONG *pSVar15;
  SLONG *pSVar16;
  int iVar17;
  int iVar18;
  int iVar19;
  int iVar20;
  int iVar21;
  int iVar22;
  int iVar23;
  int iVar24;
  int iVar25;
  int iVar26;
  SLONG *pSVar27;
  SLONG *pSVar28;
  SLONG *pSVar29;
  SLONG *pSVar30;
  SLONG *pSVar31;
  SLONG *pSVar32;
  SLONG *pSVar33;
  SLONG *pSVar34;
  SLONG *pSVar35;
  SLONG *pSVar36;
  SLONG *pSVar37;
  SLONG *pSVar38;
  SLONG *pSVar39;
  SLONG *pSVar40;
  SLONG *pSVar41;
  int iVar42;
  uint uVar43;
  uint local_c8;
  uint local_c4;
  uint local_c0;
  uint local_bc;
  uint local_b8;
  uint local_b4;
  uint local_b0;
  uint local_ac;
  int *local_48;
  
  iVar24 = RVc8;
  iVar23 = RVc7;
  iVar22 = RVc6;
  iVar21 = RVc5;
  iVar20 = RVc4;
  iVar19 = RVc3;
  iVar18 = RVc2;
  iVar17 = RVc1;
  pSVar16 = RVbufR8;
  pSVar15 = RVbufR7;
  pSVar14 = RVbufR6;
  pSVar13 = RVbufR5;
  pSVar12 = RVbufR4;
  pSVar11 = RVbufR3;
  pSVar10 = RVbufR2;
  pSVar9 = RVbufR1;
  pSVar8 = RVbufL8;
  pSVar7 = RVbufL7;
  pSVar6 = RVbufL6;
  pSVar5 = RVbufL5;
  pSVar4 = RVbufL4;
  pSVar3 = RVbufL3;
  pSVar2 = RVbufL2;
                    /* Unresolved local var: uint speedup@[???]
                       Unresolved local var: int ReverbPct@[DW_OP_reg25(t9)]
                       Unresolved local var: uint loc1@[???]
                       Unresolved local var: uint loc2@[???]
                       Unresolved local var: uint loc3@[???]
                       Unresolved local var: uint loc4@[???]
                       Unresolved local var: uint loc5@[???]
                       Unresolved local var: uint loc6@[???]
                       Unresolved local var: uint loc7@[???]
                       Unresolved local var: uint loc8@[???] */
  pSVar1 = RVbufL1;
  iVar42 = (uint)md_reverb * 2 + 0x5c;
  if (count != 0) {
    local_ac = RVRindex % (uint)RVc1;
    if (RVc1 == 0) {
      trap(7);
    }
    iVar25 = RVRindex + count + -1;
    uVar43 = RVRindex + 1;
    local_b0 = RVRindex % (uint)RVc2;
    if (RVc2 == 0) {
      trap(7);
    }
    local_b4 = RVRindex % (uint)RVc3;
    if (RVc3 == 0) {
      trap(7);
    }
    local_b8 = RVRindex % (uint)RVc4;
    if (RVc4 == 0) {
      trap(7);
    }
    local_bc = RVRindex % (uint)RVc5;
    if (RVc5 == 0) {
      trap(7);
    }
    local_c0 = RVRindex % (uint)RVc6;
    if (RVc6 == 0) {
      trap(7);
    }
    local_c4 = RVRindex % (uint)RVc7;
    if (RVc7 == 0) {
      trap(7);
    }
    local_c8 = RVRindex % (uint)RVc8;
    local_48 = srce;
    if (RVc8 == 0) {
      trap(7);
    }
    do {
      pSVar27 = pSVar1 + local_ac;
      pSVar29 = pSVar2 + local_b0;
      pSVar30 = pSVar3 + local_b4;
      iVar26 = *local_48 >> 3;
      pSVar31 = pSVar4 + local_b8;
      pSVar32 = pSVar5 + local_bc;
      pSVar33 = pSVar6 + local_c0;
      *pSVar27 = iVar26 + (iVar42 * *pSVar27 >> 7);
      pSVar34 = pSVar11 + local_b4;
      pSVar40 = pSVar7 + local_c4;
      pSVar37 = pSVar14 + local_c0;
      pSVar41 = pSVar8 + local_c8;
      pSVar39 = pSVar16 + local_c8;
      pSVar27 = pSVar9 + local_ac;
      pSVar35 = pSVar12 + local_b8;
      pSVar28 = pSVar10 + local_b0;
      pSVar36 = pSVar13 + local_bc;
      pSVar38 = pSVar15 + local_c4;
      local_ac = uVar43 % (uint)iVar17;
      if (iVar17 == 0) {
        trap(7);
      }
      *pSVar29 = iVar26 + (iVar42 * *pSVar29 >> 7);
      local_b0 = uVar43 % (uint)iVar18;
      if (iVar18 == 0) {
        trap(7);
      }
      *pSVar30 = iVar26 + (iVar42 * *pSVar30 >> 7);
      local_b4 = uVar43 % (uint)iVar19;
      if (iVar19 == 0) {
        trap(7);
      }
      *pSVar31 = iVar26 + (iVar42 * *pSVar31 >> 7);
      local_b8 = uVar43 % (uint)iVar20;
      if (iVar20 == 0) {
        trap(7);
      }
      *pSVar32 = iVar26 + (iVar42 * *pSVar32 >> 7);
      local_bc = uVar43 % (uint)iVar21;
      if (iVar21 == 0) {
        trap(7);
      }
      *pSVar33 = iVar26 + (iVar42 * *pSVar33 >> 7);
      local_c0 = uVar43 % (uint)iVar22;
      if (iVar22 == 0) {
        trap(7);
      }
      *pSVar40 = iVar26 + (iVar42 * *pSVar40 >> 7);
      local_c4 = uVar43 % (uint)iVar23;
      if (iVar23 == 0) {
        trap(7);
      }
      *pSVar41 = iVar26 + (iVar42 * *pSVar41 >> 7);
      iVar26 = local_48[1] >> 3;
      *pSVar27 = iVar26 + (iVar42 * *pSVar27 >> 7);
      local_c8 = uVar43 % (uint)iVar24;
      if (iVar24 == 0) {
        trap(7);
      }
      uVar43 = uVar43 + 1;
      *pSVar28 = iVar26 + (iVar42 * *pSVar28 >> 7);
      *pSVar34 = iVar26 + (iVar42 * *pSVar34 >> 7);
      *pSVar35 = iVar26 + (iVar42 * *pSVar35 >> 7);
      *pSVar36 = iVar26 + (iVar42 * *pSVar36 >> 7);
      *pSVar37 = iVar26 + (iVar42 * *pSVar37 >> 7);
      *pSVar38 = iVar26 + (iVar42 * *pSVar38 >> 7);
      *pSVar39 = iVar26 + (iVar42 * *pSVar39 >> 7);
      *local_48 = *local_48 +
                  (((((((pSVar1[local_ac] - pSVar2[local_b0]) + pSVar3[local_b4]) - pSVar4[local_b8]
                      ) + pSVar5[local_bc]) - pSVar6[local_c0]) + pSVar7[local_c4]) -
                  pSVar8[local_c8]);
      local_48[1] = local_48[1] +
                    (((((((pSVar9[local_ac] - pSVar10[local_b0]) + pSVar11[local_b4]) -
                        pSVar12[local_b8]) + pSVar13[local_bc]) - pSVar14[local_c0]) +
                     pSVar15[local_c4]) - pSVar16[local_c8]);
      local_48 = local_48 + 2;
    } while (iVar25 + 2U != uVar43);
    RVRindex = iVar25 + 1;
  }
  return;
}



----------------------------------------

// Function: samples2bytes @ 0895ff04

ULONG samples2bytes(ULONG samples)

{
  if ((vc_mode & 1) != 0) {
    samples = samples << 1;
  }
  if ((vc_mode & 2) != 0) {
    samples = samples << 1;
  }
  return samples;
}



----------------------------------------

// Function: bytes2samples @ 0895ff2c

ULONG bytes2samples(ULONG bytes)

{
  if ((vc_mode & 1) != 0) {
    bytes = bytes >> 1;
  }
  if ((vc_mode & 2) != 0) {
    bytes = bytes >> 1;
  }
  return bytes;
}



----------------------------------------

// Function: VC1_VoiceGetVolume @ 0895ff54

UWORD VC1_VoiceGetVolume(UBYTE voice)

{
  return (UWORD)vinf[voice].vol;
}



----------------------------------------

// Function: VC1_VoiceGetPanning @ 0895ff78

ULONG VC1_VoiceGetPanning(UBYTE voice)

{
  return vinf[voice].pan;
}



----------------------------------------

// Function: VC1_VoiceSetFrequency @ 0895ff9c

void VC1_VoiceSetFrequency(UBYTE voice,ULONG frq)

{
  vinf[voice].frq = frq;
  return;
}



----------------------------------------

// Function: VC1_VoiceGetFrequency @ 0895ffc0

ULONG VC1_VoiceGetFrequency(UBYTE voice)

{
  return vinf[voice].frq;
}



----------------------------------------

// Function: VC1_VoicePlay @ 0895ffe4

void VC1_VoicePlay(UBYTE voice,SWORD handle,ULONG start,ULONG size,ULONG reppos,ULONG repend,
                  UWORD flags)

{
  VINFO *pVVar1;
  ULONG in_t0;
  ULONG in_t1;
  UWORD in_t2;
  
  pVVar1 = vinf + voice;
  pVVar1->kick = '\x01';
  pVVar1->flags = in_t2;
  pVVar1->handle = handle;
  pVVar1->start = start;
  pVVar1->size = size;
  pVVar1->reppos = in_t0;
  pVVar1->repend = in_t1;
  return;
}



----------------------------------------

// Function: VC1_VoiceStop @ 08960024

void VC1_VoiceStop(UBYTE voice)

{
  vinf[voice].active = '\0';
  return;
}



----------------------------------------

// Function: VC1_VoiceStopped @ 08960048

BOOL VC1_VoiceStopped(UBYTE voice)

{
  return (uint)(vinf[voice].active == '\0');
}



----------------------------------------

// Function: VC1_VoiceGetPosition @ 08960070

SLONG VC1_VoiceGetPosition(UBYTE voice)

{
  return *(int *)((int)&vinf[voice].current + 4) << 0x15 | (uint)vinf[voice].current >> 0xb;
}



----------------------------------------

// Function: VC1_VoiceSetVolume @ 089600a4

/* WARNING: Removing unreachable block (ram,0x089600e0) */

void VC1_VoiceSetVolume(UBYTE voice,UWORD vol)

{
  vinf[voice].vol = (uint)vol;
  return;
}



----------------------------------------

// Function: VC1_VoiceSetPanning @ 089600ec

/* WARNING: Removing unreachable block (ram,0x08960124) */

void VC1_VoiceSetPanning(UBYTE voice,ULONG pan)

{
  vinf[voice].pan = pan;
  return;
}



----------------------------------------

// Function: VC1_SampleSpace @ 08960130

ULONG VC1_SampleSpace(int type)

{
  return 0;
}



----------------------------------------

// Function: VC1_SampleLength @ 08960138

ULONG VC1_SampleLength(int type,SAMPLE *s)

{
  ULONG UVar1;
  int iVar2;
  
  iVar2 = 2;
  UVar1 = 0;
  if (s != (SAMPLE *)0x0) {
    if ((s->flags & 1) == 0) {
      iVar2 = 1;
    }
    UVar1 = iVar2 * s->length + 0x10;
  }
  return UVar1;
}



----------------------------------------

// Function: VC1_VoiceRealVolume @ 0896016c

ULONG VC1_VoiceRealVolume(UBYTE voice)

{
  uint uVar1;
  
                    /* Unresolved local var: ULONG i@[???]
                       Unresolved local var: ULONG s@[???]
                       Unresolved local var: ULONG size@[DW_OP_reg9(t1)]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: SWORD * smp@[???]
                       Unresolved local var: SLONG t@[???] */
  if (vinf[voice].active != '\0') {
    if (vinf[voice].size < 0x40) {
      uVar1 = vinf[voice].size & 0xfffffffe;
    }
    else {
      uVar1 = 0x40;
    }
    if (uVar1 != 0) {
      do {
        uVar1 = uVar1 - 1;
      } while (uVar1 != 0);
      return 0;
    }
  }
  return 0;
}



----------------------------------------

// Function: VC1_PlayStop @ 08960240

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC1_PlayStop(void)

{
  if (RVbufL1 != (SLONG *)0x0) {
    free(RVbufL1);
  }
  if (RVbufL2 != (SLONG *)0x0) {
    free(RVbufL2);
  }
  if (RVbufL3 != (SLONG *)0x0) {
    free(RVbufL3);
  }
  if (RVbufL4 != (SLONG *)0x0) {
    free(RVbufL4);
  }
  if (RVbufL5 != (SLONG *)0x0) {
    free(RVbufL5);
  }
  if (RVbufL6 != (SLONG *)0x0) {
    free(RVbufL6);
  }
  if (RVbufL7 != (SLONG *)0x0) {
    free(RVbufL7);
  }
  if (RVbufL8 != (SLONG *)0x0) {
    free(RVbufL8);
  }
  RVbufL8 = (SLONG *)0x0;
  RVbufL7 = (SLONG *)0x0;
  RVbufL6 = (SLONG *)0x0;
  RVbufL5 = (SLONG *)0x0;
  RVbufL4 = (SLONG *)0x0;
  RVbufL3 = (SLONG *)0x0;
  RVbufL2 = (SLONG *)0x0;
  RVbufL1 = (SLONG *)0x0;
  if (RVbufR1 != (SLONG *)0x0) {
    free(RVbufR1);
  }
  if (RVbufR2 != (SLONG *)0x0) {
    free(RVbufR2);
  }
  if (RVbufR3 != (SLONG *)0x0) {
    free(RVbufR3);
  }
  if (RVbufR4 != (SLONG *)0x0) {
    free(RVbufR4);
  }
  if (RVbufR5 != (SLONG *)0x0) {
    free(RVbufR5);
  }
  if (RVbufR6 != (SLONG *)0x0) {
    free(RVbufR6);
  }
  if (RVbufR7 != (SLONG *)0x0) {
    free(RVbufR7);
  }
  if (RVbufR8 != (SLONG *)0x0) {
    free(RVbufR8);
  }
  RVbufR8 = (SLONG *)0x0;
  RVbufR7 = (SLONG *)0x0;
  RVbufR6 = (SLONG *)0x0;
  RVbufR5 = (SLONG *)0x0;
  RVbufR4 = (SLONG *)0x0;
  RVbufR3 = (SLONG *)0x0;
  RVbufR2 = (SLONG *)0x0;
  RVbufR1 = (SLONG *)0x0;
  return;
}



----------------------------------------

// Function: VC1_SampleUnload @ 08960420

void VC1_SampleUnload(SWORD handle)

{
  int iVar1;
  
  iVar1 = (int)handle;
  if (Samples != (SWORD **)0x0) {
    if (iVar1 < 0x180) {
      if (Samples[iVar1] != (SWORD *)0x0) {
        free(Samples[iVar1]);
      }
      Samples[iVar1] = (SWORD *)0x0;
    }
  }
  return;
}



----------------------------------------

// Function: VC1_SetNumVoices @ 08960484

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC1_SetNumVoices(void)

{
  int iVar1;
  VINFO *pVVar2;
  uint uVar3;
  int iVar4;
  
                    /* Unresolved local var: int t@[???] */
  vc_softchn = (int)md_softchn;
  if (vc_softchn != 0) {
    if (vinf != (VINFO *)0x0) {
      free(vinf);
    }
    pVVar2 = _mm_calloc(0x48,vc_softchn);
    iVar1 = vc_softchn;
    if (pVVar2 == (VINFO *)0x0) {
      vinf = pVVar2;
      return 1;
    }
    if (vc_softchn < 1) {
      vinf = pVVar2;
      return 0;
    }
    iVar4 = 0xff;
    uVar3 = 0;
    vinf = pVVar2;
    pVVar2->frq = 10000;
    while( true ) {
      uVar3 = uVar3 + 1;
      pVVar2->pan = iVar4;
      iVar4 = 0;
      if ((uVar3 & 1) == 0) {
        iVar4 = 0xff;
      }
      if (iVar1 == uVar3) break;
      pVVar2[1].frq = 10000;
      pVVar2 = pVVar2 + 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: VC1_PlayStart @ 08960548

/* WARNING: Removing unreachable block (ram,0x089606ac) */
/* WARNING: Removing unreachable block (ram,0x08960684) */
/* WARNING: Removing unreachable block (ram,0x0896065c) */
/* WARNING: Removing unreachable block (ram,0x08960630) */
/* WARNING: Removing unreachable block (ram,0x08960648) */
/* WARNING: Removing unreachable block (ram,0x08960670) */
/* WARNING: Removing unreachable block (ram,0x08960698) */
/* WARNING: Removing unreachable block (ram,0x089606c0) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC1_PlayStart(void)

{
  BOOL BVar1;
  uint uVar2;
  
  samplesthatfit = 0x2000;
  if ((vc_mode & 2) != 0) {
    samplesthatfit = 0x1000;
  }
  uVar2 = (uint)md_mixfreq;
  tickleft = 0;
  RVc1 = uVar2 / 0x16;
  RVc8 = (uVar2 * 0x227c) / 110000;
  RVc2 = (uVar2 * 0x13d6) / 110000;
  RVc3 = (uVar2 * 0x14c1) / 110000;
  RVc4 = (uVar2 * 0x1647) / 110000;
  RVc5 = (uVar2 * 0x186a) / 110000;
  RVc6 = (uVar2 * 0x1b29) / 110000;
  RVc7 = (uVar2 * 0x1e85) / 110000;
  RVbufL1 = _mm_calloc(RVc1 + 1,4);
  if (((((RVbufL1 == (SLONG *)0x0) || (RVbufL2 = _mm_calloc(RVc2 + 1,4), RVbufL2 == (SLONG *)0x0))
       || (RVbufL3 = _mm_calloc(RVc3 + 1,4), RVbufL3 == (SLONG *)0x0)) ||
      (((RVbufL4 = _mm_calloc(RVc4 + 1,4), RVbufL4 == (SLONG *)0x0 ||
        (RVbufL5 = _mm_calloc(RVc5 + 1,4), RVbufL5 == (SLONG *)0x0)) ||
       ((RVbufL6 = _mm_calloc(RVc6 + 1,4), RVbufL6 == (SLONG *)0x0 ||
        ((RVbufL7 = _mm_calloc(RVc7 + 1,4), RVbufL7 == (SLONG *)0x0 ||
         (RVbufL8 = _mm_calloc(RVc8 + 1,4), RVbufL8 == (SLONG *)0x0)))))))) ||
     ((RVbufR1 = _mm_calloc(RVc1 + 1,4), RVbufR1 == (SLONG *)0x0 ||
      (((((RVbufR2 = _mm_calloc(RVc2 + 1,4), RVbufR2 == (SLONG *)0x0 ||
          (RVbufR3 = _mm_calloc(RVc3 + 1,4), RVbufR3 == (SLONG *)0x0)) ||
         (RVbufR4 = _mm_calloc(RVc4 + 1,4), RVbufR4 == (SLONG *)0x0)) ||
        ((RVbufR5 = _mm_calloc(RVc5 + 1,4), RVbufR5 == (SLONG *)0x0 ||
         (RVbufR6 = _mm_calloc(RVc6 + 1,4), RVbufR6 == (SLONG *)0x0)))) ||
       ((RVbufR7 = _mm_calloc(RVc7 + 1,4), RVbufR7 == (SLONG *)0x0 ||
        (RVbufR8 = _mm_calloc(RVc8 + 1,4), RVbufR8 == (SLONG *)0x0)))))))) {
    BVar1 = 1;
  }
  else {
    BVar1 = 0;
    RVRindex = 0;
  }
  return BVar1;
}



----------------------------------------

// Function: VC1_Exit @ 089608c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC1_Exit(void)

{
  if (vc_tickbuf != (SLONG *)0x0) {
    free(vc_tickbuf);
  }
  if (vinf != (VINFO *)0x0) {
    free(vinf);
  }
  if (Samples != (SWORD **)0x0) {
    free(Samples);
  }
  vc_tickbuf = (SLONG *)0x0;
  vinf = (VINFO *)0x0;
  Samples = (SWORD **)0x0;
  VC_SetupPointers();
  return;
}



----------------------------------------

// Function: VC1_Init @ 08960944

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC1_Init(void)

{
  BOOL BVar1;
  code *pcVar2;
  
  VC_SetupPointers();
  if ((md_mode & 0x10) != 0) {
    BVar1 = VC2_Init();
    return BVar1;
  }
  Samples = _mm_calloc(0x180,4);
  if (Samples == (SWORD **)0x0) {
    MikMod_errno = 0x11;
    return 1;
  }
  if ((vc_tickbuf == (SLONG *)0x0) && (vc_tickbuf = _mm_malloc(0x8080), vc_tickbuf == (SLONG *)0x0))
  {
    MikMod_errno = 0x11;
    return 1;
  }
  if ((md_mode & 2) == 0) {
    pcVar2 = MixReverb_Normal;
  }
  else {
    pcVar2 = MixReverb_Stereo;
  }
  MixReverb = pcVar2;
  vc_mode = md_mode;
  return 0;
}



----------------------------------------

// Function: VC1_WriteSamples @ 08960a28

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x089617f0) */

void VC1_WriteSamples(SBYTE *buf,ULONG todo)

{
  ushort uVar1;
  longlong lVar2;
  longlong lVar3;
  ushort uVar4;
  SWORD **ppSVar5;
  VINFO *pVVar6;
  ULONG UVar7;
  SWORD *pSVar8;
  uint samples;
  uint uVar9;
  int iVar10;
  uint uVar11;
  short *psVar12;
  ushort uVar13;
  ULONG UVar14;
  uint uVar15;
  uint uVar16;
  int iVar17;
  int iVar18;
  int iVar19;
  short *psVar20;
  SLONG *pSVar21;
  short *psVar22;
  uint uVar23;
  uint uVar24;
  VINFO *pVVar25;
  ULONG samples_00;
  DItype DVar26;
  uint local_80;
  uint local_7c;
  uint local_78;
  uint local_74;
  int local_58;
  uint local_50;
  short *local_40;
  
                    /* Unresolved local var: int left@[???]
                       Unresolved local var: int portion@[???]
                       Unresolved local var: int count@[???]
                       Unresolved local var: SBYTE * buffer@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int pan@[???]
                       Unresolved local var: int vol@[???] */
  local_40 = (short *)buf;
  if (todo == 0) {
    return;
  }
  while( true ) {
    if (tickleft == 0) {
      if ((vc_mode & 8) != 0) {
        (*md_player)();
      }
      tickleft = ((uint)md_mixfreq * 0x7d) / ((uint)md_bpm * 0x32);
      if ((uint)md_bpm * 0x32 == 0) {
        trap(7);
      }
    }
    samples_00 = todo;
    if ((uint)tickleft <= todo) {
      samples_00 = tickleft;
    }
    tickleft = tickleft - samples_00;
    UVar7 = samples2bytes(samples_00);
    todo = todo - samples_00;
    if (samples_00 != 0) break;
LAB_08960af8:
    if (todo == 0) {
      return;
    }
    local_40 = (short *)((int)local_40 + UVar7);
  }
  samples = samples_00 + samplesthatfit;
  psVar22 = local_40;
  do {
    local_50 = samples;
    if ((vc_mode & 2) != 0) {
      local_50 = samples << 1;
    }
    memset(vc_tickbuf,0,local_50 << 2);
    iVar19 = vc_softchn;
    ppSVar5 = Samples;
    if (0 < vc_softchn) {
                    /* Unresolved local var: SLONGLONG end@[???]
                       Unresolved local var: SLONGLONG done@[???]
                       Unresolved local var: SWORD * s@[???] */
      uVar4 = vc_mode & 2;
      local_78 = (uint)idxsize;
      local_74 = idxsize._4_4_;
      local_80 = (uint)idxlend;
      local_7c = idxlend._4_4_;
      local_58 = 0;
      pVVar6 = vinf;
      uVar15 = (uint)idxlpos;
      uVar11 = idxlpos._4_4_;
      do {
        pVVar25 = pVVar6;
        if (pVVar25->kick == '\0') {
          UVar14 = pVVar25->frq;
        }
        else {
          uVar9 = pVVar25->start;
          pVVar25->kick = '\0';
          *(uint *)((int)&pVVar25->current + 4) = uVar9 >> 0x15;
          *(uint *)&pVVar25->current = uVar9 << 0xb;
          pVVar25->active = '\x01';
          UVar14 = pVVar25->frq;
        }
        if (UVar14 == 0) {
          pVVar25->active = '\0';
        }
        else if (pVVar25->active != '\0') {
          DVar26 = __divdi3((ulonglong)(UVar14 << 0xb),(ulonglong)md_mixfreq);
          uVar1 = pVVar25->flags;
          pVVar25->increment = DVar26;
          if ((uVar1 & 0x400) != 0) {
            *(int *)&pVVar25->increment = -(int)DVar26;
            *(uint *)((int)&pVVar25->increment + 4) =
                 -(uint)(-(int)DVar26 != 0) - (int)((ulonglong)DVar26 >> 0x20);
          }
          iVar10 = pVVar25->vol;
          iVar17 = pVVar25->pan;
          pVVar25->oldlvol = pVVar25->lvolsel;
          pVVar25->oldrvol = pVVar25->rvolsel;
          if (uVar4 == 0) {
            pVVar25->lvolsel = iVar10;
          }
          else if (iVar17 == 0x200) {
            pVVar25->lvolsel = iVar10 / 2;
            pVVar25->rvolsel = iVar10 / 2;
          }
          else {
            pVVar25->lvolsel = iVar10 * (0xff - iVar17) >> 8;
            pVVar25->rvolsel = iVar10 * iVar17 >> 8;
          }
          uVar11 = pVVar25->size;
          if (uVar11 == 0) {
            local_78 = 0;
            local_74 = 0;
          }
          else {
            local_78 = uVar11 * 0x800 - 1;
            local_74 = (uint)(local_78 < uVar11 * 0x800) + ((uVar11 >> 0x15) - 1);
          }
          uVar15 = pVVar25->repend;
          if (uVar15 == 0) {
            local_80 = 0;
            local_7c = 0;
            uVar11 = pVVar25->reppos;
            pSVar8 = ppSVar5[pVVar25->handle];
          }
          else {
            local_80 = uVar15 * 0x800 - 1;
            uVar11 = pVVar25->reppos;
            pSVar8 = ppSVar5[pVVar25->handle];
            local_7c = (uint)(local_80 < uVar15 * 0x800) + ((uVar15 >> 0x15) - 1);
          }
          uVar15 = uVar11 * 0x800;
          uVar11 = uVar11 >> 0x15;
          if (pSVar8 == (SWORD *)0x0) {
            pVVar25->active = '\0';
            *(undefined4 *)&pVVar25->current = 0;
            *(undefined4 *)((int)&pVVar25->current + 4) = 0;
          }
          else if (0 < (int)samples) {
                    /* Unresolved local var: SLONGLONG endpos@[???] */
            if ((uVar1 & 0x400) == 0) {
              uVar13 = uVar1 & 0x100;
              if ((uVar1 & 0x100) == 0) {
                uVar9 = *(uint *)((int)&pVVar25->current + 4);
LAB_08960f8c:
                if (((int)uVar9 < (int)local_74) ||
                   ((uVar9 == local_74 && ((uint)pVVar25->current < local_78)))) goto LAB_089611fc;
LAB_08960fa4:
                pVVar25->active = '\0';
                *(undefined4 *)&pVVar25->current = 0;
                *(undefined4 *)((int)&pVVar25->current + 4) = 0;
                goto LAB_08960fb8;
              }
              uVar23 = *(uint *)((int)&pVVar25->current + 4);
              uVar9 = (uint)pVVar25->current;
              if (((int)uVar23 < (int)local_7c) || ((uVar23 == local_7c && (uVar9 < local_80)))) {
                uVar9 = *(uint *)((int)&pVVar25->current + 4);
                goto LAB_08960f8c;
              }
              if ((uVar1 & 0x200) == 0) {
                uVar16 = uVar15 + (uVar9 - local_80);
                *(uint *)&pVVar25->current = uVar16;
                *(uint *)((int)&pVVar25->current + 4) =
                     (uint)(uVar16 < uVar15) +
                     uVar11 + ((uVar23 - local_7c) - (uint)(uVar9 < uVar9 - local_80));
              }
              else {
                pVVar25->flags = uVar1 | 0x400;
                iVar17 = *(int *)((int)&pVVar25->increment + 4);
                iVar10 = -(int)pVVar25->increment;
                uVar16 = local_80 - (uVar9 - local_80);
                uVar1 = pVVar25->flags;
                *(int *)&pVVar25->increment = iVar10;
                *(uint *)((int)&pVVar25->increment + 4) = -(uint)(iVar10 != 0) - iVar17;
                *(uint *)&pVVar25->current = uVar16;
                *(uint *)((int)&pVVar25->current + 4) =
                     ((local_7c * 2 - uVar23) + (uint)(uVar9 < uVar9 - local_80)) -
                     (uint)(local_80 < uVar16);
              }
LAB_089611e8:
              if ((uVar1 & 0x400) != 0) goto LAB_08960d78;
              uVar13 = uVar1 & 0x100;
LAB_089611fc:
              uVar9 = local_80;
              uVar23 = local_7c;
              if (uVar13 == 0) {
                uVar9 = local_78;
                uVar23 = local_74;
              }
            }
            else {
              if ((uVar1 & 0x100) == 0) {
                iVar10 = *(int *)((int)&pVVar25->current + 4);
LAB_08960d70:
                if (iVar10 < 0) goto LAB_08960fa4;
              }
              else {
                uVar23 = *(uint *)((int)&pVVar25->current + 4);
                uVar9 = (uint)pVVar25->current;
                if ((int)uVar11 <= (int)uVar23) {
                  if (uVar23 == uVar11) {
                    if (uVar9 < uVar15) goto LAB_08961400;
                    iVar10 = *(int *)((int)&pVVar25->current + 4);
                  }
                  else {
                    iVar10 = *(int *)((int)&pVVar25->current + 4);
                  }
                  goto LAB_08960d70;
                }
LAB_08961400:
                if ((uVar1 & 0x200) != 0) {
                  pVVar25->flags = uVar1 & 0xfbff;
                  iVar17 = *(int *)((int)&pVVar25->increment + 4);
                  uVar1 = pVVar25->flags;
                  uVar16 = uVar15 + (uVar15 - uVar9);
                  iVar10 = -(int)pVVar25->increment;
                  *(uint *)&pVVar25->current = uVar16;
                  *(uint *)((int)&pVVar25->current + 4) =
                       (uint)(uVar16 < uVar15) +
                       ((uVar11 * 2 - uVar23) - (uint)(uVar15 < uVar15 - uVar9));
                  *(int *)&pVVar25->increment = iVar10;
                  *(uint *)((int)&pVVar25->increment + 4) = -(uint)(iVar10 != 0) - iVar17;
                  goto LAB_089611e8;
                }
                uVar16 = local_80 - (uVar15 - uVar9);
                *(uint *)((int)&pVVar25->current + 4) =
                     (local_7c - ((uVar11 - uVar23) - (uint)(uVar15 < uVar15 - uVar9))) -
                     (uint)(local_80 < uVar16);
                *(uint *)&pVVar25->current = uVar16;
                uVar13 = uVar1 & 0x100;
                if ((uVar1 & 0x400) == 0) goto LAB_089611fc;
              }
LAB_08960d78:
              uVar9 = uVar15;
              uVar23 = uVar11;
              if ((uVar1 & 0x100) == 0) {
                uVar9 = 0;
                uVar23 = 0;
              }
            }
            uVar16 = (uint)pVVar25->current;
            uVar24 = *(uint *)((int)&pVVar25->current + 4);
            if (uVar16 == uVar9) {
              if (uVar24 != uVar23) {
                iVar10 = (int)pVVar25->increment;
                goto LAB_08960d98;
              }
            }
            else {
              iVar10 = (int)pVVar25->increment;
LAB_08960d98:
              iVar17 = *(int *)((int)&pVVar25->increment + 4);
              if (iVar10 != 0 || iVar17 != 0) {
                uVar16 = uVar9 - uVar16;
                DVar26 = __divdi3(CONCAT44((uVar23 - uVar24) - (uint)(uVar9 < uVar16),uVar16),
                                  CONCAT44(iVar17,iVar10));
                lVar2 = DVar26 + 1;
                iVar10 = (int)((ulonglong)lVar2 >> 0x20);
                lVar3 = (longlong)(int)samples;
                if (((iVar10 <= (int)samples >> 0x1f) &&
                    (lVar3 = lVar2, (int)samples >> 0x1f == iVar10)) &&
                   (lVar3 = (longlong)(int)samples, (uint)lVar2 <= samples)) {
                  lVar3 = lVar2;
                }
                if ((-1 < lVar3) && (lVar3 != 0)) {
                    /* WARNING: Bad instruction - Truncating control flow here */
                  halt_baddata();
                }
              }
            }
            pVVar25->active = '\0';
          }
        }
LAB_08960fb8:
        local_58 = local_58 + 1;
        pVVar6 = pVVar25 + 1;
      } while (local_58 != iVar19);
      idxsize._0_4_ = local_78;
      idxsize._4_4_ = local_74;
      idxlend._0_4_ = local_80;
      idxlend._4_4_ = local_7c;
      vnf = pVVar25;
      idxlpos._0_4_ = uVar15;
      idxlpos._4_4_ = uVar11;
    }
    if (md_reverb != '\0') {
      if (0xf < md_reverb) {
        md_reverb = '\x0f';
      }
      (*MixReverb)(vc_tickbuf,samples);
    }
    iVar19 = (int)local_50 >> 2;
    pSVar21 = vc_tickbuf;
    psVar12 = psVar22;
    if ((vc_mode & 1) == 0) {
      for (; iVar19 != 0; iVar19 = iVar19 + -1) {
        iVar10 = pSVar21[1];
        iVar17 = pSVar21[2];
        iVar18 = pSVar21[3];
        *(char *)psVar12 = (char)(*pSVar21 >> 0x11) + '\x7f';
        *(char *)((int)psVar12 + 1) = (char)(iVar10 >> 0x11) + '\x7f';
        *(char *)(psVar12 + 1) = (char)(iVar17 >> 0x11) + '\x7f';
        *(char *)((int)psVar12 + 3) = (char)(iVar18 >> 0x11) + '\x7f';
        pSVar21 = pSVar21 + 4;
        psVar12 = psVar12 + 2;
      }
      if ((local_50 & 3) == 0) goto LAB_08961118;
      psVar20 = (short *)((int)psVar12 + (local_50 & 3));
      do {
        *(char *)psVar12 = (char)(*pSVar21 >> 0x11) + '\x7f';
        psVar12 = (short *)((int)psVar12 + 1);
        pSVar21 = pSVar21 + 1;
      } while (psVar12 != psVar20);
      UVar14 = samples2bytes(samples);
    }
    else {
      for (; iVar19 != 0; iVar19 = iVar19 + -1) {
        iVar10 = pSVar21[1];
        iVar17 = pSVar21[2];
        iVar18 = pSVar21[3];
        *psVar12 = (short)(*pSVar21 >> 9) + -1;
        psVar12[1] = (short)(iVar10 >> 9) + -1;
        psVar12[2] = (short)(iVar17 >> 9) + -1;
        psVar12[3] = (short)(iVar18 >> 9) + -1;
        pSVar21 = pSVar21 + 4;
        psVar12 = psVar12 + 4;
      }
      uVar11 = 0;
      if ((local_50 & 3) != 0) {
        do {
          iVar19 = *pSVar21;
          uVar11 = uVar11 + 1;
          pSVar21 = pSVar21 + 1;
          *psVar12 = (short)(iVar19 >> 9) + -1;
          psVar12 = psVar12 + 1;
        } while (uVar11 != (local_50 & 3));
      }
LAB_08961118:
      UVar14 = samples2bytes(samples);
    }
    samples_00 = samples_00 - samples;
    if (samples_00 == 0) goto LAB_08960af8;
    psVar22 = (short *)((int)psVar22 + UVar14);
    samples = samples_00 + samplesthatfit;
  } while( true );
}



----------------------------------------

// Function: VC1_SilenceBytes @ 08961ef0

ULONG VC1_SilenceBytes(SBYTE *buf,ULONG todo)

{
  ULONG UVar1;
  int c;
  
  UVar1 = bytes2samples(todo);
  UVar1 = samples2bytes(UVar1);
  c = 0;
  if ((vc_mode & 1) == 0) {
    c = 0x80;
  }
  memset(buf,c,UVar1);
  return UVar1;
}



----------------------------------------

// Function: VC1_WriteBytes @ 08961f60

ULONG VC1_WriteBytes(SBYTE *buf,ULONG todo)

{
  ULONG UVar1;
  
  if (vc_softchn == 0) {
    UVar1 = VC1_SilenceBytes(buf,todo);
    return UVar1;
  }
  UVar1 = bytes2samples(todo);
  VC1_WriteSamples(buf,UVar1);
  UVar1 = samples2bytes(UVar1);
  return UVar1;
}



----------------------------------------

// Function: VC1_SampleLoad @ 08961fc4

SWORD VC1_SampleLoad(SAMPLOAD *sload,int type)

{
  undefined2 *puVar1;
  undefined2 uVar2;
  void *pvVar3;
  BOOL BVar4;
  undefined2 *puVar5;
  undefined2 *puVar6;
  int iVar7;
  undefined4 *puVar8;
  int iVar9;
  int iVar10;
  SAMPLE *pSVar11;
  uint length;
  uint uVar12;
  uint uVar13;
  
                    /* Unresolved local var: SAMPLE * s@[???]
                       Unresolved local var: int handle@[???]
                       Unresolved local var: ULONG t@[???]
                       Unresolved local var: ULONG length@[???]
                       Unresolved local var: ULONG loopstart@[???]
                       Unresolved local var: ULONG loopend@[???] */
  pSVar11 = sload->sample;
  if (type != 0) {
    iVar10 = 0;
    iVar9 = 0;
    while (*(int *)((int)Samples + iVar9) != 0) {
      iVar10 = iVar10 + 1;
      iVar9 = iVar9 + 4;
      if (iVar10 == 0x180) {
        MikMod_errno = 5;
        return -1;
      }
    }
    uVar12 = pSVar11->loopstart;
    uVar13 = pSVar11->loopend;
    length = pSVar11->length;
    if (((2 < uVar13 - uVar12) && (uVar13 < uVar12)) && (length < uVar12)) {
      uVar12 = uVar12 >> 1;
    }
    SL_SampleSigned(sload);
    SL_Sample8to16(sload);
    puVar8 = (undefined4 *)(iVar9 + (int)Samples);
    pvVar3 = _mm_malloc((length + 0x14) * 2);
    *puVar8 = pvVar3;
    if (pvVar3 == (void *)0x0) {
      MikMod_errno = 4;
      return -1;
    }
    BVar4 = SL_Load(*(void **)((int)Samples + iVar9),sload,length);
    if (BVar4 == 0) {
      if ((pSVar11->flags & 0x100) == 0) {
        iVar7 = 0;
        puVar6 = (undefined2 *)(length * 2 + *(int *)((int)Samples + iVar9));
        do {
          iVar7 = iVar7 + 1;
          *puVar6 = 0;
          puVar6 = puVar6 + 1;
        } while (iVar7 != 0x10);
      }
      else if ((pSVar11->flags & 0x200) == 0) {
        iVar7 = 0;
        puVar5 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar13 * 2);
        puVar6 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar12 * 2);
        do {
          uVar2 = *puVar6;
          iVar7 = iVar7 + 1;
          puVar6 = puVar6 + 1;
          *puVar5 = uVar2;
          puVar5 = puVar5 + 1;
        } while (iVar7 != 0x10);
      }
      else {
        iVar7 = 0;
        puVar5 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar13 * 2);
        puVar6 = puVar5;
        do {
          puVar1 = puVar6 + -1;
          iVar7 = iVar7 + 1;
          puVar6 = puVar6 + -1;
          *puVar5 = *puVar1;
          puVar5 = puVar5 + 1;
        } while (iVar7 != 0x10);
      }
      return (SWORD)iVar10;
    }
  }
  return -1;
}



----------------------------------------

// Function: MixReverb_Normal @ 08962254

void MixReverb_Normal(SLONG *srce,SLONG count)

{
  SLONG *pSVar1;
  SLONG *pSVar2;
  SLONG *pSVar3;
  SLONG *pSVar4;
  SLONG *pSVar5;
  SLONG *pSVar6;
  SLONG *pSVar7;
  SLONG *pSVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  int iVar16;
  SLONG *pSVar17;
  int iVar18;
  int iVar19;
  SLONG *pSVar20;
  SLONG *pSVar21;
  SLONG *pSVar22;
  SLONG *pSVar23;
  SLONG *pSVar24;
  SLONG *pSVar25;
  uint uVar26;
  int iVar27;
  uint uVar28;
  uint uVar29;
  uint uVar30;
  uint uVar31;
  uint uVar32;
  uint uVar33;
  uint uVar34;
  uint uVar35;
  
  iVar16 = RVc8;
  iVar15 = RVc7;
  iVar14 = RVc6;
  iVar13 = RVc5;
  iVar12 = RVc4;
  iVar11 = RVc3;
  iVar10 = RVc2;
  iVar9 = RVc1;
  pSVar8 = RVbufL8;
  pSVar7 = RVbufL7;
  pSVar6 = RVbufL6;
  pSVar5 = RVbufL5;
  pSVar4 = RVbufL4;
  pSVar3 = RVbufL3;
  pSVar2 = RVbufL2;
                    /* Unresolved local var: SLONG speedup@[???]
                       Unresolved local var: int ReverbPct@[DW_OP_reg25(t9)]
                       Unresolved local var: uint loc1@[???]
                       Unresolved local var: uint loc2@[???]
                       Unresolved local var: uint loc3@[???]
                       Unresolved local var: uint loc4@[???]
                       Unresolved local var: uint loc5@[???]
                       Unresolved local var: uint loc6@[???]
                       Unresolved local var: uint loc7@[???]
                       Unresolved local var: uint loc8@[???] */
  pSVar1 = RVbufL1;
  iVar27 = (uint)md_reverb * 4 + 0x3a;
  if (count != 0) {
    uVar28 = RVRindex % (uint)RVc1;
    if (RVc1 == 0) {
      trap(7);
    }
    iVar19 = RVRindex + count + -1;
    uVar26 = RVRindex + 1;
    uVar29 = RVRindex % (uint)RVc2;
    if (RVc2 == 0) {
      trap(7);
    }
    uVar30 = RVRindex % (uint)RVc3;
    if (RVc3 == 0) {
      trap(7);
    }
    uVar31 = RVRindex % (uint)RVc4;
    if (RVc4 == 0) {
      trap(7);
    }
    uVar32 = RVRindex % (uint)RVc5;
    if (RVc5 == 0) {
      trap(7);
    }
    uVar33 = RVRindex % (uint)RVc6;
    if (RVc6 == 0) {
      trap(7);
    }
    uVar34 = RVRindex % (uint)RVc7;
    if (RVc7 == 0) {
      trap(7);
    }
    uVar35 = RVRindex % (uint)RVc8;
    if (RVc8 == 0) {
      trap(7);
    }
    do {
      pSVar17 = pSVar1 + uVar28;
      iVar18 = *srce >> 3;
      pSVar20 = pSVar2 + uVar29;
      pSVar21 = pSVar3 + uVar30;
      pSVar22 = pSVar4 + uVar31;
      pSVar23 = pSVar5 + uVar32;
      *pSVar17 = iVar18 + (iVar27 * *pSVar17 >> 7);
      pSVar17 = pSVar6 + uVar33;
      uVar28 = uVar26 % (uint)iVar9;
      if (iVar9 == 0) {
        trap(7);
      }
      pSVar24 = pSVar7 + uVar34;
      pSVar25 = pSVar8 + uVar35;
      uVar29 = uVar26 % (uint)iVar10;
      if (iVar10 == 0) {
        trap(7);
      }
      *pSVar20 = iVar18 + (iVar27 * *pSVar20 >> 7);
      uVar30 = uVar26 % (uint)iVar11;
      if (iVar11 == 0) {
        trap(7);
      }
      *pSVar21 = iVar18 + (iVar27 * *pSVar21 >> 7);
      uVar31 = uVar26 % (uint)iVar12;
      if (iVar12 == 0) {
        trap(7);
      }
      *pSVar22 = iVar18 + (iVar27 * *pSVar22 >> 7);
      uVar32 = uVar26 % (uint)iVar13;
      if (iVar13 == 0) {
        trap(7);
      }
      *pSVar23 = iVar18 + (iVar27 * *pSVar23 >> 7);
      uVar33 = uVar26 % (uint)iVar14;
      if (iVar14 == 0) {
        trap(7);
      }
      *pSVar17 = iVar18 + (iVar27 * *pSVar17 >> 7);
      uVar34 = uVar26 % (uint)iVar15;
      if (iVar15 == 0) {
        trap(7);
      }
      *pSVar24 = iVar18 + (iVar27 * *pSVar24 >> 7);
      uVar35 = uVar26 % (uint)iVar16;
      if (iVar16 == 0) {
        trap(7);
      }
      uVar26 = uVar26 + 1;
      *pSVar25 = iVar18 + (iVar27 * *pSVar25 >> 7);
      *srce = *srce + (((((((pSVar1[uVar28] - pSVar2[uVar29]) + pSVar3[uVar30]) - pSVar4[uVar31]) +
                         pSVar5[uVar32]) - pSVar6[uVar33]) + pSVar7[uVar34]) - pSVar8[uVar35]);
      srce = srce + 1;
    } while (iVar19 + 2U != uVar26);
    RVRindex = iVar19 + 1;
  }
  return;
}



----------------------------------------

// Function: MixReverb_Stereo @ 089626e4

void MixReverb_Stereo(SLONG *srce,SLONG count)

{
  SLONG *pSVar1;
  SLONG *pSVar2;
  SLONG *pSVar3;
  SLONG *pSVar4;
  SLONG *pSVar5;
  SLONG *pSVar6;
  SLONG *pSVar7;
  SLONG *pSVar8;
  SLONG *pSVar9;
  SLONG *pSVar10;
  SLONG *pSVar11;
  SLONG *pSVar12;
  SLONG *pSVar13;
  SLONG *pSVar14;
  SLONG *pSVar15;
  SLONG *pSVar16;
  int iVar17;
  int iVar18;
  int iVar19;
  int iVar20;
  int iVar21;
  int iVar22;
  int iVar23;
  int iVar24;
  int iVar25;
  int iVar26;
  SLONG *pSVar27;
  SLONG *pSVar28;
  SLONG *pSVar29;
  SLONG *pSVar30;
  SLONG *pSVar31;
  SLONG *pSVar32;
  SLONG *pSVar33;
  SLONG *pSVar34;
  SLONG *pSVar35;
  SLONG *pSVar36;
  SLONG *pSVar37;
  SLONG *pSVar38;
  SLONG *pSVar39;
  SLONG *pSVar40;
  SLONG *pSVar41;
  int iVar42;
  uint uVar43;
  uint local_c8;
  uint local_c4;
  uint local_c0;
  uint local_bc;
  uint local_b8;
  uint local_b4;
  uint local_b0;
  uint local_ac;
  int *local_48;
  
  iVar24 = RVc8;
  iVar23 = RVc7;
  iVar22 = RVc6;
  iVar21 = RVc5;
  iVar20 = RVc4;
  iVar19 = RVc3;
  iVar18 = RVc2;
  iVar17 = RVc1;
  pSVar16 = RVbufR8;
  pSVar15 = RVbufR7;
  pSVar14 = RVbufR6;
  pSVar13 = RVbufR5;
  pSVar12 = RVbufR4;
  pSVar11 = RVbufR3;
  pSVar10 = RVbufR2;
  pSVar9 = RVbufR1;
  pSVar8 = RVbufL8;
  pSVar7 = RVbufL7;
  pSVar6 = RVbufL6;
  pSVar5 = RVbufL5;
  pSVar4 = RVbufL4;
  pSVar3 = RVbufL3;
  pSVar2 = RVbufL2;
                    /* Unresolved local var: SLONG speedup@[???]
                       Unresolved local var: int ReverbPct@[DW_OP_reg25(t9)]
                       Unresolved local var: uint loc1@[???]
                       Unresolved local var: uint loc2@[???]
                       Unresolved local var: uint loc3@[???]
                       Unresolved local var: uint loc4@[???]
                       Unresolved local var: uint loc5@[???]
                       Unresolved local var: uint loc6@[???]
                       Unresolved local var: uint loc7@[???]
                       Unresolved local var: uint loc8@[???] */
  pSVar1 = RVbufL1;
  iVar42 = (uint)md_reverb * 4 + 0x3a;
  if (count != 0) {
    local_ac = RVRindex % (uint)RVc1;
    if (RVc1 == 0) {
      trap(7);
    }
    iVar25 = RVRindex + count + -1;
    uVar43 = RVRindex + 1;
    local_b0 = RVRindex % (uint)RVc2;
    if (RVc2 == 0) {
      trap(7);
    }
    local_b4 = RVRindex % (uint)RVc3;
    if (RVc3 == 0) {
      trap(7);
    }
    local_b8 = RVRindex % (uint)RVc4;
    if (RVc4 == 0) {
      trap(7);
    }
    local_bc = RVRindex % (uint)RVc5;
    if (RVc5 == 0) {
      trap(7);
    }
    local_c0 = RVRindex % (uint)RVc6;
    if (RVc6 == 0) {
      trap(7);
    }
    local_c4 = RVRindex % (uint)RVc7;
    if (RVc7 == 0) {
      trap(7);
    }
    local_c8 = RVRindex % (uint)RVc8;
    local_48 = srce;
    if (RVc8 == 0) {
      trap(7);
    }
    do {
      pSVar27 = pSVar1 + local_ac;
      pSVar29 = pSVar2 + local_b0;
      pSVar30 = pSVar3 + local_b4;
      iVar26 = *local_48 >> 3;
      pSVar31 = pSVar4 + local_b8;
      pSVar32 = pSVar5 + local_bc;
      pSVar33 = pSVar6 + local_c0;
      *pSVar27 = iVar26 + (iVar42 * *pSVar27 >> 7);
      pSVar34 = pSVar11 + local_b4;
      pSVar40 = pSVar7 + local_c4;
      pSVar37 = pSVar14 + local_c0;
      pSVar41 = pSVar8 + local_c8;
      pSVar39 = pSVar16 + local_c8;
      pSVar27 = pSVar9 + local_ac;
      pSVar35 = pSVar12 + local_b8;
      pSVar28 = pSVar10 + local_b0;
      pSVar36 = pSVar13 + local_bc;
      pSVar38 = pSVar15 + local_c4;
      local_ac = uVar43 % (uint)iVar17;
      if (iVar17 == 0) {
        trap(7);
      }
      *pSVar29 = iVar26 + (iVar42 * *pSVar29 >> 7);
      local_b0 = uVar43 % (uint)iVar18;
      if (iVar18 == 0) {
        trap(7);
      }
      *pSVar30 = iVar26 + (iVar42 * *pSVar30 >> 7);
      local_b4 = uVar43 % (uint)iVar19;
      if (iVar19 == 0) {
        trap(7);
      }
      *pSVar31 = iVar26 + (iVar42 * *pSVar31 >> 7);
      local_b8 = uVar43 % (uint)iVar20;
      if (iVar20 == 0) {
        trap(7);
      }
      *pSVar32 = iVar26 + (iVar42 * *pSVar32 >> 7);
      local_bc = uVar43 % (uint)iVar21;
      if (iVar21 == 0) {
        trap(7);
      }
      *pSVar33 = iVar26 + (iVar42 * *pSVar33 >> 7);
      local_c0 = uVar43 % (uint)iVar22;
      if (iVar22 == 0) {
        trap(7);
      }
      *pSVar40 = iVar26 + (iVar42 * *pSVar40 >> 7);
      local_c4 = uVar43 % (uint)iVar23;
      if (iVar23 == 0) {
        trap(7);
      }
      *pSVar41 = iVar26 + (iVar42 * *pSVar41 >> 7);
      iVar26 = local_48[1] >> 3;
      *pSVar27 = iVar26 + (iVar42 * *pSVar27 >> 7);
      local_c8 = uVar43 % (uint)iVar24;
      if (iVar24 == 0) {
        trap(7);
      }
      uVar43 = uVar43 + 1;
      *pSVar28 = iVar26 + (iVar42 * *pSVar28 >> 7);
      *pSVar34 = iVar26 + (iVar42 * *pSVar34 >> 7);
      *pSVar35 = iVar26 + (iVar42 * *pSVar35 >> 7);
      *pSVar36 = iVar26 + (iVar42 * *pSVar36 >> 7);
      *pSVar37 = iVar26 + (iVar42 * *pSVar37 >> 7);
      *pSVar38 = iVar26 + (iVar42 * *pSVar38 >> 7);
      *pSVar39 = iVar26 + (iVar42 * *pSVar39 >> 7);
      *local_48 = *local_48 +
                  (((((((pSVar1[local_ac] - pSVar2[local_b0]) + pSVar3[local_b4]) - pSVar4[local_b8]
                      ) + pSVar5[local_bc]) - pSVar6[local_c0]) + pSVar7[local_c4]) -
                  pSVar8[local_c8]);
      local_48[1] = local_48[1] +
                    (((((((pSVar9[local_ac] - pSVar10[local_b0]) + pSVar11[local_b4]) -
                        pSVar12[local_b8]) + pSVar13[local_bc]) - pSVar14[local_c0]) +
                     pSVar15[local_c4]) - pSVar16[local_c8]);
      local_48 = local_48 + 2;
    } while (iVar25 + 2U != uVar43);
    RVRindex = iVar25 + 1;
  }
  return;
}



----------------------------------------

// Function: Mix32To16_Normal @ 08962de8

/* WARNING: Removing unreachable block (ram,0x08962e1c) */
/* WARNING: Removing unreachable block (ram,0x08962e44) */

void Mix32To16_Normal(SWORD *dste,SLONG *srce,SLONG count)

{
  int *piVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  
                    /* Unresolved local var: SLONG x1@[???]
                       Unresolved local var: SLONG x2@[???]
                       Unresolved local var: SLONG tmpx@[???]
                       Unresolved local var: int i@[???] */
  if ((uint)count >> 2 != 0) {
    uVar6 = 0;
    while( true ) {
      iVar4 = 2;
      uVar5 = 0;
      piVar3 = srce;
      do {
        iVar2 = *piVar3;
        piVar1 = piVar3 + 1;
        iVar4 = iVar4 + -1;
        piVar3 = piVar3 + 2;
        uVar5 = *piVar1 / 0x200 + iVar2 / 0x200 + -2 + uVar5;
      } while (iVar4 != 0);
      uVar6 = uVar6 + 1;
      *dste = (SWORD)(uVar5 >> 2);
      srce = srce + 4;
      if ((uint)count >> 2 == uVar6) break;
      dste = dste + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Mix32To16_Stereo @ 08962e84

/* WARNING: Removing unreachable block (ram,0x08962f08) */
/* WARNING: Removing unreachable block (ram,0x08962ebc) */
/* WARNING: Removing unreachable block (ram,0x08962eec) */
/* WARNING: Removing unreachable block (ram,0x08962f24) */

void Mix32To16_Stereo(SWORD *dste,SLONG *srce,SLONG count)

{
  int *piVar1;
  int *piVar2;
  SLONG *pSVar3;
  int iVar4;
  SLONG *pSVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  
                    /* Unresolved local var: SLONG x1@[???]
                       Unresolved local var: SLONG x2@[???]
                       Unresolved local var: SLONG x3@[???]
                       Unresolved local var: SLONG x4@[???]
                       Unresolved local var: SLONG tmpx@[???]
                       Unresolved local var: SLONG tmpy@[???]
                       Unresolved local var: int i@[???] */
  if ((uint)count >> 2 != 0) {
    uVar9 = 0;
    while( true ) {
      uVar7 = 0;
      uVar8 = 0;
      iVar6 = 2;
      pSVar5 = srce;
      do {
        iVar4 = *pSVar5;
        piVar1 = pSVar5 + 1;
        piVar2 = pSVar5 + 3;
        pSVar3 = pSVar5 + 2;
        iVar6 = iVar6 + -1;
        pSVar5 = pSVar5 + 4;
        uVar8 = *piVar2 / 0x200 + *piVar1 / 0x200 + -2 + uVar8;
        uVar7 = *pSVar3 / 0x200 + iVar4 / 0x200 + -2 + uVar7;
      } while (iVar6 != 0);
      uVar9 = uVar9 + 1;
      *dste = (SWORD)(uVar7 >> 2);
      dste[1] = (SWORD)(uVar8 >> 2);
      srce = srce + 8;
      if (uVar9 == (uint)count >> 2) break;
      dste = dste + 2;
    }
  }
  return;
}



----------------------------------------

// Function: Mix32To8_Normal @ 08962f6c

/* WARNING: Removing unreachable block (ram,0x08962fa0) */
/* WARNING: Removing unreachable block (ram,0x08962fc8) */

void Mix32To8_Normal(SBYTE *dste,SLONG *srce,SLONG count)

{
  int *piVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  
                    /* Unresolved local var: SLONG x1@[???]
                       Unresolved local var: SLONG x2@[???]
                       Unresolved local var: SLONG tmpx@[???]
                       Unresolved local var: int i@[???] */
  if ((uint)count >> 2 != 0) {
    uVar6 = 0;
    while( true ) {
      uVar5 = 0;
      iVar4 = 2;
      piVar3 = srce;
      do {
        iVar2 = *piVar3;
        piVar1 = piVar3 + 1;
        iVar4 = iVar4 + -1;
        piVar3 = piVar3 + 2;
        uVar5 = *piVar1 / 0x20000 + iVar2 / 0x20000 + -2 + uVar5;
      } while (iVar4 != 0);
      uVar6 = uVar6 + 1;
      *dste = (char)(uVar5 >> 2) + -0x80;
      srce = srce + 4;
      if ((uint)count >> 2 == uVar6) break;
      dste = dste + 1;
    }
  }
  return;
}



----------------------------------------

// Function: Mix32To8_Stereo @ 0896300c

/* WARNING: Removing unreachable block (ram,0x08963090) */
/* WARNING: Removing unreachable block (ram,0x08963044) */
/* WARNING: Removing unreachable block (ram,0x08963074) */
/* WARNING: Removing unreachable block (ram,0x089630ac) */

void Mix32To8_Stereo(SBYTE *dste,SLONG *srce,SLONG count)

{
  int *piVar1;
  int *piVar2;
  SLONG *pSVar3;
  int iVar4;
  SLONG *pSVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  
                    /* Unresolved local var: SLONG x1@[???]
                       Unresolved local var: SLONG x2@[???]
                       Unresolved local var: SLONG x3@[???]
                       Unresolved local var: SLONG x4@[???]
                       Unresolved local var: SLONG tmpx@[???]
                       Unresolved local var: SLONG tmpy@[???]
                       Unresolved local var: int i@[???] */
  if ((uint)count >> 2 != 0) {
    uVar9 = 0;
    while( true ) {
      uVar7 = 0;
      uVar8 = 0;
      iVar6 = 2;
      pSVar5 = srce;
      do {
        iVar4 = *pSVar5;
        piVar1 = pSVar5 + 1;
        piVar2 = pSVar5 + 3;
        pSVar3 = pSVar5 + 2;
        iVar6 = iVar6 + -1;
        pSVar5 = pSVar5 + 4;
        uVar8 = *piVar2 / 0x20000 + *piVar1 / 0x20000 + -2 + uVar8;
        uVar7 = *pSVar3 / 0x20000 + iVar4 / 0x20000 + -2 + uVar7;
      } while (iVar6 != 0);
      uVar9 = uVar9 + 1;
      *dste = (char)(uVar7 >> 2) + -0x80;
      dste[1] = (char)(uVar8 >> 2) + -0x80;
      srce = srce + 8;
      if (uVar9 == (uint)count >> 2) break;
      dste = dste + 2;
    }
  }
  return;
}



----------------------------------------

// Function: samples2bytes @ 089630fc

ULONG samples2bytes(ULONG samples)

{
  if ((vc_mode & 1) != 0) {
    samples = samples << 1;
  }
  if ((vc_mode & 2) != 0) {
    samples = samples << 1;
  }
  return samples;
}



----------------------------------------

// Function: bytes2samples @ 08963124

ULONG bytes2samples(ULONG bytes)

{
  if ((vc_mode & 1) != 0) {
    bytes = bytes >> 1;
  }
  if ((vc_mode & 2) != 0) {
    bytes = bytes >> 1;
  }
  return bytes;
}



----------------------------------------

// Function: VC2_VoiceGetVolume @ 0896314c

UWORD VC2_VoiceGetVolume(UBYTE voice)

{
  return (UWORD)vinf[voice].vol;
}



----------------------------------------

// Function: VC2_VoiceGetPanning @ 08963170

ULONG VC2_VoiceGetPanning(UBYTE voice)

{
  return vinf[voice].pan;
}



----------------------------------------

// Function: VC2_VoiceSetFrequency @ 08963194

void VC2_VoiceSetFrequency(UBYTE voice,ULONG frq)

{
  vinf[voice].frq = frq;
  return;
}



----------------------------------------

// Function: VC2_VoiceGetFrequency @ 089631b8

ULONG VC2_VoiceGetFrequency(UBYTE voice)

{
  return vinf[voice].frq;
}



----------------------------------------

// Function: VC2_VoicePlay @ 089631dc

void VC2_VoicePlay(UBYTE voice,SWORD handle,ULONG start,ULONG size,ULONG reppos,ULONG repend,
                  UWORD flags)

{
  VINFO_conflict *pVVar1;
  ULONG in_t0;
  ULONG in_t1;
  UWORD in_t2;
  
  pVVar1 = vinf + voice;
  pVVar1->kick = '\x01';
  pVVar1->flags = in_t2;
  pVVar1->handle = handle;
  pVVar1->start = start;
  pVVar1->size = size;
  pVVar1->reppos = in_t0;
  pVVar1->repend = in_t1;
  return;
}



----------------------------------------

// Function: VC2_VoiceStop @ 0896321c

void VC2_VoiceStop(UBYTE voice)

{
  vinf[voice].active = '\0';
  return;
}



----------------------------------------

// Function: VC2_VoiceStopped @ 08963240

BOOL VC2_VoiceStopped(UBYTE voice)

{
  return (uint)(vinf[voice].active == '\0');
}



----------------------------------------

// Function: VC2_VoiceGetPosition @ 08963268

SLONG VC2_VoiceGetPosition(UBYTE voice)

{
  return *(int *)((int)&vinf[voice].current + 4) << 4 | (uint)vinf[voice].current >> 0x1c;
}



----------------------------------------

// Function: VC2_VoiceSetVolume @ 0896329c

/* WARNING: Removing unreachable block (ram,0x089632d8) */

void VC2_VoiceSetVolume(UBYTE voice,UWORD vol)

{
  vinf[voice].vol = (uint)vol;
  return;
}



----------------------------------------

// Function: VC2_VoiceSetPanning @ 089632e4

/* WARNING: Removing unreachable block (ram,0x0896331c) */

void VC2_VoiceSetPanning(UBYTE voice,ULONG pan)

{
  vinf[voice].pan = pan;
  return;
}



----------------------------------------

// Function: VC2_SampleSpace @ 08963328

ULONG VC2_SampleSpace(int type)

{
  return 0;
}



----------------------------------------

// Function: VC2_SampleLength @ 08963330

ULONG VC2_SampleLength(int type,SAMPLE *s)

{
  ULONG UVar1;
  int iVar2;
  
  iVar2 = 2;
  UVar1 = 0;
  if (s != (SAMPLE *)0x0) {
    if ((s->flags & 1) == 0) {
      iVar2 = 1;
    }
    UVar1 = iVar2 * s->length + 0x10;
  }
  return UVar1;
}



----------------------------------------

// Function: VC2_VoiceRealVolume @ 08963364

ULONG VC2_VoiceRealVolume(UBYTE voice)

{
  uint uVar1;
  
                    /* Unresolved local var: ULONG i@[???]
                       Unresolved local var: ULONG s@[???]
                       Unresolved local var: ULONG size@[DW_OP_reg9(t1)]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: SWORD * smp@[???]
                       Unresolved local var: SLONG t@[???] */
  if (vinf[voice].active != '\0') {
    if (vinf[voice].size < 0x40) {
      uVar1 = vinf[voice].size & 0xfffffffe;
    }
    else {
      uVar1 = 0x40;
    }
    if (uVar1 != 0) {
      do {
        uVar1 = uVar1 - 1;
      } while (uVar1 != 0);
      return 0;
    }
  }
  return 0;
}



----------------------------------------

// Function: VC2_PlayStop @ 08963438

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC2_PlayStop(void)

{
  if (RVbufL1 != (SLONG *)0x0) {
    free(RVbufL1);
  }
  if (RVbufL2 != (SLONG *)0x0) {
    free(RVbufL2);
  }
  if (RVbufL3 != (SLONG *)0x0) {
    free(RVbufL3);
  }
  if (RVbufL4 != (SLONG *)0x0) {
    free(RVbufL4);
  }
  if (RVbufL5 != (SLONG *)0x0) {
    free(RVbufL5);
  }
  if (RVbufL6 != (SLONG *)0x0) {
    free(RVbufL6);
  }
  if (RVbufL7 != (SLONG *)0x0) {
    free(RVbufL7);
  }
  if (RVbufL8 != (SLONG *)0x0) {
    free(RVbufL8);
  }
  if (RVbufR1 != (SLONG *)0x0) {
    free(RVbufR1);
  }
  if (RVbufR2 != (SLONG *)0x0) {
    free(RVbufR2);
  }
  if (RVbufR3 != (SLONG *)0x0) {
    free(RVbufR3);
  }
  if (RVbufR4 != (SLONG *)0x0) {
    free(RVbufR4);
  }
  if (RVbufR5 != (SLONG *)0x0) {
    free(RVbufR5);
  }
  if (RVbufR6 != (SLONG *)0x0) {
    free(RVbufR6);
  }
  if (RVbufR7 != (SLONG *)0x0) {
    free(RVbufR7);
  }
  if (RVbufR8 != (SLONG *)0x0) {
    free(RVbufR8);
  }
  RVbufL6 = (SLONG *)0x0;
  RVbufL5 = (SLONG *)0x0;
  RVbufL7 = (SLONG *)0x0;
  RVbufL4 = (SLONG *)0x0;
  RVbufL8 = (SLONG *)0x0;
  RVbufL3 = (SLONG *)0x0;
  RVbufR8 = (SLONG *)0x0;
  RVbufR7 = (SLONG *)0x0;
  RVbufR6 = (SLONG *)0x0;
  RVbufR5 = (SLONG *)0x0;
  RVbufR4 = (SLONG *)0x0;
  RVbufR3 = (SLONG *)0x0;
  RVbufR2 = (SLONG *)0x0;
  RVbufL2 = (SLONG *)0x0;
  RVbufL1 = (SLONG *)0x0;
  RVbufR1 = (SLONG *)0x0;
  return;
}



----------------------------------------

// Function: VC2_SampleUnload @ 08963648

void VC2_SampleUnload(SWORD handle)

{
  int iVar1;
  
  iVar1 = (int)handle;
  if (Samples != (SWORD **)0x0) {
    if (iVar1 < 0x180) {
      if (Samples[iVar1] != (SWORD *)0x0) {
        free(Samples[iVar1]);
      }
      Samples[iVar1] = (SWORD *)0x0;
    }
  }
  return;
}



----------------------------------------

// Function: VC2_SetNumVoices @ 089636ac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC2_SetNumVoices(void)

{
  int iVar1;
  VINFO_conflict *pVVar2;
  uint uVar3;
  int iVar4;
  
                    /* Unresolved local var: int t@[???] */
  vc_softchn = (int)md_softchn;
  md_mode = md_mode | 0x200;
  if (vc_softchn != 0) {
    if (vinf != (VINFO_conflict *)0x0) {
      free(vinf);
    }
    pVVar2 = _mm_calloc(0x58,vc_softchn);
    iVar1 = vc_softchn;
    if (pVVar2 == (VINFO_conflict *)0x0) {
      vinf = pVVar2;
      return 1;
    }
    if (vc_softchn < 1) {
      vinf = pVVar2;
      return 0;
    }
    iVar4 = 0xff;
    uVar3 = 0;
    vinf = pVVar2;
    pVVar2->frq = 10000;
    while( true ) {
      uVar3 = uVar3 + 1;
      pVVar2->pan = iVar4;
      iVar4 = 0;
      if ((uVar3 & 1) == 0) {
        iVar4 = 0xff;
      }
      if (iVar1 == uVar3) break;
      pVVar2[1].frq = 10000;
      pVVar2 = pVVar2 + 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: VC2_PlayStart @ 08963780

/* WARNING: Removing unreachable block (ram,0x089638f4) */
/* WARNING: Removing unreachable block (ram,0x089638cc) */
/* WARNING: Removing unreachable block (ram,0x089638a4) */
/* WARNING: Removing unreachable block (ram,0x08963878) */
/* WARNING: Removing unreachable block (ram,0x08963890) */
/* WARNING: Removing unreachable block (ram,0x089638b8) */
/* WARNING: Removing unreachable block (ram,0x089638e0) */
/* WARNING: Removing unreachable block (ram,0x08963908) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC2_PlayStart(void)

{
  BOOL BVar1;
  uint uVar2;
  
  md_mode = md_mode | 0x200;
  samplesthatfit = 0x2000;
  if ((vc_mode & 2) != 0) {
    samplesthatfit = 0x1000;
  }
  uVar2 = (uint)md_mixfreq;
  tickleft = 0;
  RVc1 = uVar2 / 0x16;
  RVc8 = (uVar2 * 0x227c) / 110000;
  RVc2 = (uVar2 * 0x13d6) / 110000;
  RVc3 = (uVar2 * 0x14c1) / 110000;
  RVc4 = (uVar2 * 0x1647) / 110000;
  RVc5 = (uVar2 * 0x186a) / 110000;
  RVc6 = (uVar2 * 0x1b29) / 110000;
  RVc7 = (uVar2 * 0x1e85) / 110000;
  RVbufL1 = _mm_calloc(RVc1 + 1,4);
  if (((((RVbufL1 == (SLONG *)0x0) || (RVbufL2 = _mm_calloc(RVc2 + 1,4), RVbufL2 == (SLONG *)0x0))
       || (RVbufL3 = _mm_calloc(RVc3 + 1,4), RVbufL3 == (SLONG *)0x0)) ||
      (((RVbufL4 = _mm_calloc(RVc4 + 1,4), RVbufL4 == (SLONG *)0x0 ||
        (RVbufL5 = _mm_calloc(RVc5 + 1,4), RVbufL5 == (SLONG *)0x0)) ||
       ((RVbufL6 = _mm_calloc(RVc6 + 1,4), RVbufL6 == (SLONG *)0x0 ||
        ((RVbufL7 = _mm_calloc(RVc7 + 1,4), RVbufL7 == (SLONG *)0x0 ||
         (RVbufL8 = _mm_calloc(RVc8 + 1,4), RVbufL8 == (SLONG *)0x0)))))))) ||
     ((RVbufR1 = _mm_calloc(RVc1 + 1,4), RVbufR1 == (SLONG *)0x0 ||
      (((((RVbufR2 = _mm_calloc(RVc2 + 1,4), RVbufR2 == (SLONG *)0x0 ||
          (RVbufR3 = _mm_calloc(RVc3 + 1,4), RVbufR3 == (SLONG *)0x0)) ||
         (RVbufR4 = _mm_calloc(RVc4 + 1,4), RVbufR4 == (SLONG *)0x0)) ||
        ((RVbufR5 = _mm_calloc(RVc5 + 1,4), RVbufR5 == (SLONG *)0x0 ||
         (RVbufR6 = _mm_calloc(RVc6 + 1,4), RVbufR6 == (SLONG *)0x0)))) ||
       ((RVbufR7 = _mm_calloc(RVc7 + 1,4), RVbufR7 == (SLONG *)0x0 ||
        (RVbufR8 = _mm_calloc(RVc8 + 1,4), RVbufR8 == (SLONG *)0x0)))))))) {
    BVar1 = 1;
  }
  else {
    BVar1 = 0;
    RVRindex = 0;
  }
  return BVar1;
}



----------------------------------------

// Function: VC2_Exit @ 08963b0c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void VC2_Exit(void)

{
  if (vc_tickbuf != (SLONG *)0x0) {
    free(vc_tickbuf);
  }
  if (vinf != (VINFO_conflict *)0x0) {
    free(vinf);
  }
  if (Samples != (SWORD **)0x0) {
    free(Samples);
  }
  vc_tickbuf = (SLONG *)0x0;
  vinf = (VINFO_conflict *)0x0;
  Samples = (SWORD **)0x0;
  VC_SetupPointers();
  return;
}



----------------------------------------

// Function: VC2_Init @ 08963b8c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL VC2_Init(void)

{
  BOOL BVar1;
  
  VC_SetupPointers();
  if ((md_mode & 0x10) == 0) {
    BVar1 = VC1_Init();
    return BVar1;
  }
  Samples = _mm_calloc(0x180,4);
  if (Samples == (SWORD **)0x0) {
    MikMod_errno = 0x11;
    return 1;
  }
  if ((vc_tickbuf == (SLONG *)0x0) && (vc_tickbuf = _mm_malloc(0x8080), vc_tickbuf == (SLONG *)0x0))
  {
    MikMod_errno = 0x11;
    return 1;
  }
  if ((md_mode & 2) == 0) {
    Mix32to16 = Mix32To16_Normal;
    Mix32to8 = Mix32To8_Normal;
    MixReverb = MixReverb_Normal;
  }
  else {
    Mix32to16 = Mix32To16_Stereo;
    Mix32to8 = Mix32To8_Stereo;
    MixReverb = MixReverb_Stereo;
  }
  vc_mode = md_mode | 0x200;
  md_mode = md_mode | 0x200;
  return 0;
}



----------------------------------------

// Function: VC2_WriteSamples @ 08963cc0

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x08964c70) */

void VC2_WriteSamples(SBYTE *buf,ULONG todo)

{
  ushort uVar1;
  longlong lVar2;
  longlong lVar3;
  ushort uVar4;
  SWORD **ppSVar5;
  VINFO_conflict *pVVar6;
  ULONG UVar7;
  int iVar8;
  int iVar9;
  SWORD *pSVar10;
  ULONG UVar11;
  uint uVar12;
  uint uVar13;
  ushort uVar14;
  uint uVar15;
  int iVar16;
  VINFO_conflict *pVVar17;
  uint uVar18;
  DItype DVar19;
  uint local_d8;
  uint local_d0;
  uint local_cc;
  uint local_c8;
  uint local_c4;
  uint local_c0;
  uint local_bc;
  int local_94;
  SWORD *local_90;
  uint local_8c;
  ULONG local_88;
  SWORD *local_7c;
  
                    /* Unresolved local var: int left@[???]
                       Unresolved local var: int portion@[???]
                       Unresolved local var: SBYTE * buffer@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int pan@[???]
                       Unresolved local var: int vol@[???] */
  local_d8 = todo << 2;
  local_7c = (SWORD *)buf;
  if (local_d8 == 0) {
    return;
  }
  while( true ) {
    if (tickleft == 0) {
      if ((vc_mode & 8) != 0) {
        (*md_player)();
      }
      if ((uint)md_bpm * 0x32 == 0) {
        trap(7);
      }
      tickleft = ((uint)md_mixfreq * 500) / ((uint)md_bpm * 0x32) & 0xfffffffc;
    }
    local_88 = local_d8;
    if ((uint)tickleft <= local_d8) {
      local_88 = tickleft;
    }
    tickleft = tickleft - local_88;
    local_d8 = local_d8 - local_88;
    UVar7 = samples2bytes(local_88);
    if (local_88 != 0) break;
LAB_08963d8c:
    if (local_d8 == 0) {
      return;
    }
    local_7c = (SWORD *)((int)local_7c + (UVar7 >> 2));
  }
  local_8c = local_88 + samplesthatfit;
  local_90 = local_7c;
  if ((vc_mode & 2) == 0) goto LAB_089643c4;
LAB_08963e44:
  iVar8 = 3;
  do {
    memset(vc_tickbuf,0,local_8c << iVar8);
    iVar8 = vc_softchn;
    ppSVar5 = Samples;
    if (0 < vc_softchn) {
                    /* Unresolved local var: SLONGLONG end@[???]
                       Unresolved local var: SLONGLONG done@[???]
                       Unresolved local var: SWORD * s@[???] */
      uVar4 = vc_mode & 2;
      local_c0 = (uint)idxsize;
      local_bc = idxsize._4_4_;
      local_d0 = (uint)idxlpos;
      local_cc = idxlpos._4_4_;
      local_c8 = (uint)idxlend;
      local_c4 = idxlend._4_4_;
      local_94 = 0;
      pVVar6 = vinf;
      do {
        while( true ) {
          pVVar17 = pVVar6;
          if (pVVar17->kick == '\0') {
            uVar13 = pVVar17->frq;
          }
          else {
            uVar13 = pVVar17->start;
            pVVar17->click = 0x100;
            *(uint *)((int)&pVVar17->current + 4) = uVar13 >> 4;
            *(uint *)&pVVar17->current = uVar13 << 0x1c;
            pVVar17->active = '\x01';
            pVVar17->kick = '\0';
            pVVar17->rampvol = 0;
            uVar13 = pVVar17->frq;
          }
          if (uVar13 != 0) break;
          pVVar17->active = '\0';
LAB_089642a0:
          local_94 = local_94 + 1;
          pVVar6 = pVVar17 + 1;
          if (local_94 == iVar8) goto LAB_089642bc;
        }
        if (pVVar17->active != '\0') {
          DVar19 = __divdi3(CONCAT44(uVar13 >> 6,uVar13 << 0x1a),(ulonglong)md_mixfreq);
          uVar1 = pVVar17->flags;
          pVVar17->increment = DVar19;
          if ((uVar1 & 0x400) != 0) {
            *(int *)&pVVar17->increment = -(int)DVar19;
            *(uint *)((int)&pVVar17->increment + 4) =
                 -(uint)(-(int)DVar19 != 0) - (int)((ulonglong)DVar19 >> 0x20);
          }
          iVar16 = pVVar17->vol;
          pVVar17->oldlvol = pVVar17->lvolsel;
          iVar9 = pVVar17->pan;
          pVVar17->oldrvol = pVVar17->rvolsel;
          if (uVar4 == 0) {
            uVar13 = pVVar17->size;
            pVVar17->lvolsel = iVar16;
            if (uVar13 != 0) goto LAB_08964898;
LAB_08963fec:
            local_c0 = 0;
            local_bc = 0;
          }
          else {
            if (iVar9 == 0x200) {
              iVar9 = (iVar16 << 8) / 0x1e0;
              pVVar17->lvolsel = iVar9;
              pVVar17->rvolsel = iVar9;
            }
            else {
              pVVar17->lvolsel = iVar16 * (0xff - iVar9) >> 8;
              pVVar17->rvolsel = iVar16 * iVar9 >> 8;
            }
            uVar13 = pVVar17->size;
            if (uVar13 == 0) goto LAB_08963fec;
LAB_08964898:
            local_c0 = uVar13 * 0x10000000 - 1;
            local_bc = (uint)(local_c0 < uVar13 * 0x10000000) + ((uVar13 >> 4) - 1);
          }
          uVar13 = pVVar17->repend;
          if (uVar13 == 0) {
            local_c4 = 0;
            local_cc = pVVar17->reppos;
            pSVar10 = ppSVar5[pVVar17->handle];
            local_c8 = 0;
          }
          else {
            local_c8 = uVar13 * 0x10000000 - 1;
            local_cc = pVVar17->reppos;
            local_c4 = (uint)(local_c8 < uVar13 * 0x10000000) + ((uVar13 >> 4) - 1);
            pSVar10 = ppSVar5[pVVar17->handle];
          }
          local_d0 = local_cc * 0x10000000;
          local_cc = local_cc >> 4;
          if (pSVar10 == (SWORD *)0x0) {
            pVVar17->active = '\0';
            *(undefined4 *)&pVVar17->current = 0;
            *(undefined4 *)((int)&pVVar17->current + 4) = 0;
            pVVar17->lastvalR = 0;
            pVVar17->lastvalL = 0;
          }
          else if (0 < (int)local_8c) {
                    /* Unresolved local var: SLONGLONG endpos@[???] */
            if ((uVar1 & 0x400) == 0) {
              uVar14 = uVar1 & 0x100;
              if ((uVar1 & 0x100) != 0) {
                uVar15 = *(uint *)((int)&pVVar17->current + 4);
                uVar13 = (uint)pVVar17->current;
                if (((int)uVar15 < (int)local_c4) || ((uVar15 == local_c4 && (uVar13 < local_c8))))
                {
                  uVar13 = *(uint *)((int)&pVVar17->current + 4);
                  goto LAB_089643dc;
                }
                if ((uVar1 & 0x200) == 0) {
                  uVar12 = local_d0 + (uVar13 - local_c8);
                  *(uint *)&pVVar17->current = uVar12;
                  *(uint *)((int)&pVVar17->current + 4) =
                       (uint)(uVar12 < local_d0) +
                       local_cc + ((uVar15 - local_c4) - (uint)(uVar13 < uVar13 - local_c8));
                }
                else {
                  iVar16 = *(int *)((int)&pVVar17->increment + 4);
                  pVVar17->flags = uVar1 | 0x400;
                  iVar9 = -(int)pVVar17->increment;
                  uVar12 = local_c8 - (uVar13 - local_c8);
                  uVar1 = pVVar17->flags;
                  *(int *)&pVVar17->increment = iVar9;
                  *(uint *)((int)&pVVar17->increment + 4) = -(uint)(iVar9 != 0) - iVar16;
                  *(uint *)&pVVar17->current = uVar12;
                  *(uint *)((int)&pVVar17->current + 4) =
                       ((local_c4 * 2 - uVar15) + (uint)(uVar13 < uVar13 - local_c8)) -
                       (uint)(local_c8 < uVar12);
                }
LAB_08964264:
                if ((uVar1 & 0x400) == 0) {
                  uVar14 = uVar1 & 0x100;
                  goto LAB_08964278;
                }
LAB_089640a8:
                uVar13 = local_d0;
                uVar15 = local_cc;
                if ((uVar1 & 0x100) == 0) {
                  uVar13 = 0;
                  uVar15 = 0;
                }
LAB_089640b8:
                uVar12 = (uint)pVVar17->current;
                uVar18 = *(uint *)((int)&pVVar17->current + 4);
                if (uVar12 != uVar13) goto LAB_089640c4;
LAB_08964294:
                if (uVar18 != uVar15) {
                  iVar9 = (int)pVVar17->increment;
                  goto LAB_089640c8;
                }
LAB_0896429c:
                pVVar17->active = '\0';
                goto LAB_089642a0;
              }
              uVar13 = *(uint *)((int)&pVVar17->current + 4);
LAB_089643dc:
              if (((int)uVar13 < (int)local_bc) ||
                 ((uVar13 == local_bc && ((uint)pVVar17->current < local_c0)))) goto LAB_08964278;
            }
            else {
              if ((uVar1 & 0x100) != 0) {
                uVar15 = *(uint *)((int)&pVVar17->current + 4);
                uVar13 = (uint)pVVar17->current;
                if ((int)local_cc <= (int)uVar15) {
                  if (uVar15 == local_cc) {
                    if (uVar13 < local_d0) goto LAB_08964b40;
                    iVar9 = *(int *)((int)&pVVar17->current + 4);
                  }
                  else {
                    iVar9 = *(int *)((int)&pVVar17->current + 4);
                  }
                  goto LAB_089640a0;
                }
LAB_08964b40:
                if ((uVar1 & 0x200) != 0) {
                  iVar16 = *(int *)((int)&pVVar17->increment + 4);
                  pVVar17->flags = uVar1 & 0xfbff;
                  uVar12 = local_d0 + (local_d0 - uVar13);
                  iVar9 = -(int)pVVar17->increment;
                  uVar1 = pVVar17->flags;
                  *(uint *)&pVVar17->current = uVar12;
                  *(uint *)((int)&pVVar17->current + 4) =
                       (uint)(uVar12 < local_d0) +
                       ((local_cc * 2 - uVar15) - (uint)(local_d0 < local_d0 - uVar13));
                  *(int *)&pVVar17->increment = iVar9;
                  *(uint *)((int)&pVVar17->increment + 4) = -(uint)(iVar9 != 0) - iVar16;
                  goto LAB_08964264;
                }
                uVar12 = local_c8 - (local_d0 - uVar13);
                *(uint *)((int)&pVVar17->current + 4) =
                     (local_c4 - ((local_cc - uVar15) - (uint)(local_d0 < local_d0 - uVar13))) -
                     (uint)(local_c8 < uVar12);
                *(uint *)&pVVar17->current = uVar12;
                if ((uVar1 & 0x400) != 0) goto LAB_089640a8;
                uVar14 = uVar1 & 0x100;
LAB_08964278:
                uVar13 = local_c0;
                uVar15 = local_bc;
                if (uVar14 == 0) goto LAB_089640b8;
                uVar12 = (uint)pVVar17->current;
                uVar18 = *(uint *)((int)&pVVar17->current + 4);
                uVar13 = local_c8;
                uVar15 = local_c4;
                if (uVar12 == local_c8) goto LAB_08964294;
LAB_089640c4:
                iVar9 = (int)pVVar17->increment;
LAB_089640c8:
                iVar16 = *(int *)((int)&pVVar17->increment + 4);
                if (iVar9 != 0 || iVar16 != 0) {
                  DVar19 = __divdi3(CONCAT44((uVar15 - uVar18) - (uint)(uVar13 < uVar13 - uVar12),
                                             uVar13 - uVar12),CONCAT44(iVar16,iVar9));
                  lVar2 = DVar19 + 1;
                  iVar9 = (int)((ulonglong)lVar2 >> 0x20);
                  lVar3 = (longlong)(int)local_8c;
                  if (((iVar9 <= (int)local_8c >> 0x1f) &&
                      (lVar3 = lVar2, (int)local_8c >> 0x1f == iVar9)) &&
                     (lVar3 = (longlong)(int)local_8c, (uint)lVar2 <= local_8c)) {
                    lVar3 = lVar2;
                  }
                  if ((-1 < lVar3) && (lVar3 != 0)) {
                    /* WARNING: Bad instruction - Truncating control flow here */
                    halt_baddata();
                  }
                }
                goto LAB_0896429c;
              }
              iVar9 = *(int *)((int)&pVVar17->current + 4);
LAB_089640a0:
              if (-1 < iVar9) goto LAB_089640a8;
            }
            pVVar17->active = '\0';
            *(undefined4 *)&pVVar17->current = 0;
            *(undefined4 *)((int)&pVVar17->current + 4) = 0;
          }
        }
        local_94 = local_94 + 1;
        pVVar6 = pVVar17 + 1;
      } while (local_94 != iVar8);
LAB_089642bc:
      idxsize._0_4_ = local_c0;
      idxsize._4_4_ = local_bc;
      idxlpos._0_4_ = local_d0;
      idxlpos._4_4_ = local_cc;
      idxlend._0_4_ = local_c8;
      idxlend._4_4_ = local_c4;
      vnf = pVVar17;
    }
    if (md_reverb != '\0') {
      if (0xf < md_reverb) {
        md_reverb = '\x0f';
      }
      (*MixReverb)(vc_tickbuf,local_8c);
    }
    if ((vc_mode & 1) == 0) {
      (*Mix32to8)((SBYTE *)local_90,vc_tickbuf,local_8c);
    }
    else {
      (*Mix32to16)(local_90,vc_tickbuf,local_8c);
    }
    local_88 = local_88 - local_8c;
    UVar11 = samples2bytes(local_8c);
    if (local_88 == 0) goto LAB_08963d8c;
    local_90 = (SWORD *)((int)local_90 + (UVar11 >> 2));
    local_8c = local_88 + samplesthatfit;
    if ((vc_mode & 2) != 0) goto LAB_08963e44;
LAB_089643c4:
    iVar8 = 2;
  } while( true );
}



----------------------------------------

// Function: VC2_SilenceBytes @ 08965474

ULONG VC2_SilenceBytes(SBYTE *buf,ULONG todo)

{
  ULONG UVar1;
  int c;
  
  UVar1 = bytes2samples(todo);
  UVar1 = samples2bytes(UVar1);
  c = 0;
  if ((vc_mode & 1) == 0) {
    c = 0x80;
  }
  memset(buf,c,UVar1);
  return UVar1;
}



----------------------------------------

// Function: VC2_WriteBytes @ 089654e4

ULONG VC2_WriteBytes(SBYTE *buf,ULONG todo)

{
  ULONG UVar1;
  
  if (vc_softchn == 0) {
    UVar1 = VC2_SilenceBytes(buf,todo);
    return UVar1;
  }
  UVar1 = bytes2samples(todo);
  VC2_WriteSamples(buf,UVar1);
  UVar1 = samples2bytes(UVar1);
  return UVar1;
}



----------------------------------------

// Function: VC2_SampleLoad @ 08965548

SWORD VC2_SampleLoad(SAMPLOAD *sload,int type)

{
  undefined2 *puVar1;
  undefined2 uVar2;
  void *pvVar3;
  BOOL BVar4;
  undefined2 *puVar5;
  undefined2 *puVar6;
  int iVar7;
  undefined4 *puVar8;
  int iVar9;
  int iVar10;
  SAMPLE *pSVar11;
  uint length;
  uint uVar12;
  uint uVar13;
  
                    /* Unresolved local var: SAMPLE * s@[???]
                       Unresolved local var: int handle@[???]
                       Unresolved local var: ULONG t@[???]
                       Unresolved local var: ULONG length@[???]
                       Unresolved local var: ULONG loopstart@[???]
                       Unresolved local var: ULONG loopend@[???] */
  pSVar11 = sload->sample;
  if (type != 0) {
    iVar10 = 0;
    iVar9 = 0;
    while (*(int *)((int)Samples + iVar9) != 0) {
      iVar10 = iVar10 + 1;
      iVar9 = iVar9 + 4;
      if (iVar10 == 0x180) {
        MikMod_errno = 5;
        return -1;
      }
    }
    uVar12 = pSVar11->loopstart;
    uVar13 = pSVar11->loopend;
    length = pSVar11->length;
    if (((2 < uVar13 - uVar12) && (uVar13 < uVar12)) && (length < uVar12)) {
      uVar12 = uVar12 >> 1;
    }
    SL_SampleSigned(sload);
    SL_Sample8to16(sload);
    puVar8 = (undefined4 *)(iVar9 + (int)Samples);
    pvVar3 = _mm_malloc((length + 0x14) * 2);
    *puVar8 = pvVar3;
    if (pvVar3 == (void *)0x0) {
      MikMod_errno = 4;
      return -1;
    }
    BVar4 = SL_Load(*(void **)((int)Samples + iVar9),sload,length);
    if (BVar4 == 0) {
      if ((pSVar11->flags & 0x100) == 0) {
        iVar7 = 0;
        puVar6 = (undefined2 *)(length * 2 + *(int *)((int)Samples + iVar9));
        do {
          iVar7 = iVar7 + 1;
          *puVar6 = 0;
          puVar6 = puVar6 + 1;
        } while (iVar7 != 0x10);
      }
      else if ((pSVar11->flags & 0x200) == 0) {
        iVar7 = 0;
        puVar5 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar13 * 2);
        puVar6 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar12 * 2);
        do {
          uVar2 = *puVar6;
          iVar7 = iVar7 + 1;
          puVar6 = puVar6 + 1;
          *puVar5 = uVar2;
          puVar5 = puVar5 + 1;
        } while (iVar7 != 0x10);
      }
      else {
        iVar7 = 0;
        puVar5 = (undefined2 *)(*(int *)((int)Samples + iVar9) + uVar13 * 2);
        puVar6 = puVar5;
        do {
          puVar1 = puVar6 + -1;
          iVar7 = iVar7 + 1;
          puVar6 = puVar6 + -1;
          *puVar5 = *puVar1;
          puVar5 = puVar5 + 1;
        } while (iVar7 != 0x10);
      }
      return (SWORD)iVar10;
    }
  }
  return -1;
}



----------------------------------------

// Function: MOD_LoadTitle @ 089657d8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * MOD_LoadTitle(void)

{
  BOOL BVar1;
  CHAR *pCVar2;
  CHAR aCStack_20 [20];
  undefined1 local_c;
  
                    /* Unresolved local var: CHAR[21] s@[???] */
  (*modreader->Seek)(modreader,0,0);
  BVar1 = (*modreader->Read)(modreader,aCStack_20,0x14);
  pCVar2 = (CHAR *)0x0;
  if (BVar1 != 0) {
    local_c = 0;
    pCVar2 = DupStr(aCStack_20,0x15,1);
  }
  return pCVar2;
}



----------------------------------------

// Function: MOD_Cleanup @ 08965844

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void MOD_Cleanup(void)

{
  if (mh != (MODULEHEADER *)0x0) {
    free(mh);
  }
  mh = (MODULEHEADER *)0x0;
  if (patbuf != (MODNOTE *)0x0) {
    free(patbuf);
  }
  patbuf = (MODNOTE *)0x0;
  return;
}



----------------------------------------

// Function: MOD_CheckType @ 089658a0

BOOL MOD_CheckType(UBYTE *id,UBYTE *numchn,CHAR **descr)

{
  int iVar1;
  CHAR *pCVar2;
  uint uVar3;
  byte *m1;
  
  iVar1 = memcmp(id,&DAT_089e7478,4);
  if ((iVar1 == 0) || (iVar1 = memcmp(id,&DAT_089e7480,4), iVar1 == 0)) {
    *descr = protracker;
    modtype = 0;
    uVar3 = 1;
    *numchn = '\x04';
  }
  else {
    iVar1 = memcmp(id,&DAT_089e7488,3);
    if (((iVar1 == 0) || (iVar1 = memcmp(id,&DAT_089e748c,3), iVar1 == 0)) &&
       ((__ctype_ptr[id[3]] & 4U) != 0)) {
      modtype = 1;
      *descr = startrekker;
      uVar3 = (uint)((UBYTE)(id[3] + 0xd0) == '\x04');
      *numchn = id[3] + 0xd0;
    }
    else {
      iVar1 = memcmp(id,&DAT_089e7490,4);
      if (iVar1 == 0) {
        pCVar2 = oktalyzer;
      }
      else {
        iVar1 = memcmp(id,&DAT_089e7498,4);
        if (iVar1 != 0) {
          m1 = id + 1;
          iVar1 = memcmp(m1,&DAT_089e74a0,3);
          if ((iVar1 == 0) && ((__ctype_ptr[*id] & 4U) != 0)) {
            *descr = fasttracker;
            modtype = 1;
            *numchn = *id + 0xd0;
            return 1;
          }
          iVar1 = memcmp(id + 2,&DAT_089e74a4,2);
          if ((iVar1 != 0) && (iVar1 = memcmp(id + 2,&DAT_089e74a8,2), iVar1 != 0)) {
            return 0;
          }
          if ((__ctype_ptr[*id] & 4U) == 0) {
            return 0;
          }
          if ((__ctype_ptr[*m1] & 4U) == 0) {
            return 0;
          }
          if (id[3] == 'H') {
            *descr = fasttracker;
            modtype = 2;
          }
          else {
            *descr = taketracker;
            modtype = 1;
          }
          *numchn = *id * '\n' + *m1 + 0xf0;
          return 1;
        }
        pCVar2 = oktalyser;
      }
      uVar3 = 1;
      *descr = pCVar2;
      modtype = 1;
      *numchn = '\b';
    }
  }
  return uVar3;
}



----------------------------------------

// Function: MOD_Test @ 08965b74

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MOD_Test(void)

{
  BOOL BVar1;
  uint uVar2;
  UBYTE UStack_20;
  UBYTE aUStack_1f [7];
  CHAR *apCStack_18 [2];
  
                    /* Unresolved local var: UBYTE[4] id@[???]
                       Unresolved local var: UBYTE numchn@[???]
                       Unresolved local var: CHAR * descr@[???] */
  (*modreader->Seek)(modreader,0x438,0);
  BVar1 = (*modreader->Read)(modreader,aUStack_1f,4);
  uVar2 = 0;
  if (BVar1 != 0) {
    BVar1 = MOD_CheckType(aUStack_1f,&UStack_20,apCStack_18);
    uVar2 = (uint)(BVar1 != 0);
  }
  return uVar2;
}



----------------------------------------

// Function: MOD_Load @ 08965bec

BOOL MOD_Load(BOOL curious)

{
  byte bVar1;
  bool bVar2;
  undefined *puVar3;
  MREADER *pMVar4;
  UWORD UVar5;
  int iVar6;
  int iVar7;
  BOOL BVar8;
  uint uVar9;
  MODULEHEADER *pMVar10;
  CHAR *pCVar11;
  UBYTE *pUVar12;
  char cVar13;
  byte bVar14;
  uint uVar15;
  BOOL BVar16;
  ULONG UVar17;
  char cVar18;
  UBYTE UVar19;
  UWORD *pUVar20;
  SAMPLE *pSVar21;
  MODNOTE *pMVar22;
  MSAMPINFO *s;
  uint uVar23;
  ushort uVar24;
  int iVar25;
  CHAR *local_48 [2];
  int local_40;
  UBYTE **local_3c;
  int local_38;
  int local_34;
  int local_30;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int scan@[???]
                       Unresolved local var: SAMPLE * q@[???]
                       Unresolved local var: MSAMPINFO * s@[???]
                       Unresolved local var: CHAR * descr@[???] */
  iVar25 = 0;
  _mm_read_string(mh->songname,0x14,modreader);
  mh->songname[0x14] = '\0';
  iVar7 = 0x10;
  do {
    pMVar10 = mh;
    _mm_read_string(mh->songname + iVar7 + 6,0x16,modreader);
    pMVar10->samples[0].samplename[iVar7 + 6] = '\0';
    iVar25 = iVar25 + 1;
    UVar5 = _mm_read_M_UWORD(modreader);
    pMVar4 = modreader;
    *(UWORD *)(pMVar10->samples[0].samplename + iVar7 + 8) = UVar5;
    iVar6 = (*pMVar4->Get)(pMVar4);
    pMVar10->samples[0].samplename[iVar7 + 10] = (CHAR)iVar6;
    iVar6 = (*modreader->Get)(modreader);
    pMVar10->samples[0].samplename[iVar7 + 0xb] = (CHAR)iVar6;
    UVar5 = _mm_read_M_UWORD(modreader);
    pMVar4 = modreader;
    *(UWORD *)(pMVar10->samples[0].samplename + iVar7 + 0xc) = UVar5;
    UVar5 = _mm_read_M_UWORD(pMVar4);
    *(UWORD *)(pMVar10->samples[0].samplename + iVar7 + 0xe) = UVar5;
    pMVar10 = mh;
    iVar7 = iVar7 + 0x20;
  } while (iVar25 != 0x1f);
  iVar7 = (*modreader->Get)(modreader);
  pMVar10->songlength = (UBYTE)iVar7;
  pMVar10 = mh;
  iVar7 = (*modreader->Get)(modreader);
  pMVar10->magic1 = (UBYTE)iVar7;
  (*modreader->Read)(modreader,mh->positions,0x80);
  (*modreader->Read)(modreader,mh->magic2,4);
  BVar8 = (*modreader->Eof)(modreader);
  pMVar10 = mh;
  if (BVar8 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  of.initspeed = '\x06';
  of.inittempo = 0x7d;
  BVar8 = MOD_CheckType(mh->magic2,&of.numchn,local_48);
  if (BVar8 == 0) {
    MikMod_errno = 0xb;
    return 0;
  }
  of.songname = DupStr(pMVar10->songname,0x15,1);
  uVar9 = (uint)mh->songlength;
  of.reppos = 0;
  of.numpat = 0;
  of.numpos = (UWORD)mh->songlength;
  if (uVar9 != 0) {
    iVar7 = 0;
    pMVar10 = mh;
    do {
      iVar7 = iVar7 + 1;
      if (of.numpat < pMVar10->positions[0]) {
        of.numpat = (UWORD)pMVar10->positions[0];
      }
      pMVar10 = (MODULEHEADER *)(mh->songname + iVar7);
    } while (iVar7 < (int)uVar9);
  }
  if (uVar9 < 0x80) {
    pUVar12 = mh->positions + uVar9;
    bVar2 = true;
    uVar15 = uVar9;
    do {
      UVar19 = *pUVar12;
      uVar15 = uVar15 + 1;
      pUVar12 = pUVar12 + 1;
      if ((char)UVar19 < '\0') {
        bVar2 = false;
      }
    } while (uVar15 != 0x80);
    if (!bVar2) goto LAB_08965e98;
  }
  if (uVar9 < 0x80) {
    pUVar12 = mh->positions + uVar9;
    do {
      if (of.numpat < *pUVar12) {
        of.numpat = (UWORD)*pUVar12;
      }
      if ((curious != 0) && (*pUVar12 != 0)) {
        of.numpos = (short)uVar9 + 1;
      }
      pUVar12 = pUVar12 + 1;
      uVar9 = uVar9 + 1;
    } while (uVar9 != 0x80);
  }
LAB_08965e98:
  of.numpat = of.numpat + 1;
  of.numtrk = of.numpat * of.numchn;
  BVar8 = AllocPositions((uint)of.numpos);
  BVar16 = 0;
  if (BVar8 != 0) {
    if (of.numpos != 0) {
      iVar7 = 0;
      pUVar20 = of.positions;
      pMVar10 = mh;
      do {
        pUVar12 = pMVar10->positions;
        iVar7 = iVar7 + 1;
        pMVar10 = (MODULEHEADER *)(pMVar10->songname + 1);
        *pUVar20 = (ushort)*pUVar12;
        pUVar20 = pUVar20 + 1;
      } while (iVar7 < (int)(uint)of.numpos);
    }
    of.numins = 0x1f;
    of.numsmp = 0x1f;
    BVar8 = AllocSamples();
    BVar16 = 0;
    if (BVar8 != 0) {
      if (of.numins != 0) {
        s = mh->samples;
        iVar7 = 0;
        pSVar21 = of.samples;
        do {
          pCVar11 = DupStr(s->samplename,0x17,1);
          pSVar21->samplename = pCVar11;
          iVar7 = iVar7 + 1;
          pSVar21->speed = (uint)finetune[s->finetune & 0xf];
          pSVar21->volume = s->volume & 0x7f;
          iVar25 = modtype;
          uVar24 = s->length;
          UVar17 = (uint)s->reppos * 2;
          pSVar21->loopend = UVar17 + (uint)s->replen * 2;
          pSVar21->length = (uint)uVar24 << 1;
          pSVar21->flags = 4;
          pSVar21->loopstart = UVar17;
          if (iVar25 == 2) {
            if ((char)s->volume < '\0') {
              pSVar21->flags = 5;
              local_48[0] = orpheus;
              goto LAB_08965f54;
            }
            uVar24 = s->replen;
          }
          else {
LAB_08965f54:
            uVar24 = s->replen;
          }
          s = s + 1;
          if (2 < uVar24) {
            pSVar21->flags = pSVar21->flags | 0x100;
          }
          if (pSVar21->length < pSVar21->loopend) {
            pSVar21->loopend = pSVar21->length;
          }
          pSVar21 = pSVar21 + 1;
        } while (iVar7 < (int)(uint)of.numins);
      }
      of.modtype = strdup(local_48[0]);
      BVar8 = AllocPatterns();
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int s@[???]
                       Unresolved local var: int tracks@[???] */
      BVar16 = 0;
      if (BVar8 != 0) {
        BVar8 = AllocTracks();
        if (BVar8 == 0) {
          BVar16 = 0;
        }
        else {
          patbuf = _mm_calloc((uint)of.numchn << 6,4);
          if (patbuf == (MODNOTE *)0x0) {
LAB_0896602c:
            BVar16 = 0;
          }
          else if (of.numpat == 0) {
            BVar16 = 1;
          }
          else {
            local_38 = 0;
            local_30 = 0;
            do {
              puVar3 = PTR_of_089e74d4;
              if (of.numchn != '\0') {
                uVar9 = 0;
                do {
                  pMVar22 = patbuf + uVar9;
                  iVar7 = (*modreader->Get)(modreader);
                  pMVar22->a = (UBYTE)iVar7;
                  pMVar22 = patbuf;
                  iVar7 = (*modreader->Get)(modreader);
                  pMVar22[uVar9].b = (UBYTE)iVar7;
                  pMVar22 = patbuf;
                  iVar7 = (*modreader->Get)(modreader);
                  pMVar22[uVar9].c = (UBYTE)iVar7;
                  pMVar22 = patbuf;
                  iVar7 = (*modreader->Get)(modreader);
                  pMVar22[uVar9].d = (UBYTE)iVar7;
                  uVar9 = uVar9 + 1;
                } while (uVar9 < (uint)(byte)puVar3[0xe] << 6);
              }
              puVar3 = PTR_of_089e74d4;
              if (of.numchn != '\0') {
                local_40 = local_30 << 2;
                local_34 = 0;
LAB_089661dc:
                pMVar22 = patbuf + local_34;
                    /* Unresolved local var: int t@[???] */
                local_3c = of.tracks;
                UniReset();
                    /* Unresolved local var: UBYTE instrument@[???]
                       Unresolved local var: UBYTE effect@[???]
                       Unresolved local var: UBYTE effdat@[???]
                       Unresolved local var: UBYTE note@[???]
                       Unresolved local var: UWORD period@[???]
                       Unresolved local var: UBYTE lastnote@[???] */
                bVar14 = pMVar22->c;
                uVar9 = (pMVar22->a & 0xf) * 0x100 + (uint)pMVar22->b;
                iVar7 = 0;
                uVar15 = pMVar22->a & 0x10 | (uint)(bVar14 >> 4);
                bVar1 = pMVar22->d;
                do {
                  bVar14 = bVar14 & 0xf;
                  uVar23 = (uint)bVar1;
                  if (uVar9 != 0) {
                    pUVar20 = npertab;
                    cVar18 = '\0';
                    do {
                      uVar24 = *pUVar20;
                      cVar13 = cVar18 + '\x01';
                      pUVar20 = pUVar20 + 1;
                      if (uVar24 <= uVar9) {
                        uVar24 = (ushort)(byte)(cVar18 + 1);
                        goto joined_r0x08966270;
                      }
                      cVar18 = cVar13;
                    } while (cVar13 != 'T');
                  }
                  uVar24 = 0;
joined_r0x08966270:
                  if (uVar15 == 0) {
joined_r0x0896635c:
                    if (uVar24 != 0) goto LAB_08966368;
LAB_089662d8:
                    if (bVar14 != 0xd) goto LAB_089662e0;
LAB_0896637c:
                    uVar9 = (uVar23 >> 4) * 10 + (uVar23 & 0xf);
                    UVar19 = (UBYTE)uVar9;
                    if ((uVar9 & 0xff) == 0) {
LAB_0896639c:
                      if ((byte)(bVar14 - 1) < 3) {
                        bVar14 = 0;
                        UVar19 = '\0';
                      }
                      else {
                        UVar19 = '\0';
                      }
                    }
                  }
                  else {
                    if ((0x1f < uVar15) ||
                       (UVar5 = (short)uVar15 - 1, mh->samples[uVar15 - 1].length == 0)) {
                      UniPTEffect('\f','\0');
                      if (bVar14 == 0xc) {
                        bVar14 = 0;
                        uVar23 = 0;
                      }
                      goto joined_r0x0896635c;
                    }
                    if (modtype != 0) {
                      UniEffect(2,UVar5);
                      goto joined_r0x0896635c;
                    }
                    if (uVar24 == 0) {
                      if ((bVar14 == 0) && (uVar23 == 0)) {
                        UniPTEffect('\f',mh->samples[uVar15 - 1].volume & 0x7f);
                      }
                      else {
                        UniEffect(2,UVar5);
                      }
                      goto LAB_089662d8;
                    }
                    UniEffect(2,UVar5);
LAB_08966368:
                    UniEffect(1,uVar24 + 0x17);
                    if (bVar14 == 0xd) goto LAB_0896637c;
LAB_089662e0:
                    if (bVar14 == 10) {
                      if (((uVar23 & 0xf) != 0) && ((uVar23 & 0xf0) != 0)) {
                        uVar23 = uVar23 & 0xf0;
                      }
LAB_089662f0:
                      UVar19 = (UBYTE)uVar23;
                      if (uVar23 != 0) goto LAB_08966300;
                      goto LAB_0896639c;
                    }
                    if ((bVar14 != 0xc) || (UVar19 = '@', uVar23 < 0x41)) goto LAB_089662f0;
                    bVar14 = 0xc;
                  }
LAB_08966300:
                  iVar7 = iVar7 + 1;
                  UniPTEffect(bVar14,UVar19);
                  UniNewline();
                  if (iVar7 == 0x40) goto LAB_0896644c;
                  pMVar22 = pMVar22 + (byte)puVar3[0xe];
                  bVar14 = pMVar22->c;
                  uVar9 = (pMVar22->a & 0xf) * 0x100 + (uint)pMVar22->b;
                  uVar15 = pMVar22->a & 0x10 | (uint)(bVar14 >> 4);
                  bVar1 = pMVar22->d;
                } while( true );
              }
LAB_08966494:
              local_38 = local_38 + 1;
            } while (local_38 < (int)(uint)of.numpat);
            BVar16 = 1;
          }
        }
      }
    }
  }
  return BVar16;
LAB_0896644c:
  pUVar12 = UniDup();
  *(UBYTE **)((int)local_3c + local_40) = pUVar12;
  if (pUVar12 == (UBYTE *)0x0) goto LAB_0896602c;
  local_34 = local_34 + 1;
  local_30 = local_30 + 1;
  local_40 = local_40 + 4;
  if ((int)(uint)(byte)puVar3[0xe] <= local_34) goto LAB_08966494;
  goto LAB_089661dc;
}



----------------------------------------

// Function: MOD_Init @ 089664c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL MOD_Init(void)

{
  mh = _mm_malloc(0x47c);
  return (uint)(mh != (MODULEHEADER *)0x0);
}



----------------------------------------

// Function: XM_LoadTitle @ 089664ec

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

CHAR * XM_LoadTitle(void)

{
  BOOL BVar1;
  CHAR *pCVar2;
  CHAR aCStack_20 [24];
  
                    /* Unresolved local var: CHAR[21] s@[???] */
  (*modreader->Seek)(modreader,0x11,0);
  BVar1 = (*modreader->Read)(modreader,aCStack_20,0x15);
  pCVar2 = (CHAR *)0x0;
  if (BVar1 != 0) {
    pCVar2 = DupStr(aCStack_20,0x15,1);
  }
  return pCVar2;
}



----------------------------------------

// Function: XM_Cleanup @ 08966558

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void XM_Cleanup(void)

{
  if (mh != (XMHEADER *)0x0) {
    free(mh);
  }
  mh = (XMHEADER *)0x0;
  return;
}



----------------------------------------

// Function: XM_Convert @ 08966590

UBYTE * XM_Convert(XMNOTE *xmtrack,UWORD rows)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  byte eff;
  UBYTE *pUVar4;
  byte dat;
  UWORD dat_00;
  uint uVar5;
  uint uVar6;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: UBYTE note@[???]
                       Unresolved local var: UBYTE ins@[???]
                       Unresolved local var: UBYTE vol@[???]
                       Unresolved local var: UBYTE eff@[???]
                       Unresolved local var: UBYTE dat@[???] */
  UniReset();
  uVar6 = 0;
  if (rows == 0) {
LAB_089666e0:
    pUVar4 = UniDup();
    return pUVar4;
  }
  bVar1 = xmtrack->note;
  do {
    bVar2 = xmtrack->ins;
    bVar3 = xmtrack->vol;
    uVar5 = (uint)bVar3;
    eff = xmtrack->eff;
    dat = xmtrack->dat;
    if (bVar1 != 0) {
      if (bVar1 < 0x61) {
        UniEffect(1,bVar1 - 1);
      }
      else {
        UniEffect(0x1d,0);
      }
    }
    if (bVar2 != 0) {
      UniEffect(2,bVar2 - 1);
    }
    switch((bVar3 >> 4) - 6) {
    case 0:
      if ((bVar3 & 0xf) != 0) {
        UniEffect(0x20,bVar3 & 0xf);
      }
      break;
    case 1:
      if ((bVar3 & 0xf) != 0) {
        UniEffect(0x20,(ushort)bVar3 << 4);
      }
      break;
    case 2:
      UniPTEffect('\x0e',bVar3 & 0xf | 0xb0);
      break;
    case 3:
      UniPTEffect('\x0e',bVar3 & 0xf | 0xa0);
      break;
    case 4:
      UniPTEffect('\x04',(UBYTE)((uVar5 & 0xf) << 4));
      break;
    case 5:
      UniPTEffect('\x04',bVar3 & 0xf);
      break;
    case 6:
      UniPTEffect('\b',(UBYTE)((uVar5 & 0xf) << 4));
      break;
    case 7:
      if ((bVar3 & 0xf) != 0) {
        UniEffect(0x28,bVar3 & 0xf);
      }
      break;
    case 8:
      if ((bVar3 & 0xf) != 0) {
        UniEffect(0x28,(ushort)bVar3 << 4);
      }
      break;
    case 9:
      UniPTEffect('\x03',(UBYTE)((uVar5 & 0xf) << 4));
      break;
    default:
      if ((uVar5 - 0x10 & 0xff) < 0x41) {
        UniPTEffect('\f',(UBYTE)(uVar5 - 0x10));
      }
    }
    switch(eff) {
    case 4:
      UniEffect(0x1f,(ushort)dat);
      break;
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:
    case 0xb:
    case 0xc:
    case 0xd:
    case 0xf:
    case 0x12:
    case 0x13:
    case 0x16:
    case 0x17:
    case 0x18:
    case 0x1a:
    case 0x1c:
    case 0x1e:
    case 0x1f:
    case 0x20:
    case 0x22:
    default:
      if (eff < 0x10) {
        if (eff == 0xd) {
          if ((dat >> 4 < 10) && ((dat & 0xf) < 10)) {
            dat = (dat >> 4) * '\n' + (dat & 0xf);
          }
        }
        UniPTEffect(eff,dat);
      }
      break;
    case 10:
      UniEffect(0x20,(ushort)dat);
      break;
    case 0xe:
      bVar1 = dat >> 4;
      if (bVar1 == 2) {
        UniEffect(0x22,dat & 0xf);
      }
      else if (bVar1 < 3) {
        if (bVar1 == 1) {
          UniEffect(0x21,dat & 0xf);
        }
        else {
LAB_0896697c:
          UniPTEffect(eff,dat);
        }
      }
      else if (bVar1 == 10) {
        UniEffect(0x23,dat & 0xf);
      }
      else {
        if (bVar1 != 0xb) goto LAB_0896697c;
        UniEffect(0x24,dat & 0xf);
      }
      break;
    case 0x10:
      dat_00 = 0x40;
      if (dat < 0x41) {
        dat_00 = (UWORD)dat;
      }
      UniEffect(0x25,dat_00);
      break;
    case 0x11:
      UniEffect(0x26,(ushort)dat);
      break;
    case 0x14:
      UniEffect(0x1d,(ushort)dat);
      break;
    case 0x15:
      UniEffect(0x27,(ushort)dat);
      break;
    case 0x19:
      UniEffect(0x28,(ushort)dat);
      break;
    case 0x1b:
      UniEffect(0x18,(ushort)dat);
      break;
    case 0x1d:
      UniEffect(0x17,(ushort)dat);
      break;
    case 0x21:
      if (dat >> 4 == 1) {
        UniEffect(0x29,dat & 0xf);
      }
      else if (dat >> 4 == 2) {
        UniEffect(0x2a,dat & 0xf);
      }
      break;
    case 0x23:
      UniEffect(0x3c,(ushort)dat);
    }
    uVar6 = uVar6 + 1;
    UniNewline();
    xmtrack = xmtrack + 1;
    if (uVar6 == rows) goto LAB_089666e0;
    bVar1 = xmtrack->note;
  } while( true );
}



----------------------------------------

// Function: LoadPatterns @ 089669dc

/* WARNING: Type propagation algorithm not settling */

BOOL LoadPatterns(BOOL dummypat)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  undefined *puVar4;
  undefined *puVar5;
  UWORD UVar6;
  BOOL BVar7;
  ULONG UVar8;
  undefined2 extraout_var;
  undefined2 extraout_var_00;
  UBYTE *pUVar9;
  int iVar10;
  short sVar11;
  uint uVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  undefined4 *puVar16;
  int iVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  int local_34;
  int local_30;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: int v@[???]
                       Unresolved local var: int numtrk@[???] */
  BVar7 = AllocTracks();
  if ((BVar7 != 0) && (BVar7 = AllocPatterns(), BVar7 != 0)) {
    iVar20 = 0;
    if (mh->numpat == 0) {
      local_30 = 0;
    }
    else {
      local_30 = 0;
      do {
        while( true ) {
                    /* Unresolved local var: XMPATHEADER ph@[???] */
          UVar8 = _mm_read_I_ULONG(modreader);
          uVar12 = 8;
          if (mh->version != 0x102) {
            uVar12 = 9;
          }
          if ((UVar8 < uVar12) || (uVar12 = (*modreader->Get)(modreader), (uVar12 & 0xff) != 0)) {
            MikMod_errno = 7;
            return 0;
          }
          if (mh->version == 0x102) {
            uVar12 = (*modreader->Get)(modreader);
            iVar17 = (uVar12 & 0xff) + 1;
          }
          else {
            UVar6 = _mm_read_I_UWORD(modreader);
            iVar17 = CONCAT22(extraout_var,UVar6);
          }
          UVar6 = _mm_read_I_UWORD(modreader);
          iVar13 = 8;
          if (mh->version != 0x102) {
            iVar13 = 9;
          }
          if (UVar8 - iVar13 != 0) {
            (*modreader->Seek)(modreader,UVar8 - iVar13,1);
          }
          puVar4 = PTR_of_089e7580;
          *(UWORD *)(local_30 * 2 + *(int *)(PTR_of_089e7580 + 0x118)) = (UWORD)iVar17;
          puVar5 = PTR_of_089e7580;
          if (iVar17 == 0) break;
          xmpat = _mm_calloc(iVar17 * (uint)of.numchn,5);
          if (xmpat == (XMNOTE *)0x0) {
            return 0;
          }
          if (CONCAT22(extraout_var_00,UVar6) != 0) {
            iVar13 = (int)(short)UVar6;
            if (0 < iVar17) {
              local_34 = 0;
              do {
                if ((of.numchn != '\0') && (iVar13 != 0)) {
                  iVar19 = 0;
                  iVar14 = local_34 * 5;
                  do {
                    pUVar9 = &xmpat->note + iVar14;
                    *pUVar9 = '\0';
                    pUVar9[1] = '\0';
                    pUVar9[2] = '\0';
                    pUVar9[3] = '\0';
                    pUVar9[4] = '\0';
                    uVar12 = (*modreader->Get)(modreader);
                    uVar18 = uVar12 & 0xff;
                    if ((char)(UBYTE)uVar12 < '\0') {
                      if ((uVar12 & 1) == 0) {
                        iVar15 = 1;
                        uVar3 = uVar12;
                      }
                      else {
                        iVar15 = 2;
                        iVar10 = (*modreader->Get)(modreader);
                        *pUVar9 = (UBYTE)iVar10;
                        uVar3 = uVar18;
                      }
                      uVar2 = uVar12;
                      if ((uVar12 & 2) != 0) {
                        iVar15 = iVar15 + 1;
                        iVar10 = (**(_func_int_MREADER_ptr **)((int)modreader + 0xc))(modreader);
                        pUVar9[1] = (UBYTE)iVar10;
                        uVar2 = uVar18;
                        uVar3 = uVar12;
                      }
                      uVar1 = uVar12;
                      if ((uVar3 & 4) != 0) {
                        iVar15 = iVar15 + 1;
                        iVar10 = (*modreader->Get)(modreader);
                        pUVar9[2] = (UBYTE)iVar10;
                        uVar1 = uVar18;
                        uVar2 = uVar12;
                      }
                      if ((uVar2 & 8) != 0) {
                        iVar15 = iVar15 + 1;
                        iVar10 = (*modreader->Get)(modreader);
                        pUVar9[3] = (UBYTE)iVar10;
                        uVar1 = uVar12;
                      }
                      if ((uVar1 & 0x10) != 0) {
                        iVar10 = (*modreader->Get)(modreader);
                        iVar15 = iVar15 + 1;
                        pUVar9[4] = (UBYTE)iVar10;
                        goto LAB_08966c98;
                      }
                      uVar12 = iVar13 - iVar15;
                      sVar11 = (short)uVar12;
                    }
                    else {
                      *pUVar9 = (UBYTE)uVar12;
                    /* Unresolved local var: UBYTE cmp@[???]
                       Unresolved local var: UBYTE result@[???] */
                      iVar15 = (*modreader->Get)(modreader);
                      pUVar9[1] = (UBYTE)iVar15;
                      iVar15 = (*modreader->Get)(modreader);
                      pUVar9[2] = (UBYTE)iVar15;
                      iVar15 = (*modreader->Get)(modreader);
                      pUVar9[3] = (UBYTE)iVar15;
                      iVar15 = (*modreader->Get)(modreader);
                      pUVar9[4] = (UBYTE)iVar15;
                      iVar15 = 5;
LAB_08966c98:
                      uVar12 = iVar13 - iVar15;
                      sVar11 = (short)uVar12;
                    }
                    iVar13 = (int)sVar11;
                    if (iVar13 < 0) {
                      free(xmpat);
                      MikMod_errno = 7;
                      xmpat = (XMNOTE *)0x0;
                      return 0;
                    }
                    iVar19 = iVar19 + 1;
                  } while ((iVar19 < (int)(uint)of.numchn) &&
                          (iVar14 = iVar14 + iVar17 * 5, (uVar12 & 0xffff) != 0));
                }
                local_34 = local_34 + 1;
              } while (iVar17 != local_34);
              if (iVar13 == 0) goto LAB_08966ed0;
            }
            (*modreader->Seek)(modreader,iVar13,1);
          }
LAB_08966ed0:
          BVar7 = (*modreader->Eof)(modreader);
          puVar4 = PTR_of_089e7580;
          if (BVar7 != 0) {
            free(xmpat);
            MikMod_errno = 7;
            xmpat = (XMNOTE *)0x0;
            return 0;
          }
          if (of.numchn != '\0') {
            iVar13 = iVar20 << 2;
            iVar19 = 0;
            iVar14 = 0;
            do {
              iVar15 = *(int *)(puVar4 + 0x110);
              pUVar9 = XM_Convert((XMNOTE *)(&xmpat->note + iVar14),(UWORD)iVar17);
              *(UBYTE **)(iVar13 + iVar15) = pUVar9;
              iVar19 = iVar19 + 1;
              iVar20 = iVar20 + 1;
              iVar13 = iVar13 + 4;
              iVar14 = iVar14 + iVar17 * 5;
            } while (iVar19 < (int)(uint)(byte)puVar4[0xe]);
          }
          free(xmpat);
          xmpat = (XMNOTE *)0x0;
          local_30 = local_30 + 1;
          if ((int)(uint)mh->numpat <= local_30) goto LAB_08966bb8;
        }
        if (puVar4[0xe] != '\0') {
          iVar17 = iVar20 << 2;
          iVar13 = 0;
          do {
            iVar14 = *(int *)(puVar5 + 0x110);
            pUVar9 = XM_Convert((XMNOTE *)0x0,0);
            *(UBYTE **)(iVar17 + iVar14) = pUVar9;
            iVar13 = iVar13 + 1;
            iVar20 = iVar20 + 1;
            iVar17 = iVar17 + 4;
          } while (iVar13 < (int)(uint)(byte)puVar5[0xe]);
        }
        local_30 = local_30 + 1;
      } while (local_30 < (int)(uint)mh->numpat);
    }
LAB_08966bb8:
    if (dummypat == 0) {
      return 1;
    }
    of.pattrows[local_30] = 0x40;
    xmpat = _mm_calloc((uint)of.numchn << 6,5);
    if (xmpat != (XMNOTE *)0x0) {
      iVar20 = iVar20 << 2;
      if (of.numchn != '\0') {
        iVar13 = 0;
        iVar17 = 0;
        do {
          iVar13 = iVar13 + 1;
          puVar16 = (undefined4 *)(iVar20 + (int)of.tracks);
          iVar20 = iVar20 + 4;
          pUVar9 = XM_Convert((XMNOTE *)(&xmpat->note + iVar17),0x40);
          *puVar16 = pUVar9;
          iVar17 = iVar13 * 0x140;
        } while (iVar13 < (int)(uint)of.numchn);
      }
      free(xmpat);
      xmpat = (XMNOTE *)0x0;
      return 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: LoadInstruments @ 08967084

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL LoadInstruments(void)

{
  ushort uVar1;
  UWORD UVar2;
  undefined *puVar3;
  XMWAVHEADER *pXVar4;
  XMWAVHEADER *pXVar5;
  MREADER *pMVar6;
  byte bVar7;
  BOOL BVar8;
  long lVar9;
  ULONG UVar10;
  int iVar11;
  CHAR *pCVar12;
  long lVar13;
  int iVar14;
  _func_BOOL_MREADER_ptr *p_Var15;
  UWORD *m;
  INSTRUMENT *pIVar16;
  UWORD *pUVar17;
  uint uVar18;
  ULONG *pUVar19;
  INSTRUMENT *pIVar20;
  short local_138;
  CHAR aCStack_134 [22];
  undefined1 local_11e;
  UWORD local_11c;
  ULONG local_118;
  UWORD local_114 [48];
  UWORD local_b4;
  SWORD local_b2;
  SWORD local_b0;
  SWORD local_ae;
  SWORD local_ac;
  SWORD local_aa;
  SWORD local_a8;
  SWORD local_a6;
  SWORD local_a4;
  SWORD local_a2;
  SWORD local_a0;
  SWORD local_9e;
  UWORD local_84;
  SWORD local_82;
  SWORD local_80;
  SWORD local_7e;
  SWORD local_7c;
  SWORD local_7a;
  SWORD local_78;
  SWORD local_76;
  SWORD local_74;
  SWORD local_72;
  SWORD local_70;
  SWORD local_6e;
  byte local_54;
  byte local_53;
  UBYTE local_52;
  UBYTE local_51;
  UBYTE local_50;
  UBYTE local_4f;
  UBYTE local_4e;
  UBYTE local_4d;
  byte local_4c;
  byte local_4b;
  UBYTE local_4a;
  UBYTE local_49;
  char local_48;
  UBYTE local_47;
  UWORD local_46;
  uint local_40;
  ULONG local_3c;
  int local_38;
  UWORD *local_30;
  
                    /* Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: INSTRUMENT * d@[???]
                       Unresolved local var: ULONG next@[???]
                       Unresolved local var: UWORD wavcnt@[???] */
  BVar8 = AllocInstruments();
  if (BVar8 != 0) {
    if (of.numins != 0) {
      local_30 = &local_b4;
      local_38 = 0;
      local_3c = 0;
      local_40 = 0;
      pIVar20 = of.instruments;
      do {
                    /* Unresolved local var: XMINSTHEADER ih@[???]
                       Unresolved local var: long headend@[???] */
        m = pIVar20->samplenumber;
        memset(m,0xff,0xf0);
        lVar9 = (*modreader->Tell)(modreader);
        UVar10 = _mm_read_I_ULONG(modreader);
        _mm_read_string(aCStack_134,0x16,modreader);
        iVar11 = (*modreader->Get)(modreader);
        local_11e = (undefined1)iVar11;
        local_11c = _mm_read_I_UWORD(modreader);
        pCVar12 = DupStr(aCStack_134,0x16,1);
        local_138 = (short)UVar10;
        pIVar20->insname = pCVar12;
        if (0x1d < local_138) {
          local_118 = _mm_read_I_ULONG(modreader);
          if ((ushort)(local_11c - 1) < 0x60) {
                    /* Unresolved local var: XMPATCHHEADER pth@[???]
                       Unresolved local var: int p@[???] */
            (*modreader->Read)(modreader,local_114,0x60);
            _mm_read_I_UWORDS(&local_b4,0x18,modreader);
            _mm_read_I_UWORDS(&local_84,0x18,modreader);
            iVar11 = (*modreader->Get)(modreader);
            local_54 = (byte)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_53 = (byte)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_52 = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_51 = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_50 = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4f = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4e = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4d = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4c = (byte)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4b = (byte)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_4a = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_49 = (UBYTE)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_48 = (char)iVar11;
            iVar11 = (*modreader->Get)(modreader);
            local_47 = (UBYTE)iVar11;
            local_46 = _mm_read_I_UWORD(modreader);
            lVar13 = (*modreader->Tell)(modreader);
            for (iVar11 = (UVar10 + lVar9) - lVar13; iVar11 != 0; iVar11 = iVar11 + -1) {
              (*modreader->Get)(modreader);
            }
            if (0xc < local_54) {
              local_54 = 0xc;
            }
            if (0xc < local_53) {
              local_53 = 0xc;
            }
            BVar8 = (*modreader->Eof)(modreader);
            puVar3 = PTR_of_089e7584;
            if (((BVar8 != 0) || (0xc < local_54)) || (0xc < local_53)) {
              if (nextwav != (ULONG *)0x0) {
                free(nextwav);
                nextwav = (ULONG *)0x0;
              }
              if (wh != (XMWAVHEADER *)0x0) {
                free(wh);
                wh = (XMWAVHEADER *)0x0;
              }
              MikMod_errno = 10;
              return 0;
            }
            pUVar17 = local_114;
            do {
              UVar2 = *pUVar17;
              pUVar17 = (UWORD *)((int)pUVar17 + 1);
              *m = (ushort)(byte)UVar2 + *(short *)(puVar3 + 0x16);
              m = m + 1;
            } while (pUVar17 != local_30);
            pIVar20->volfade = local_46;
            pIVar20->volenv[0].pos = local_b4;
            pIVar20->volenv[0].val = local_b2;
            pIVar20->volenv[5].val = local_9e;
            pIVar20->volenv[1].pos = local_b0;
            pIVar20->volenv[1].val = local_ae;
            pIVar20->volenv[2].pos = local_ac;
            pIVar20->volenv[2].val = local_aa;
            pIVar20->volenv[3].pos = local_a8;
            pIVar20->volenv[3].val = local_a6;
            pIVar20->volenv[4].pos = local_a4;
            pIVar20->volenv[4].val = local_a2;
            pIVar20->volenv[5].pos = local_a0;
            if ((local_4c & 1) == 0) {
              if ((local_4c & 2) == 0) goto LAB_089674a4;
              bVar7 = pIVar20->volflg;
LAB_08967900:
              pIVar20->volflg = bVar7 | 2;
              if ((local_4c & 4) != 0) {
                bVar7 = pIVar20->volflg;
LAB_089678f4:
                pIVar20->volflg = bVar7 | 4;
              }
            }
            else {
              pIVar20->volflg = pIVar20->volflg | 1;
              if ((local_4c & 2) != 0) {
                bVar7 = pIVar20->volflg;
                goto LAB_08967900;
              }
LAB_089674a4:
              if ((local_4c & 4) != 0) {
                bVar7 = pIVar20->volflg;
                goto LAB_089678f4;
              }
            }
            iVar11 = 0;
            pIVar20->volsusbeg = local_52;
            pIVar20->volsusend = local_52;
            pIVar20->volbeg = local_51;
            pIVar20->volend = local_50;
            pIVar20->volpts = local_54;
            pIVar16 = pIVar20;
            do {
              iVar11 = iVar11 + 1;
              pIVar16->volenv[0].val = pIVar16->volenv[0].val << 2;
              pIVar16 = (INSTRUMENT *)&pIVar16->flags;
            } while (iVar11 != 0xc);
            if (((pIVar20->volflg & 1) != 0) && (pIVar20->volpts < 2)) {
              pIVar20->volflg = pIVar20->volflg & 0xfe;
            }
            pIVar20->panenv[0].pos = local_84;
            pIVar20->panenv[5].val = local_6e;
            pIVar20->panenv[0].val = local_82;
            pIVar20->panenv[1].pos = local_80;
            pIVar20->panenv[1].val = local_7e;
            pIVar20->panenv[2].pos = local_7c;
            pIVar20->panenv[2].val = local_7a;
            pIVar20->panenv[3].pos = local_78;
            pIVar20->panenv[3].val = local_76;
            pIVar20->panenv[4].pos = local_74;
            pIVar20->panenv[4].val = local_72;
            pIVar20->panenv[5].pos = local_70;
            if ((local_4b & 1) == 0) {
              if ((local_4b & 2) == 0) goto LAB_08967588;
              bVar7 = pIVar20->panflg;
LAB_089678a4:
              pIVar20->panflg = bVar7 | 2;
              if ((local_4b & 4) != 0) {
                bVar7 = pIVar20->panflg;
LAB_08967898:
                pIVar20->panflg = bVar7 | 4;
              }
            }
            else {
              pIVar20->panflg = pIVar20->panflg | 1;
              if ((local_4b & 2) != 0) {
                bVar7 = pIVar20->panflg;
                goto LAB_089678a4;
              }
LAB_08967588:
              if ((local_4b & 4) != 0) {
                bVar7 = pIVar20->panflg;
                goto LAB_08967898;
              }
            }
            iVar11 = 0;
            pIVar20->pansusbeg = local_4f;
            pIVar20->pansusend = local_4f;
            pIVar20->panbeg = local_4e;
            pIVar20->panend = local_4d;
            pIVar20->panpts = local_53;
            pIVar16 = pIVar20;
            do {
              iVar11 = iVar11 + 1;
              pIVar16->panenv[0].val = pIVar16->panenv[0].val << 2;
              pIVar16 = (INSTRUMENT *)&pIVar16->flags;
            } while (iVar11 != 0xc);
            if (((pIVar20->panflg & 1) != 0) && (pIVar20->panpts < 2)) {
              pIVar20->panflg = pIVar20->panflg & 0xfe;
            }
            puVar3 = PTR_of_089e7584;
            if (0x103 < mh->version) {
              local_3c = 0;
            }
            uVar18 = 0;
            if (local_11c != 0) {
              iVar11 = 0;
              do {
                if ((uint)*(ushort *)(puVar3 + 0x16) + iVar11 == local_40) {
                  uVar18 = local_40 + 0x40 & 0xffff;
                  nextwav = realloc(nextwav,uVar18 << 2);
                  local_40 = uVar18;
                  if (nextwav == (ULONG *)0x0) {
                    if (wh != (XMWAVHEADER *)0x0) {
                      free(wh);
                      wh = (XMWAVHEADER *)0x0;
                    }
                    MikMod_errno = 2;
                    return 0;
                  }
                  wh = realloc(wh,uVar18 * 0x2c);
                  if (wh == (XMWAVHEADER *)0x0) {
                    free(nextwav);
                    MikMod_errno = 2;
                    nextwav = (ULONG *)0x0;
                    return 0;
                  }
                  s = wh + (uVar18 - 0x40);
                }
                pXVar4 = s;
                UVar10 = _mm_read_I_ULONG(modreader);
                pMVar6 = modreader;
                pXVar5 = s;
                pXVar4->length = UVar10;
                UVar10 = _mm_read_I_ULONG(pMVar6);
                pMVar6 = modreader;
                pXVar5->loopstart = UVar10;
                pXVar4 = s;
                UVar10 = _mm_read_I_ULONG(pMVar6);
                pMVar6 = modreader;
                pXVar4->looplength = UVar10;
                pXVar4 = s;
                iVar14 = (*pMVar6->Get)(pMVar6);
                pXVar4->volume = (UBYTE)iVar14;
                pXVar4 = s;
                iVar14 = (*modreader->Get)(modreader);
                pXVar4->finetune = (SBYTE)iVar14;
                pXVar4 = s;
                iVar14 = (*modreader->Get)(modreader);
                pXVar4->type = (UBYTE)iVar14;
                pXVar4 = s;
                iVar14 = (*modreader->Get)(modreader);
                pXVar4->panning = (UBYTE)iVar14;
                pXVar4 = s;
                iVar14 = (*modreader->Get)(modreader);
                pXVar4->relnote = (SBYTE)iVar14;
                pXVar4 = s;
                s->vibtype = local_4a;
                pXVar4->vibsweep = local_49;
                pXVar4->vibdepth = local_48 << 2;
                pXVar4->vibrate = local_47;
                iVar14 = (*modreader->Get)(modreader);
                pXVar4->reserved = (UBYTE)iVar14;
                _mm_read_string(s->samplename,0x16,modreader);
                pMVar6 = modreader;
                pXVar4 = s;
                p_Var15 = modreader->Eof;
                nextwav[(uint)*(ushort *)(puVar3 + 0x16) + iVar11] = local_3c;
                UVar10 = pXVar4->length;
                BVar8 = (*p_Var15)(pMVar6);
                if (BVar8 != 0) {
                  free(nextwav);
                  free(wh);
                  MikMod_errno = 10;
                  nextwav = (ULONG *)0x0;
                  wh = (XMWAVHEADER *)0x0;
                  return 0;
                }
                uVar18 = (uint)local_11c;
                iVar11 = iVar11 + 1;
                s = s + 1;
                local_3c = local_3c + UVar10;
              } while (iVar11 < (int)uVar18);
            }
            puVar3 = PTR_of_089e7584;
            if (mh->version < 0x104) {
              of.numsmp = (short)uVar18 + of.numsmp;
            }
            else {
              if (uVar18 != 0) {
                iVar11 = 0;
                do {
                  uVar1 = *(ushort *)(puVar3 + 0x16);
                  pUVar19 = nextwav + uVar1;
                  UVar10 = *pUVar19;
                  lVar9 = (*modreader->Tell)(modreader);
                  iVar11 = iVar11 + 1;
                  *pUVar19 = UVar10 + lVar9;
                  *(ushort *)(puVar3 + 0x16) = uVar1 + 1;
                } while (iVar11 < (int)(uint)local_11c);
              }
              (*modreader->Seek)(modreader,local_3c,1);
            }
          }
          else {
            lVar13 = (*modreader->Tell)(modreader);
            for (iVar11 = (UVar10 + lVar9) - lVar13; iVar11 != 0; iVar11 = iVar11 + -1) {
              (*modreader->Get)(modreader);
            }
            BVar8 = (*modreader->Eof)(modreader);
            if (BVar8 != 0) {
              free(nextwav);
              free(wh);
              MikMod_errno = 10;
              nextwav = (ULONG *)0x0;
              wh = (XMWAVHEADER *)0x0;
              return 0;
            }
          }
        }
        local_38 = local_38 + 1;
        if ((int)(uint)of.numins <= local_38) break;
        pIVar20 = pIVar20 + 1;
      } while( true );
    }
    if (of.numsmp != 0) {
      return 1;
    }
    if (nextwav != (ULONG *)0x0) {
      free(nextwav);
      nextwav = (ULONG *)0x0;
    }
    if (wh != (XMWAVHEADER *)0x0) {
      free(wh);
      wh = (XMWAVHEADER *)0x0;
    }
    MikMod_errno = 10;
  }
  return 0;
}



----------------------------------------

// Function: XM_Load @ 08967bc8

BOOL XM_Load(BOOL curious)

{
  char *pcVar1;
  UBYTE *pUVar2;
  byte bVar3;
  ushort uVar4;
  XMHEADER *pXVar5;
  XMWAVHEADER *aptr;
  MREADER *pMVar6;
  UWORD UVar7;
  ULONG UVar8;
  BOOL BVar9;
  BOOL BVar10;
  long lVar11;
  CHAR *pCVar12;
  uint uVar13;
  char *pcVar14;
  UWORD *pUVar15;
  uint uVar16;
  XMHEADER *pXVar17;
  uint uVar18;
  int iVar19;
  INSTRUMENT *pIVar20;
  INSTRUMENT *pIVar21;
  SAMPLE *pSVar22;
  ULONG *pUVar23;
  int iVar24;
  char cStack_79;
  undefined4 local_78;
  char local_74 [4];
  char local_70 [4];
  char local_6c [7];
  char local_65 [69];
  
                    /* Unresolved local var: INSTRUMENT * d@[???]
                       Unresolved local var: SAMPLE * q@[???]
                       Unresolved local var: int t@[???]
                       Unresolved local var: int u@[???]
                       Unresolved local var: BOOL dummypat@[???]
                       Unresolved local var: char[21] tracker@[???]
                       Unresolved local var: char[60] modtype@[???] */
  _mm_read_string(mh->id,0x11,modreader);
  _mm_read_string(mh->songname,0x15,modreader);
  _mm_read_string(mh->trackername,0x14,modreader);
  pXVar17 = mh;
  UVar7 = _mm_read_I_UWORD(modreader);
  pXVar5 = mh;
  pXVar17->version = UVar7;
  if (2 < (ushort)(pXVar5->version - 0x102)) {
    MikMod_errno = 0xb;
    return 0;
  }
  UVar8 = _mm_read_I_ULONG(modreader);
  pMVar6 = modreader;
  pXVar17 = mh;
  pXVar5->headersize = UVar8;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar5 = mh;
  pXVar17->songlength = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar17 = mh;
  pXVar5->restart = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar5 = mh;
  pXVar17->numchn = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar17 = mh;
  pXVar5->numpat = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar5 = mh;
  pXVar17->numins = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar5->flags = UVar7;
  pXVar17 = mh;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pMVar6 = modreader;
  pXVar5 = mh;
  pXVar17->tempo = UVar7;
  UVar7 = _mm_read_I_UWORD(pMVar6);
  pXVar17 = mh;
  pXVar5->bpm = UVar7;
  if (pXVar17->bpm == 0) {
    MikMod_errno = 0xb;
    return 0;
  }
  (*modreader->Read)(modreader,pXVar17->orders,0x100);
  BVar9 = (*modreader->Eof)(modreader);
  if (BVar9 != 0) {
    MikMod_errno = 9;
    return 0;
  }
  of.initspeed = (UBYTE)mh->tempo;
  of.inittempo = (UWORD)(byte)mh->bpm;
  strncpy((char *)&local_78,mh->trackername,0x14);
  local_65[1] = 0;
  if (local_65[0] < '!') {
    pcVar14 = local_65;
    do {
      pcVar1 = pcVar14 + -1;
      *pcVar14 = '\0';
      pcVar14 = pcVar14 + -1;
      if (' ' < *pcVar1) goto LAB_08967dcc;
    } while (pcVar14 != &cStack_79);
  }
  else {
LAB_08967dcc:
  }
  if ((char)local_78 == '\0') {
    local_78._0_1_ = s_Unknown_tracker_089e7588[0];
    local_78._1_1_ = s_Unknown_tracker_089e7588[1];
    local_78._2_1_ = s_Unknown_tracker_089e7588[2];
    local_78._3_1_ = s_Unknown_tracker_089e7588[3];
    local_74[0] = s_Unknown_tracker_089e7588[4];
    local_74[1] = s_Unknown_tracker_089e7588[5];
    local_74[2] = s_Unknown_tracker_089e7588[6];
    local_74[3] = s_Unknown_tracker_089e7588[7];
    local_6c[0] = s_Unknown_tracker_089e7588[0xc];
    local_6c[1] = s_Unknown_tracker_089e7588[0xd];
    local_6c[2] = s_Unknown_tracker_089e7588[0xe];
    local_6c[3] = s_Unknown_tracker_089e7588[0xf];
    local_70[0] = s_Unknown_tracker_089e7588[8];
    local_70[1] = s_Unknown_tracker_089e7588[9];
    local_70[2] = s_Unknown_tracker_089e7588[10];
    local_70[3] = s_Unknown_tracker_089e7588[0xb];
  }
  sprintf(local_65 + 2,"%s (XM format %d.%02d)",&local_78,(uint)(mh->version >> 8));
  of.modtype = strdup(local_65 + 2);
  of.numchn = (UBYTE)mh->numchn;
  of.numpat = mh->numpat;
  of.numtrk = of.numpat * (mh->numchn & 0xff);
  of.songname = DupStr(mh->songname,0x14,1);
  of.numpos = mh->songlength;
  of.reppos = mh->restart;
  if (mh->songlength <= of.reppos) {
    of.reppos = 0;
  }
  of.numins = mh->numins;
  uVar4 = of.flags | 0x285;
  if ((mh->flags & 1) != 0) {
    uVar4 = of.flags | 0x287;
  }
  of.flags = uVar4;
  memset(of.chanvol,0x40,(uint)of.numchn);
  BVar9 = AllocPositions(of.numpos + 1);
  if (BVar9 == 0) {
    return 0;
  }
  if (of.numpos != 0) {
    iVar19 = 0;
    pUVar15 = of.positions;
    pXVar17 = mh;
    do {
      pUVar2 = pXVar17->orders;
      iVar19 = iVar19 + 1;
      pXVar17 = (XMHEADER *)(pXVar17->id + 1);
      *pUVar15 = (ushort)*pUVar2;
      pUVar15 = pUVar15 + 1;
    } while (iVar19 < (int)(uint)of.numpos);
    if (of.numpos != 0) {
      iVar19 = 0;
      BVar9 = 0;
      pUVar15 = of.positions;
      do {
        iVar19 = iVar19 + 1;
        if (of.numpat <= *pUVar15) {
          BVar9 = 1;
          *pUVar15 = of.numpat;
        }
        pUVar15 = pUVar15 + 1;
      } while (iVar19 < (int)(uint)of.numpos);
      if (BVar9 != 0) {
        of.numpat = of.numpat + 1;
        of.numtrk = of.numtrk + of.numchn;
      }
      goto LAB_08967f64;
    }
  }
  BVar9 = 0;
LAB_08967f64:
  if (mh->version < 0x104) {
    BVar10 = LoadInstruments();
    if ((BVar10 == 0) || (BVar9 = LoadPatterns(BVar9), BVar9 == 0)) {
      return 0;
    }
    if (of.numsmp != 0) {
      iVar19 = 0;
      do {
        pUVar23 = nextwav + iVar19;
        UVar8 = *pUVar23;
        lVar11 = (*modreader->Tell)(modreader);
        uVar16 = (uint)of.numsmp;
        iVar19 = iVar19 + 1;
        *pUVar23 = UVar8 + lVar11;
      } while (iVar19 < (int)uVar16);
    }
  }
  else {
    BVar9 = LoadPatterns(BVar9);
    if (BVar9 == 0) {
      return 0;
    }
    BVar9 = LoadInstruments();
    if (BVar9 == 0) {
      return 0;
    }
  }
  BVar9 = AllocSamples();
  if (BVar9 == 0) {
    free(nextwav);
    free(wh);
    nextwav = (ULONG *)0x0;
    wh = (XMWAVHEADER *)0x0;
    return 0;
  }
  s = wh;
  if (of.numsmp != 0) {
    pSVar22 = of.samples;
    iVar19 = 0;
    do {
      pCVar12 = DupStr(s->samplename,0x16,1);
      pSVar22->samplename = pCVar12;
      uVar16 = s->length;
      iVar24 = iVar19 + 1;
      pSVar22->length = uVar16;
      uVar18 = s->loopstart;
      pSVar22->loopstart = uVar18;
      uVar13 = s->loopstart + s->looplength;
      pSVar22->loopend = uVar13;
      pSVar22->volume = s->volume;
      pUVar23 = nextwav;
      pSVar22->speed = (int)s->finetune + 0x80;
      bVar3 = s->panning;
      pSVar22->seekpos = pUVar23[iVar19];
      pSVar22->panning = (ushort)bVar3;
      pSVar22->vibtype = s->vibtype;
      pSVar22->vibsweep = s->vibsweep;
      pSVar22->vibdepth = s->vibdepth;
      pSVar22->vibrate = s->vibrate;
      if ((s->type & 0x10) != 0) {
        pSVar22->length = uVar16 >> 1;
        pSVar22->loopstart = uVar18 >> 1;
        pSVar22->loopend = uVar13 >> 1;
      }
      uVar4 = pSVar22->flags;
      pSVar22->flags = uVar4 | 0x1000;
      bVar3 = s->type;
      if ((bVar3 & 3) != 0) {
        pSVar22->flags = uVar4 | 0x1100;
        bVar3 = s->type;
      }
      if ((bVar3 & 2) != 0) {
        pSVar22->flags = pSVar22->flags | 0x200;
        bVar3 = s->type;
      }
      uVar4 = pSVar22->flags;
      if ((bVar3 & 0x10) != 0) {
        pSVar22->flags = uVar4 | 1;
        uVar4 = pSVar22->flags;
      }
      s = s + 1;
      pSVar22->flags = uVar4 | 0x14;
      pSVar22 = pSVar22 + 1;
      iVar19 = iVar24;
    } while (iVar24 < (int)(uint)of.numsmp);
  }
  aptr = wh;
  s = wh;
  if (of.numins != 0) {
    iVar19 = 0;
    pIVar21 = of.instruments;
    do {
      pUVar15 = pIVar21->samplenumber;
      iVar24 = 0;
      pIVar20 = pIVar21;
      do {
        if ((uint)*pUVar15 < (uint)of.numsmp) {
                    /* Unresolved local var: int note@[???] */
          pIVar20->samplenote[0] = aptr[*pUVar15].relnote + (char)iVar24;
        }
        else {
          pIVar20->samplenote[0] = 0xff;
        }
        iVar24 = iVar24 + 1;
        pUVar15 = pUVar15 + 1;
        pIVar20 = (INSTRUMENT *)((int)&pIVar20->insname + 1);
      } while (iVar24 != 0x60);
      iVar19 = iVar19 + 1;
      pIVar21 = pIVar21 + 1;
    } while (iVar19 < (int)(uint)of.numins);
  }
  free(aptr);
  free(nextwav);
  nextwav = (ULONG *)0x0;
  wh = (XMWAVHEADER *)0x0;
  return 1;
}



----------------------------------------

// Function: XM_Init @ 08968298

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL XM_Init(void)

{
  mh = _mm_malloc(0x150);
  return (uint)(mh != (XMHEADER *)0x0);
}



----------------------------------------

// Function: XM_Test @ 089682c0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL XM_Test(void)

{
  BOOL BVar1;
  int iVar2;
  undefined1 auStack_30 [37];
  char local_b;
  
                    /* Unresolved local var: UBYTE[38] id@[???] */
  BVar1 = (*modreader->Read)(modreader,auStack_30,0x26);
  if (BVar1 != 0) {
    iVar2 = memcmp(auStack_30,"Extended Module: ",0x11);
    if (iVar2 == 0) {
      return (uint)(local_b == '\x1a');
    }
  }
  return 0;
}



----------------------------------------

// Function: UniVolEffect @ 08968328

void UniVolEffect(UWORD eff,UBYTE dat)

{
  if ((eff == 0) && (dat == '\0')) {
    return;
  }
  UniWriteByte('\x1e');
  UniWriteByte((UBYTE)eff);
  UniWriteByte(dat);
  return;
}



----------------------------------------

// Function: UniEffect @ 08968388

void UniEffect(UWORD eff,UWORD dat)

{
  if (0x3b < (eff - 1 & 0xffff)) {
    return;
  }
  UniWriteByte((UBYTE)eff);
  if (unioperands[eff] != 2) {
    UniWriteByte((UBYTE)dat);
    return;
  }
  UniWriteWord(dat);
  return;
}



----------------------------------------

// Function: UniPTEffect @ 0896841c

void UniPTEffect(UBYTE eff,UBYTE dat)

{
  if ((eff == '\0') && (dat == '\0')) {
    return;
  }
  UniEffect(eff + 3,(ushort)dat);
  return;
}



----------------------------------------

// Function: S3MIT_CreateOrders @ 08968448

void S3MIT_CreateOrders(BOOL curious)

{
  int iVar1;
  
                    /* Unresolved local var: int t@[DW_OP_reg7(a3)] */
  of.numpos = 0;
  memset(of.positions,0,(uint)poslookupcnt << 1);
  memset(poslookup,-1,0x100);
  if (poslookupcnt != '\0') {
    iVar1 = 0;
    do {
      of.positions[of.numpos] = origpositions[iVar1];
      poslookup[iVar1] = (UBYTE)of.numpos;
      if (origpositions[iVar1] < 0xfe) {
        of.numpos = of.numpos + 1;
      }
      else if ((of.positions[iVar1] == 0xff) && (curious = curious + -1, curious == -1)) {
        return;
      }
      iVar1 = iVar1 + 1;
    } while (iVar1 < (int)(uint)poslookupcnt);
  }
  return;
}



----------------------------------------

// Function: S3MIT_ProcessCmd @ 08968564

void S3MIT_ProcessCmd(UBYTE cmd,UBYTE inf,BOOL oldeffect)

{
  uint uVar1;
  UBYTE UVar2;
  UWORD eff;
  ushort dat;
  uint uVar3;
  
                    /* Unresolved local var: UBYTE hi@[???]
                       Unresolved local var: UBYTE lo@[???] */
  uVar1 = (uint)inf;
  dat = (ushort)inf;
  if (cmd == 0xff) {
    return;
  }
  uVar3 = uVar1 & 0xf;
  switch(cmd) {
  default:
    return;
  case '\x01':
    eff = 0x13;
    break;
  case '\x02':
    if (poslookupcnt <= uVar1) {
      return;
    }
    inf = poslookup[uVar1];
    UVar2 = '\v';
    if ((char)inf < '\0') {
      if (origpositions[uVar1] == 0xff) {
        return;
      }
      S3MIT_CreateOrders(1);
      inf = poslookup[uVar1];
      if ((char)inf < '\0') {
        return;
      }
      UVar2 = '\v';
    }
    goto LAB_0896861c;
  case '\x03':
    if (oldeffect == 1) {
      UVar2 = '\r';
      inf = (UBYTE)uVar3 + (inf >> 4) * '\n';
    }
    else {
      UVar2 = '\r';
    }
    goto LAB_0896861c;
  case '\x04':
switchD_089685c4_caseD_4:
    goto LAB_089685e8;
  case '\x05':
    eff = 0x15;
    break;
  case '\x06':
    eff = 0x16;
    break;
  case '\a':
    eff = 0x2b;
    break;
  case '\b':
    if ((oldeffect & 1U) != 0) {
      UVar2 = '\x04';
      goto LAB_0896861c;
    }
    eff = 0x2c;
    break;
  case '\t':
    if ((oldeffect & 1U) == 0) {
      eff = 0x2d;
    }
    else {
      eff = 0x17;
    }
    break;
  case '\n':
    UVar2 = '\0';
    goto LAB_0896861c;
  case '\v':
    if ((oldeffect & 1U) != 0) {
      UniPTEffect('\x04','\0');
      goto switchD_089685c4_caseD_4;
    }
    UniEffect(0x2c,0);
    goto LAB_089685e8;
  case '\f':
    if ((oldeffect & 1U) == 0) {
      UniEffect(0x2b,0);
    }
    else {
      UniPTEffect('\x03','\0');
    }
LAB_089685e8:
    eff = 0x14;
    break;
  case '\r':
    eff = 0x2e;
    break;
  case '\x0e':
    eff = 0x2f;
    break;
  case '\x0f':
    UVar2 = '\t';
    goto LAB_0896861c;
  case '\x10':
    eff = 0x30;
    break;
  case '\x11':
    UniWriteByte('\x18');
    if (((inf != '\0') && ((inf & 0xf) == 0)) && ((oldeffect & 1U) == 0)) {
      inf = '\x01';
    }
    goto LAB_089686c8;
  case '\x12':
    eff = 0x19;
    break;
  case '\x13':
    if (0xef < uVar1) {
      if (filters == 0) {
        return;
      }
      if (uVar3 == activemacro) {
        return;
      }
      UVar2 = filtermacros[uVar3];
      uVar1 = 0;
      activemacro = (UBYTE)uVar3;
      do {
        uVar3 = uVar1 & 0xff;
        uVar1 = uVar1 + 1;
        filtersettings[uVar3].filter = UVar2;
      } while (uVar1 != 0x80);
      return;
    }
    eff = 0x36;
    break;
  case '\x14':
    if (uVar1 < 0x20) {
      if ((oldeffect & 1U) != 0) {
        return;
      }
      eff = 0x31;
      dat = (ushort)inf;
    }
    else {
      eff = 0x1a;
    }
    break;
  case '\x15':
    if ((oldeffect & 1U) == 0) {
      eff = 0x32;
    }
    else {
      eff = 0x1b;
    }
    break;
  case '\x16':
    eff = 0x25;
    break;
  case '\x17':
    eff = 0x33;
    break;
  case '\x18':
    if ((oldeffect & 1U) == 0) {
      UVar2 = '\b';
    }
    else {
      if (0x80 < uVar1) {
        eff = 0x36;
        dat = 0x91;
        break;
      }
      if (uVar1 == 0x80) {
        inf = 0xff;
        UVar2 = '\b';
      }
      else {
        inf = (UBYTE)((uVar1 & 0x7f) << 1);
        UVar2 = '\b';
      }
    }
LAB_0896861c:
    UniPTEffect(UVar2,inf);
    return;
  case '\x19':
    eff = 0x34;
    break;
  case '\x1a':
    if (filtersettings[uVar1].filter == '\0') {
      return;
    }
    UniWriteByte('5');
    UniWriteByte(filtersettings[uVar1].filter);
    inf = filtersettings[uVar1].inf;
LAB_089686c8:
    UniWriteByte(inf);
    return;
  }
  UniEffect(eff,dat);
  return;
}



----------------------------------------

// Function: speed_to_finetune @ 08968954

int speed_to_finetune(ULONG speed,int sample)

{
  UBYTE UVar1;
  UWORD UVar2;
  undefined2 extraout_var;
  ULONG UVar3;
  undefined2 extraout_var_00;
  ULONG UVar4;
  undefined2 extraout_var_01;
  UWORD note;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  
                    /* Unresolved local var: int ctmp@[???]
                       Unresolved local var: int tmp@[???]
                       Unresolved local var: int note@[???]
                       Unresolved local var: int finetune@[???] */
  uVar5 = speed >> 1;
  uVar7 = 1;
  uVar6 = 0;
  while( true ) {
    UVar1 = (UBYTE)of.flags;
    note = (UWORD)((uVar7 & 0x7fff) << 1);
    UVar2 = getlinearperiod(note,0);
    UVar3 = getfrequency(UVar1,CONCAT22(extraout_var,UVar2));
    if (uVar5 <= UVar3) break;
    uVar7 = uVar7 + 1;
    uVar6 = UVar3;
  }
  if (UVar3 != uVar5) {
    if (UVar3 - uVar5 < uVar5 - uVar6) {
      if (uVar5 < UVar3) {
        UVar3 = 0;
        do {
          UVar1 = (UBYTE)of.flags;
          UVar3 = UVar3 - 1;
          UVar2 = getlinearperiod(note,UVar3);
          UVar4 = getfrequency(UVar1,CONCAT22(extraout_var_01,UVar2));
        } while (uVar5 < UVar4);
        goto LAB_08968a34;
      }
    }
    else {
      uVar7 = uVar7 - 1;
      if (uVar6 < uVar5) {
        UVar3 = 0;
        do {
          UVar1 = (UBYTE)of.flags;
          UVar3 = UVar3 + 1;
          UVar2 = getlinearperiod((short)uVar7 * 2,UVar3);
          UVar4 = getfrequency(UVar1,CONCAT22(extraout_var_00,UVar2));
        } while (UVar4 < uVar5);
        goto LAB_08968a34;
      }
    }
  }
  UVar3 = 0;
LAB_08968a34:
  noteindex[sample] = uVar7 - 0x30;
  return UVar3;
}



----------------------------------------

// Function: FreeLinear @ 08968ac0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void FreeLinear(void)

{
  if (noteindex != (int *)0x0) {
    free(noteindex);
    noteindex = (int *)0x0;
  }
  noteindexcount = 0;
  return;
}



----------------------------------------

// Function: AllocLinear @ 08968b00

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int * AllocLinear(void)

{
  uint uVar1;
  
  uVar1 = (uint)of.numsmp;
  if ((int)uVar1 <= noteindexcount) {
    return noteindex;
  }
  noteindexcount = uVar1;
  noteindex = realloc(noteindex,uVar1 << 2);
  return noteindex;
}



----------------------------------------

// Function: SDRV_IsThere @ 08968b68

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL SDRV_IsThere(void)

{
  return 1;
}



----------------------------------------

// Function: SDRV_Update @ 08968b70

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDRV_Update(void)

{
  return;
}



----------------------------------------

// Function: SDRV_Reset @ 08968b78

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL SDRV_Reset(void)

{
  return 0;
}



----------------------------------------

// Function: SDRV_Exit @ 08968b80

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void SDRV_Exit(void)

{
  (*VC_Exit_ptr)();
  return;
}



----------------------------------------

// Function: SDRV_Init @ 08968b88

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

BOOL SDRV_Init(void)

{
  BOOL BVar1;
  
  md_mode = md_mode | 0xc;
  BVar1 = VC_Init();
  return BVar1;
}



----------------------------------------

// Function: ctl_open @ 08968b9c

int ctl_open(int using_stdin,int using_stdout)

{
  sdl_control_mode.opened = 1;
  return 0;
}



----------------------------------------

// Function: ctl_close @ 08968bb0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void ctl_close(void)

{
  sdl_control_mode.opened = 0;
  return;
}



----------------------------------------

// Function: ctl_read @ 08968bbc

int ctl_read(int32 *valp)

{
  return 0;
}



----------------------------------------

// Function: ctl_refresh @ 08968bc4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void ctl_refresh(void)

{
  return;
}



----------------------------------------

// Function: ctl_total_time @ 08968bcc

void ctl_total_time(int tt)

{
  return;
}



----------------------------------------

// Function: ctl_master_volume @ 08968bd4

void ctl_master_volume(int mv)

{
  return;
}



----------------------------------------

// Function: ctl_file_name @ 08968bdc

void ctl_file_name(char *name)

{
  return;
}



----------------------------------------

// Function: ctl_current_time @ 08968be4

void ctl_current_time(int ct)

{
  return;
}



----------------------------------------

// Function: ctl_note @ 08968bec

void ctl_note(int v)

{
  return;
}



----------------------------------------

// Function: ctl_program @ 08968bf4

void ctl_program(int ch,int val)

{
  return;
}



----------------------------------------

// Function: ctl_volume @ 08968bfc

void ctl_volume(int channel,int val)

{
  return;
}



----------------------------------------

// Function: ctl_expression @ 08968c04

void ctl_expression(int channel,int val)

{
  return;
}



----------------------------------------

// Function: ctl_panning @ 08968c0c

void ctl_panning(int channel,int val)

{
  return;
}



----------------------------------------

// Function: ctl_sustain @ 08968c14

void ctl_sustain(int channel,int val)

{
  return;
}



----------------------------------------

// Function: ctl_pitch_bend @ 08968c1c

void ctl_pitch_bend(int channel,int val)

{
  return;
}



----------------------------------------

// Function: ctl_reset @ 08968c24

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void ctl_reset(void)

{
  return;
}



----------------------------------------

// Function: cmsg @ 08968c2c

int cmsg(int type,int verbosity_level,char *fmt,...)

{
  undefined4 in_a3;
  undefined4 local_14 [5];
  
                    /* Unresolved local var: va_list ap@[???] */
  if ((((type != 8) && (type != 0)) && (type != 1)) ||
     (verbosity_level <= sdl_control_mode.verbosity)) {
    local_14[0] = in_a3;
    vsprintf(timidity_error,fmt,local_14);
  }
  return 0;
}



----------------------------------------

// Function: init_tables @ 08968cb0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void init_tables(void)

{
  return;
}



----------------------------------------

// Function: ino @ 08968cb8

/* WARNING: Unknown calling convention */

float ino(float x)

{
  bool bVar1;
  SItype SVar2;
  int iVar3;
  float fVar4;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  float arg_a;
  float fVar5;
  float arg_a_00;
  float fVar6;
  
                    /* Unresolved local var: float y@[???]
                       Unresolved local var: float de@[???]
                       Unresolved local var: float e@[???]
                       Unresolved local var: float sde@[???]
                       Unresolved local var: int i@[???] */
  fVar6 = x * DAT_089dc448;
  iVar3 = 1;
  fVar5 = DAT_089dbce4;
  arg_a_00 = DAT_089dbce4;
  do {
    fVar5 = (fVar5 * fVar6) / (float)iVar3;
    arg_a = fVar5 * fVar5;
    arg_a_00 = arg_a_00 + arg_a;
    fVar4 = arg_a_00;
    __extendsfdf2(arg_a_00);
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,fVar4),in_f14_15);
    __extendsfdf2(arg_a);
    __subdf3((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    SVar2 = __gtdf2((FLO_type_conflict)CONCAT44(in_f13,arg_a),in_f14_15);
    if (0 < SVar2) {
      return arg_a_00;
    }
    bVar1 = iVar3 != 0x1a;
    iVar3 = iVar3 + 1;
  } while (bVar1);
  return arg_a_00;
}



----------------------------------------

// Function: antialiasing @ 08968dd0

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void antialiasing(Sample *sp,int32 output_rate)

{
  short sVar1;
  ControlMode *pCVar2;
  sample_t sVar3;
  float *pfVar4;
  int iVar5;
  float *pfVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  SFtype *pSVar10;
  short *psVar11;
  sample_t *psVar12;
  uint uVar13;
  SFtype SVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  SFtype SVar18;
  float fVar19;
  undefined4 in_f13;
  FLO_type_conflict in_f14_15;
  SFtype local_f0 [9];
  float local_cc [11];
  float local_a0 [20];
  float local_50;
  sample_t *local_4c;
  int local_48;
  void *local_44;
  int local_40;
  
                    /* Unresolved local var: sample_t * temp@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: float[20] fir_symetric@[???]
                       Unresolved local var: float[10] fir_coef@[???]
                       Unresolved local var: float freq_cut@[???] */
  pSVar10 = local_f0;
  pfVar4 = local_f0;
  (*ctl->cmsg)(0,2,"Antialiasing: Fsample=%iKHz",sp->sample_rate);
  if (output_rate < sp->sample_rate) {
    iVar9 = 0;
    SVar18 = (float)output_rate / (float)sp->sample_rate;
    __extendsfdf2(SVar18);
    pCVar2 = ctl;
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
    (*pCVar2->cmsg)(0,2,"Antialiasing: cutoff=%f%%");
    do {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: float xi@[???]
                       Unresolved local var: float omega@[???]
                       Unresolved local var: float att@[???]
                       Unresolved local var: float beta@[???]
                       Unresolved local var: float[10] w@[???] */
      __floatsidf(iVar9);
      __adddf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      SVar18 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
      iVar9 = iVar9 + 1;
      __extendsfdf2(SVar18);
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      SVar18 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
      __extendsfdf2(SVar18);
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      sin((double)CONCAT44(in_f13,SVar18));
      __divdf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      SVar14 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
      *pSVar10 = SVar14;
      pSVar10 = pSVar10 + 1;
    } while (iVar9 != 10);
    iVar9 = 0;
    log((double)CONCAT44(in_f13,SVar18));
    __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
    exp((double)CONCAT44(in_f13,SVar18));
    __adddf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
    SVar14 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
    SVar18 = SVar14;
    __extendsfdf2(SVar14);
    fVar17 = DAT_089e7694;
    fVar16 = DAT_089de20c;
    pfVar6 = local_cc + 1;
    do {
                    /* Unresolved local var: float xind@[???]
                       Unresolved local var: float xi@[???]
                       Unresolved local var: int i@[???] */
      __floatsidf(iVar9);
      iVar9 = iVar9 + 1;
      __adddf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      SVar18 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
      fVar19 = (SVar18 * fVar16 * SVar18) / fVar17;
      __extendsfdf2(fVar19);
      __adddf3((FLO_type_conflict)CONCAT44(in_f13,fVar19),in_f14_15);
      sqrt((double)CONCAT44(in_f13,fVar19));
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,fVar19),in_f14_15);
      SVar18 = __truncdfsf2((DFtype)CONCAT44(in_f13,fVar19));
      fVar19 = ino(SVar18);
      SVar18 = SVar14;
      fVar15 = ino(SVar14);
      *pfVar6 = fVar19 / fVar15;
      pfVar6 = pfVar6 + 1;
    } while (iVar9 != 10);
    pfVar6 = local_cc;
    do {
      pfVar6 = pfVar6 + 1;
      *pfVar4 = *pfVar4 * *pfVar6;
      pfVar4 = pfVar4 + 1;
    } while (pfVar4 != local_cc + 1);
    pfVar4 = local_a0;
    iVar9 = 0;
    do {
      fVar16 = *(float *)((int)local_f0 + iVar9 + 0x24);
      iVar7 = iVar9 + -4;
      *pfVar4 = fVar16;
      *(float *)((int)local_a0 + iVar9 + 0x4c) = fVar16;
      pfVar4 = pfVar4 + 1;
      iVar9 = iVar7;
    } while (iVar7 != -0x28);
    local_48 = 0;
    iVar9 = -10;
    local_44 = safe_malloc(sp->data_length);
    memcpy(local_44,sp->data,sp->data_length);
    fVar17 = DAT_089e7698;
    fVar16 = DAT_089df680;
    psVar12 = sp->data;
    local_4c = psVar12;
    uVar13 = (uint)sp->data_length >> 1;
    do {
      fVar19 = 0.0;
      psVar11 = (short *)(iVar9 * 2 + (int)local_44);
      pfVar4 = local_a0;
      iVar7 = iVar9;
      do {
                    /* Unresolved local var: int32 sample@[???]
                       Unresolved local var: int32 i@[???]
                       Unresolved local var: int32 sample_window@[???]
                       Unresolved local var: int16 peak@[???]
                       Unresolved local var: float sum@[???] */
        SVar18 = *pfVar4;
        if (-1 < iVar7) {
          sVar1 = *psVar11;
          iVar7 = iVar7 + 1;
          psVar11 = psVar11 + 1;
          __floatsidf((int)sVar1);
        }
        pfVar4 = pfVar4 + 1;
        __extendsfdf2(SVar18);
        __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
        SVar14 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
        fVar19 = fVar19 + SVar14;
      } while (pfVar4 != local_a0 + 0x14);
      if (fVar16 < fVar19) {
        local_48 = (int)(short)((short)local_48 + 1);
        sVar3 = 0x7fff;
      }
      else if (fVar17 <= fVar19) {
        sVar3 = (sample_t)(int)fVar19;
      }
      else {
        local_48 = (int)(short)((short)local_48 + 1);
        sVar3 = -0x8000;
      }
      iVar9 = iVar9 + 1;
      *psVar12 = sVar3;
      fVar15 = DAT_089e7698;
      fVar19 = DAT_089df680;
      psVar12 = psVar12 + 1;
    } while (iVar9 != 0);
    iVar9 = uVar13 - 10;
    if (10 < iVar9) {
      iVar7 = (int)local_44 + 0x14;
      iVar8 = 10;
      psVar12 = local_4c;
      do {
        fVar16 = 0.0;
        pfVar6 = local_a0;
        iVar5 = iVar7;
        do {
          psVar11 = (short *)(iVar5 + -0x14);
          fVar17 = *pfVar6;
          pfVar6 = pfVar6 + 1;
          iVar5 = iVar5 + 2;
          fVar16 = fVar16 + (float)(int)*psVar11 * fVar17;
        } while (pfVar6 != pfVar4);
        if (fVar19 < fVar16) {
          local_48 = (int)(short)((short)local_48 + 1);
          sVar3 = 0x7fff;
        }
        else if (fVar15 <= fVar16) {
          sVar3 = (sample_t)(int)fVar16;
        }
        else {
          local_48 = (int)(short)((short)local_48 + 1);
          sVar3 = -0x8000;
        }
        iVar8 = iVar8 + 1;
        psVar12[10] = sVar3;
        iVar7 = iVar7 + 2;
        psVar12 = psVar12 + 1;
      } while (iVar9 != iVar8);
    }
    fVar17 = DAT_089e7698;
    fVar16 = DAT_089df680;
    if (iVar9 < (int)uVar13) {
      psVar12 = local_4c + uVar13;
      local_40 = uVar13 - iVar9;
      iVar9 = uVar13 - 0x14;
      local_50 = 0.0;
      do {
        fVar19 = 0.0;
        psVar11 = (short *)(iVar9 * 2 + (int)local_44);
        pfVar6 = local_a0;
        iVar7 = iVar9;
        do {
          SVar18 = *pfVar6;
          if (iVar7 < (int)uVar13) {
            sVar1 = *psVar11;
            iVar7 = iVar7 + 1;
            psVar11 = psVar11 + 1;
            __floatsidf((int)sVar1);
          }
          pfVar6 = pfVar6 + 1;
          __extendsfdf2(SVar18);
          __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
          SVar14 = __truncdfsf2((DFtype)CONCAT44(in_f13,SVar18));
          fVar19 = fVar19 + SVar14;
        } while (pfVar6 != pfVar4);
        if (fVar16 < fVar19) {
          local_48 = (int)(short)((short)local_48 + 1);
          sVar3 = 0x7fff;
        }
        else if (fVar17 <= fVar19) {
          sVar3 = (sample_t)(int)fVar19;
        }
        else {
          local_48 = (int)(short)((short)local_48 + 1);
          sVar3 = -0x8000;
        }
        psVar12[-10] = sVar3;
        local_50 = (float)((int)local_50 + 1);
        iVar9 = iVar9 + 1;
        psVar12 = psVar12 + 1;
      } while (local_50 != (float)local_40);
    }
    if (local_48 != 0) {
      __floatsidf(local_48);
      pCVar2 = ctl;
      __muldf3((FLO_type_conflict)CONCAT44(in_f13,SVar18),in_f14_15);
      fVar16 = (float)uVar13;
      __extendsfdf2(fVar16);
      __divdf3((FLO_type_conflict)CONCAT44(in_f13,fVar16),in_f14_15);
      (*pCVar2->cmsg)(2,0,"Saturation %2.3f %%.");
    }
    free(local_44);
  }
  return;
}



----------------------------------------

// Function: ov_streams @ 089694cc

undefined4 ov_streams(int param_1)

{
  return *(undefined4 *)(param_1 + 0x1c);
}



----------------------------------------

// Function: ov_seekable @ 089694d4

undefined4 ov_seekable(int param_1)

{
  return *(undefined4 *)(param_1 + 4);
}



----------------------------------------

// Function: ov_bitrate_instant @ 089694dc

/* WARNING: Control flow encountered bad instruction data */

undefined4 ov_bitrate_instant(int param_1)

{
  undefined4 uVar1;
  
  uVar1 = 0xffffff7d;
  if (1 < *(int *)(param_1 + 0x40)) {
    uVar1 = 0xffffffff;
    if (*(int *)(param_1 + 0x58) != 0 || *(int *)(param_1 + 0x5c) != 0) {
      __divdi3(*(DItype *)(param_1 + 0x50),*(DItype *)(param_1 + 0x58));
      *(undefined4 *)(param_1 + 0x58) = 0;
      *(undefined4 *)(param_1 + 0x5c) = 0;
      *(undefined4 *)(param_1 + 0x50) = 0;
      *(undefined4 *)(param_1 + 0x54) = 0;
                    /* WARNING: Bad instruction - Truncating control flow here */
      halt_baddata();
    }
  }
  return uVar1;
}



----------------------------------------

// Function: ov_serialnumber @ 0896959c

undefined4 ov_serialnumber(int param_1,int param_2)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = *(int *)(param_1 + 0x1c);
  do {
    do {
      iVar3 = param_2;
      param_2 = iVar2 + -1;
    } while (iVar2 <= iVar3);
    do {
      if (*(int *)(param_1 + 4) != 0) {
        if (-1 < iVar3) {
          return *(undefined4 *)(iVar3 * 4 + *(int *)(param_1 + 0x28));
        }
LAB_089695e0:
        return *(undefined4 *)(param_1 + 0x44);
      }
      bVar1 = iVar3 < 0;
      iVar3 = -1;
      if (bVar1) goto LAB_089695e0;
    } while (-1 < iVar2);
  } while( true );
}



----------------------------------------

// Function: ov_raw_total @ 089695f8

longlong ov_raw_total(int param_1,int param_2)

{
  longlong lVar1;
  uint uVar2;
  int *piVar3;
  int iVar4;
  longlong lVar5;
  
  if ((*(int *)(param_1 + 0x40) < 2) || (*(int *)(param_1 + 4) == 0)) {
    lVar1 = -0x83;
  }
  else {
    lVar1 = -0x83;
    if (param_2 < *(int *)(param_1 + 0x1c)) {
      if (param_2 < 0) {
        iVar4 = 0;
        if (*(int *)(param_1 + 0x1c) < 1) {
          lVar1 = 0;
        }
        else {
          lVar1 = 0;
          do {
            lVar5 = ov_raw_total(param_1,iVar4);
            lVar1 = lVar5 + lVar1;
            iVar4 = iVar4 + 1;
          } while (iVar4 < *(int *)(param_1 + 0x1c));
        }
      }
      else {
        piVar3 = (int *)(*(int *)(param_1 + 0x20) + param_2 * 8);
        uVar2 = piVar3[2] - *piVar3;
        lVar1 = CONCAT44((piVar3[3] - piVar3[1]) - (uint)((uint)piVar3[2] < uVar2),uVar2);
      }
    }
  }
  return lVar1;
}



----------------------------------------

// Function: ov_pcm_total @ 08969700

longlong ov_pcm_total(int param_1,int param_2)

{
  longlong lVar1;
  int iVar2;
  longlong lVar3;
  
  if ((*(int *)(param_1 + 0x40) < 2) || (*(int *)(param_1 + 4) == 0)) {
    lVar1 = -0x83;
  }
  else {
    lVar1 = -0x83;
    if (param_2 < *(int *)(param_1 + 0x1c)) {
      if (param_2 < 0) {
        iVar2 = 0;
        if (*(int *)(param_1 + 0x1c) < 1) {
          lVar1 = 0;
        }
        else {
          lVar1 = 0;
          do {
            lVar3 = ov_pcm_total(param_1,iVar2);
            lVar1 = lVar3 + lVar1;
            iVar2 = iVar2 + 1;
          } while (iVar2 < *(int *)(param_1 + 0x1c));
        }
      }
      else {
        lVar1 = *(longlong *)(param_2 * 0x10 + *(int *)(param_1 + 0x2c) + 8);
      }
    }
  }
  return lVar1;
}



----------------------------------------

// Function: ov_time_total @ 089697e4

/* WARNING: Control flow encountered bad instruction data */

longlong ov_time_total(int param_1,int param_2)

{
  longlong lVar1;
  int iVar2;
  longlong lVar3;
  
  if ((*(int *)(param_1 + 0x40) < 2) || (*(int *)(param_1 + 4) == 0)) {
    lVar1 = -0x83;
  }
  else {
    lVar1 = -0x83;
    if (param_2 < *(int *)(param_1 + 0x1c)) {
      if (-1 < param_2) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      iVar2 = 0;
      if (*(int *)(param_1 + 0x1c) < 1) {
        lVar1 = 0;
      }
      else {
        lVar1 = 0;
        do {
          lVar3 = ov_time_total(param_1,iVar2);
          lVar1 = lVar3 + lVar1;
          iVar2 = iVar2 + 1;
        } while (iVar2 < *(int *)(param_1 + 0x1c));
      }
    }
  }
  return lVar1;
}



----------------------------------------

// Function: ov_bitrate @ 0896990c

/* WARNING: Control flow encountered bad instruction data */

DItype ov_bitrate(int param_1,int param_2)

{
  undefined4 in_v1;
  int iVar1;
  int iVar2;
  DItype DVar3;
  
  if (1 < *(int *)(param_1 + 0x40)) {
    iVar2 = *(int *)(param_1 + 0x1c);
    while (param_2 < iVar2) {
      if (*(int *)(param_1 + 4) != 0) {
        if (-1 < param_2) {
                    /* WARNING: Bad instruction - Truncating control flow here */
          halt_baddata();
        }
        if (iVar2 < 1) {
          DVar3 = ov_time_total(param_1,0xffffffff);
          DVar3 = __divdi3(0,DVar3);
          return DVar3;
        }
        iVar1 = 0;
        do {
          iVar1 = iVar1 + 1;
        } while (iVar1 != iVar2);
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      if (param_2 == 0) {
        iVar1 = *(int *)(param_1 + 0x30);
        iVar2 = *(int *)(iVar1 + 0x10);
        if (iVar2 < 1) {
          iVar2 = *(int *)(iVar1 + 0xc);
          if (iVar2 < 1) {
            iVar2 = -1;
          }
          else if (0 < *(int *)(iVar1 + 0x14)) {
            iVar2 = iVar2 + *(int *)(iVar1 + 0x14) >> 1;
          }
        }
        return CONCAT44(in_v1,iVar2);
      }
      param_2 = 0;
    }
  }
  return CONCAT44(in_v1,0xffffff7d);
}



----------------------------------------

// Function: ov_raw_tell @ 08969ae8

undefined8 ov_raw_tell(int param_1)

{
  undefined4 uVar1;
  undefined4 uVar2;
  
  uVar1 = 0xffffff7d;
  uVar2 = 0xffffffff;
  if (1 < *(int *)(param_1 + 0x40)) {
    uVar1 = *(undefined4 *)(param_1 + 8);
    uVar2 = *(undefined4 *)(param_1 + 0xc);
  }
  return CONCAT44(uVar2,uVar1);
}



----------------------------------------

// Function: ov_pcm_tell @ 08969b10

undefined8 ov_pcm_tell(int param_1)

{
  undefined4 uVar1;
  undefined4 uVar2;
  
  uVar1 = 0xffffff7d;
  uVar2 = 0xffffffff;
  if (1 < *(int *)(param_1 + 0x40)) {
    uVar1 = *(undefined4 *)(param_1 + 0x38);
    uVar2 = *(undefined4 *)(param_1 + 0x3c);
  }
  return CONCAT44(uVar2,uVar1);
}



----------------------------------------

// Function: ov_time_tell @ 08969b38

/* WARNING: Control flow encountered bad instruction data */

undefined8 ov_time_tell(int param_1)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  undefined8 uVar6;
  
  if (1 < *(int *)(param_1 + 0x40)) {
    if (*(int *)(param_1 + 4) != 0) {
      uVar6 = ov_pcm_total(param_1,0xffffffff);
      ov_time_total(param_1,0xffffffff);
      iVar1 = *(int *)(param_1 + 0x1c);
      iVar4 = iVar1 + -1;
      if (-1 < iVar4) {
        iVar3 = iVar1 - iVar4;
        iVar1 = iVar1 * 0x10;
        iVar5 = *(int *)(param_1 + 0x2c);
        while( true ) {
          iVar1 = iVar1 + -0x10;
          uVar2 = (uint)uVar6 - *(int *)(iVar5 + iVar1 + 8);
          iVar5 = ((int)((ulonglong)uVar6 >> 0x20) - *(int *)(iVar5 + iVar1 + 0xc)) -
                  (uint)((uint)uVar6 < uVar2);
          uVar6 = CONCAT44(iVar5,uVar2);
          ov_time_total(param_1,iVar4);
          if (((iVar5 <= *(int *)(param_1 + 0x3c)) &&
              ((*(int *)(param_1 + 0x3c) != iVar5 || (uVar2 <= *(uint *)(param_1 + 0x38))))) ||
             (iVar4 = iVar4 + -1, iVar4 == iVar3 + -2)) break;
          iVar5 = *(int *)(param_1 + 0x2c);
        }
      }
    }
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  return 0xffffffffffffff7d;
}



----------------------------------------

// Function: ov_info @ 08969d30

int ov_info(int param_1,int param_2)

{
  int iVar1;
  
  if (*(int *)(param_1 + 4) == 0) {
    iVar1 = *(int *)(param_1 + 0x30);
  }
  else if (param_2 < 0) {
    if (2 < *(int *)(param_1 + 0x40)) {
      return *(int *)(param_1 + 0x48) * 0x20 + *(int *)(param_1 + 0x30);
    }
    iVar1 = *(int *)(param_1 + 0x30);
  }
  else {
    iVar1 = 0;
    if (param_2 < *(int *)(param_1 + 0x1c)) {
      iVar1 = param_2 * 0x20 + *(int *)(param_1 + 0x30);
    }
  }
  return iVar1;
}



----------------------------------------

// Function: ov_comment @ 08969d90

int ov_comment(int param_1,int param_2)

{
  int iVar1;
  
  if (*(int *)(param_1 + 4) == 0) {
    iVar1 = *(int *)(param_1 + 0x34);
  }
  else if (param_2 < 0) {
    if (2 < *(int *)(param_1 + 0x40)) {
      return *(int *)(param_1 + 0x48) * 0x10 + *(int *)(param_1 + 0x34);
    }
    iVar1 = *(int *)(param_1 + 0x34);
  }
  else {
    iVar1 = 0;
    if (param_2 < *(int *)(param_1 + 0x1c)) {
      iVar1 = param_2 * 0x10 + *(int *)(param_1 + 0x34);
    }
  }
  return iVar1;
}



----------------------------------------

// Function: _get_next_page @ 08969df0

undefined8 _get_next_page(int *param_1,undefined4 param_2,uint param_3,int param_4)

{
  int iVar1;
  int *piVar2;
  undefined4 uVar3;
  uint uVar4;
  uint uVar5;
  int iVar6;
  
  if (param_4 < 1) {
    if ((param_4 != 0) || (param_3 == 0)) goto LAB_08969e40;
    iVar1 = param_1[2];
  }
  else {
    iVar1 = param_1[2];
  }
  param_4 = (uint)(param_3 + iVar1 < param_3) + param_4 + param_1[3];
  param_3 = param_3 + iVar1;
LAB_08969e40:
  do {
    if (0 < param_4) {
      iVar1 = param_1[3];
LAB_08969e4c:
      if (iVar1 < param_4) {
        iVar1 = param_1[6];
        goto LAB_08969e9c;
      }
      if ((iVar1 == param_4) && ((uint)param_1[2] < param_3)) {
        iVar1 = ogg_sync_pageseek(param_1[6],param_2);
        goto joined_r0x08969f3c;
      }
LAB_08969e64:
      uVar5 = 0xffffffff;
      iVar6 = -1;
      goto LAB_08969e68;
    }
    if (param_4 == 0) {
      if (param_3 != 0) {
        iVar1 = param_1[3];
        goto LAB_08969e4c;
      }
      iVar1 = param_1[6];
    }
    else {
      iVar1 = param_1[6];
    }
LAB_08969e9c:
    iVar1 = ogg_sync_pageseek(iVar1,param_2);
joined_r0x08969f3c:
    if (iVar1 < 0) {
      uVar4 = param_1[2];
      uVar5 = uVar4 - iVar1;
      param_1[2] = uVar5;
      param_1[3] = (param_1[3] - (iVar1 >> 0x1f)) - (uint)(uVar4 < uVar5);
      goto LAB_08969e40;
    }
    if (iVar1 != 0) {
      uVar5 = param_1[2];
      iVar6 = param_1[3];
      param_1[2] = uVar5 + iVar1;
      param_1[3] = (uint)(uVar5 + iVar1 < uVar5) + iVar6 + (iVar1 >> 0x1f);
      goto LAB_08969e68;
    }
    if (param_3 == 0 && param_4 == 0) goto LAB_08969e64;
    piVar2 = __errno();
    iVar1 = *param_1;
    *piVar2 = 0;
    if (iVar1 == 0) {
LAB_08969fa8:
      uVar5 = 0xfffffffe;
      iVar6 = -1;
      goto LAB_08969e68;
    }
    uVar3 = ogg_sync_bufferin(param_1[6],0x400);
    iVar1 = (*(code *)param_1[0x46])(uVar3,1,0x400,*param_1);
    if (0 < iVar1) {
      ogg_sync_wrote(param_1[6],iVar1);
    }
    if (iVar1 == 0) {
      piVar2 = __errno();
      if (*piVar2 == 0) goto LAB_08969fa8;
      goto LAB_08969f1c;
    }
    if (iVar1 < 0) {
LAB_08969f1c:
      uVar5 = 0xffffff80;
      iVar6 = -1;
LAB_08969e68:
      return CONCAT44(iVar6,uVar5);
    }
  } while( true );
}



----------------------------------------

// Function: _decode_clear @ 08969fd8

void _decode_clear(int param_1)

{
  vorbis_dsp_clear(param_1 + 0x68);
  vorbis_block_clear(param_1 + 0xb8);
  *(undefined4 *)(param_1 + 0x40) = 2;
  return;
}



----------------------------------------

// Function: _fetch_headers @ 0896a010

int _fetch_headers(int param_1,undefined4 param_2,undefined4 param_3,undefined4 *param_4)

{
  undefined4 uVar1;
  int iVar2;
  int extraout_v1;
  undefined1 *in_t0;
  undefined4 uVar3;
  int iVar4;
  undefined4 *puVar5;
  longlong lVar6;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
  puVar5 = &local_58;
  local_4c = DAT_089e7774;
  local_30 = DAT_089e7760;
  local_58 = C_5_3501;
  local_54 = DAT_089e776c;
  local_50 = DAT_089e7770;
  local_48 = C_6_3502;
  local_44 = DAT_089e774c;
  local_40 = DAT_089e7750;
  local_3c = DAT_089e7754;
  local_38 = DAT_089e7758;
  local_34 = DAT_089e775c;
  local_2c = DAT_089e7764;
  if (in_t0 == (undefined1 *)0x0) {
    lVar6 = _get_next_page(param_1,&local_58,0x400,0);
    if (lVar6 == -0x80) {
      return -0x80;
    }
    if (lVar6 < 0) {
      return -0x84;
    }
    uVar3 = *(undefined4 *)(param_1 + 0x60);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x60);
    puVar5 = (undefined4 *)in_t0;
  }
  uVar1 = ogg_page_serialno(puVar5);
  ogg_stream_reset_serialno(uVar3,uVar1);
  if (param_4 != (undefined4 *)0x0) {
    *param_4 = *(undefined4 *)(*(int *)(param_1 + 0x60) + 0x18);
  }
  *(undefined4 *)(param_1 + 0x40) = 3;
  vorbis_info_init(param_2);
  vorbis_comment_init(param_3);
  iVar4 = 0;
  uVar3 = *(undefined4 *)(param_1 + 0x60);
  while( true ) {
    ogg_stream_pagein(uVar3,puVar5);
    uVar3 = *(undefined4 *)(param_1 + 0x60);
    while (iVar2 = ogg_stream_packetout(uVar3,&local_48), iVar2 != 0) {
      iVar4 = iVar4 + 1;
      if (iVar2 == -1) goto LAB_0896a1a0;
      iVar2 = vorbis_synthesis_headerin(param_2,param_3,&local_48);
      if (iVar2 != 0) goto LAB_0896a1a4;
      if (2 < iVar4) goto LAB_0896a15c;
      uVar3 = *(undefined4 *)(param_1 + 0x60);
    }
    _get_next_page(param_1,puVar5,0x400,0);
    if (extraout_v1 < 0) break;
    if (2 < iVar4) {
LAB_0896a15c:
      ogg_packet_release(&local_48);
      ogg_page_release(&local_58);
      return 0;
    }
    uVar3 = *(undefined4 *)(param_1 + 0x60);
  }
LAB_0896a1a0:
  iVar2 = -0x85;
LAB_0896a1a4:
  ogg_packet_release(&local_48);
  ogg_page_release(&local_58);
  vorbis_info_clear(param_2);
  vorbis_comment_clear(param_3);
  *(undefined4 *)(param_1 + 0x40) = 2;
  return iVar2;
}



----------------------------------------

// Function: _make_decode_ready @ 0896a274

void _make_decode_ready(int param_1)

{
  if (*(int *)(param_1 + 0x40) != 3) {
    return;
  }
  if (*(int *)(param_1 + 4) == 0) {
    vorbis_synthesis_init(param_1 + 0x68,*(undefined4 *)(param_1 + 0x30));
  }
  else {
    vorbis_synthesis_init(param_1 + 0x68,*(int *)(param_1 + 0x48) * 0x20 + *(int *)(param_1 + 0x30))
    ;
  }
  vorbis_block_init(param_1 + 0x68,param_1 + 0xb8);
  *(undefined4 *)(param_1 + 0x40) = 4;
  *(undefined4 *)(param_1 + 0x58) = 0;
  *(undefined4 *)(param_1 + 0x5c) = 0;
  *(undefined4 *)(param_1 + 0x50) = 0;
  *(undefined4 *)(param_1 + 0x54) = 0;
  return;
}



----------------------------------------

// Function: _fetch_and_process_packet @ 0896a324

undefined4 _fetch_and_process_packet(int param_1,int param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  undefined4 uVar5;
  int *piVar6;
  uint uVar7;
  int iVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  uint uVar12;
  int iVar13;
  undefined4 local_60;
  int local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  int local_4c;
  undefined4 local_48;
  int local_44;
  uint local_40;
  int local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30;
  
  local_60 = C_11_3671;
  local_5c = DAT_089e773c;
  local_58 = DAT_089e7740;
  local_54 = DAT_089e7744;
  local_50 = C_12_3672;
  local_4c = DAT_089e771c;
  local_48 = DAT_089e7720;
  local_44 = DAT_089e7724;
  local_40 = DAT_089e7728;
  local_3c = DAT_089e772c;
  local_38 = DAT_089e7730;
  local_30 = param_1 + 0x68;
  local_34 = DAT_089e7734;
  do {
    iVar3 = *(int *)(param_1 + 0x40);
    if (iVar3 == 4) {
      uVar5 = *(undefined4 *)(param_1 + 0x60);
      while( true ) {
        iVar2 = ogg_stream_packetout(uVar5,&local_50);
        iVar3 = local_3c;
        uVar4 = local_40;
        if (iVar2 < 0) {
          uVar5 = 0xfffffffd;
          goto LAB_0896a544;
        }
        if (iVar2 == 0) break;
        iVar2 = vorbis_synthesis(param_1 + 0xb8,&local_50,1);
        if (iVar2 == 0) {
          iVar2 = vorbis_synthesis_pcmout(local_30,0);
          uVar5 = 0xffffff7f;
          if (iVar2 != 0) goto LAB_0896a544;
          vorbis_synthesis_blockin(local_30,param_1 + 0xb8);
          uVar12 = *(uint *)(param_1 + 0x58);
          iVar13 = *(int *)(param_1 + 0x5c);
          iVar2 = vorbis_synthesis_pcmout(local_30,0);
          uVar10 = *(uint *)(param_1 + 0x50);
          uVar7 = uVar12 + iVar2;
          uVar9 = uVar10 + local_4c * 8;
          *(uint *)(param_1 + 0x58) = uVar7;
          *(uint *)(param_1 + 0x5c) = (uint)(uVar7 < uVar12) + iVar13 + (iVar2 >> 0x1f);
          *(uint *)(param_1 + 0x50) = uVar9;
          *(uint *)(param_1 + 0x54) =
               (uint)(uVar9 < uVar10) + *(int *)(param_1 + 0x54) + (local_4c * 8 >> 0x1f);
          if ((uVar4 == 0xffffffff) && (iVar3 == -1)) {
            uVar5 = 1;
            goto LAB_0896a544;
          }
          uVar5 = 1;
          if (local_44 != 0) goto LAB_0896a544;
          if (*(int *)(param_1 + 4) != 0) {
            iVar2 = *(int *)(param_1 + 0x48);
            if (0 < iVar2) {
              piVar6 = (int *)(iVar2 * 0x10 + *(int *)(param_1 + 0x2c));
              uVar7 = uVar4 - *piVar6;
              iVar3 = (iVar3 - piVar6[1]) - (uint)(uVar4 < uVar7);
              if ((iVar3 < 1) && ((iVar3 != 0 || (uVar7 == 0)))) {
                uVar7 = 0;
                iVar3 = 0;
              }
              iVar13 = vorbis_synthesis_pcmout(local_30,0);
              iVar8 = *(int *)(param_1 + 0x2c);
              iVar3 = (iVar3 - (iVar13 >> 0x1f)) - (uint)(uVar7 < uVar7 - iVar13);
              iVar11 = 0;
              uVar4 = uVar7 - iVar13;
              do {
                iVar11 = iVar11 + 1;
                uVar7 = uVar4 + *(int *)(iVar8 + 8);
                iVar3 = (uint)(uVar7 < uVar4) + iVar3 + *(int *)(iVar8 + 0xc);
                iVar8 = iVar8 + 0x10;
                uVar4 = uVar7;
              } while (iVar11 != iVar2);
LAB_0896a784:
              uVar5 = 1;
              *(uint *)(param_1 + 0x38) = uVar7;
              *(int *)(param_1 + 0x3c) = iVar3;
              goto LAB_0896a544;
            }
          }
          if ((iVar3 < 1) && ((iVar3 != 0 || (uVar4 == 0)))) {
            uVar4 = 0;
            iVar3 = 0;
          }
          iVar2 = vorbis_synthesis_pcmout(local_30,0);
          uVar7 = uVar4 - iVar2;
          iVar3 = (iVar3 - (iVar2 >> 0x1f)) - (uint)(uVar4 < uVar7);
          goto LAB_0896a784;
        }
        uVar5 = *(undefined4 *)(param_1 + 0x60);
      }
      iVar3 = *(int *)(param_1 + 0x40);
    }
    if (iVar3 < 2) {
      if (iVar3 != 4) goto LAB_0896a434;
      uVar5 = *(undefined4 *)(param_1 + 0x60);
    }
    else {
      if ((param_2 == 0) ||
         (iVar3 = _get_next_page(param_1,&local_60,0xffffffff,0xffffffff), iVar3 < 0)) {
        uVar5 = 0;
LAB_0896a544:
        ogg_packet_release(&local_50);
        ogg_page_release(&local_60);
        return uVar5;
      }
      uVar7 = *(uint *)(param_1 + 0x50);
      uVar4 = uVar7 + local_5c * 8;
      iVar3 = *(int *)(param_1 + 0x40);
      *(uint *)(param_1 + 0x50) = uVar4;
      *(uint *)(param_1 + 0x54) =
           (uint)(uVar4 < uVar7) + *(int *)(param_1 + 0x54) + (local_5c * 8 >> 0x1f);
      if (iVar3 == 4) {
        iVar2 = *(int *)(param_1 + 0x44);
        iVar3 = ogg_page_serialno(&local_60);
        if (iVar2 == iVar3) {
          iVar3 = *(int *)(param_1 + 0x40);
        }
        else {
          if (param_3 == 0) {
            uVar5 = 0;
            goto LAB_0896a544;
          }
          _decode_clear(param_1);
          if (*(int *)(param_1 + 4) == 0) {
            vorbis_info_clear(*(undefined4 *)(param_1 + 0x30));
            vorbis_comment_clear(*(undefined4 *)(param_1 + 0x34));
            iVar3 = *(int *)(param_1 + 0x40);
            if (iVar3 == 4) {
              uVar5 = *(undefined4 *)(param_1 + 0x60);
              goto LAB_0896a480;
            }
            goto LAB_0896a434;
          }
          iVar3 = *(int *)(param_1 + 0x40);
        }
        if (iVar3 == 4) {
          uVar5 = *(undefined4 *)(param_1 + 0x60);
          goto LAB_0896a480;
        }
      }
LAB_0896a434:
      if (iVar3 < 3) {
        if (*(int *)(param_1 + 4) == 0) {
          iVar3 = _fetch_headers(param_1,*(undefined4 *)(param_1 + 0x30),
                                 *(undefined4 *)(param_1 + 0x34),param_1 + 0x44);
          uVar5 = 0;
          if (iVar3 != 0) goto LAB_0896a544;
          *(int *)(param_1 + 0x48) = *(int *)(param_1 + 0x48) + 1;
        }
        else {
          iVar3 = ogg_page_serialno(&local_60);
          iVar2 = *(int *)(param_1 + 0x1c);
          *(int *)(param_1 + 0x44) = iVar3;
          if (iVar2 < 1) {
            iVar13 = 0;
            if (iVar2 == 0) {
LAB_0896a5f0:
              uVar5 = 0xffffff77;
              goto LAB_0896a544;
            }
          }
          else {
            piVar6 = *(int **)(param_1 + 0x28);
            iVar13 = 0;
            if (iVar3 != *piVar6) {
              iVar13 = 1;
              while( true ) {
                if (iVar13 == iVar2) goto LAB_0896a5f0;
                piVar1 = piVar6 + 1;
                piVar6 = piVar6 + 1;
                if (iVar3 == *piVar1) break;
                iVar13 = iVar13 + 1;
              }
            }
          }
          *(int *)(param_1 + 0x48) = iVar13;
          ogg_stream_reset_serialno(*(undefined4 *)(param_1 + 0x60),*(undefined4 *)(param_1 + 0x44))
          ;
          *(undefined4 *)(param_1 + 0x40) = 3;
        }
      }
      _make_decode_ready(param_1);
      uVar5 = *(undefined4 *)(param_1 + 0x60);
    }
LAB_0896a480:
    ogg_stream_pagein(uVar5,&local_60);
  } while( true );
}



----------------------------------------

// Function: ov_read @ 0896a7d8

int ov_read(int param_1,short *param_2,int param_3,undefined4 *param_4)

{
  short sVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int *piVar5;
  int iVar6;
  short *psVar7;
  uint uVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  undefined4 *local_28 [2];
  
  iVar4 = *(int *)(param_1 + 0x40);
  if (iVar4 < 2) {
    return -0x83;
  }
  while ((iVar4 != 4 || (iVar4 = vorbis_synthesis_pcmout(param_1 + 0x68,local_28), iVar4 == 0))) {
    iVar4 = _fetch_and_process_packet(param_1,1,1);
    if (iVar4 == -2) {
      return 0;
    }
    if (iVar4 < 1) {
      return iVar4;
    }
    iVar4 = *(int *)(param_1 + 0x40);
  }
  if (0 < iVar4) {
    iVar2 = ov_info(param_1,0xffffffff);
    iVar2 = *(int *)(iVar2 + 4);
    iVar11 = iVar2 * 2;
    if (iVar11 == 0) {
      trap(7);
    }
    iVar4 = iVar4 + param_3 / iVar11;
    if (0 < iVar2) {
      iVar10 = 0;
      do {
        piVar5 = (int *)*local_28[0];
        if (0 < iVar4) {
          iVar9 = 0;
          psVar7 = param_2;
          do {
            while( true ) {
              iVar6 = *piVar5 >> 9;
              if (iVar6 < 0x8000) break;
              iVar9 = iVar9 + 1;
              *psVar7 = 0x7fff;
              piVar5 = piVar5 + 1;
              psVar7 = psVar7 + iVar2;
              if (iVar9 == iVar4) goto LAB_0896a924;
            }
            sVar1 = 0;
            if (iVar6 < -0x8000) {
              sVar1 = -0x8000 - (short)iVar6;
            }
            iVar9 = iVar9 + 1;
            *psVar7 = (short)iVar6 + sVar1;
            piVar5 = piVar5 + 1;
            psVar7 = psVar7 + iVar2;
          } while (iVar9 != iVar4);
        }
LAB_0896a924:
        iVar10 = iVar10 + 1;
        local_28[0] = local_28[0] + 1;
        param_2 = param_2 + 1;
      } while (iVar10 != iVar2);
    }
    vorbis_synthesis_read(param_1 + 0x68,iVar4);
    uVar8 = *(uint *)(param_1 + 0x38);
    uVar3 = uVar8 + iVar4;
    *(uint *)(param_1 + 0x38) = uVar3;
    *(uint *)(param_1 + 0x3c) = (uint)(uVar3 < uVar8) + *(int *)(param_1 + 0x3c) + (iVar4 >> 0x1f);
    if (param_4 != (undefined4 *)0x0) {
      *param_4 = *(undefined4 *)(param_1 + 0x48);
    }
    iVar4 = iVar11 * iVar4;
  }
  return iVar4;
}



----------------------------------------

// Function: _seek_helper @ 0896a9f0

void _seek_helper(int *param_1,undefined4 param_2,int param_3,int param_4)

{
  if (*param_1 != 0) {
    (*(code *)param_1[0x47])(*param_1);
    param_1[2] = param_3;
    param_1[3] = param_4;
    ogg_sync_reset(param_1[6]);
    return;
  }
  return;
}



----------------------------------------

// Function: _get_prev_page @ 0896aa68

longlong _get_prev_page(int param_1,undefined4 param_2)

{
  longlong lVar1;
  uint uVar2;
  int iVar3;
  int extraout_v1;
  int extraout_v1_00;
  uint uVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  longlong lVar8;
  
  uVar6 = *(uint *)(param_1 + 8);
  iVar7 = *(int *)(param_1 + 0xc);
  uVar4 = uVar6;
  iVar3 = iVar7;
  do {
    uVar2 = uVar4 - 0x400;
    iVar3 = (uint)(uVar2 < uVar4) + iVar3 + -1;
    if (iVar3 < 1) {
      if (iVar3 == 0) {
        if (uVar2 == 0) {
          uVar2 = 0;
          iVar3 = 0;
        }
      }
      else {
        uVar2 = 0;
        iVar3 = 0;
      }
    }
    _seek_helper(param_1);
    lVar8 = -1;
    do {
      lVar1 = lVar8;
      iVar5 = *(int *)(param_1 + 0xc);
      uVar4 = uVar6 - *(uint *)(param_1 + 8);
      if ((iVar7 <= iVar5) && ((iVar5 != iVar7 || (uVar6 <= *(uint *)(param_1 + 8))))) break;
      lVar8 = _get_next_page(param_1,param_2,uVar4,(iVar7 - iVar5) - (uint)(uVar6 < uVar4));
      if (lVar8 == -0x80) {
        return -0x80;
      }
    } while (-1 < lVar8);
    if ((int)lVar1 != -1) {
      _seek_helper(param_1);
      _get_next_page(param_1,param_2,0x400,0);
      iVar3 = extraout_v1;
      goto joined_r0x0896ab40;
    }
    uVar4 = uVar2;
    if ((int)((ulonglong)lVar1 >> 0x20) != -1) {
      _seek_helper(param_1);
      _get_next_page(param_1,param_2,0x400,0);
      iVar3 = extraout_v1_00;
joined_r0x0896ab40:
      if (-1 < iVar3) {
        return lVar1;
      }
      return -0x81;
    }
  } while( true );
}



----------------------------------------

// Function: ov_raw_seek @ 0896ac54

undefined4 ov_raw_seek(int param_1,undefined4 param_2,uint param_3,int param_4)

{
  int *piVar1;
  int iVar2;
  uint uVar3;
  int extraout_v1;
  int *piVar4;
  undefined4 uVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  undefined8 uVar11;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined1 auStack_50 [16];
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  uint local_30;
  int local_2c;
  undefined4 local_28;
  undefined4 local_24;
  
  local_54 = DAT_089e7804;
  local_24 = DAT_089e77f4;
  local_60 = C_30_4070;
  local_5c = DAT_089e77fc;
  local_58 = DAT_089e7800;
  local_40 = C_31_4071;
  local_3c = DAT_089e77dc;
  local_38 = DAT_089e77e0;
  local_34 = DAT_089e77e4;
  local_30 = DAT_089e77e8;
  local_2c = DAT_089e77ec;
  local_28 = DAT_089e77f0;
  if (*(int *)(param_1 + 0x40) < 2) {
    return 0xffffff7d;
  }
  if (*(int *)(param_1 + 4) == 0) {
    return 0xffffff76;
  }
  if (param_4 < 0) {
    return 0xffffff7d;
  }
  if (*(int *)(param_1 + 0x14) < param_4) {
    return 0xffffff7d;
  }
  if (*(int *)(param_1 + 0x14) == param_4) {
    if (*(uint *)(param_1 + 0x10) < param_3) {
      return 0xffffff7d;
    }
    uVar5 = *(undefined4 *)(param_1 + 0x44);
  }
  else {
    uVar5 = *(undefined4 *)(param_1 + 0x44);
  }
  *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
  *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
  ogg_stream_reset_serialno(*(undefined4 *)(param_1 + 0x60),uVar5);
  vorbis_synthesis_restart(param_1 + 0x68);
  _seek_helper(param_1);
  iVar10 = 0;
  uVar5 = ogg_stream_create(*(undefined4 *)(param_1 + 0x44));
  iVar9 = 0;
  iVar8 = 0;
LAB_0896add0:
  iVar2 = *(int *)(param_1 + 0x40);
  do {
    if ((2 < iVar2) && (iVar2 = ogg_stream_packetout(uVar5,&local_40), 0 < iVar2)) {
      iVar2 = *(int *)(param_1 + 0x48) * 0x20 + *(int *)(param_1 + 0x30);
      if (*(int *)(iVar2 + 0x1c) != 0) break;
      ogg_stream_packetout(*(undefined4 *)(param_1 + 0x60),0);
    }
    if (iVar8 != 0) {
      *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
      *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
      goto LAB_0896af80;
    }
    _get_next_page(param_1,&local_60,0xffffffff,0xffffffff);
    if (extraout_v1 < 0) {
      uVar11 = ov_pcm_total(param_1,0xffffffff);
      *(undefined8 *)(param_1 + 0x38) = uVar11;
      goto LAB_0896af80;
    }
    if (*(int *)(param_1 + 0x40) < 3) {
LAB_0896ae10:
      iVar9 = ogg_page_serialno(&local_60);
      iVar2 = *(int *)(param_1 + 0x1c);
      *(int *)(param_1 + 0x44) = iVar9;
      if (iVar2 < 1) {
        iVar6 = 0;
        if (iVar2 == 0) {
LAB_0896ae54:
          ogg_packet_release(&local_40);
          ogg_page_release(&local_60);
          *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
          *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
          ogg_stream_destroy(uVar5);
          _decode_clear(param_1);
          return 0xffffff77;
        }
      }
      else {
        piVar4 = *(int **)(param_1 + 0x28);
        iVar6 = 0;
        if (*piVar4 != iVar9) {
          iVar6 = 1;
          while( true ) {
            if (iVar6 == iVar2) goto LAB_0896ae54;
            piVar1 = piVar4 + 1;
            piVar4 = piVar4 + 1;
            if (iVar9 == *piVar1) break;
            iVar6 = iVar6 + 1;
          }
        }
      }
      *(int *)(param_1 + 0x48) = iVar6;
      ogg_stream_reset_serialno(*(undefined4 *)(param_1 + 0x60),*(undefined4 *)(param_1 + 0x44));
      ogg_stream_reset_serialno(uVar5,*(undefined4 *)(param_1 + 0x44));
      *(undefined4 *)(param_1 + 0x40) = 3;
    }
    else {
      iVar2 = *(int *)(param_1 + 0x44);
      iVar9 = ogg_page_serialno(&local_60);
      if (iVar2 == iVar9) {
        iVar9 = *(int *)(param_1 + 0x40);
      }
      else {
        _decode_clear(param_1);
        ogg_stream_destroy(uVar5);
        iVar9 = *(int *)(param_1 + 0x40);
      }
      if (iVar9 < 3) goto LAB_0896ae10;
    }
    ogg_page_dup(auStack_50,&local_60);
    iVar9 = ogg_page_eos(&local_60);
    ogg_stream_pagein(*(undefined4 *)(param_1 + 0x60),&local_60);
    ogg_stream_pagein(uVar5,auStack_50);
    iVar2 = *(int *)(param_1 + 0x40);
  } while( true );
  iVar2 = vorbis_packet_blocksize(iVar2,&local_40);
  if (iVar2 < 0) {
    ogg_stream_packetout(*(undefined4 *)(param_1 + 0x60),0);
    iVar2 = 0;
  }
  else if (iVar9 == 0) {
    if (iVar8 != 0) {
      iVar10 = iVar10 + (iVar8 + iVar2 >> 2);
    }
  }
  else {
    ogg_stream_packetout(*(undefined4 *)(param_1 + 0x60),0);
  }
  if (local_30 != 0xffffffff) {
    iVar8 = *(int *)(param_1 + 0x48);
    goto LAB_0896aefc;
  }
  iVar8 = iVar2;
  if (local_2c != -1) {
    iVar8 = *(int *)(param_1 + 0x48);
LAB_0896aefc:
    iVar2 = *(int *)(param_1 + 0x2c);
    piVar4 = (int *)(iVar8 * 0x10 + iVar2);
    uVar3 = local_30 - *piVar4;
    iVar9 = (local_2c - piVar4[1]) - (uint)(local_30 < uVar3);
    if ((iVar9 < 1) && ((iVar9 != 0 || (uVar3 == 0)))) {
      uVar3 = 0;
      iVar9 = 0;
    }
    iVar6 = 0;
    uVar7 = uVar3;
    if (0 < iVar8) {
      do {
        iVar6 = iVar6 + 1;
        uVar3 = uVar7 + *(int *)(iVar2 + 8);
        iVar9 = (uint)(uVar3 < uVar7) + iVar9 + *(int *)(iVar2 + 0xc);
        iVar2 = iVar2 + 0x10;
        uVar7 = uVar3;
      } while (iVar8 != iVar6);
    }
    *(uint *)(param_1 + 0x38) = uVar3 - iVar10;
    *(uint *)(param_1 + 0x3c) = (iVar9 - (iVar10 >> 0x1f)) - (uint)(uVar3 < uVar3 - iVar10);
LAB_0896af80:
    ogg_packet_release(&local_40);
    ogg_page_release(&local_60);
    ogg_stream_destroy(uVar5);
    *(undefined4 *)(param_1 + 0x58) = 0;
    *(undefined4 *)(param_1 + 0x5c) = 0;
    *(undefined4 *)(param_1 + 0x50) = 0;
    *(undefined4 *)(param_1 + 0x54) = 0;
    return 0;
  }
  goto LAB_0896add0;
}



----------------------------------------

// Function: ov_pcm_seek_page @ 0896b0f4

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x0896b7bc) */
/* WARNING: Removing unreachable block (ram,0x0896b6a4) */

undefined4 ov_pcm_seek_page(int param_1,undefined4 param_2,uint param_3,int param_4)

{
  uint *puVar1;
  bool bVar2;
  bool bVar3;
  longlong lVar4;
  longlong lVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  undefined4 uVar9;
  int iVar10;
  int extraout_v1;
  int extraout_v1_00;
  uint *puVar11;
  int *piVar12;
  uint uVar13;
  int iVar14;
  uint *puVar15;
  uint uVar16;
  int iVar17;
  int iVar18;
  int iVar19;
  uint uVar20;
  int iVar21;
  int iVar22;
  int iVar23;
  uint uVar24;
  longlong lVar25;
  undefined8 uVar26;
  longlong lVar27;
  longlong lVar28;
  undefined4 local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_84;
  uint local_80;
  int local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined8 local_70;
  undefined8 local_68;
  longlong local_60;
  undefined8 local_58;
  uint local_50;
  int local_4c;
  uint local_48;
  uint local_44;
  uint local_40;
  uint local_3c;
  undefined8 local_38;
  
  lVar25 = ov_pcm_total(param_1,0xffffffff);
  lVar27 = CONCAT44(local_68._4_4_,(undefined4)local_68);
  iVar10 = (int)((ulonglong)lVar25 >> 0x20);
  uVar20 = (uint)lVar25;
  local_a0 = C_33_4151;
  local_9c = DAT_089e77cc;
  local_98 = DAT_089e77d0;
  local_94 = DAT_089e77d4;
  local_90 = C_34_4152;
  local_8c = DAT_089e77ac;
  local_88 = DAT_089e77b0;
  local_84 = DAT_089e77b4;
  local_80 = DAT_089e77b8;
  local_7c = DAT_089e77bc;
  local_78 = DAT_089e77c0;
  local_74 = DAT_089e77c4;
  if (*(int *)(param_1 + 0x40) < 2) {
    return 0xffffff7d;
  }
  if (*(int *)(param_1 + 4) == 0) {
    return 0xffffff76;
  }
  if (param_4 < 0) {
    return 0xffffff7d;
  }
  if (iVar10 < param_4) {
    return 0xffffff7d;
  }
  if (iVar10 == param_4) {
    if (uVar20 < param_3) {
      return 0xffffff7d;
    }
    iVar14 = *(int *)(param_1 + 0x1c);
  }
  else {
    iVar14 = *(int *)(param_1 + 0x1c);
  }
  iVar19 = iVar14 + -1;
  iVar22 = *(int *)(param_1 + 0x2c);
  if (iVar19 < 0) {
    iVar17 = iVar19 * 0x10;
  }
  else {
    iVar17 = iVar19 * 0x10;
    uVar6 = uVar20 - *(int *)(iVar22 + iVar17 + 8);
    iVar10 = (iVar10 - *(int *)(iVar22 + iVar17 + 0xc)) - (uint)(uVar20 < uVar6);
    lVar25 = CONCAT44(iVar10,uVar6);
    if ((param_4 < iVar10) ||
       ((param_4 == iVar10 && (lVar25 = CONCAT44(iVar10,uVar6), param_3 < uVar6)))) {
      iVar18 = iVar22 + iVar14 * 0x10;
      iVar21 = 0;
      iVar14 = iVar14 * 0x10 + -0x20;
      iVar23 = iVar19;
      do {
        do {
          iVar17 = iVar14;
          iVar23 = iVar23 + -1;
          if (iVar21 == iVar19) {
            iVar17 = iVar23 * 0x10;
            iVar19 = iVar23;
            lVar25 = CONCAT44(iVar10,uVar6);
            goto LAB_0896b298;
          }
          iVar21 = iVar21 + 1;
          uVar20 = uVar6 - *(int *)(iVar18 + -0x18);
          iVar10 = (iVar10 - *(int *)(iVar18 + -0x14)) - (uint)(uVar6 < uVar20);
          lVar25 = CONCAT44(iVar10,uVar20);
          iVar18 = iVar18 + -0x10;
          iVar14 = iVar17 + -0x10;
          uVar6 = uVar20;
        } while (param_4 < iVar10);
        if (param_4 != iVar10) {
          iVar14 = *(int *)(param_1 + 0x20);
          lVar25 = CONCAT44(iVar10,uVar20);
          goto LAB_0896b29c;
        }
      } while (param_3 < uVar20);
      iVar14 = *(int *)(param_1 + 0x20);
      goto LAB_0896b29c;
    }
  }
LAB_0896b298:
  iVar14 = *(int *)(param_1 + 0x20);
  iVar23 = iVar19;
LAB_0896b29c:
  puVar15 = (uint *)(iVar22 + iVar17);
  puVar11 = (uint *)(iVar14 + iVar23 * 8);
  uVar7 = *puVar15;
  local_60 = *(longlong *)puVar15;
  uVar8 = param_3 - (int)lVar25;
  local_50 = uVar7 + uVar8;
  uVar6 = puVar11[1];
  puVar1 = puVar11 + 2;
  lVar5 = *(longlong *)puVar1;
  uVar20 = *puVar11;
  local_70 = *(longlong *)puVar11;
  local_4c = (uint)(local_50 < uVar7) +
             puVar15[1] + ((param_4 - (int)((ulonglong)lVar25 >> 0x20)) - (uint)(param_3 < uVar8));
  bVar2 = (int)uVar6 < (int)puVar11[3];
  if ((bVar2) ||
     ((local_38 = CONCAT44(local_38._4_4_,(undefined4)local_38), lVar4 = *(longlong *)puVar1,
      uVar6 == puVar11[3] &&
      (lVar27 = CONCAT44(local_68._4_4_,(undefined4)local_68),
      local_38 = CONCAT44(local_38._4_4_,(undefined4)local_38), lVar4 = *(longlong *)puVar1,
      uVar20 < *puVar1)))) {
    uVar8 = uVar7 + *(int *)(iVar22 + iVar17 + 8);
    lVar27 = CONCAT44((uint)(uVar8 < uVar7) + puVar15[1] + *(int *)(iVar22 + iVar17 + 0xc),uVar8);
    local_38 = CONCAT44(local_38._4_4_,(undefined4)local_38);
LAB_0896b4cc:
    local_58._4_4_ = (uint)((ulonglong)lVar5 >> 0x20);
    local_58._0_4_ = (uint)lVar5;
    uVar7 = (uint)((uint)local_58 < (uint)local_58 - uVar20);
    if ((0 < (int)((local_58._4_4_ - uVar6) - uVar7)) ||
       ((local_58._4_4_ - uVar6 == uVar7 && (0x3ff < (uint)local_58 - uVar20)))) {
                    /* WARNING: Bad instruction - Truncating control flow here */
      halt_baddata();
    }
    local_40 = uVar20;
    local_3c = uVar6;
    local_68 = lVar27;
    local_58 = lVar5;
    _seek_helper(param_1);
    uVar7 = local_40;
    uVar8 = local_3c;
    uVar16 = uVar20;
    uVar24 = uVar6;
    lVar4 = local_58;
LAB_0896b5c4:
    iVar10 = *(int *)(param_1 + 8);
    do {
      local_58._4_4_ = (uint)((ulonglong)lVar4 >> 0x20);
      local_58._0_4_ = (uint)lVar4;
      uVar20 = (uint)local_58 - iVar10;
      bVar3 = (uint)local_58 < uVar20;
      iVar10 = local_58._4_4_ - *(int *)(param_1 + 0xc);
      local_40 = uVar7;
      local_3c = uVar8;
      local_58 = lVar4;
      lVar27 = _get_next_page(param_1,&local_a0,uVar20,iVar10 - (uint)bVar3);
      lVar5 = CONCAT44(local_3c,local_40);
      uVar9 = (undefined4)lVar27;
      if (lVar27 == -0x80) {
        uVar9 = 0xffffff80;
        goto LAB_0896b6d0;
      }
      if (lVar27 < 0) {
        uVar7 = local_40 + 1;
        uVar8 = (uVar7 < local_40) + local_3c;
        if (((int)uVar24 <= (int)uVar8) &&
           ((uVar20 = local_40, uVar6 = local_3c, lVar27 = local_68, uVar8 != uVar24 ||
            (lVar5 = CONCAT44(local_3c,local_40), uVar16 <= uVar7)))) goto LAB_0896b68c;
        if (uVar16 == 0 && uVar24 == 0) goto LAB_0896b6d0;
        uVar13 = uVar16 - 0x400;
        uVar16 = (uint)(uVar13 < uVar16) + (uVar24 - 1);
        uVar20 = uVar13;
        uVar6 = uVar16;
        if ((((int)local_3c < (int)uVar16) || (uVar20 = uVar7, uVar6 = uVar8, local_3c != uVar16))
           || (uVar20 = uVar13, uVar6 = uVar16, local_40 < uVar13)) {
          uVar7 = uVar20;
          uVar8 = uVar6;
        }
        local_48 = uVar7;
        local_44 = uVar8;
        _seek_helper(param_1,uVar16,uVar7,uVar8);
        uVar7 = local_40;
        uVar8 = local_3c;
        uVar16 = local_48;
        uVar24 = local_44;
        lVar4 = local_58;
      }
      else {
        local_38 = lVar27;
        lVar28 = ogg_page_granulepos(&local_a0);
        uVar7 = local_40;
        uVar8 = local_3c;
        lVar4 = local_58;
        if (lVar28 != -1) {
          lVar27 = local_68;
          if (lVar28 < CONCAT44(local_4c,local_50)) {
            uVar20 = *(uint *)(param_1 + 8);
            uVar8 = local_50 - (int)lVar28;
            uVar7 = (uint)(local_50 < uVar8);
            uVar16 = local_4c - (int)((ulonglong)lVar28 >> 0x20);
            uVar6 = *(uint *)(param_1 + 0xc);
            local_60 = lVar28;
            local_70 = local_38;
            lVar5 = local_58;
            if ((0 < (int)(uVar16 - uVar7)) || ((uVar16 == uVar7 && (0xac44 < uVar8))))
            goto LAB_0896b68c;
            bVar2 = (int)uVar6 < (int)local_58._4_4_;
            uVar7 = uVar20;
            uVar8 = uVar6;
            uVar16 = uVar20;
            uVar24 = uVar6;
          }
          else {
            uVar7 = local_40 + 1;
            uVar8 = (uVar7 < local_40) + local_3c;
            uVar20 = local_40;
            uVar6 = local_3c;
            if (((((int)uVar24 <= (int)uVar8) &&
                 ((lVar5 = CONCAT44(local_3c,local_40), uVar8 != uVar24 ||
                  (lVar5 = CONCAT44(local_3c,local_40), uVar16 <= uVar7)))) ||
                (lVar27 = lVar28, lVar5 = local_38, *(int *)(param_1 + 8) != (uint)local_58)) ||
               (*(int *)(param_1 + 0xc) != local_58._4_4_)) {
LAB_0896b68c:
              local_58._4_4_ = (uint)((ulonglong)lVar5 >> 0x20);
              bVar2 = (int)uVar6 < (int)local_58._4_4_;
              lVar4 = lVar5;
              if (lVar5 <= CONCAT44(uVar6,uVar20)) break;
              goto LAB_0896b4cc;
            }
            uVar13 = uVar16 - 0x400;
            uVar16 = (uint)(uVar13 < uVar16) + (uVar24 - 1);
            uVar20 = uVar13;
            uVar6 = uVar16;
            if ((((int)local_3c < (int)uVar16) ||
                (uVar20 = uVar7, uVar6 = uVar8, local_3c != uVar16)) ||
               (uVar20 = uVar13, uVar6 = uVar16, local_40 < uVar13)) {
              uVar7 = uVar20;
              uVar8 = uVar6;
            }
            local_48 = uVar7;
            local_44 = uVar8;
            local_58 = local_38;
            _seek_helper(param_1,uVar16,uVar7,uVar8);
            bVar2 = (int)local_3c < (int)local_58._4_4_;
            uVar7 = local_40;
            uVar8 = local_3c;
            uVar16 = local_48;
            uVar24 = local_44;
            lVar4 = local_58;
          }
        }
      }
      local_58._4_4_ = (uint)((ulonglong)lVar4 >> 0x20);
      local_58._0_4_ = (uint)lVar4;
      if (bVar2) goto LAB_0896b5c4;
      lVar27 = local_68;
      if ((uVar8 != local_58._4_4_) || ((uint)local_58 <= uVar7)) break;
      iVar10 = *(int *)(param_1 + 8);
    } while( true );
  }
  local_68 = lVar27;
  local_58 = lVar4;
  _seek_helper(param_1);
  *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
  *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
  _get_next_page(param_1,&local_a0,0xffffffff,0xffffffff);
  if (extraout_v1 < 0) {
    ogg_page_release(&local_a0);
    return 0xfffffffe;
  }
  if (*(int *)(param_1 + 0x48) == iVar23) {
    vorbis_synthesis_restart(param_1 + 0x68);
    uVar9 = *(undefined4 *)(param_1 + 0x60);
  }
  else {
    _decode_clear(param_1);
    *(int *)(param_1 + 0x48) = iVar23;
    uVar9 = ogg_page_serialno(&local_a0);
    *(undefined4 *)(param_1 + 0x44) = uVar9;
    *(undefined4 *)(param_1 + 0x40) = 3;
    uVar9 = *(undefined4 *)(param_1 + 0x60);
  }
  ogg_stream_reset_serialno(uVar9,*(undefined4 *)(param_1 + 0x44));
  ogg_stream_pagein(*(undefined4 *)(param_1 + 0x60),&local_a0);
  uVar9 = *(undefined4 *)(param_1 + 0x60);
  while( true ) {
    iVar10 = ogg_stream_packetpeek(uVar9,&local_90);
    if (iVar10 == 0) break;
    if (iVar10 >> 0x1f < 0) {
      uVar9 = 0xffffff78;
      goto LAB_0896b6d0;
    }
    if (local_80 != 0xffffffff) {
      iVar10 = *(int *)(param_1 + 0x48);
LAB_0896b3e0:
      piVar12 = (int *)(iVar10 * 0x10 + *(int *)(param_1 + 0x2c));
      uVar20 = local_80 - *piVar12;
      iVar10 = (local_7c - piVar12[1]) - (uint)(local_80 < uVar20);
      *(uint *)(param_1 + 0x38) = uVar20;
      *(int *)(param_1 + 0x3c) = iVar10;
      if (iVar10 < 0) {
        *(undefined4 *)(param_1 + 0x38) = 0;
        *(undefined4 *)(param_1 + 0x3c) = 0;
      }
      lVar25 = lVar25 + *(longlong *)(param_1 + 0x38);
      iVar10 = (int)((ulonglong)lVar25 >> 0x20);
      *(longlong *)(param_1 + 0x38) = lVar25;
      if ((param_4 < iVar10) || ((param_4 == iVar10 && (param_3 < (uint)lVar25)))) {
        uVar9 = 0xffffff7f;
      }
      else {
        uVar26 = ov_pcm_total(param_1,0xffffffff);
        iVar10 = (int)((ulonglong)uVar26 >> 0x20);
        uVar9 = 0xffffff7f;
        if (param_4 <= iVar10) {
          if ((iVar10 != param_4) || (param_3 <= (uint)uVar26)) {
            *(undefined4 *)(param_1 + 0x58) = 0;
            *(undefined4 *)(param_1 + 0x5c) = 0;
            *(undefined4 *)(param_1 + 0x50) = 0;
            *(undefined4 *)(param_1 + 0x54) = 0;
            ogg_page_release(&local_a0);
            ogg_packet_release(&local_90);
            return 0;
          }
          uVar9 = 0xffffff7f;
        }
      }
      goto LAB_0896b6d0;
    }
    if (local_7c != -1) {
      iVar10 = *(int *)(param_1 + 0x48);
      goto LAB_0896b3e0;
    }
    ogg_stream_packetout(*(undefined4 *)(param_1 + 0x60));
    uVar9 = *(undefined4 *)(param_1 + 0x60);
  }
  _seek_helper(param_1,0,(undefined4)local_70,local_70._4_4_);
  do {
    lVar25 = _get_prev_page(param_1,&local_a0);
    uVar9 = (undefined4)lVar25;
    if (lVar25 < 0) {
LAB_0896b6d0:
      ogg_page_release(&local_a0);
      ogg_packet_release(&local_90);
      *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
      *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
      _decode_clear(param_1);
      return uVar9;
    }
    ogg_page_granulepos(&local_a0);
    if (-1 < extraout_v1_00) {
LAB_0896baa4:
      uVar9 = ov_raw_seek(param_1);
      return uVar9;
    }
    iVar10 = ogg_page_continued(&local_a0);
    if (iVar10 == 0) goto LAB_0896baa4;
    *(longlong *)(param_1 + 8) = lVar25;
  } while( true );
}



----------------------------------------

// Function: ov_time_seek_page @ 0896baf0

/* WARNING: Control flow encountered bad instruction data */

undefined4 ov_time_seek_page(int param_1,undefined4 param_2,uint param_3,int param_4)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  undefined8 uVar7;
  undefined8 uVar8;
  
  uVar1 = ov_pcm_total(param_1,0xffffffff);
  uVar7 = ov_time_total(param_1,0xffffffff);
  iVar2 = (int)((ulonglong)uVar7 >> 0x20);
  if (1 < *(int *)(param_1 + 0x40)) {
    if (*(int *)(param_1 + 4) == 0) {
      return 0xffffff76;
    }
    if ((-1 < param_4) && (param_4 <= iVar2)) {
      if (iVar2 == param_4) {
        if ((uint)uVar7 < param_3) {
          return 0xffffff7d;
        }
        iVar2 = *(int *)(param_1 + 0x1c);
      }
      else {
        iVar2 = *(int *)(param_1 + 0x1c);
      }
      iVar5 = iVar2 + -1;
      iVar4 = iVar2 - iVar5;
      if (-1 < iVar5) {
        iVar2 = iVar2 * 0x10;
        iVar6 = *(int *)(param_1 + 0x2c);
        while( true ) {
          iVar2 = iVar2 + -0x10;
          uVar3 = uVar1 - *(int *)(iVar6 + iVar2 + 8);
          uVar8 = ov_time_total(param_1,iVar5,uVar1 < uVar3);
          uVar1 = (uint)uVar7 - (int)uVar8;
          iVar6 = ((int)((ulonglong)uVar7 >> 0x20) - (int)((ulonglong)uVar8 >> 0x20)) -
                  (uint)((uint)uVar7 < uVar1);
          uVar7 = CONCAT44(iVar6,uVar1);
          if (((iVar6 <= param_4) && ((param_4 != iVar6 || (uVar1 <= param_3)))) ||
             (iVar5 = iVar5 + -1, iVar5 == iVar4 + -2)) break;
          iVar6 = *(int *)(param_1 + 0x2c);
          uVar1 = uVar3;
        }
      }
                    /* WARNING: Bad instruction - Truncating control flow here */
      halt_baddata();
    }
  }
  return 0xffffff7d;
}



----------------------------------------

// Function: ov_pcm_seek @ 0896bd38

int ov_pcm_seek(int param_1,undefined4 param_2,uint param_3,int param_4)

{
  int *piVar1;
  bool bVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  int extraout_v1;
  undefined4 uVar8;
  int *piVar9;
  int iVar10;
  uint uVar11;
  undefined8 uVar12;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  uint local_40;
  int local_3c;
  undefined4 local_38;
  undefined4 local_34;
  uint local_30;
  int local_2c;
  
  local_50 = C_36_4241;
  local_4c = DAT_089e778c;
  local_48 = DAT_089e7790;
  local_44 = DAT_089e7794;
  local_40 = DAT_089e7798;
  local_3c = DAT_089e779c;
  local_38 = DAT_089e77a0;
  local_34 = DAT_089e77a4;
  local_60 = C_37_4242;
  local_5c = DAT_089e777c;
  local_58 = DAT_089e7780;
  local_54 = DAT_089e7784;
  local_30 = param_3;
  local_2c = param_4;
  iVar3 = ov_pcm_seek_page();
  if (iVar3 < 0) {
    return iVar3;
  }
  _make_decode_ready(param_1);
  iVar3 = 0;
  do {
    uVar8 = *(undefined4 *)(param_1 + 0x60);
LAB_0896be04:
    while (iVar4 = ogg_stream_packetpeek(uVar8,&local_50), iVar4 < 1) {
      if ((iVar4 != 0) && (iVar4 != -3)) {
        uVar8 = *(undefined4 *)(param_1 + 0x38);
        goto LAB_0896beb0;
      }
      _get_next_page(param_1,&local_60,0xffffffff,0xffffffff);
      if (extraout_v1 < 0) {
        uVar8 = *(undefined4 *)(param_1 + 0x38);
        goto LAB_0896beb0;
      }
      iVar6 = *(int *)(param_1 + 0x44);
      iVar4 = ogg_page_serialno(&local_60);
      if (iVar6 == iVar4) {
        iVar4 = *(int *)(param_1 + 0x40);
      }
      else {
        _decode_clear(param_1);
        iVar4 = *(int *)(param_1 + 0x40);
      }
      if (iVar4 < 3) {
        iVar3 = ogg_page_serialno(&local_60);
        iVar4 = *(int *)(param_1 + 0x1c);
        *(int *)(param_1 + 0x44) = iVar3;
        if (iVar4 < 1) {
          iVar6 = 0;
          if (iVar4 == 0) {
LAB_0896c088:
            ogg_page_release(&local_60);
            ogg_packet_release(&local_50);
            return -0x89;
          }
        }
        else {
          piVar9 = *(int **)(param_1 + 0x28);
          iVar6 = 0;
          if (iVar3 != *piVar9) {
            iVar6 = 1;
            while( true ) {
              if (iVar6 == iVar4) goto LAB_0896c088;
              piVar1 = piVar9 + 1;
              piVar9 = piVar9 + 1;
              if (iVar3 == *piVar1) break;
              iVar6 = iVar6 + 1;
            }
          }
        }
        *(int *)(param_1 + 0x48) = iVar6;
        iVar3 = 0;
        ogg_stream_reset_serialno(*(undefined4 *)(param_1 + 0x60),*(undefined4 *)(param_1 + 0x44));
        *(undefined4 *)(param_1 + 0x40) = 3;
        _make_decode_ready(param_1);
        uVar8 = *(undefined4 *)(param_1 + 0x60);
      }
      else {
        uVar8 = *(undefined4 *)(param_1 + 0x60);
      }
      ogg_stream_pagein(uVar8,&local_60);
      uVar8 = *(undefined4 *)(param_1 + 0x60);
    }
    iVar4 = vorbis_packet_blocksize
                      (*(int *)(param_1 + 0x48) * 0x20 + *(int *)(param_1 + 0x30),&local_50);
    if (iVar4 < 0) {
      ogg_stream_packetout(*(undefined4 *)(param_1 + 0x60),0);
      uVar8 = *(undefined4 *)(param_1 + 0x60);
      goto LAB_0896be04;
    }
    uVar11 = *(uint *)(param_1 + 0x38);
    if (iVar3 == 0) {
      iVar3 = *(int *)(param_1 + 0x3c);
    }
    else {
      uVar5 = uVar11 + (iVar3 + iVar4 >> 2);
      iVar3 = (uint)(uVar5 < uVar11) + *(int *)(param_1 + 0x3c) + (iVar3 + iVar4 >> 0x1f);
      *(uint *)(param_1 + 0x38) = uVar5;
      *(int *)(param_1 + 0x3c) = iVar3;
      uVar11 = uVar5;
    }
    iVar6 = vorbis_info_blocksize(*(undefined4 *)(param_1 + 0x30),1);
    uVar5 = uVar11 + (iVar4 + iVar6 >> 2);
    iVar3 = (uint)(uVar5 < uVar11) + iVar3 + (iVar4 + iVar6 >> 0x1f);
    if (iVar3 < local_2c) {
      uVar8 = *(undefined4 *)(param_1 + 0x60);
    }
    else {
      if (iVar3 != local_2c) {
        uVar8 = *(undefined4 *)(param_1 + 0x38);
        goto LAB_0896beb0;
      }
      if (local_30 <= uVar5) {
        uVar8 = *(undefined4 *)(param_1 + 0x38);
LAB_0896beb0:
        uVar12 = CONCAT44(*(undefined4 *)(param_1 + 0x3c),uVar8);
        *(undefined4 *)(param_1 + 0x50) = 0;
        *(undefined4 *)(param_1 + 0x54) = 0;
        *(undefined4 *)(param_1 + 0x58) = 0;
        *(undefined4 *)(param_1 + 0x5c) = 0;
LAB_0896bed4:
        do {
          bVar2 = (int)((ulonglong)uVar12 >> 0x20) < local_2c;
          do {
            iVar3 = (int)((ulonglong)uVar12 >> 0x20);
            if ((!bVar2) && ((iVar3 != local_2c || (local_30 <= (uint)uVar12)))) {
              ogg_page_release(&local_60);
              ogg_packet_release(&local_50);
              return 0;
            }
            uVar5 = local_30 - (uint)uVar12;
            iVar3 = (local_2c - iVar3) - (uint)(local_30 < uVar5);
            uVar11 = vorbis_synthesis_pcmout(param_1 + 0x68,0);
            iVar4 = (int)uVar11 >> 0x1f;
            if ((iVar3 < iVar4) || ((iVar3 == iVar4 && (uVar5 < uVar11)))) {
              iVar4 = (int)uVar5 >> 0x1f;
              uVar11 = uVar5;
            }
            vorbis_synthesis_read(param_1 + 0x68,uVar11);
            uVar7 = *(uint *)(param_1 + 0x38) + uVar11;
            iVar6 = (uint)(uVar7 < *(uint *)(param_1 + 0x38)) + *(int *)(param_1 + 0x3c) + iVar4;
            uVar12 = CONCAT44(iVar6,uVar7);
            *(uint *)(param_1 + 0x38) = uVar7;
            *(int *)(param_1 + 0x3c) = iVar6;
            if (iVar4 < iVar3) break;
            if (iVar4 != iVar3) goto LAB_0896bed4;
            bVar2 = iVar6 < local_2c;
          } while (uVar5 <= uVar11);
          iVar3 = _fetch_and_process_packet(param_1,1,1);
          if (iVar3 < 1) {
            uVar12 = ov_pcm_total(param_1,0xffffffff);
            *(undefined8 *)(param_1 + 0x38) = uVar12;
          }
          else {
            uVar12 = *(undefined8 *)(param_1 + 0x38);
          }
        } while( true );
      }
      uVar8 = *(undefined4 *)(param_1 + 0x60);
    }
    ogg_stream_packetout(uVar8,0);
    vorbis_synthesis(param_1 + 0xb8,&local_50,0);
    vorbis_synthesis_blockin(param_1 + 0x68,param_1 + 0xb8);
    iVar3 = iVar4;
    if (-1 < local_3c) {
      iVar6 = *(int *)(param_1 + 0x48);
      piVar9 = (int *)(iVar6 * 0x10 + *(int *)(param_1 + 0x2c));
      uVar11 = local_40 - *piVar9;
      iVar4 = (local_3c - piVar9[1]) - (uint)(local_40 < uVar11);
      *(uint *)(param_1 + 0x38) = uVar11;
      *(int *)(param_1 + 0x3c) = iVar4;
      if (iVar4 < 0) {
        *(undefined4 *)(param_1 + 0x38) = 0;
        *(undefined4 *)(param_1 + 0x3c) = 0;
      }
      piVar9 = (int *)(*(int *)(param_1 + 0x2c) + 8);
      if (0 < iVar6) {
        iVar4 = *(int *)(param_1 + 0x3c);
        iVar10 = 0;
        uVar11 = *(uint *)(param_1 + 0x38);
        do {
          iVar10 = iVar10 + 1;
          uVar5 = uVar11 + *piVar9;
          iVar4 = (uint)(uVar5 < uVar11) + iVar4 + piVar9[1];
          *(uint *)(param_1 + 0x38) = uVar5;
          *(int *)(param_1 + 0x3c) = iVar4;
          piVar9 = piVar9 + 4;
          uVar11 = uVar5;
        } while (iVar10 < iVar6);
      }
    }
  } while( true );
}



----------------------------------------

// Function: ov_time_seek @ 0896c244

/* WARNING: Control flow encountered bad instruction data */

undefined4 ov_time_seek(int param_1,undefined4 param_2,uint param_3,int param_4)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  undefined8 uVar7;
  undefined8 uVar8;
  
  uVar1 = ov_pcm_total(param_1,0xffffffff);
  uVar7 = ov_time_total(param_1,0xffffffff);
  iVar2 = (int)((ulonglong)uVar7 >> 0x20);
  if (1 < *(int *)(param_1 + 0x40)) {
    if (*(int *)(param_1 + 4) == 0) {
      return 0xffffff76;
    }
    if ((-1 < param_4) && (param_4 <= iVar2)) {
      if (iVar2 == param_4) {
        if ((uint)uVar7 < param_3) {
          return 0xffffff7d;
        }
        iVar2 = *(int *)(param_1 + 0x1c);
      }
      else {
        iVar2 = *(int *)(param_1 + 0x1c);
      }
      iVar5 = iVar2 + -1;
      iVar4 = iVar2 - iVar5;
      if (-1 < iVar5) {
        iVar2 = iVar2 * 0x10;
        iVar6 = *(int *)(param_1 + 0x2c);
        while( true ) {
          iVar2 = iVar2 + -0x10;
          uVar3 = uVar1 - *(int *)(iVar6 + iVar2 + 8);
          uVar8 = ov_time_total(param_1,iVar5,uVar1 < uVar3);
          uVar1 = (uint)uVar7 - (int)uVar8;
          iVar6 = ((int)((ulonglong)uVar7 >> 0x20) - (int)((ulonglong)uVar8 >> 0x20)) -
                  (uint)((uint)uVar7 < uVar1);
          uVar7 = CONCAT44(iVar6,uVar1);
          if (((iVar6 <= param_4) && ((param_4 != iVar6 || (uVar1 <= param_3)))) ||
             (iVar5 = iVar5 + -1, iVar5 == iVar4 + -2)) break;
          iVar6 = *(int *)(param_1 + 0x2c);
          uVar1 = uVar3;
        }
      }
                    /* WARNING: Bad instruction - Truncating control flow here */
      halt_baddata();
    }
  }
  return 0xffffff7d;
}



----------------------------------------

// Function: _bisect_forward_serialno @ 0896c48c

undefined4
_bisect_forward_serialno(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  longlong lVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  void *pvVar5;
  uint uVar6;
  int iVar7;
  uint in_t0;
  int in_t1;
  uint in_t2;
  int in_t3;
  longlong lVar8;
  int local_res0;
  int local_res4;
  undefined4 local_50;
  uint local_4c;
  undefined4 local_48;
  int local_44;
  longlong local_40;
  undefined4 local_38;
  undefined4 local_34;
  uint local_30;
  int local_2c;
  
  local_40 = CONCAT44(in_t3,in_t2);
  local_50 = C_3_3437;
  local_4c = DAT_089e781c;
  local_48 = DAT_089e7820;
  local_44 = DAT_089e7824;
  local_38 = param_3;
  local_34 = param_4;
  local_30 = in_t2;
  local_2c = in_t3;
  if ((in_t1 < in_t3) || ((in_t1 == in_t3 && (in_t0 < in_t2)))) {
    uVar6 = in_t2 - in_t0;
    do {
      while( true ) {
        iVar2 = (in_t3 - in_t1) - (uint)(in_t2 < uVar6);
        if ((0 < iVar2) || ((uVar4 = in_t0, iVar7 = in_t1, iVar2 == 0 && (0x3ff < uVar6)))) {
          uVar4 = in_t2 + in_t0;
          iVar7 = (uint)(uVar4 < in_t2) + in_t3 + in_t1;
          uVar6 = uVar4;
          if (iVar7 < 0) {
            uVar6 = uVar4 + 1;
            iVar7 = (uint)(uVar6 < uVar4) + iVar7;
          }
          uVar4 = iVar7 << 0x1f | uVar6 >> 1;
          iVar7 = iVar7 >> 1;
        }
        _seek_helper(param_1,iVar2,uVar4,iVar7);
        lVar8 = _get_next_page(param_1,&local_50,0xffffffff,0xffffffff);
        if (lVar8 == -0x80) {
          return 0xffffff80;
        }
        lVar1 = local_40;
        if (-1 < lVar8) {
          iVar2 = ogg_page_serialno(&local_50);
          lVar1 = lVar8;
          if (local_res0 == iVar2) {
            in_t0 = (uint)lVar8 + local_4c + local_44;
            in_t1 = (uint)(in_t0 < (uint)lVar8) +
                    (int)((ulonglong)lVar8 >> 0x20) +
                    (uint)(local_4c + local_44 < local_4c) +
                    ((int)local_4c >> 0x1f) + (local_44 >> 0x1f);
            uVar4 = in_t2;
            iVar7 = in_t3;
            lVar1 = local_40;
          }
        }
        local_40 = lVar1;
        ogg_page_release(&local_50);
        in_t2 = uVar4;
        in_t3 = iVar7;
        if (iVar7 <= in_t1) break;
        uVar6 = uVar4 - in_t0;
      }
    } while ((in_t1 == iVar7) && (uVar6 = uVar4 - in_t0, in_t0 < uVar4));
  }
  _seek_helper(param_1);
  lVar8 = _get_next_page(param_1,&local_50,0xffffffff,0xffffffff);
  if (lVar8 == -0x80) {
    return 0xffffff80;
  }
  if (((in_t1 < local_2c) || ((in_t1 == local_2c && (in_t0 < local_30)))) && (-1 < lVar8)) {
    ogg_page_serialno(&local_50);
    iVar2 = _bisect_forward_serialno(param_1);
    ogg_page_release(&local_50);
    if (iVar2 == -0x80) {
      return 0xffffff80;
    }
    iVar7 = *(int *)(param_1 + 0x20);
    iVar2 = local_res4 << 3;
  }
  else {
    ogg_page_release(&local_50);
    *(int *)(param_1 + 0x1c) = local_res4 + 1;
    pvVar5 = malloc((local_res4 + 1) * 8 + 8);
    *(void **)(param_1 + 0x20) = pvVar5;
    pvVar5 = malloc(*(int *)(param_1 + 0x1c) << 2);
    iVar7 = *(int *)(param_1 + 0x20);
    *(void **)(param_1 + 0x28) = pvVar5;
    iVar2 = local_res4 * 8;
    *(uint *)(iVar7 + iVar2 + 8) = in_t0;
    *(int *)(iVar7 + iVar2 + 0xc) = in_t1;
  }
  iVar3 = *(int *)(param_1 + 0x28);
  ((undefined4 *)(iVar7 + iVar2))[1] = local_34;
  *(undefined4 *)(iVar7 + iVar2) = local_38;
  *(int *)(local_res4 * 4 + iVar3) = local_res0;
  return 0;
}



----------------------------------------

// Function: _fseek64_wrap @ 0896c85c

int _fseek64_wrap(FILE *param_1,undefined4 param_2,long param_3)

{
  int iVar1;
  int in_t0;
  
  if (param_1 != (FILE *)0x0) {
    iVar1 = fseek(param_1,param_3,in_t0);
    return iVar1;
  }
  return -1;
}



----------------------------------------

// Function: ov_clear @ 0896c878

undefined4 ov_clear(int *param_1)

{
  void *pvVar1;
  int iVar2;
  int iVar3;
  
  if (param_1 != (int *)0x0) {
    vorbis_block_clear(param_1 + 0x2e);
    vorbis_dsp_clear(param_1 + 0x1a);
    ogg_stream_destroy(param_1[0x18]);
    pvVar1 = (void *)param_1[0xc];
    if (pvVar1 == (void *)0x0) {
      pvVar1 = (void *)param_1[9];
    }
    else if (param_1[7] == 0) {
      pvVar1 = (void *)param_1[9];
    }
    else {
      if (0 < param_1[7]) {
        iVar3 = 0;
        do {
          vorbis_info_clear((void *)(iVar3 * 0x20 + (int)pvVar1));
          iVar2 = iVar3 * 0x10;
          iVar3 = iVar3 + 1;
          vorbis_comment_clear(iVar2 + param_1[0xd]);
          pvVar1 = (void *)param_1[0xc];
        } while (iVar3 < param_1[7]);
      }
      free(pvVar1);
      free((void *)param_1[0xd]);
      pvVar1 = (void *)param_1[9];
    }
    if (pvVar1 == (void *)0x0) {
      pvVar1 = (void *)param_1[0xb];
    }
    else {
      free(pvVar1);
      pvVar1 = (void *)param_1[0xb];
    }
    if (pvVar1 == (void *)0x0) {
      pvVar1 = (void *)param_1[10];
    }
    else {
      free(pvVar1);
      pvVar1 = (void *)param_1[10];
    }
    if (pvVar1 == (void *)0x0) {
      pvVar1 = (void *)param_1[8];
    }
    else {
      free(pvVar1);
      pvVar1 = (void *)param_1[8];
    }
    if (pvVar1 != (void *)0x0) {
      free(pvVar1);
    }
    ogg_sync_destroy(param_1[6]);
    if (*param_1 != 0) {
      (*(code *)param_1[0x48])();
    }
    memset(param_1,0,0x128);
  }
  return 0;
}



----------------------------------------

// Function: _ov_open2 @ 0896c9ac

int _ov_open2(undefined4 *param_1)

{
  int iVar1;
  void *pvVar2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  uint *puVar6;
  int extraout_v1;
  undefined4 uVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  longlong lVar12;
  undefined8 uVar13;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_84;
  undefined4 local_80;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  int local_68;
  int local_64;
  int local_60;
  undefined4 local_58;
  undefined4 local_54;
  int local_50;
  int local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
  if ((int)param_1[0x10] < 2) {
    param_1[0x10] = 2;
  }
  if (param_1[1] != 0) {
    local_58 = param_1[2];
    local_54 = param_1[3];
    local_a8 = C_10_3625;
    local_a0 = DAT_089e7810;
    local_a4 = DAT_089e780c;
    local_9c = DAT_089e7814;
    iVar11 = param_1[0x11];
    (*(code *)param_1[0x47])(*param_1,C_10_3625,0,0);
    iVar1 = (*(code *)param_1[0x49])(*param_1);
    param_1[2] = iVar1;
    param_1[3] = iVar1 >> 0x1f;
    param_1[4] = iVar1;
    param_1[5] = iVar1 >> 0x1f;
    lVar12 = _get_prev_page(param_1,&local_a8);
    iVar1 = (int)lVar12;
    if (-1 < lVar12) {
      iVar1 = ogg_page_serialno(&local_a8);
      ogg_page_release(&local_a8);
      if (iVar11 == iVar1) {
        iVar1 = _bisect_forward_serialno(param_1);
        if (iVar1 != 0) {
          iVar1 = -0x80;
          goto LAB_0896ce8c;
        }
      }
      else {
        iVar11 = _bisect_forward_serialno(param_1);
        iVar1 = -0x80;
        if (iVar11 < 0) goto LAB_0896ce8c;
      }
      local_90 = DAT_089e7850;
      local_98 = C_7_3537;
      local_94 = DAT_089e784c;
      local_8c = DAT_089e7854;
      pvVar2 = realloc((void *)param_1[0xc],param_1[7] << 5);
      param_1[0xc] = pvVar2;
      pvVar2 = realloc((void *)param_1[0xd],param_1[7] << 4);
      param_1[0xd] = pvVar2;
      pvVar2 = malloc(param_1[7] << 3);
      param_1[9] = pvVar2;
      pvVar2 = malloc(param_1[7] << 4);
      param_1[0xb] = pvVar2;
      if (0 < (int)param_1[7]) {
        local_48 = C_9_3579;
        local_2c = DAT_089e7844;
        local_44 = DAT_089e782c;
        local_40 = DAT_089e7830;
        local_3c = DAT_089e7834;
        local_38 = DAT_089e7838;
        local_34 = DAT_089e783c;
        local_30 = DAT_089e7840;
        local_4c = 0;
        local_64 = 0;
        local_68 = 0;
        do {
          if (local_4c == 0) {
            puVar3 = (undefined4 *)param_1[9];
            *puVar3 = local_58;
            puVar3[1] = local_54;
            _seek_helper(param_1);
            uVar9 = param_1[9];
            local_60 = 0;
LAB_0896cc04:
            if (*(int *)(uVar9 + local_68) != -1) goto LAB_0896cc20;
            iVar1 = ((int *)(uVar9 + local_68))[1];
LAB_0896cf70:
            if (iVar1 != -1) goto LAB_0896cc20;
          }
          else {
            local_60 = local_4c;
            _seek_helper(param_1);
            iVar1 = _fetch_headers(param_1,local_4c * 0x20 + param_1[0xc],local_64 + param_1[0xd],0)
            ;
            if (iVar1 < 0) {
              uVar9 = param_1[9];
              *(undefined4 *)(uVar9 + local_68) = 0xffffffff;
              ((undefined4 *)(uVar9 + local_68))[1] = 0xffffffff;
              goto LAB_0896cc04;
            }
            uVar9 = param_1[9];
            uVar7 = param_1[3];
            *(undefined4 *)(uVar9 + local_68) = param_1[2];
            ((undefined4 *)(uVar9 + local_68))[1] = uVar7;
            if (*(int *)(uVar9 + local_68) == -1) {
              iVar1 = ((int *)(uVar9 + local_68))[1];
              goto LAB_0896cf70;
            }
LAB_0896cc20:
            local_50 = local_60 * 4;
            uVar10 = 0;
            iVar11 = local_60 * 0x20;
            uVar9 = 0;
            ogg_stream_reset_serialno(param_1[0x18],*(undefined4 *)(param_1[10] + local_50));
            iVar1 = -1;
            do {
              local_88 = local_48;
              local_84 = local_44;
              local_80 = local_40;
              local_7c = local_3c;
              local_78 = local_38;
              local_74 = local_34;
              local_70 = local_30;
              local_6c = local_2c;
              _get_next_page(param_1,&local_98,0xffffffff,0xffffffff);
              if (extraout_v1 < 0) {
                iVar1 = param_1[0xb];
                goto LAB_0896cd90;
              }
              iVar4 = ogg_page_serialno(&local_98);
              if (iVar4 != *(int *)(local_50 + param_1[10])) {
                iVar1 = param_1[0xb];
                goto LAB_0896cd90;
              }
              lVar12 = ogg_page_granulepos(&local_98);
              ogg_stream_pagein(param_1[0x18],&local_98);
              iVar4 = ogg_stream_packetout(param_1[0x18],&local_88);
              while (iVar4 != 0) {
                uVar8 = uVar10;
                if (iVar4 < 1) {
                  uVar7 = param_1[0x18];
                  iVar5 = iVar1;
                }
                else {
                  iVar5 = vorbis_packet_blocksize(iVar11 + param_1[0xc],&local_88);
                  if (iVar1 != -1) {
                    uVar8 = uVar10 + (iVar1 + iVar5 >> 2);
                    uVar9 = (uint)(uVar8 < uVar10) + uVar9 + (iVar1 + iVar5 >> 0x1f);
                  }
                  uVar7 = param_1[0x18];
                }
                iVar4 = ogg_stream_packetout(uVar7,&local_88);
                uVar10 = uVar8;
                iVar1 = iVar5;
              }
              ogg_packet_release(&local_88);
            } while (lVar12 == -1);
            uVar10 = (uint)lVar12 - uVar10;
            uVar9 = ((int)((ulonglong)lVar12 >> 0x20) - uVar9) - (uint)((uint)lVar12 < uVar10);
            iVar1 = param_1[0xb];
LAB_0896cd90:
            puVar6 = (uint *)(local_64 + iVar1);
            if ((int)uVar9 < 1) {
              if ((uVar9 != 0) || (uVar10 == 0)) {
                uVar10 = 0;
                uVar9 = 0;
                goto LAB_0896cda4;
              }
              *puVar6 = uVar10;
            }
            else {
LAB_0896cda4:
              *puVar6 = uVar10;
            }
            puVar6[1] = uVar9;
          }
          _seek_helper(param_1,uVar9,*(undefined4 *)(param_1[8] + local_68 + 8),
                       *(undefined4 *)(param_1[8] + local_68 + 0xc));
          lVar12 = _get_prev_page(param_1,&local_98);
          while (-1 < lVar12) {
            uVar13 = ogg_page_granulepos(&local_98);
            if ((int)uVar13 != -1) {
              iVar1 = param_1[0xb];
LAB_0896cdfc:
              iVar1 = local_64 + iVar1;
              uVar13 = ogg_page_granulepos(&local_98);
              iVar11 = ((int *)(param_1[0xb] + local_64))[1];
              uVar9 = (uint)uVar13 - *(int *)(param_1[0xb] + local_64);
              *(uint *)(iVar1 + 8) = uVar9;
              *(uint *)(iVar1 + 0xc) =
                   ((int)((ulonglong)uVar13 >> 0x20) - iVar11) - (uint)((uint)uVar13 < uVar9);
              goto LAB_0896ce3c;
            }
            if ((int)((ulonglong)uVar13 >> 0x20) != -1) {
              iVar1 = param_1[0xb];
              goto LAB_0896cdfc;
            }
            *(longlong *)(param_1 + 2) = lVar12;
            lVar12 = _get_prev_page(param_1,&local_98);
          }
          vorbis_info_clear(local_60 * 0x20 + param_1[0xc]);
          vorbis_comment_clear(local_60 * 0x10 + param_1[0xd]);
LAB_0896ce3c:
          local_4c = local_4c + 1;
          local_64 = local_64 + 0x10;
          local_68 = local_68 + 8;
        } while (local_4c < (int)param_1[7]);
      }
      ogg_page_release(&local_98);
      iVar1 = ov_raw_seek(param_1);
    }
    if (iVar1 != 0) {
LAB_0896ce8c:
      *param_1 = 0;
      ov_clear(param_1);
      return iVar1;
    }
  }
  return 0;
}



----------------------------------------

// Function: ov_test_open @ 0896d058

undefined4 ov_test_open(int param_1)

{
  undefined4 uVar1;
  
  if (*(int *)(param_1 + 0x40) != 1) {
    return 0xffffff7d;
  }
  uVar1 = _ov_open2();
  return uVar1;
}



----------------------------------------

// Function: _ov_open1 @ 0896d078

int _ov_open1(int param_1,int *param_2,void *param_3,size_t param_4)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  int *in_t0;
  int iVar5;
  code *pcVar6;
  
  iVar5 = in_t0[3];
  iVar4 = *in_t0;
  pcVar6 = (code *)in_t0[1];
  iVar1 = in_t0[2];
  if (param_1 == 0) {
    iVar2 = -1;
  }
  else {
    iVar2 = (*pcVar6)(param_1,param_2,0,0);
  }
  memset(param_2,0,0x128);
  *param_2 = param_1;
  param_2[0x47] = (int)pcVar6;
  param_2[0x46] = iVar4;
  param_2[0x48] = iVar1;
  param_2[0x49] = iVar5;
  iVar1 = ogg_sync_create();
  param_2[6] = iVar1;
  if (param_3 != (void *)0x0) {
    pvVar3 = (void *)ogg_sync_bufferin(iVar1,param_4);
    memcpy(pvVar3,param_3,param_4);
    ogg_sync_wrote(param_2[6],param_4);
  }
  if (iVar2 != -1) {
    param_2[1] = 1;
  }
  param_2[7] = 1;
  pvVar3 = calloc(1,0x20);
  param_2[0xc] = (int)pvVar3;
  pvVar3 = calloc(param_2[7],0x10);
  param_2[0xd] = (int)pvVar3;
  iVar1 = ogg_stream_create(0xffffffff);
  param_2[0x18] = iVar1;
  iVar1 = _fetch_headers(param_2,param_2[0xc],param_2[0xd],param_2 + 0x11);
  if (-1 < iVar1) {
    if (param_2[0x10] < 1) {
      param_2[0x10] = 1;
    }
    return iVar1;
  }
  *param_2 = 0;
  ov_clear(param_2);
  return iVar1;
}



----------------------------------------

// Function: ov_test_callbacks @ 0896d21c

void ov_test_callbacks(void)

{
  _ov_open1();
  return;
}



----------------------------------------

// Function: ov_test @ 0896d258

void ov_test(void)

{
  ov_test_callbacks();
  return;
}



----------------------------------------

// Function: ov_open_callbacks @ 0896d29c

void ov_open_callbacks(undefined4 param_1,undefined4 param_2)

{
  int iVar1;
  
  iVar1 = _ov_open1();
  if (iVar1 != 0) {
    return;
  }
  _ov_open2(param_2);
  return;
}



----------------------------------------

// Function: ov_open @ 0896d2fc

void ov_open(void)

{
  ov_open_callbacks();
  return;
}



----------------------------------------

// Function: _ogg_buffer_mark_one @ 0896d340

void _ogg_buffer_mark_one(int *param_1)

{
  *(int *)(*param_1 + 8) = *(int *)(*param_1 + 8) + 1;
  return;
}



----------------------------------------

// Function: ogg_buffer_mark @ 0896d354

void ogg_buffer_mark(int param_1)

{
  for (; param_1 != 0; param_1 = *(int *)(param_1 + 0xc)) {
    _ogg_buffer_mark_one(param_1);
  }
  return;
}



----------------------------------------

// Function: ogg_buffer_walk @ 0896d38c

void ogg_buffer_walk(int param_1)

{
  for (; param_1 != 0; param_1 = *(int *)(param_1 + 0xc)) {
  }
  return;
}



----------------------------------------

// Function: ogg_buffer_cat @ 0896d3a8

void ogg_buffer_cat(int param_1,undefined4 param_2)

{
  int iVar1;
  
  if (param_1 == 0) {
    return;
  }
  do {
    iVar1 = param_1;
    param_1 = *(int *)(iVar1 + 0xc);
  } while (param_1 != 0);
  *(undefined4 *)(iVar1 + 0xc) = param_2;
  ogg_buffer_walk(param_2);
  return;
}



----------------------------------------

// Function: _positionB @ 0896d3d0

void _positionB(undefined4 *param_1,int param_2)

{
  undefined4 uVar1;
  undefined4 *puVar2;
  int *piVar3;
  
  if (param_2 < (int)param_1[3]) {
    puVar2 = (undefined4 *)*param_1;
    param_1[3] = 0;
    uVar1 = puVar2[2];
    piVar3 = (int *)*puVar2;
    param_1[1] = puVar2;
    param_1[4] = uVar1;
    param_1[2] = *piVar3 + puVar2[1];
  }
  return;
}



----------------------------------------

// Function: _positionF @ 0896d410

void _positionF(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  undefined4 *puVar5;
  int iVar6;
  
  if (*(int *)(param_1 + 0x10) <= param_2) {
    puVar5 = *(undefined4 **)(param_1 + 4);
    iVar6 = *(int *)(param_1 + 0xc);
    do {
      piVar4 = puVar5 + 2;
      puVar5 = (undefined4 *)puVar5[3];
      iVar6 = iVar6 + *piVar4;
      *(int *)(param_1 + 0xc) = iVar6;
      iVar2 = puVar5[2];
      piVar4 = (int *)*puVar5;
      *(int *)(param_1 + 0x10) = iVar2 + iVar6;
      iVar1 = *piVar4;
      iVar3 = puVar5[1];
      *(undefined4 **)(param_1 + 4) = puVar5;
      *(int *)(param_1 + 8) = iVar1 + iVar3;
    } while (iVar2 + iVar6 <= param_2);
  }
  return;
}



----------------------------------------

// Function: oggbyte_set4 @ 0896d478

void oggbyte_set4(int param_1,uint param_2,int param_3)

{
  int iVar1;
  
  iVar1 = 0;
  _positionB(param_1,param_3);
  do {
    _positionF(param_1,param_3);
    iVar1 = iVar1 + 1;
    *(char *)(*(int *)(param_1 + 8) + (param_3 - *(int *)(param_1 + 0xc))) = (char)param_2;
    param_3 = param_3 + 1;
    param_2 = param_2 >> 8;
  } while (iVar1 != 4);
  return;
}



----------------------------------------

// Function: oggbyte_read1 @ 0896d500

undefined1 oggbyte_read1(int param_1,int param_2)

{
  _positionB();
  _positionF(param_1,param_2);
  return *(undefined1 *)(*(int *)(param_1 + 8) + (param_2 - *(int *)(param_1 + 0xc)));
}



----------------------------------------

// Function: oggbyte_read4 @ 0896d550

undefined4 oggbyte_read4(int param_1,int param_2)

{
  undefined1 uVar1;
  undefined1 uVar2;
  undefined1 uVar3;
  
  _positionB();
  _positionF(param_1,param_2);
  uVar1 = *(undefined1 *)(*(int *)(param_1 + 8) + (param_2 - *(int *)(param_1 + 0xc)));
  _positionF(param_1,param_2 + 1);
  uVar2 = *(undefined1 *)(*(int *)(param_1 + 8) + ((param_2 + 1) - *(int *)(param_1 + 0xc)));
  _positionF(param_1,param_2 + 2);
  uVar3 = *(undefined1 *)(*(int *)(param_1 + 8) + ((param_2 + 2) - *(int *)(param_1 + 0xc)));
  _positionF(param_1,param_2 + 3);
  return CONCAT13(*(undefined1 *)(*(int *)(param_1 + 8) + ((param_2 + 3) - *(int *)(param_1 + 0xc)))
                  ,CONCAT12(uVar3,CONCAT11(uVar2,uVar1)));
}



----------------------------------------

// Function: ogg_sync_wrote @ 0896d63c

undefined4 ogg_sync_wrote(int param_1,int param_2)

{
  int *piVar1;
  
  piVar1 = *(int **)(param_1 + 4);
  if ((piVar1 != (int *)0x0) && (param_2 <= (*(int *)(*piVar1 + 4) - piVar1[2]) - piVar1[1])) {
    piVar1[2] = piVar1[2] + param_2;
    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + param_2;
    return 0;
  }
  return 0xfffffff2;
}



----------------------------------------

// Function: _next_lace @ 0896d698

void _next_lace(undefined4 param_1,int param_2)

{
  int iVar1;
  uint uVar2;
  
  *(undefined4 *)(param_2 + 0x48) = 0;
  do {
    iVar1 = *(int *)(param_2 + 0x44);
    if (*(int *)(param_2 + 0x30) <= iVar1) {
      return;
    }
    *(int *)(param_2 + 0x44) = iVar1 + 1;
    iVar1 = oggbyte_read1(param_1,iVar1 + 0x1b);
    uVar2 = *(int *)(param_2 + 0x48) + iVar1;
    *(uint *)(param_2 + 0x48) = uVar2;
  } while (0xfe < iVar1);
  *(undefined4 *)(param_2 + 0x40) = 1;
  *(uint *)(param_2 + 0x48) = uVar2 | 0x80000000;
  return;
}



----------------------------------------

// Function: oggbyte_init @ 0896d714

undefined4 oggbyte_init(undefined4 *param_1,undefined4 *param_2)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  int *piVar4;
  
  *param_1 = 0;
  uVar3 = 0xffffffff;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  if (param_2 != (undefined4 *)0x0) {
    param_1[3] = 0;
    uVar3 = param_2[2];
    piVar4 = (int *)*param_2;
    *param_1 = param_2;
    param_1[4] = uVar3;
    iVar1 = *piVar4;
    iVar2 = param_2[1];
    param_1[1] = param_2;
    uVar3 = 0;
    param_1[2] = iVar1 + iVar2;
  }
  return uVar3;
}



----------------------------------------

// Function: ogg_page_packets @ 0896d768

int ogg_page_packets(undefined4 *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  undefined1 auStack_30 [24];
  
  oggbyte_init(auStack_30,*param_1);
  iVar1 = oggbyte_read1(auStack_30,0x1a);
  if (0 < iVar1) {
    iVar5 = 0;
    iVar2 = 0x1b;
    iVar3 = 0;
    do {
      iVar4 = iVar3 + 1;
      iVar2 = oggbyte_read1(auStack_30,iVar2);
      if (iVar2 != 0xff) {
        iVar5 = iVar5 + 1;
      }
      iVar2 = iVar3 + 0x1c;
      iVar3 = iVar4;
    } while (iVar1 != iVar4);
    return iVar5;
  }
  return 0;
}



----------------------------------------

// Function: ogg_page_pageno @ 0896d810

void ogg_page_pageno(undefined4 *param_1)

{
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  oggbyte_read4(auStack_20,0x12);
  return;
}



----------------------------------------

// Function: ogg_page_serialno @ 0896d83c

void ogg_page_serialno(undefined4 *param_1)

{
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  oggbyte_read4(auStack_20,0xe);
  return;
}



----------------------------------------

// Function: ogg_page_granulepos @ 0896d868

undefined8 ogg_page_granulepos(undefined4 *param_1)

{
  byte bVar1;
  byte *pbVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  undefined1 auStack_36 [5];
  byte bStack_31;
  byte local_30 [8];
  undefined1 auStack_28 [8];
  int local_20;
  int local_1c;
  
  oggbyte_init(auStack_28,*param_1);
  _positionB(auStack_28,6);
  iVar5 = 6;
  do {
    _positionF(auStack_28,iVar5);
    iVar6 = iVar5 + 1;
    auStack_36[iVar5] = *(undefined1 *)(local_20 + (iVar5 - local_1c));
    iVar5 = iVar6;
  } while (iVar6 != 0xd);
  _positionF(auStack_28,0xd);
  uVar3 = (uint)*(byte *)(local_20 + (0xd - local_1c));
  pbVar2 = local_30 + 6;
  uVar4 = 0;
  do {
    bVar1 = *pbVar2;
    uVar4 = uVar3 >> 0x18 | uVar4 << 8;
    pbVar2 = pbVar2 + -1;
    uVar3 = uVar3 << 8 | (uint)bVar1;
  } while (pbVar2 != &bStack_31);
  return CONCAT44(uVar4,uVar3);
}



----------------------------------------

// Function: ogg_page_eos @ 0896d944

uint ogg_page_eos(undefined4 *param_1)

{
  uint uVar1;
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  uVar1 = oggbyte_read1(auStack_20,5);
  return uVar1 & 4;
}



----------------------------------------

// Function: ogg_page_bos @ 0896d974

uint ogg_page_bos(undefined4 *param_1)

{
  uint uVar1;
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  uVar1 = oggbyte_read1(auStack_20,5);
  return uVar1 & 2;
}



----------------------------------------

// Function: ogg_page_continued @ 0896d9a4

uint ogg_page_continued(undefined4 *param_1)

{
  uint uVar1;
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  uVar1 = oggbyte_read1(auStack_20,5);
  return uVar1 & 1;
}



----------------------------------------

// Function: ogg_page_version @ 0896d9d4

void ogg_page_version(undefined4 *param_1)

{
  undefined1 auStack_20 [24];
  
  oggbyte_init(auStack_20,*param_1);
  oggbyte_read1(auStack_20,4);
  return;
}



----------------------------------------

// Function: _ogg_buffer_destroy @ 0896da00

void _ogg_buffer_destroy(undefined4 *param_1)

{
  void *pvVar1;
  undefined4 *aptr;
  undefined4 *puVar2;
  void *aptr_00;
  
  if (param_1[3] != 0) {
    aptr = (undefined4 *)*param_1;
    aptr_00 = (void *)param_1[1];
    if (aptr != (undefined4 *)0x0) {
      pvVar1 = (void *)*aptr;
      while( true ) {
        puVar2 = (undefined4 *)aptr[3];
        if (pvVar1 != (void *)0x0) {
          free(pvVar1);
        }
        free(aptr);
        if (puVar2 == (undefined4 *)0x0) break;
        pvVar1 = (void *)*puVar2;
        aptr = puVar2;
      }
    }
    *param_1 = 0;
    while (aptr_00 != (void *)0x0) {
      pvVar1 = *(void **)((int)aptr_00 + 0xc);
      free(aptr_00);
      aptr_00 = pvVar1;
    }
    param_1[1] = 0;
    if (param_1[2] == 0) {
      free(param_1);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: ogg_buffer_release_one @ 0896dac0

void ogg_buffer_release_one(int *param_1)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  iVar3 = *param_1;
  piVar2 = *(int **)(iVar3 + 0xc);
  iVar1 = *(int *)(iVar3 + 8) + -1;
  *(int *)(iVar3 + 8) = iVar1;
  if (iVar1 == 0) {
    piVar2[2] = piVar2[2] + -1;
    *(int *)(iVar3 + 0xc) = *piVar2;
    *piVar2 = iVar3;
  }
  iVar1 = piVar2[2];
  param_1[3] = piVar2[1];
  piVar2[2] = iVar1 + -1;
  piVar2[1] = (int)param_1;
  _ogg_buffer_destroy(piVar2);
  return;
}



----------------------------------------

// Function: ogg_buffer_pretruncate @ 0896db14

int ogg_buffer_pretruncate(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  if (param_1 == 0) {
    return 0;
  }
  iVar2 = *(int *)(param_1 + 8);
  if (param_2 < iVar2) {
    iVar1 = *(int *)(param_1 + 4);
  }
  else {
    do {
      param_1 = *(int *)(param_1 + 0xc);
      param_2 = param_2 - iVar2;
      ogg_buffer_release_one();
      if (param_1 == 0) {
        return 0;
      }
      iVar2 = *(int *)(param_1 + 8);
    } while (iVar2 <= param_2);
    iVar1 = *(int *)(param_1 + 4);
  }
  *(int *)(param_1 + 8) = iVar2 - param_2;
  *(int *)(param_1 + 4) = iVar1 + param_2;
  return param_1;
}



----------------------------------------

// Function: ogg_buffer_release @ 0896dbb0

void ogg_buffer_release(int param_1)

{
  while (param_1 != 0) {
    param_1 = *(int *)(param_1 + 0xc);
    ogg_buffer_release_one();
  }
  return;
}



----------------------------------------

// Function: ogg_page_release @ 0896dbe0

undefined4 ogg_page_release(undefined4 *param_1)

{
  if (param_1 != (undefined4 *)0x0) {
    ogg_buffer_release(*param_1);
    ogg_buffer_release(param_1[2]);
    param_1[3] = 0;
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
  }
  return 0;
}



----------------------------------------

// Function: ogg_stream_pagein @ 0896dc28

undefined4 ogg_stream_pagein(undefined4 *param_1,undefined4 *param_2)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  
  iVar1 = ogg_page_serialno(param_2);
  iVar2 = ogg_page_version(param_2);
  if (iVar1 != param_1[6]) {
    ogg_page_release(param_2);
    return 0xfffffff3;
  }
  if (0 < iVar2) {
    ogg_page_release(param_2);
    return 0xfffffff4;
  }
  if (param_1[3] == 0) {
    param_1[3] = param_2[2];
    uVar3 = ogg_buffer_walk();
    param_1[2] = uVar3;
    if (param_1[1] != 0) {
      uVar3 = *param_1;
LAB_0896dc9c:
      uVar3 = ogg_buffer_cat(uVar3,*param_2);
      *param_1 = uVar3;
      goto LAB_0896dca8;
    }
    uVar3 = *param_2;
  }
  else {
    uVar3 = ogg_buffer_cat(param_1[2],param_2[2]);
    param_1[2] = uVar3;
    if (param_1[1] != 0) {
      uVar3 = *param_1;
      goto LAB_0896dc9c;
    }
    uVar3 = *param_2;
  }
  param_1[1] = uVar3;
  uVar3 = ogg_buffer_walk();
  param_1[0xc] = 0xffffffe5;
  *param_1 = uVar3;
LAB_0896dca8:
  param_2[3] = 0;
  *param_2 = 0;
  param_2[1] = 0;
  param_2[2] = 0;
  return 0;
}



----------------------------------------

// Function: ogg_packet_release @ 0896dd28

undefined4 ogg_packet_release(undefined4 *param_1)

{
  if (param_1 != (undefined4 *)0x0) {
    ogg_buffer_release(*param_1);
    param_1[7] = 0;
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = 0;
  }
  return 0;
}



----------------------------------------

// Function: ogg_stream_reset @ 0896dd78

undefined4 ogg_stream_reset(undefined4 *param_1)

{
  ogg_buffer_release(param_1[1]);
  ogg_buffer_release(param_1[3]);
  param_1[7] = 0xffffffff;
  param_1[8] = 0;
  param_1[10] = 0;
  param_1[0x12] = 0;
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[9] = 0;
  param_1[0xb] = 0;
  param_1[0xd] = 0;
  param_1[0xc] = 0;
  param_1[0xe] = 0;
  param_1[0xf] = 0;
  param_1[0x10] = 0;
  param_1[0x11] = 0;
  return 0;
}



----------------------------------------

// Function: ogg_stream_reset_serialno @ 0896de00

undefined4 ogg_stream_reset_serialno(int param_1,undefined4 param_2)

{
  ogg_stream_reset();
  *(undefined4 *)(param_1 + 0x18) = param_2;
  return 0;
}



----------------------------------------

// Function: ogg_stream_destroy @ 0896de38

undefined4 ogg_stream_destroy(void *param_1)

{
  if (param_1 != (void *)0x0) {
    ogg_buffer_release(*(undefined4 *)((int)param_1 + 4));
    ogg_buffer_release(*(undefined4 *)((int)param_1 + 0xc));
    memset(param_1,0,0x50);
    free(param_1);
  }
  return 0;
}



----------------------------------------

// Function: ogg_sync_reset @ 0896de88

undefined4 ogg_sync_reset(int param_1)

{
  ogg_buffer_release(*(undefined4 *)(param_1 + 8));
  *(undefined4 *)(param_1 + 0x18) = 0;
  *(undefined4 *)(param_1 + 8) = 0;
  *(undefined4 *)(param_1 + 4) = 0;
  *(undefined4 *)(param_1 + 0xc) = 0;
  *(undefined4 *)(param_1 + 0x10) = 0;
  *(undefined4 *)(param_1 + 0x14) = 0;
  return 0;
}



----------------------------------------

// Function: ogg_sync_destroy @ 0896decc

undefined4 ogg_sync_destroy(int *param_1)

{
  if (param_1 != (int *)0x0) {
    ogg_sync_reset();
    *(undefined4 *)(*param_1 + 0xc) = 1;
    _ogg_buffer_destroy();
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = 0;
    free(param_1);
  }
  return 0;
}



----------------------------------------

// Function: _fetch_ref @ 0896df30

void * _fetch_ref(int param_1)

{
  void *pvVar1;
  
  pvVar1 = *(void **)(param_1 + 4);
  *(int *)(param_1 + 8) = *(int *)(param_1 + 8) + 1;
  if (pvVar1 == (void *)0x0) {
    pvVar1 = malloc(0x10);
  }
  else {
    *(undefined4 *)(param_1 + 4) = *(undefined4 *)((int)pvVar1 + 0xc);
  }
  *(undefined4 *)((int)pvVar1 + 4) = 0;
  *(undefined4 *)((int)pvVar1 + 8) = 0;
  *(undefined4 *)((int)pvVar1 + 0xc) = 0;
  return pvVar1;
}



----------------------------------------

// Function: ogg_buffer_split @ 0896df88

int * ogg_buffer_split(int *param_1,int *param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int *piVar5;
  int iVar6;
  int *piVar7;
  
  piVar7 = (int *)*param_1;
  if (piVar7 == (int *)0x0) {
    return (int *)0x0;
  }
  iVar6 = piVar7[2];
  piVar5 = piVar7;
  if (iVar6 < param_3) {
    for (piVar5 = (int *)piVar7[3]; param_3 = param_3 - iVar6, piVar5 != (int *)0x0;
        piVar5 = (int *)piVar5[3]) {
      iVar6 = piVar5[2];
      if (param_3 <= iVar6) goto LAB_0896e024;
    }
  }
  else {
LAB_0896e024:
    if (param_3 != 0) {
      if (iVar6 <= param_3) {
        if (piVar5[3] == 0) {
          *param_2 = 0;
          *param_1 = 0;
          return piVar7;
        }
        *param_1 = piVar5[3];
        piVar5[3] = 0;
        return piVar7;
      }
      iVar4 = piVar5[1];
      piVar1 = (int *)_fetch_ref(*(undefined4 *)(*piVar5 + 0xc));
      *param_1 = (int)piVar1;
      iVar3 = *piVar5;
      piVar1[3] = piVar5[3];
      iVar2 = *param_1;
      *piVar1 = iVar3;
      piVar1[1] = param_3 + iVar4;
      piVar1[2] = iVar6 - param_3;
      _ogg_buffer_mark_one(iVar2);
      if (param_2 == (int *)0x0) {
        piVar5[2] = param_3;
      }
      else {
        if ((int *)*param_2 == piVar5) {
          iVar6 = *param_1;
          piVar5[2] = param_3;
          *param_2 = iVar6;
          piVar5[3] = 0;
          return piVar7;
        }
        piVar5[2] = param_3;
      }
      piVar5[3] = 0;
      return piVar7;
    }
  }
  return (int *)0x0;
}



----------------------------------------

// Function: ogg_buffer_dup @ 0896e0e4

int * ogg_buffer_dup(int *param_1)

{
  int *piVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  
  piVar1 = (int *)0x0;
  if (param_1 != (int *)0x0) {
    piVar1 = (int *)_fetch_ref(*(undefined4 *)(*param_1 + 0xc));
    piVar6 = piVar1;
    while( true ) {
      iVar3 = *param_1;
      iVar4 = param_1[1];
      iVar5 = param_1[2];
      param_1 = (int *)param_1[3];
      *piVar6 = iVar3;
      piVar6[1] = iVar4;
      piVar6[2] = iVar5;
      if (param_1 == (int *)0x0) break;
      piVar2 = (int *)_fetch_ref(*(undefined4 *)(*param_1 + 0xc));
      piVar6[3] = (int)piVar2;
      piVar6 = piVar2;
    }
  }
  ogg_buffer_mark(piVar1);
  return piVar1;
}



----------------------------------------

// Function: ogg_page_dup @ 0896e174

void ogg_page_dup(undefined4 *param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  undefined4 uVar2;
  
  uVar1 = param_2[1];
  uVar2 = *param_2;
  param_1[3] = param_2[3];
  param_1[1] = uVar1;
  uVar1 = ogg_buffer_dup(uVar2);
  uVar2 = param_2[2];
  *param_1 = uVar1;
  uVar1 = ogg_buffer_dup(uVar2);
  param_1[2] = uVar1;
  return;
}



----------------------------------------

// Function: _packetout @ 0896e1c8

undefined4 _packetout(undefined4 *param_1,undefined4 *param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  undefined4 uVar4;
  uint uVar5;
  int *piVar6;
  int iVar7;
  int *piVar8;
  int *piVar9;
  int *piVar10;
  undefined8 uVar11;
  int local_50 [4];
  undefined1 auStack_40 [24];
  
  ogg_packet_release(param_2);
  if ((int)param_1[0xd] < 0) {
    iVar2 = param_1[0xe];
  }
  else {
    iVar2 = param_1[1];
    if (iVar2 == 0) {
      iVar2 = param_1[0xe];
    }
    else {
      iVar7 = param_1[0xc];
      while( true ) {
        if (-1 < iVar7) {
          iVar2 = ogg_buffer_pretruncate(iVar2,iVar7 + 0x1b);
          param_1[1] = iVar2;
        }
        param_1[0xc] = 0;
        param_1[0x11] = 0;
        param_1[0x10] = 0;
        if (iVar2 == 0) break;
        local_50[0] = iVar2;
        iVar2 = ogg_page_pageno(local_50);
        oggbyte_init(auStack_40,param_1[1]);
        uVar4 = oggbyte_read1(auStack_40,0x1a);
        param_1[0xc] = uVar4;
        if (iVar2 != param_1[7]) {
          if (param_1[7] == -1) {
            param_1[0xe] = 1;
          }
          else {
            param_1[0xe] = 2;
          }
          iVar7 = ogg_buffer_pretruncate(param_1[3],param_1[0xd]);
          param_1[3] = iVar7;
          if (iVar7 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
        }
        iVar7 = ogg_page_continued(local_50);
        if (iVar7 == 0) {
          if (param_1[0xd] == 0) {
            iVar3 = param_1[0x11];
            goto LAB_0896e2d4;
          }
          iVar7 = ogg_buffer_pretruncate(param_1[3]);
          param_1[3] = iVar7;
          if (iVar7 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
          if (param_1[0xf] != 0) goto LAB_0896e2d0;
          iVar7 = param_1[0xe];
LAB_0896e3b8:
          iVar3 = param_1[0x11];
          if (iVar7 != 0) goto LAB_0896e2d4;
          param_1[0xf] = 2;
          if (iVar3 < (int)param_1[0xc]) goto LAB_0896e3d0;
        }
        else {
          if (param_1[0xd] == 0) {
            _next_lace(auStack_40,param_1);
            iVar7 = ogg_buffer_pretruncate(param_1[3],param_1[0x12] & 0x7fffffff);
            param_1[3] = iVar7;
            if (iVar7 == 0) {
              param_1[2] = 0;
            }
            if (param_1[0xf] == 0) {
              iVar7 = param_1[0xe];
              goto LAB_0896e3b8;
            }
            iVar3 = param_1[0x11];
          }
          else {
LAB_0896e2d0:
            iVar3 = param_1[0x11];
          }
LAB_0896e2d4:
          if (iVar3 < (int)param_1[0xc]) {
LAB_0896e3d0:
            uVar11 = ogg_page_granulepos(local_50);
            *(undefined8 *)(param_1 + 10) = uVar11;
            _next_lace(auStack_40,param_1);
            param_1[0xd] = param_1[0xd] + param_1[0x12];
            _next_lace(auStack_40,param_1);
          }
        }
        param_1[7] = iVar2 + 1;
        uVar4 = ogg_page_eos(local_50);
        param_1[4] = uVar4;
        uVar4 = ogg_page_bos(local_50);
        param_1[5] = uVar4;
        if (((int)param_1[0xd] < 0) || (iVar2 = param_1[1], iVar2 == 0)) goto LAB_0896e318;
        iVar7 = param_1[0xc];
      }
      *param_1 = 0;
LAB_0896e318:
      iVar2 = param_1[0xe];
    }
  }
  if (iVar2 == 0) {
    iVar2 = param_1[0xf];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xe] = 1;
    }
    else {
      param_1[0xe] = 0;
    }
    if (iVar2 == 2) {
      uVar5 = param_1[8];
      iVar2 = param_1[9];
      uVar4 = 0xfffffff6;
      goto LAB_0896e5ec;
    }
    iVar2 = param_1[0xf];
  }
  if (iVar2 == 0) {
    uVar5 = param_1[0xd];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xf] = 1;
    }
    else {
      param_1[0xf] = 0;
    }
    if (iVar2 == 2) {
      uVar5 = param_1[8];
      iVar2 = param_1[9];
      uVar4 = 0xfffffff5;
      goto LAB_0896e5ec;
    }
    uVar5 = param_1[0xd];
  }
  if (-1 < (int)uVar5) {
    return 0;
  }
  if (param_2 == (undefined4 *)0x0) {
    if (param_3 == 0) {
      return 1;
    }
    oggbyte_init(auStack_40,param_1[1]);
    iVar2 = ogg_buffer_pretruncate(param_1[3],param_1[0xd] & 0x7fffffff);
    param_1[3] = iVar2;
    if (iVar2 == 0) {
      param_1[2] = 0;
    }
  }
  else {
    iVar2 = param_1[4];
    param_2[2] = param_1[5];
    if (iVar2 == 0) {
      param_2[3] = 0;
    }
    else if (param_1[0x12] == 0) {
      param_2[3] = iVar2;
    }
    else {
      param_2[3] = 0;
    }
    if (((int)uVar5 < 0) && (-1 < (int)param_1[0x12])) {
      uVar4 = param_1[0xb];
      param_2[4] = param_1[10];
      param_2[5] = uVar4;
    }
    else {
      param_2[4] = 0xffffffff;
      param_2[5] = 0xffffffff;
    }
    uVar4 = param_1[9];
    param_2[6] = param_1[8];
    param_2[7] = uVar4;
    if (param_3 == 0) {
      piVar6 = (int *)param_1[3];
      piVar9 = (int *)0x0;
      if (piVar6 != (int *)0x0) {
        iVar2 = piVar6[2];
        iVar7 = 0;
        if (iVar2 < 1) {
          for (piVar6 = (int *)piVar6[3]; iVar7 = iVar7 - iVar2, piVar6 != (int *)0x0;
              piVar6 = (int *)piVar6[3]) {
            iVar2 = piVar6[2];
            if (iVar7 < iVar2) goto LAB_0896e634;
          }
        }
        else {
LAB_0896e634:
          uVar5 = uVar5 & 0x7fffffff;
          if (uVar5 != 0) {
            piVar8 = (int *)0x0;
            piVar10 = (int *)0x0;
            do {
              piVar1 = (int *)_fetch_ref(*(undefined4 *)(*piVar6 + 0xc));
              piVar9 = piVar1;
              if (piVar8 != (int *)0x0) {
                piVar8[3] = (int)piVar1;
                piVar9 = piVar10;
              }
              piVar1[2] = uVar5;
              iVar3 = piVar6[2] - iVar7;
              iVar2 = piVar6[1] + iVar7;
              iVar7 = 0;
              *piVar1 = *piVar6;
              piVar1[1] = iVar2;
              if (iVar3 < (int)uVar5) {
                piVar1[2] = iVar3;
              }
              piVar6 = (int *)piVar6[3];
            } while ((piVar6 != (int *)0x0) &&
                    (uVar5 = uVar5 - piVar1[2], piVar8 = piVar1, piVar10 = piVar9, uVar5 != 0));
            goto LAB_0896e510;
          }
        }
        piVar9 = (int *)0x0;
      }
LAB_0896e510:
      ogg_buffer_mark(piVar9);
      param_2[1] = param_1[0xd] & 0x7fffffff;
      *param_2 = piVar9;
      return 1;
    }
    oggbyte_init(auStack_40,param_1[1]);
    uVar4 = ogg_buffer_split(param_1 + 3,param_1 + 2,param_1[0xd] & 0x7fffffff);
    uVar5 = param_1[0xd];
    *param_2 = uVar4;
    param_2[1] = uVar5 & 0x7fffffff;
  }
  param_1[0xd] = param_1[0x12];
  _next_lace(auStack_40,param_1);
  uVar5 = param_1[8];
  iVar2 = param_1[9];
  uVar4 = 1;
  param_1[5] = 0;
LAB_0896e5ec:
  param_1[8] = uVar5 + 1;
  param_1[9] = (uint)(uVar5 + 1 < uVar5) + iVar2;
  return uVar4;
}



----------------------------------------

// Function: ogg_stream_packetpeek @ 0896e724

/* WARNING: Removing unreachable block (ram,0x0896e58c) */
/* WARNING: Removing unreachable block (ram,0x0896e6c0) */
/* WARNING: Removing unreachable block (ram,0x0896e6ec) */
/* WARNING: Removing unreachable block (ram,0x0896e5c8) */

undefined4 ogg_stream_packetpeek(undefined4 *param_1,undefined4 *param_2)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  undefined4 uVar5;
  int *piVar6;
  int iVar7;
  int *piVar8;
  int *piVar9;
  int *piVar10;
  undefined8 uVar11;
  int aiStack_50 [4];
  undefined1 auStack_40 [24];
  
  ogg_packet_release(param_2);
  if ((int)param_1[0xd] < 0) {
    iVar2 = param_1[0xe];
  }
  else {
    iVar2 = param_1[1];
    if (iVar2 == 0) {
      iVar2 = param_1[0xe];
    }
    else {
      iVar7 = param_1[0xc];
      while( true ) {
        if (-1 < iVar7) {
          iVar2 = ogg_buffer_pretruncate(iVar2,iVar7 + 0x1b);
          param_1[1] = iVar2;
        }
        param_1[0xc] = 0;
        param_1[0x11] = 0;
        param_1[0x10] = 0;
        if (iVar2 == 0) break;
        aiStack_50[0] = iVar2;
        iVar2 = ogg_page_pageno(aiStack_50);
        oggbyte_init(auStack_40,param_1[1]);
        uVar5 = oggbyte_read1(auStack_40,0x1a);
        param_1[0xc] = uVar5;
        if (iVar2 != param_1[7]) {
          if (param_1[7] == -1) {
            param_1[0xe] = 1;
          }
          else {
            param_1[0xe] = 2;
          }
          iVar7 = ogg_buffer_pretruncate(param_1[3],param_1[0xd]);
          param_1[3] = iVar7;
          if (iVar7 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
        }
        iVar7 = ogg_page_continued(aiStack_50);
        if (iVar7 == 0) {
          if (param_1[0xd] == 0) {
            iVar3 = param_1[0x11];
            goto LAB_0896e2d4;
          }
          iVar7 = ogg_buffer_pretruncate(param_1[3]);
          param_1[3] = iVar7;
          if (iVar7 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
          if (param_1[0xf] != 0) goto LAB_0896e2d0;
          iVar7 = param_1[0xe];
LAB_0896e3b8:
          iVar3 = param_1[0x11];
          if (iVar7 != 0) goto LAB_0896e2d4;
          param_1[0xf] = 2;
          if (iVar3 < (int)param_1[0xc]) goto LAB_0896e3d0;
        }
        else {
          if (param_1[0xd] == 0) {
            _next_lace(auStack_40,param_1);
            iVar7 = ogg_buffer_pretruncate(param_1[3],param_1[0x12] & 0x7fffffff);
            param_1[3] = iVar7;
            if (iVar7 == 0) {
              param_1[2] = 0;
            }
            if (param_1[0xf] == 0) {
              iVar7 = param_1[0xe];
              goto LAB_0896e3b8;
            }
            iVar3 = param_1[0x11];
          }
          else {
LAB_0896e2d0:
            iVar3 = param_1[0x11];
          }
LAB_0896e2d4:
          if (iVar3 < (int)param_1[0xc]) {
LAB_0896e3d0:
            uVar11 = ogg_page_granulepos(aiStack_50);
            *(undefined8 *)(param_1 + 10) = uVar11;
            _next_lace(auStack_40,param_1);
            param_1[0xd] = param_1[0xd] + param_1[0x12];
            _next_lace(auStack_40,param_1);
          }
        }
        param_1[7] = iVar2 + 1;
        uVar5 = ogg_page_eos(aiStack_50);
        param_1[4] = uVar5;
        uVar5 = ogg_page_bos(aiStack_50);
        param_1[5] = uVar5;
        if (((int)param_1[0xd] < 0) || (iVar2 = param_1[1], iVar2 == 0)) goto LAB_0896e318;
        iVar7 = param_1[0xc];
      }
      *param_1 = 0;
LAB_0896e318:
      iVar2 = param_1[0xe];
    }
  }
  if (iVar2 == 0) {
    iVar2 = param_1[0xf];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xe] = 1;
    }
    else {
      param_1[0xe] = 0;
    }
    if (iVar2 == 2) {
      uVar4 = param_1[8];
      iVar2 = param_1[9];
      uVar5 = 0xfffffff6;
      goto LAB_0896e5ec;
    }
    iVar2 = param_1[0xf];
  }
  if (iVar2 == 0) {
    uVar4 = param_1[0xd];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xf] = 1;
    }
    else {
      param_1[0xf] = 0;
    }
    if (iVar2 == 2) {
      uVar4 = param_1[8];
      iVar2 = param_1[9];
      uVar5 = 0xfffffff5;
LAB_0896e5ec:
      param_1[8] = uVar4 + 1;
      param_1[9] = (uint)(uVar4 + 1 < uVar4) + iVar2;
      return uVar5;
    }
    uVar4 = param_1[0xd];
  }
  uVar5 = 0;
  if ((int)uVar4 < 0) {
    if (param_2 != (undefined4 *)0x0) {
      iVar2 = param_1[4];
      param_2[2] = param_1[5];
      if (iVar2 == 0) {
        param_2[3] = 0;
      }
      else if (param_1[0x12] == 0) {
        param_2[3] = iVar2;
      }
      else {
        param_2[3] = 0;
      }
      if (((int)uVar4 < 0) && (-1 < (int)param_1[0x12])) {
        uVar5 = param_1[0xb];
        param_2[4] = param_1[10];
        param_2[5] = uVar5;
      }
      else {
        param_2[4] = 0xffffffff;
        param_2[5] = 0xffffffff;
      }
      uVar5 = param_1[9];
      param_2[6] = param_1[8];
      param_2[7] = uVar5;
      piVar6 = (int *)param_1[3];
      piVar9 = (int *)0x0;
      if (piVar6 != (int *)0x0) {
        iVar2 = piVar6[2];
        iVar7 = 0;
        if (iVar2 < 1) {
          for (piVar6 = (int *)piVar6[3]; iVar7 = iVar7 - iVar2, piVar6 != (int *)0x0;
              piVar6 = (int *)piVar6[3]) {
            iVar2 = piVar6[2];
            if (iVar7 < iVar2) goto LAB_0896e634;
          }
        }
        else {
LAB_0896e634:
          uVar4 = uVar4 & 0x7fffffff;
          if (uVar4 != 0) {
            piVar8 = (int *)0x0;
            piVar10 = (int *)0x0;
            do {
              piVar1 = (int *)_fetch_ref(*(undefined4 *)(*piVar6 + 0xc));
              piVar9 = piVar1;
              if (piVar8 != (int *)0x0) {
                piVar8[3] = (int)piVar1;
                piVar9 = piVar10;
              }
              piVar1[2] = uVar4;
              iVar3 = piVar6[2] - iVar7;
              iVar2 = piVar6[1] + iVar7;
              iVar7 = 0;
              *piVar1 = *piVar6;
              piVar1[1] = iVar2;
              if (iVar3 < (int)uVar4) {
                piVar1[2] = iVar3;
              }
              piVar6 = (int *)piVar6[3];
            } while ((piVar6 != (int *)0x0) &&
                    (uVar4 = uVar4 - piVar1[2], piVar8 = piVar1, piVar10 = piVar9, uVar4 != 0));
            goto LAB_0896e510;
          }
        }
        piVar9 = (int *)0x0;
      }
LAB_0896e510:
      ogg_buffer_mark(piVar9);
      param_2[1] = param_1[0xd] & 0x7fffffff;
      *param_2 = piVar9;
      return 1;
    }
    uVar5 = 1;
  }
  return uVar5;
}



----------------------------------------

// Function: ogg_stream_packetout @ 0896e72c

/* WARNING: Removing unreachable block (ram,0x0896e4d0) */
/* WARNING: Removing unreachable block (ram,0x0896e4dc) */
/* WARNING: Removing unreachable block (ram,0x0896e630) */
/* WARNING: Removing unreachable block (ram,0x0896e4e8) */
/* WARNING: Removing unreachable block (ram,0x0896e504) */
/* WARNING: Removing unreachable block (ram,0x0896e4f0) */
/* WARNING: Removing unreachable block (ram,0x0896e634) */
/* WARNING: Removing unreachable block (ram,0x0896e644) */
/* WARNING: Removing unreachable block (ram,0x0896e69c) */
/* WARNING: Removing unreachable block (ram,0x0896e64c) */
/* WARNING: Removing unreachable block (ram,0x0896e6b0) */
/* WARNING: Removing unreachable block (ram,0x0896e650) */
/* WARNING: Removing unreachable block (ram,0x0896e680) */
/* WARNING: Removing unreachable block (ram,0x0896e684) */
/* WARNING: Removing unreachable block (ram,0x0896e690) */
/* WARNING: Removing unreachable block (ram,0x0896e500) */
/* WARNING: Removing unreachable block (ram,0x0896e50c) */
/* WARNING: Removing unreachable block (ram,0x0896e510) */
/* WARNING: Removing unreachable block (ram,0x0896e710) */

undefined4 ogg_stream_packetout(undefined4 *param_1,undefined4 *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  undefined4 uVar5;
  undefined8 uVar6;
  int aiStack_50 [4];
  undefined1 auStack_40 [24];
  
  ogg_packet_release(param_2);
  if ((int)param_1[0xd] < 0) {
    iVar2 = param_1[0xe];
  }
  else {
    iVar2 = param_1[1];
    if (iVar2 == 0) {
      iVar2 = param_1[0xe];
    }
    else {
      iVar3 = param_1[0xc];
      while( true ) {
        if (-1 < iVar3) {
          iVar2 = ogg_buffer_pretruncate(iVar2,iVar3 + 0x1b);
          param_1[1] = iVar2;
        }
        param_1[0xc] = 0;
        param_1[0x11] = 0;
        param_1[0x10] = 0;
        if (iVar2 == 0) break;
        aiStack_50[0] = iVar2;
        iVar2 = ogg_page_pageno(aiStack_50);
        oggbyte_init(auStack_40,param_1[1]);
        uVar5 = oggbyte_read1(auStack_40,0x1a);
        param_1[0xc] = uVar5;
        if (iVar2 != param_1[7]) {
          if (param_1[7] == -1) {
            param_1[0xe] = 1;
          }
          else {
            param_1[0xe] = 2;
          }
          iVar3 = ogg_buffer_pretruncate(param_1[3],param_1[0xd]);
          param_1[3] = iVar3;
          if (iVar3 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
        }
        iVar3 = ogg_page_continued(aiStack_50);
        if (iVar3 == 0) {
          if (param_1[0xd] == 0) {
            iVar1 = param_1[0x11];
            goto LAB_0896e2d4;
          }
          iVar3 = ogg_buffer_pretruncate(param_1[3]);
          param_1[3] = iVar3;
          if (iVar3 == 0) {
            param_1[2] = 0;
          }
          param_1[0xd] = 0;
          if (param_1[0xf] != 0) goto LAB_0896e2d0;
          iVar3 = param_1[0xe];
LAB_0896e3b8:
          iVar1 = param_1[0x11];
          if (iVar3 != 0) goto LAB_0896e2d4;
          param_1[0xf] = 2;
          if (iVar1 < (int)param_1[0xc]) goto LAB_0896e3d0;
        }
        else {
          if (param_1[0xd] == 0) {
            _next_lace(auStack_40,param_1);
            iVar3 = ogg_buffer_pretruncate(param_1[3],param_1[0x12] & 0x7fffffff);
            param_1[3] = iVar3;
            if (iVar3 == 0) {
              param_1[2] = 0;
            }
            if (param_1[0xf] == 0) {
              iVar3 = param_1[0xe];
              goto LAB_0896e3b8;
            }
            iVar1 = param_1[0x11];
          }
          else {
LAB_0896e2d0:
            iVar1 = param_1[0x11];
          }
LAB_0896e2d4:
          if (iVar1 < (int)param_1[0xc]) {
LAB_0896e3d0:
            uVar6 = ogg_page_granulepos(aiStack_50);
            *(undefined8 *)(param_1 + 10) = uVar6;
            _next_lace(auStack_40,param_1);
            param_1[0xd] = param_1[0xd] + param_1[0x12];
            _next_lace(auStack_40,param_1);
          }
        }
        param_1[7] = iVar2 + 1;
        uVar5 = ogg_page_eos(aiStack_50);
        param_1[4] = uVar5;
        uVar5 = ogg_page_bos(aiStack_50);
        param_1[5] = uVar5;
        if (((int)param_1[0xd] < 0) || (iVar2 = param_1[1], iVar2 == 0)) goto LAB_0896e318;
        iVar3 = param_1[0xc];
      }
      *param_1 = 0;
LAB_0896e318:
      iVar2 = param_1[0xe];
    }
  }
  if (iVar2 == 0) {
    iVar2 = param_1[0xf];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xe] = 1;
    }
    else {
      param_1[0xe] = 0;
    }
    if (iVar2 == 2) {
      uVar4 = param_1[8];
      iVar2 = param_1[9];
      uVar5 = 0xfffffff6;
      goto LAB_0896e5ec;
    }
    iVar2 = param_1[0xf];
  }
  if (iVar2 == 0) {
    iVar2 = param_1[0xd];
  }
  else {
    if (param_1[0x10] == 0) {
      param_1[0xf] = 1;
    }
    else {
      param_1[0xf] = 0;
    }
    if (iVar2 == 2) {
      uVar4 = param_1[8];
      iVar2 = param_1[9];
      uVar5 = 0xfffffff5;
      goto LAB_0896e5ec;
    }
    iVar2 = param_1[0xd];
  }
  if (-1 < iVar2) {
    return 0;
  }
  if (param_2 == (undefined4 *)0x0) {
    oggbyte_init(auStack_40,param_1[1]);
    iVar2 = ogg_buffer_pretruncate(param_1[3],param_1[0xd] & 0x7fffffff);
    param_1[3] = iVar2;
    if (iVar2 == 0) {
      param_1[2] = 0;
    }
  }
  else {
    iVar3 = param_1[4];
    param_2[2] = param_1[5];
    if (iVar3 == 0) {
      param_2[3] = 0;
    }
    else if (param_1[0x12] == 0) {
      param_2[3] = iVar3;
    }
    else {
      param_2[3] = 0;
    }
    if ((iVar2 < 0) && (-1 < (int)param_1[0x12])) {
      uVar5 = param_1[0xb];
      param_2[4] = param_1[10];
      param_2[5] = uVar5;
    }
    else {
      param_2[4] = 0xffffffff;
      param_2[5] = 0xffffffff;
    }
    uVar5 = param_1[9];
    param_2[6] = param_1[8];
    param_2[7] = uVar5;
    oggbyte_init(auStack_40,param_1[1]);
    uVar5 = ogg_buffer_split(param_1 + 3,param_1 + 2,param_1[0xd] & 0x7fffffff);
    uVar4 = param_1[0xd];
    *param_2 = uVar5;
    param_2[1] = uVar4 & 0x7fffffff;
  }
  param_1[0xd] = param_1[0x12];
  _next_lace(auStack_40,param_1);
  uVar4 = param_1[8];
  iVar2 = param_1[9];
  uVar5 = 1;
  param_1[5] = 0;
LAB_0896e5ec:
  param_1[8] = uVar4 + 1;
  param_1[9] = (uint)(uVar4 + 1 < uVar4) + iVar2;
  return uVar5;
}



----------------------------------------

// Function: ogg_stream_create @ 0896e734

void ogg_stream_create(undefined4 param_1)

{
  void *pvVar1;
  
  pvVar1 = calloc(1,0x50);
  *(undefined4 *)((int)pvVar1 + 0x1c) = 0xffffffff;
  *(undefined4 *)((int)pvVar1 + 0x18) = param_1;
  return;
}



----------------------------------------

// Function: ogg_sync_create @ 0896e76c

undefined4 * ogg_sync_create(void)

{
  undefined4 *puVar1;
  void *pvVar2;
  
  puVar1 = calloc(1,0x1c);
  *puVar1 = 0;
  puVar1[1] = 0;
  puVar1[2] = 0;
  puVar1[3] = 0;
  puVar1[4] = 0;
  puVar1[5] = 0;
  puVar1[6] = 0;
  pvVar2 = calloc(1,0x10);
  *puVar1 = pvVar2;
  return puVar1;
}



----------------------------------------

// Function: ogg_sync_pageseek @ 0896e7c8

int ogg_sync_pageseek(int param_1,undefined4 *param_2)

{
  uint uVar1;
  undefined4 *puVar2;
  void *pvVar3;
  int iVar4;
  byte *pbVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  undefined1 auStack_30 [24];
  
  ogg_page_release(param_2);
  iVar11 = *(int *)(param_1 + 0xc);
  oggbyte_init(auStack_30,*(undefined4 *)(param_1 + 8));
  iVar4 = *(int *)(param_1 + 0x14);
  if (iVar4 == 0) {
    if (iVar11 < 0x1b) {
      return 0;
    }
    iVar4 = oggbyte_read1(auStack_30,0);
    if (iVar4 != 0x4f) {
      uVar7 = *(undefined4 *)(param_1 + 8);
      goto LAB_0896e9f0;
    }
    iVar4 = oggbyte_read1(auStack_30,1);
    if (iVar4 != 0x67) {
      uVar7 = *(undefined4 *)(param_1 + 8);
      goto LAB_0896e9f0;
    }
    iVar4 = oggbyte_read1(auStack_30,2);
    if (iVar4 != 0x67) {
      uVar7 = *(undefined4 *)(param_1 + 8);
      goto LAB_0896e9f0;
    }
    iVar4 = oggbyte_read1(auStack_30,3);
    if (iVar4 != 0x53) {
      uVar7 = *(undefined4 *)(param_1 + 8);
      goto LAB_0896e9f0;
    }
    iVar4 = oggbyte_read1(auStack_30,0x1a);
    iVar4 = iVar4 + 0x1b;
    *(int *)(param_1 + 0x14) = iVar4;
  }
  iVar8 = 0;
  if (iVar11 < iVar4) {
    return 0;
  }
  iVar9 = *(int *)(param_1 + 0x18) + iVar4;
  if (*(int *)(param_1 + 0x18) == 0) {
    iVar9 = 0;
    if (0 < iVar4 + -0x1b) {
      do {
        iVar4 = oggbyte_read1(auStack_30,iVar8 + 0x1b);
        iVar9 = iVar9 + iVar4;
        iVar8 = iVar8 + 1;
        *(int *)(param_1 + 0x18) = iVar9;
      } while (iVar8 < *(int *)(param_1 + 0x14) + -0x1b);
      iVar9 = iVar9 + *(int *)(param_1 + 0x14);
      goto LAB_0896e904;
    }
  }
  else {
LAB_0896e904:
    if (iVar11 < iVar9) {
      return 0;
    }
  }
  uVar1 = oggbyte_read4(auStack_30,0x16);
  oggbyte_set4(auStack_30,0,0x16);
  puVar2 = *(undefined4 **)(param_1 + 8);
  if (puVar2 != (undefined4 *)0x0) {
    iVar4 = *(int *)(param_1 + 0x18) + *(int *)(param_1 + 0x14);
    iVar11 = iVar4 + puVar2[2];
    uVar10 = 0;
    iVar8 = *(int *)*puVar2 + puVar2[1];
    if (iVar11 < 1) goto LAB_0896e9cc;
    do {
      iVar9 = 0;
      do {
        pbVar5 = (byte *)(iVar8 + iVar9);
        iVar9 = iVar9 + 1;
        uVar10 = uVar10 << 8 ^ *(uint *)(crc_lookup + (uVar10 >> 0x18 ^ (uint)*pbVar5) * 4);
      } while (iVar11 != iVar9);
      puVar2 = (undefined4 *)puVar2[3];
      while( true ) {
        if (puVar2 == (undefined4 *)0x0) goto LAB_0896e9d8;
        iVar4 = iVar4 - iVar9;
        iVar11 = iVar4 + puVar2[2];
        iVar8 = *(int *)*puVar2 + puVar2[1];
        if (0 < iVar11) break;
LAB_0896e9cc:
        puVar2 = (undefined4 *)puVar2[3];
        iVar9 = 0;
      }
    } while( true );
  }
  uVar10 = 0;
LAB_0896e9d8:
  if (uVar1 == uVar10) {
    oggbyte_set4(auStack_30,uVar1,0x16);
    if (param_2 == (undefined4 *)0x0) {
      iVar4 = ogg_buffer_pretruncate
                        (*(undefined4 *)(param_1 + 8),
                         *(int *)(param_1 + 0x14) + *(int *)(param_1 + 0x18));
      *(int *)(param_1 + 8) = iVar4;
      if (iVar4 == 0) {
        iVar4 = *(int *)(param_1 + 0x18);
        *(undefined4 *)(param_1 + 4) = 0;
      }
      else {
        iVar4 = *(int *)(param_1 + 0x18);
      }
    }
    else {
      uVar7 = ogg_buffer_split(param_1 + 8,param_1 + 4,*(undefined4 *)(param_1 + 0x14));
      uVar6 = *(undefined4 *)(param_1 + 0x14);
      *param_2 = uVar7;
      param_2[1] = uVar6;
      uVar7 = ogg_buffer_split(param_1 + 8,param_1 + 4,*(undefined4 *)(param_1 + 0x18));
      iVar4 = *(int *)(param_1 + 0x18);
      param_2[2] = uVar7;
      param_2[3] = iVar4;
    }
    *(undefined4 *)(param_1 + 0x10) = 0;
    iVar4 = *(int *)(param_1 + 0x14) + iVar4;
    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) - iVar4;
    *(undefined4 *)(param_1 + 0x14) = 0;
    *(undefined4 *)(param_1 + 0x18) = 0;
    return iVar4;
  }
  oggbyte_set4(auStack_30,uVar1,0x16);
  uVar7 = *(undefined4 *)(param_1 + 8);
LAB_0896e9f0:
  *(undefined4 *)(param_1 + 0x14) = 0;
  *(undefined4 *)(param_1 + 0x18) = 0;
  puVar2 = (undefined4 *)ogg_buffer_pretruncate(uVar7,1);
  *(undefined4 **)(param_1 + 8) = puVar2;
  if (puVar2 == (undefined4 *)0x0) {
    iVar4 = -1;
  }
  else {
    iVar4 = -1;
    do {
      iVar8 = puVar2[1];
      iVar11 = *(int *)*puVar2;
      pvVar3 = memchr((void *)(iVar11 + iVar8),0x4f,puVar2[2]);
      iVar9 = *(int *)(param_1 + 8);
      if (pvVar3 != (void *)0x0) {
        iVar8 = (int)pvVar3 - (iVar11 + iVar8);
        iVar11 = ogg_buffer_pretruncate(iVar9,iVar8);
        iVar4 = iVar4 - iVar8;
        *(int *)(param_1 + 8) = iVar11;
        if (iVar11 != 0) goto LAB_0896ea74;
        break;
      }
      iVar4 = iVar4 - *(int *)(iVar9 + 8);
      puVar2 = (undefined4 *)ogg_buffer_pretruncate(iVar9,*(int *)(iVar9 + 8));
      *(undefined4 **)(param_1 + 8) = puVar2;
    } while (puVar2 != (undefined4 *)0x0);
  }
  *(undefined4 *)(param_1 + 4) = 0;
LAB_0896ea74:
  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + iVar4;
  return iVar4;
}



----------------------------------------

// Function: ogg_sync_pageout @ 0896eb58

undefined4 ogg_sync_pageout(int param_1,undefined4 param_2)

{
  int iVar1;
  
  while( true ) {
    iVar1 = ogg_sync_pageseek(param_1,param_2);
    if (0 < iVar1) {
      return 1;
    }
    if (iVar1 == 0) break;
    if (*(int *)(param_1 + 0x10) == 0) {
      *(undefined4 *)(param_1 + 0x10) = 1;
      return 0xfffffff6;
    }
  }
  return 0;
}



----------------------------------------

// Function: ogg_buffer_alloc @ 0896ebcc

void ogg_buffer_alloc(undefined4 *param_1,size_t param_2)

{
  int iVar1;
  undefined4 *puVar2;
  void *pvVar3;
  undefined4 *puVar4;
  
  puVar4 = (undefined4 *)*param_1;
  param_1[2] = param_1[2] + 1;
  if (puVar4 == (undefined4 *)0x0) {
    puVar4 = malloc(0x10);
    pvVar3 = malloc(param_2 + 0x10);
    *puVar4 = pvVar3;
    puVar4[1] = param_2;
  }
  else {
    iVar1 = puVar4[1];
    *param_1 = puVar4[3];
    if (iVar1 < (int)param_2) {
      pvVar3 = realloc((void *)*puVar4,param_2);
      *puVar4 = pvVar3;
      puVar4[1] = param_2;
      puVar4[3] = param_1;
      puVar4[2] = 1;
      puVar2 = (undefined4 *)_fetch_ref(param_1);
      *puVar2 = puVar4;
      return;
    }
  }
  puVar4[3] = param_1;
  puVar4[2] = 1;
  puVar2 = (undefined4 *)_fetch_ref(param_1);
  *puVar2 = puVar4;
  return;
}



----------------------------------------

// Function: ogg_sync_bufferin @ 0896eca8

int ogg_sync_bufferin(undefined4 *param_1,size_t param_2)

{
  void *pvVar1;
  undefined4 *puVar2;
  int iVar3;
  int *piVar4;
  
  puVar2 = (undefined4 *)param_1[1];
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)ogg_buffer_alloc(*param_1);
    piVar4 = (int *)*puVar2;
    param_1[1] = puVar2;
    param_1[2] = puVar2;
    iVar3 = *piVar4;
  }
  else {
    piVar4 = (int *)*puVar2;
    iVar3 = puVar2[2];
    if ((piVar4[1] - iVar3) - puVar2[1] < (int)param_2) {
      if (iVar3 == 0) {
        if (piVar4[1] < (int)param_2) {
          pvVar1 = realloc((void *)*piVar4,param_2);
          puVar2 = (undefined4 *)param_1[1];
          piVar4[1] = param_2;
          *piVar4 = (int)pvVar1;
        }
        return *(int *)*puVar2 + puVar2[1];
      }
      puVar2 = (undefined4 *)ogg_buffer_alloc(*param_1);
      piVar4 = (int *)*puVar2;
      *(undefined4 **)(param_1[1] + 0xc) = puVar2;
      param_1[1] = puVar2;
      return *piVar4;
    }
    iVar3 = iVar3 + *piVar4 + puVar2[1];
  }
  return iVar3;
}



----------------------------------------

// Function: vorbis_synthesis_restart @ 0896edb0

/* WARNING: Removing unreachable block (ram,0x0896edf4) */

undefined4 vorbis_synthesis_restart(int param_1)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  
  iVar2 = *(int *)(param_1 + 0x48);
  uVar3 = 0xffffffff;
  if (((iVar2 != 0) && (*(int *)(param_1 + 4) != 0)) &&
     (iVar1 = *(int *)(*(int *)(param_1 + 4) + 0x1c), iVar1 != 0)) {
    iVar1 = *(int *)(iVar1 + 4);
    uVar3 = 0;
    *(undefined4 *)(param_1 + 0x40) = 0xffffffff;
    iVar1 = iVar1 / 2;
    *(undefined4 *)(param_1 + 0x44) = 0xffffffff;
    *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
    *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
    *(undefined4 *)(param_1 + 0x18) = 0xffffffff;
    *(undefined4 *)(iVar2 + 0x10) = 0xffffffff;
    *(undefined4 *)(iVar2 + 0x14) = 0xffffffff;
    *(int *)(param_1 + 0x14) = iVar1;
    *(int *)(param_1 + 0x30) = iVar1;
  }
  return uVar3;
}



----------------------------------------

// Function: vorbis_synthesis_blockin @ 0896ee24

/* WARNING: Removing unreachable block (ram,0x0896f154) */
/* WARNING: Removing unreachable block (ram,0x0896f0e4) */
/* WARNING: Removing unreachable block (ram,0x0896f080) */
/* WARNING: Removing unreachable block (ram,0x0896ef4c) */
/* WARNING: Removing unreachable block (ram,0x0896ef10) */
/* WARNING: Removing unreachable block (ram,0x0896ef00) */
/* WARNING: Removing unreachable block (ram,0x0896ef20) */
/* WARNING: Removing unreachable block (ram,0x0896ef88) */
/* WARNING: Removing unreachable block (ram,0x0896f098) */
/* WARNING: Removing unreachable block (ram,0x0896f0f4) */
/* WARNING: Removing unreachable block (ram,0x0896f168) */

undefined4 vorbis_synthesis_blockin(int param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  int *piVar3;
  undefined4 *puVar4;
  undefined4 uVar5;
  int *piVar6;
  int iVar7;
  int iVar8;
  uint uVar9;
  uint uVar10;
  int *piVar11;
  undefined4 *puVar12;
  int *piVar13;
  int iVar14;
  int iVar15;
  int *piVar16;
  int iVar17;
  int iVar18;
  int *piVar19;
  int iVar20;
  int iVar21;
  int iVar22;
  int iVar23;
  int iVar24;
  int iVar25;
  int iVar26;
  int iVar27;
  int local_40;
  int local_3c;
  
  iVar14 = *(int *)(param_1 + 0x18);
  iVar17 = *(int *)(param_1 + 4);
  piVar19 = *(int **)(iVar17 + 0x1c);
  iVar22 = *(int *)(param_1 + 0x48);
  if ((iVar14 < *(int *)(param_1 + 0x14)) && (iVar14 != -1)) {
    return 0xffffff7d;
  }
  uVar10 = *(uint *)(param_1 + 0x40);
  *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)(param_1 + 0x28);
  iVar21 = param_2[8];
  *(undefined4 *)(param_1 + 0x2c) = 0xffffffff;
  *(int *)(param_1 + 0x28) = iVar21;
  if (uVar10 == 0xffffffff) {
    if ((*(int *)(param_1 + 0x44) != -1) && (param_2[0x10] == 0)) goto LAB_0896f364;
LAB_0896eeac:
    *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
    *(undefined4 *)(param_1 + 0x3c) = 0xffffffff;
    *(undefined4 *)(iVar22 + 0x10) = 0xffffffff;
    *(undefined4 *)(iVar22 + 0x14) = 0xffffffff;
    uVar1 = param_2[0x10];
  }
  else {
    if (param_2[0x10] != uVar10 + 1) goto LAB_0896eeac;
LAB_0896f364:
    if (param_2[0x11] != (uint)(uVar10 + 1 < uVar10) + *(int *)(param_1 + 0x44)) goto LAB_0896eeac;
    uVar1 = param_2[0x10];
  }
  uVar5 = param_2[0x11];
  piVar11 = (int *)*param_2;
  *(undefined4 *)(param_1 + 0x40) = uVar1;
  *(undefined4 *)(param_1 + 0x44) = uVar5;
  if (piVar11 != (int *)0x0) {
    iVar2 = *(int *)(param_1 + 0x30);
    iVar23 = piVar19[1] / 2;
    iVar24 = piVar19[iVar21] / 2;
    iVar25 = *piVar19 / 2;
    if (iVar2 == 0) {
      local_3c = 0;
      local_40 = iVar23;
    }
    else {
      local_40 = 0;
      local_3c = iVar23;
    }
    if (0 < *(int *)(iVar17 + 4)) {
      iVar26 = iVar23 / 2;
      iVar14 = *(int *)(param_1 + 0x24);
      piVar16 = *(int **)(param_1 + 8);
      iVar18 = local_40 * 4;
      iVar20 = 0;
      iVar27 = iVar25 / 2;
      do {
        if (iVar14 == 0) {
          if (iVar21 == 0) {
            piVar6 = (int *)*piVar11;
            piVar3 = (int *)(iVar18 + *piVar16);
            if (iVar25 < 1) goto LAB_0896efec;
            iVar15 = 0;
            do {
              iVar7 = *piVar6;
              iVar15 = iVar15 + 1;
              piVar6 = piVar6 + 1;
              *piVar3 = *piVar3 + iVar7;
              piVar3 = piVar3 + 1;
            } while (iVar25 != iVar15);
            iVar15 = *piVar16;
          }
          else {
            iVar15 = *piVar16;
            piVar3 = (int *)(iVar26 * 4 + *piVar11 + iVar27 * -4);
            if (iVar25 < 1) {
              iVar7 = 0;
            }
            else {
              iVar7 = 0;
              piVar6 = (int *)(iVar18 + iVar15);
              piVar13 = piVar3;
              do {
                iVar8 = *piVar13;
                iVar7 = iVar7 + 1;
                piVar13 = piVar13 + 1;
                *piVar6 = *piVar6 + iVar8;
                piVar6 = piVar6 + 1;
              } while (iVar25 != iVar7);
            }
            iVar8 = 0;
            if (iVar26 + iVar27 <= iVar7) goto LAB_0896efec;
            piVar6 = (int *)(iVar18 + iVar15) + iVar7;
            piVar3 = piVar3 + iVar7;
            do {
              iVar15 = *piVar3;
              iVar8 = iVar8 + 1;
              piVar3 = piVar3 + 1;
              *piVar6 = iVar15;
              piVar6 = piVar6 + 1;
            } while (iVar8 != (iVar26 + iVar27) - iVar7);
            iVar15 = *piVar16;
          }
        }
        else {
          if (iVar21 == 0) {
            piVar6 = (int *)*piVar11;
            piVar3 = (int *)((iVar26 + local_40) * 4 + *piVar16 + iVar27 * -4);
            if (0 < iVar25) {
              iVar15 = 0;
              do {
                iVar7 = *piVar6;
                iVar15 = iVar15 + 1;
                piVar6 = piVar6 + 1;
                *piVar3 = *piVar3 + iVar7;
                piVar3 = piVar3 + 1;
              } while (iVar25 != iVar15);
              iVar15 = *piVar16;
              goto LAB_0896eff0;
            }
          }
          else {
            piVar6 = (int *)*piVar11;
            piVar3 = (int *)(iVar18 + *piVar16);
            if (0 < iVar23) {
              iVar15 = 0;
              do {
                iVar7 = *piVar6;
                iVar15 = iVar15 + 1;
                piVar6 = piVar6 + 1;
                *piVar3 = *piVar3 + iVar7;
                piVar3 = piVar3 + 1;
              } while (iVar23 != iVar15);
            }
          }
LAB_0896efec:
          iVar15 = *piVar16;
        }
LAB_0896eff0:
        puVar12 = (undefined4 *)(local_3c * 4 + iVar15);
        puVar4 = (undefined4 *)(iVar24 * 4 + *piVar11);
        if (0 < iVar24) {
          iVar15 = 0;
          do {
            uVar1 = *puVar4;
            iVar15 = iVar15 + 1;
            puVar4 = puVar4 + 1;
            *puVar12 = uVar1;
            puVar12 = puVar12 + 1;
          } while (iVar24 != iVar15);
        }
        iVar20 = iVar20 + 1;
        piVar16 = piVar16 + 1;
        piVar11 = piVar11 + 1;
      } while (iVar20 < *(int *)(iVar17 + 4));
      iVar14 = *(int *)(param_1 + 0x18);
    }
    iVar17 = 0;
    if (iVar2 == 0) {
      iVar17 = iVar23;
    }
    *(int *)(param_1 + 0x30) = iVar17;
    if (iVar14 == -1) {
      *(int *)(param_1 + 0x14) = local_3c;
      *(int *)(param_1 + 0x18) = local_3c;
    }
    else {
      iVar14 = piVar19[*(int *)(param_1 + 0x24)];
      iVar17 = piVar19[iVar21];
      *(int *)(param_1 + 0x18) = local_40;
      *(int *)(param_1 + 0x14) = local_40 + iVar14 / 4 + iVar17 / 4;
    }
  }
  uVar10 = *(uint *)(iVar22 + 0x10);
  if (uVar10 == 0xffffffff) {
    if (*(int *)(iVar22 + 0x14) != -1) {
      iVar14 = *(int *)(param_1 + 0x24);
      goto LAB_0896f0c0;
    }
    *(undefined4 *)(iVar22 + 0x10) = 0;
    *(undefined4 *)(iVar22 + 0x14) = 0;
  }
  else {
    iVar14 = *(int *)(param_1 + 0x24);
LAB_0896f0c0:
    iVar14 = piVar19[iVar14] / 4 + piVar19[iVar21] / 4;
    uVar9 = uVar10 + iVar14;
    *(uint *)(iVar22 + 0x10) = uVar9;
    *(uint *)(iVar22 + 0x14) = (uint)(uVar9 < uVar10) + *(int *)(iVar22 + 0x14) + (iVar14 >> 0x1f);
  }
  uVar10 = *(uint *)(param_1 + 0x38);
  if (uVar10 == 0xffffffff) {
    if (*(int *)(param_1 + 0x3c) != -1) {
      iVar14 = *(int *)(param_1 + 0x24);
      goto LAB_0896f130;
    }
    uVar10 = param_2[0xe];
    iVar14 = param_2[0xf];
    if (uVar10 == 0xffffffff) {
      if (iVar14 == -1) {
        iVar14 = param_2[0xc];
        goto LAB_0896f1c4;
      }
      *(undefined4 *)(param_1 + 0x38) = 0xffffffff;
    }
    else {
      *(uint *)(param_1 + 0x38) = uVar10;
    }
    *(int *)(param_1 + 0x3c) = iVar14;
    uVar9 = *(uint *)(iVar22 + 0x10);
    if (*(int *)(iVar22 + 0x14) <= iVar14) {
      if (iVar14 != *(int *)(iVar22 + 0x14)) {
        iVar14 = param_2[0xc];
        goto LAB_0896f1c4;
      }
      if (uVar9 <= uVar10) {
        iVar14 = param_2[0xc];
        goto LAB_0896f1c4;
      }
    }
    if (param_2[0xc] != 0) {
      *(uint *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) - (uVar9 - uVar10);
      iVar14 = param_2[0xc];
      goto LAB_0896f1c4;
    }
    iVar14 = (uVar9 - uVar10) + *(int *)(param_1 + 0x18);
    *(int *)(param_1 + 0x18) = iVar14;
    if (*(int *)(param_1 + 0x14) < iVar14) {
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x14);
      iVar14 = param_2[0xc];
      goto LAB_0896f1c4;
    }
  }
  else {
    iVar14 = *(int *)(param_1 + 0x24);
LAB_0896f130:
    iVar14 = piVar19[iVar14] / 4 + piVar19[iVar21] / 4;
    uVar9 = uVar10 + iVar14;
    iVar14 = (uint)(uVar9 < uVar10) + *(int *)(param_1 + 0x3c) + (iVar14 >> 0x1f);
    *(uint *)(param_1 + 0x38) = uVar9;
    *(int *)(param_1 + 0x3c) = iVar14;
    uVar10 = param_2[0xe];
    iVar17 = param_2[0xf];
    if ((uVar10 != 0xffffffff) || (iVar17 != -1)) {
      if ((uVar10 == uVar9) && (iVar17 == iVar14)) {
        iVar14 = param_2[0xc];
        goto LAB_0896f1c4;
      }
      if (iVar17 < iVar14) {
LAB_0896f1ac:
        iVar14 = param_2[0xc];
        if (uVar9 - uVar10 != 0) {
          if (iVar14 == 0) {
            *(uint *)(param_1 + 0x38) = uVar10;
            *(int *)(param_1 + 0x3c) = iVar17;
          }
          else {
            *(uint *)(param_1 + 0x38) = uVar10;
            *(int *)(param_1 + 0x3c) = iVar17;
            *(uint *)(param_1 + 0x14) = *(int *)(param_1 + 0x14) - (uVar9 - uVar10);
            iVar14 = param_2[0xc];
          }
          goto LAB_0896f1c4;
        }
      }
      else if (iVar17 == iVar14) {
        if (uVar10 < uVar9) goto LAB_0896f1ac;
        iVar14 = param_2[0xc];
      }
      else {
        iVar14 = param_2[0xc];
      }
      *(uint *)(param_1 + 0x38) = uVar10;
      *(int *)(param_1 + 0x3c) = iVar17;
      goto LAB_0896f1c4;
    }
  }
  iVar14 = param_2[0xc];
LAB_0896f1c4:
  if (iVar14 != 0) {
    *(undefined4 *)(param_1 + 0x20) = 1;
  }
  return 0;
}



----------------------------------------

// Function: vorbis_synthesis_pcmout @ 0896f490

int vorbis_synthesis_pcmout(int param_1,undefined4 *param_2)

{
  int iVar1;
  int *piVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int *piVar7;
  int iVar8;
  
  iVar6 = *(int *)(param_1 + 0x18);
  if ((-1 < iVar6) && (iVar8 = *(int *)(param_1 + 0x14), iVar6 < iVar8)) {
    if (param_2 != (undefined4 *)0x0) {
      iVar5 = *(int *)(*(int *)(param_1 + 4) + 4);
      if (iVar5 < 1) {
        *param_2 = *(undefined4 *)(param_1 + 0xc);
      }
      else {
        piVar7 = *(int **)(param_1 + 0xc);
        piVar3 = *(int **)(param_1 + 8);
        iVar4 = 0;
        piVar2 = piVar7;
        do {
          iVar1 = *piVar3;
          iVar4 = iVar4 + 1;
          piVar3 = piVar3 + 1;
          *piVar2 = iVar1 + iVar6 * 4;
          piVar2 = piVar2 + 1;
        } while (iVar4 != iVar5);
        *param_2 = piVar7;
      }
    }
    return iVar8 - iVar6;
  }
  return 0;
}



----------------------------------------

// Function: vorbis_synthesis_read @ 0896f50c

undefined4 vorbis_synthesis_read(int param_1,int param_2)

{
  undefined4 uVar1;
  
  if ((param_2 == 0) ||
     (uVar1 = 0xffffff7d, param_2 + *(int *)(param_1 + 0x18) <= *(int *)(param_1 + 0x14))) {
    *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + param_2;
    uVar1 = 0;
  }
  return uVar1;
}



----------------------------------------

// Function: vorbis_dsp_clear @ 0896f544

void vorbis_dsp_clear(void *param_1)

{
  int iVar1;
  int iVar2;
  void *aptr;
  int iVar3;
  int iVar4;
  void *aptr_00;
  int iVar5;
  
  if (param_1 != (void *)0x0) {
    iVar4 = *(int *)((int)param_1 + 4);
    iVar5 = 0;
    if (iVar4 != 0) {
      iVar5 = *(int *)(iVar4 + 0x1c);
    }
    aptr = *(void **)((int)param_1 + 8);
    aptr_00 = *(void **)((int)param_1 + 0x48);
    if (aptr != (void *)0x0) {
      iVar2 = *(int *)(iVar4 + 4);
      if (0 < iVar2) {
        iVar3 = 0;
        iVar1 = 0;
        do {
          iVar3 = iVar3 + 1;
          if (*(void **)(iVar1 + (int)aptr) != (void *)0x0) {
            free(*(void **)(iVar1 + (int)aptr));
            aptr = *(void **)((int)param_1 + 8);
            iVar2 = *(int *)(iVar4 + 4);
          }
          iVar1 = iVar3 * 4;
        } while (iVar3 < iVar2);
      }
      free(aptr);
      if (*(void **)((int)param_1 + 0xc) != (void *)0x0) {
        free(*(void **)((int)param_1 + 0xc));
      }
    }
    if ((iVar5 != 0) && (iVar4 = *(int *)(iVar5 + 8), 0 < iVar4)) {
      iVar1 = 0;
      iVar2 = 0;
      do {
        iVar1 = iVar1 + 1;
        if (aptr_00 != (void *)0x0) {
          if (*(int *)((int)aptr_00 + 0xc) != 0) {
            (**(code **)((&_mapping_P)
                         [*(int *)(*(int *)(*(int *)(iVar2 + iVar5 + 0x20) + 0xc) * 4 + iVar5 +
                                  0x120)] + 0xc))
                      (*(undefined4 *)(*(int *)((int)aptr_00 + 0xc) + iVar2));
            iVar4 = *(int *)(iVar5 + 8);
          }
        }
        iVar2 = iVar2 + 4;
      } while (iVar1 < iVar4);
    }
    if (aptr_00 != (void *)0x0) {
      if (*(void **)((int)aptr_00 + 0xc) != (void *)0x0) {
        free(*(void **)((int)aptr_00 + 0xc));
      }
      free(aptr_00);
    }
    memset(param_1,0,0x50);
    return;
  }
  return;
}



----------------------------------------

// Function: vorbis_block_init @ 0896f6d4

undefined4 vorbis_block_init(undefined4 param_1,void *param_2)

{
  memset(param_2,0,0x60);
  *(undefined4 *)((int)param_2 + 0x48) = param_1;
  *(undefined4 *)((int)param_2 + 0x4c) = 0;
  *(undefined4 *)((int)param_2 + 0x54) = 0;
  return 0;
}



----------------------------------------

// Function: vorbis_synthesis_init @ 0896f720

/* WARNING: Removing unreachable block (ram,0x0896f7a8) */
/* WARNING: Removing unreachable block (ram,0x0896f7cc) */

undefined4 vorbis_synthesis_init(void *param_1,int param_2)

{
  undefined4 *puVar1;
  int iVar2;
  uint uVar3;
  undefined4 uVar4;
  void *pvVar5;
  int iVar6;
  int iVar7;
  size_t n;
  int iVar8;
  undefined4 *puVar9;
  int *piVar10;
  int *piVar11;
  
  piVar11 = *(int **)(param_2 + 0x1c);
  memset(param_1,0,0x50);
  puVar1 = calloc(1,0x18);
  iVar2 = piVar11[2];
  *(undefined4 **)((int)param_1 + 0x48) = puVar1;
  *(int *)((int)param_1 + 4) = param_2;
  if (iVar2 == 0) {
    iVar6 = 0;
  }
  else {
    iVar6 = 0;
    for (uVar3 = iVar2 - 1; uVar3 != 0; uVar3 = uVar3 >> 1) {
      iVar6 = iVar6 + 1;
    }
  }
  iVar2 = *piVar11;
  puVar1[2] = iVar6;
  uVar4 = _vorbis_window(0,iVar2 / 2);
  iVar2 = piVar11[1];
  *puVar1 = uVar4;
  uVar4 = _vorbis_window(0,iVar2 / 2);
  iVar2 = piVar11[0x308];
  puVar1[1] = uVar4;
  if (iVar2 == 0) {
    pvVar5 = calloc(piVar11[7],0x34);
    piVar11[0x308] = (int)pvVar5;
    if (0 < piVar11[7]) {
      iVar2 = 0;
      piVar10 = piVar11;
      do {
        iVar6 = iVar2 * 0x34;
        iVar2 = iVar2 + 1;
        vorbis_book_init_decode(iVar6 + piVar11[0x308],piVar10[0x208]);
        vorbis_staticbook_destroy(piVar10[0x208]);
        iVar6 = piVar11[7];
        piVar10[0x208] = 0;
        piVar10 = piVar10 + 1;
      } while (iVar2 < iVar6);
      iVar2 = piVar11[1];
      goto LAB_0896f7e8;
    }
  }
  iVar2 = piVar11[1];
LAB_0896f7e8:
  *(int *)((int)param_1 + 0x10) = iVar2;
  pvVar5 = malloc(*(int *)(param_2 + 4) << 2);
  iVar2 = *(int *)(param_2 + 4);
  *(void **)((int)param_1 + 8) = pvVar5;
  pvVar5 = malloc(iVar2 << 2);
  iVar2 = *(int *)(param_2 + 4);
  *(void **)((int)param_1 + 0xc) = pvVar5;
  if (0 < iVar2) {
    iVar2 = 0;
    do {
      iVar6 = *(int *)((int)param_1 + 8);
      iVar8 = iVar2 * 4;
      pvVar5 = calloc(*(size_t *)((int)param_1 + 0x10),4);
      iVar7 = *(int *)(param_2 + 4);
      iVar2 = iVar2 + 1;
      *(void **)(iVar8 + iVar6) = pvVar5;
    } while (iVar2 < iVar7);
  }
  n = piVar11[2];
  *(undefined4 *)((int)param_1 + 0x24) = 0;
  *(undefined4 *)((int)param_1 + 0x28) = 0;
  pvVar5 = calloc(n,4);
  iVar2 = piVar11[2];
  puVar1[3] = pvVar5;
  if (0 < iVar2) {
    iVar6 = 0;
    iVar2 = 0;
    do {
      iVar8 = *(int *)((int)piVar11 + iVar2 + 0x20);
      iVar7 = *(int *)(iVar8 + 0xc);
      iVar6 = iVar6 + 1;
      puVar9 = (undefined4 *)(iVar2 + puVar1[3]);
      iVar2 = iVar2 + 4;
      uVar4 = (**(code **)((&_mapping_P)[piVar11[iVar7 + 0x48]] + 4))
                        (param_1,iVar8,piVar11[iVar7 + 0x88]);
      iVar7 = piVar11[2];
      *puVar9 = uVar4;
    } while (iVar6 < iVar7);
  }
  vorbis_synthesis_restart(param_1);
  return 0;
}



----------------------------------------

// Function: _vorbis_block_alloc @ 0896f968

int _vorbis_block_alloc(int param_1,int param_2)

{
  undefined4 *puVar1;
  void *pvVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  undefined4 uVar6;
  uint nbytes;
  
  iVar5 = *(int *)(param_1 + 0x50);
  nbytes = param_2 + 7U & 0xfffffff8;
  uVar3 = nbytes + iVar5;
  if (*(int *)(param_1 + 0x54) < (int)(nbytes + iVar5)) {
    if (*(int *)(param_1 + 0x4c) != 0) {
      puVar1 = malloc(8);
      iVar5 = *(int *)(param_1 + 0x58);
      iVar4 = *(int *)(param_1 + 0x50);
      uVar6 = *(undefined4 *)(param_1 + 0x4c);
      puVar1[1] = *(undefined4 *)(param_1 + 0x5c);
      *(int *)(param_1 + 0x58) = iVar5 + iVar4;
      *puVar1 = uVar6;
      *(undefined4 **)(param_1 + 0x5c) = puVar1;
    }
    *(uint *)(param_1 + 0x54) = nbytes;
    pvVar2 = malloc(nbytes);
    *(void **)(param_1 + 0x4c) = pvVar2;
    *(undefined4 *)(param_1 + 0x50) = 0;
    iVar5 = 0;
    uVar3 = nbytes;
  }
  *(uint *)(param_1 + 0x50) = uVar3;
  return iVar5 + *(int *)(param_1 + 0x4c);
}



----------------------------------------

// Function: _vorbis_block_ripcord @ 0896fa14

void _vorbis_block_ripcord(int param_1)

{
  undefined4 *aptr;
  void *pvVar1;
  int iVar2;
  undefined4 *puVar3;
  
  aptr = *(undefined4 **)(param_1 + 0x5c);
  while (aptr != (undefined4 *)0x0) {
    puVar3 = (undefined4 *)aptr[1];
    free((void *)*aptr);
    *aptr = 0;
    aptr[1] = 0;
    free(aptr);
    aptr = puVar3;
  }
  if (*(int *)(param_1 + 0x58) == 0) {
    *(undefined4 *)(param_1 + 0x5c) = 0;
  }
  else {
    pvVar1 = realloc(*(void **)(param_1 + 0x4c),*(int *)(param_1 + 0x58) + *(int *)(param_1 + 0x54))
    ;
    iVar2 = *(int *)(param_1 + 0x58);
    *(void **)(param_1 + 0x4c) = pvVar1;
    *(undefined4 *)(param_1 + 0x58) = 0;
    *(int *)(param_1 + 0x54) = *(int *)(param_1 + 0x54) + iVar2;
    *(undefined4 *)(param_1 + 0x5c) = 0;
  }
  *(undefined4 *)(param_1 + 0x50) = 0;
  return;
}



----------------------------------------

// Function: vorbis_block_clear @ 0896faac

undefined4 vorbis_block_clear(void *param_1)

{
  _vorbis_block_ripcord();
  if (*(void **)((int)param_1 + 0x4c) != (void *)0x0) {
    free(*(void **)((int)param_1 + 0x4c));
  }
  memset(param_1,0,0x60);
  return 0;
}



----------------------------------------

// Function: _vorbis_window @ 0896faf8

undefined1 * _vorbis_window(int param_1,int param_2)

{
  if (param_1 == 0) {
    if (param_2 == 0x100) {
      return vwin512;
    }
    if (param_2 < 0x101) {
      if (param_2 == 0x40) {
        return vwin128;
      }
      if (param_2 == 0x80) {
        return vwin256;
      }
      if (param_2 == 0x20) {
        return vwin64;
      }
    }
    else {
      if (param_2 == 0x400) {
        return vwin2048;
      }
      if (param_2 < 0x401) {
        if (param_2 == 0x200) {
          return vwin1024;
        }
      }
      else {
        if (param_2 == 0x800) {
          return vwin4096;
        }
        if (param_2 == 0x1000) {
          return vwin8192;
        }
      }
    }
  }
  return (undefined1 *)0x0;
}



----------------------------------------

// Function: _vorbis_apply_window @ 0896fbc0

/* WARNING: Removing unreachable block (ram,0x0896fc58) */
/* WARNING: Removing unreachable block (ram,0x0896fc30) */
/* WARNING: Removing unreachable block (ram,0x0896fbdc) */
/* WARNING: Removing unreachable block (ram,0x0896fc1c) */
/* WARNING: Removing unreachable block (ram,0x0896fc44) */
/* WARNING: Removing unreachable block (ram,0x0896fc6c) */

void _vorbis_apply_window(undefined4 *param_1,int *param_2,int param_3,int param_4)

{
  undefined4 *puVar1;
  byte *pbVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  int in_t0;
  int iVar6;
  int in_t1;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int local_8 [2];
  
  iVar11 = *(int *)(in_t0 * 4 + param_3);
  iVar5 = *(int *)(param_4 * 4 + param_3);
  iVar6 = *(int *)(in_t1 * 4 + param_3);
  local_8[0] = *param_2;
  local_8[1] = param_2[1];
  iVar10 = (iVar11 / 4 + iVar11 / 2) - iVar6 / 4;
  iVar8 = iVar11 / 4 - iVar5 / 4;
  iVar6 = iVar6 / 2;
  iVar9 = iVar10 + iVar6;
  iVar5 = iVar8 + iVar5 / 2;
  if (iVar8 < 1) {
    iVar3 = 0;
  }
  else {
    iVar3 = 0;
    puVar1 = param_1;
    do {
      iVar3 = iVar3 + 1;
      *puVar1 = 0;
      puVar1 = puVar1 + 1;
    } while (iVar3 != iVar8);
  }
  if (iVar3 < iVar5) {
    iVar8 = local_8[param_4];
    iVar7 = 0;
    piVar4 = param_1 + iVar3;
    do {
      pbVar2 = (byte *)(iVar8 + iVar7);
      iVar7 = iVar7 + 1;
      *piVar4 = (uint)*pbVar2 * (*piVar4 >> 8);
      piVar4 = piVar4 + 1;
    } while (iVar7 != iVar5 - iVar3);
  }
  if (iVar10 < iVar9) {
    piVar4 = param_1 + iVar10;
    iVar6 = iVar6 + local_8[in_t1];
    do {
      pbVar2 = (byte *)(iVar6 + -1);
      iVar10 = iVar10 + 1;
      iVar6 = iVar6 + -1;
      *piVar4 = (uint)*pbVar2 * (*piVar4 >> 8);
      piVar4 = piVar4 + 1;
    } while (iVar10 < iVar9);
  }
  if (iVar10 < iVar11) {
    param_1 = param_1 + iVar10;
    iVar5 = 0;
    do {
      iVar5 = iVar5 + 1;
      *param_1 = 0;
      param_1 = param_1 + 1;
    } while (iVar5 != iVar11 - iVar10);
  }
  return;
}



----------------------------------------

// Function: vorbis_packet_blocksize @ 0896fd6c

undefined4 vorbis_packet_blocksize(int param_1,undefined4 *param_2)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int iVar4;
  undefined1 auStack_20 [24];
  
  iVar4 = *(int *)(param_1 + 0x1c);
  oggpack_readinit(auStack_20,*param_2);
  iVar1 = oggpack_read(auStack_20,1);
  uVar2 = 0xffffff79;
  if (iVar1 == 0) {
    iVar3 = 0;
    for (iVar1 = *(int *)(iVar4 + 8); 1 < iVar1; iVar1 = iVar1 >> 1) {
      iVar3 = iVar3 + 1;
    }
    iVar1 = oggpack_read(auStack_20,iVar3);
    if (iVar1 == -1) {
      uVar2 = 0xffffff78;
    }
    else {
      uVar2 = *(undefined4 *)(**(int **)(iVar1 * 4 + iVar4 + 0x20) * 4 + iVar4);
    }
  }
  return uVar2;
}



----------------------------------------

// Function: vorbis_synthesis @ 0896fe04

undefined4 vorbis_synthesis(int *param_1,undefined4 *param_2,int param_3)

{
  int iVar1;
  uint uVar2;
  undefined4 uVar3;
  int *piVar4;
  int iVar5;
  uint uVar6;
  int iVar7;
  int *piVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  
  piVar8 = param_1 + 1;
  iVar10 = *(int *)(param_1[0x12] + 4);
  iVar12 = *(int *)(param_1[0x12] + 0x48);
  iVar11 = *(int *)(iVar10 + 0x1c);
  _vorbis_block_ripcord();
  oggpack_readinit(piVar8,*param_2);
  iVar1 = oggpack_read(piVar8,1);
  if (iVar1 != 0) {
    return 0xffffff79;
  }
  iVar1 = oggpack_read(piVar8,*(undefined4 *)(iVar12 + 8));
  if (iVar1 == -1) {
LAB_08970024:
    uVar3 = 0xffffff78;
  }
  else {
    iVar13 = iVar1 * 4;
    piVar4 = *(int **)(iVar13 + iVar11 + 0x20);
    param_1[0xb] = iVar1;
    iVar1 = *piVar4;
    param_1[8] = iVar1;
    if (iVar1 == 0) {
      param_1[7] = 0;
      param_1[9] = 0;
    }
    else {
      iVar1 = oggpack_read(piVar8,1);
      param_1[7] = iVar1;
      iVar1 = oggpack_read(piVar8,1);
      param_1[9] = iVar1;
      if (iVar1 == -1) goto LAB_08970024;
    }
    iVar1 = param_2[5];
    iVar7 = param_2[3];
    param_1[0xe] = param_2[4];
    param_1[0xf] = iVar1;
    uVar6 = param_2[6];
    iVar1 = param_2[7];
    param_1[0xc] = iVar7;
    uVar2 = uVar6 - 3;
    param_1[0x10] = uVar2;
    param_1[0x11] = (uint)(uVar2 < uVar6) + iVar1 + -1;
    if (param_3 != 0) {
      param_1[10] = *(int *)(param_1[8] * 4 + iVar11);
      iVar1 = _vorbis_block_alloc(param_1,*(int *)(iVar10 + 4) << 2);
      iVar7 = *(int *)(iVar10 + 4);
      *param_1 = iVar1;
      if (0 < iVar7) {
        iVar1 = 0;
        do {
          iVar7 = *param_1;
          iVar9 = iVar1 * 4;
          uVar3 = _vorbis_block_alloc(param_1,param_1[10] << 2);
          iVar5 = *(int *)(iVar10 + 4);
          iVar1 = iVar1 + 1;
          *(undefined4 *)(iVar9 + iVar7) = uVar3;
        } while (iVar1 < iVar5);
      }
                    /* WARNING: Could not recover jumptable at 0x0896fff8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      uVar3 = (**(code **)((&_mapping_P)
                           [*(int *)(*(int *)(*(int *)(iVar13 + iVar11 + 0x20) + 0xc) * 4 + iVar11 +
                                    0x120)] + 0x10))
                        (param_1,*(undefined4 *)(iVar13 + *(int *)(iVar12 + 0xc)));
      return uVar3;
    }
    uVar3 = 0;
    *param_1 = 0;
    param_1[10] = 0;
  }
  return uVar3;
}



----------------------------------------

// Function: tagcompare @ 0897002c

undefined4 tagcompare(char *param_1,int param_2,int param_3)

{
  char *pcVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
  iVar4 = 0;
  pcVar1 = param_1;
  if (0 < param_3) {
    while( true ) {
      iVar3 = (int)*pcVar1;
      pcVar1 = (char *)(param_2 + iVar4);
      iVar4 = iVar4 + 1;
      if ((__ctype_ptr[iVar3] & 2U) != 0) {
        iVar3 = iVar3 + -0x20;
      }
      iVar2 = (int)*pcVar1;
      if ((__ctype_ptr[iVar2] & 2U) != 0) {
        iVar2 = iVar2 + -0x20;
      }
      if (iVar3 != iVar2) {
        return 1;
      }
      if (param_3 == iVar4) break;
      pcVar1 = param_1 + iVar4;
    }
  }
  return 0;
}



----------------------------------------

// Function: vorbis_info_blocksize @ 08970098

undefined4 vorbis_info_blocksize(int param_1,int param_2)

{
  undefined4 uVar1;
  
  uVar1 = 0xffffffff;
  if (*(int *)(param_1 + 0x1c) != 0) {
    uVar1 = *(undefined4 *)(param_2 * 4 + *(int *)(param_1 + 0x1c));
  }
  return uVar1;
}



----------------------------------------

// Function: _v_readstring @ 089700b8

void _v_readstring(undefined4 param_1,undefined1 *param_2,int param_3)

{
  undefined1 uVar1;
  undefined1 *puVar2;
  
  if (param_3 != 0) {
    puVar2 = param_2 + param_3;
    do {
      uVar1 = oggpack_read(param_1,8);
      *param_2 = uVar1;
      param_2 = param_2 + 1;
    } while (param_2 != puVar2);
  }
  return;
}



----------------------------------------

// Function: vorbis_comment_init @ 08970118

void vorbis_comment_init(undefined4 *param_1)

{
  param_1[3] = 0;
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  return;
}



----------------------------------------

// Function: vorbis_info_init @ 0897012c

void vorbis_info_init(undefined4 *param_1)

{
  void *pvVar1;
  
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  pvVar1 = calloc(1,0xca8);
  param_1[7] = pvVar1;
  return;
}



----------------------------------------

// Function: vorbis_comment_clear @ 0897017c

void vorbis_comment_clear(int *param_1)

{
  int iVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  
  if (param_1 != (int *)0x0) {
    iVar3 = param_1[2];
    pvVar2 = (void *)*param_1;
    if (0 < iVar3) {
      iVar4 = 0;
      iVar1 = 0;
      do {
        iVar4 = iVar4 + 1;
        if (*(void **)(iVar1 + (int)pvVar2) != (void *)0x0) {
          free(*(void **)(iVar1 + (int)pvVar2));
          iVar3 = param_1[2];
          pvVar2 = (void *)*param_1;
        }
        iVar1 = iVar4 * 4;
      } while (iVar4 < iVar3);
    }
    if (pvVar2 == (void *)0x0) {
      pvVar2 = (void *)param_1[1];
    }
    else {
      free(pvVar2);
      pvVar2 = (void *)param_1[1];
    }
    if (pvVar2 == (void *)0x0) {
      pvVar2 = (void *)param_1[3];
    }
    else {
      free(pvVar2);
      pvVar2 = (void *)param_1[3];
    }
    if (pvVar2 == (void *)0x0) {
      param_1[3] = 0;
    }
    else {
      free(pvVar2);
      param_1[3] = 0;
    }
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
  }
  return;
}



----------------------------------------

// Function: vorbis_info_clear @ 08970234

void vorbis_info_clear(undefined4 *param_1)

{
  void *aptr;
  int iVar1;
  void *pvVar2;
  int iVar3;
  void *aptr_00;
  
  aptr_00 = (void *)param_1[7];
  if (aptr_00 != (void *)0x0) {
    iVar1 = *(int *)((int)aptr_00 + 8);
    if (iVar1 < 1) {
      iVar1 = *(int *)((int)aptr_00 + 0xc);
    }
    else {
      iVar3 = 0;
      aptr = *(void **)((int)aptr_00 + 0x20);
      pvVar2 = aptr_00;
      while( true ) {
        iVar3 = iVar3 + 1;
        if (aptr != (void *)0x0) {
          free(aptr);
          iVar1 = *(int *)((int)aptr_00 + 8);
        }
        if (iVar1 <= iVar3) break;
        aptr = *(void **)((int)pvVar2 + 0x24);
        pvVar2 = (void *)((int)pvVar2 + 4);
      }
      iVar1 = *(int *)((int)aptr_00 + 0xc);
    }
    if (0 < iVar1) {
      iVar3 = 0;
      pvVar2 = aptr_00;
      do {
        iVar3 = iVar3 + 1;
        if (*(int *)((int)pvVar2 + 0x220) != 0) {
          (**(code **)((&_mapping_P)[*(int *)((int)pvVar2 + 0x120)] + 8))
                    (*(int *)((int)pvVar2 + 0x220));
          iVar1 = *(int *)((int)aptr_00 + 0xc);
        }
        pvVar2 = (void *)((int)pvVar2 + 4);
      } while (iVar3 < iVar1);
    }
    iVar1 = *(int *)((int)aptr_00 + 0x14);
    if (0 < iVar1) {
      iVar3 = 0;
      pvVar2 = aptr_00;
      do {
        iVar3 = iVar3 + 1;
        if (*(int *)((int)pvVar2 + 0x520) != 0) {
          (**(code **)((&_floor_P)[*(int *)((int)pvVar2 + 0x420)] + 8))
                    (*(int *)((int)pvVar2 + 0x520));
          iVar1 = *(int *)((int)aptr_00 + 0x14);
        }
        pvVar2 = (void *)((int)pvVar2 + 4);
      } while (iVar3 < iVar1);
    }
    iVar1 = *(int *)((int)aptr_00 + 0x18);
    if (0 < iVar1) {
      iVar3 = 0;
      pvVar2 = aptr_00;
      do {
        iVar3 = iVar3 + 1;
        if (*(int *)((int)pvVar2 + 0x720) != 0) {
          (**(code **)(*(int *)(_residue_P + *(int *)((int)pvVar2 + 0x620) * 4) + 8))
                    (*(int *)((int)pvVar2 + 0x720));
          iVar1 = *(int *)((int)aptr_00 + 0x18);
        }
        pvVar2 = (void *)((int)pvVar2 + 4);
      } while (iVar3 < iVar1);
    }
    if (0 < *(int *)((int)aptr_00 + 0x1c)) {
      iVar3 = 0;
      iVar1 = *(int *)((int)aptr_00 + 0x820);
      pvVar2 = aptr_00;
      while( true ) {
        if (iVar1 != 0) {
          vorbis_staticbook_destroy(iVar1);
        }
        if (*(int *)((int)aptr_00 + 0xc20) != 0) {
          vorbis_book_clear(iVar3 * 0x34 + *(int *)((int)aptr_00 + 0xc20));
        }
        iVar3 = iVar3 + 1;
        if (*(int *)((int)aptr_00 + 0x1c) <= iVar3) break;
        iVar1 = *(int *)((int)pvVar2 + 0x824);
        pvVar2 = (void *)((int)pvVar2 + 4);
      }
    }
    if (*(void **)((int)aptr_00 + 0xc20) != (void *)0x0) {
      free(*(void **)((int)aptr_00 + 0xc20));
    }
    free(aptr_00);
  }
  param_1[7] = 0;
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[6] = 0;
  return;
}



----------------------------------------

// Function: vorbis_synthesis_headerin @ 0897044c

undefined4 vorbis_synthesis_headerin(int *param_1,int *param_2,undefined4 *param_3)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  undefined4 *puVar5;
  undefined4 uVar6;
  uint uVar7;
  int *piVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  undefined4 local_40;
  undefined2 local_3c;
  undefined1 auStack_38 [24];
  
  if (param_3 == (undefined4 *)0x0) {
    return 0xffffff7b;
  }
  oggpack_readinit(auStack_38,*param_3);
  iVar1 = oggpack_read(auStack_38,8);
  local_40 = 0;
  local_3c = 0;
  _v_readstring(auStack_38,&local_40,6);
  iVar2 = memcmp(&local_40,"vorbis",6);
  if (iVar2 != 0) {
    return 0xffffff7c;
  }
  if (iVar1 == 3) {
    if (param_1[2] == 0) {
      return 0xffffff7b;
    }
    iVar1 = oggpack_read(auStack_38,0x20);
    if (-1 < iVar1) {
      pvVar3 = calloc(iVar1 + 1,1);
      param_2[3] = (int)pvVar3;
      _v_readstring(auStack_38,pvVar3,iVar1);
      iVar1 = oggpack_read(auStack_38,0x20);
      param_2[2] = iVar1;
      if (-1 < iVar1) {
        pvVar3 = calloc(iVar1 + 1,4);
        *param_2 = (int)pvVar3;
        pvVar3 = calloc(param_2[2] + 1,4);
        param_2[1] = (int)pvVar3;
        if (0 < param_2[2]) {
          iVar2 = 0;
          iVar1 = 0;
          do {
            iVar10 = oggpack_read(auStack_38,0x20);
            iVar2 = iVar2 + 1;
            if (iVar10 < 0) goto LAB_08970638;
            iVar11 = *param_2;
            *(int *)(iVar1 + param_2[1]) = iVar10;
            pvVar3 = calloc(iVar10 + 1,1);
            iVar4 = *param_2;
            *(void **)(iVar1 + iVar11) = pvVar3;
            _v_readstring(auStack_38,*(undefined4 *)(iVar1 + iVar4),iVar10);
            iVar1 = iVar1 + 4;
          } while (iVar2 < param_2[2]);
        }
        iVar1 = oggpack_read(auStack_38,1);
        if (iVar1 == 1) {
          return 0;
        }
      }
    }
LAB_08970638:
    vorbis_comment_clear(param_2);
    return 0xffffff7b;
  }
  if (iVar1 == 5) {
    if (param_1[2] == 0) {
      return 0xffffff7b;
    }
    if (param_2[3] == 0) {
      return 0xffffff7b;
    }
    iVar1 = param_1[7];
    if (iVar1 != 0) {
      iVar2 = oggpack_read(auStack_38,8);
      *(int *)(iVar1 + 0x1c) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          pvVar3 = calloc(1,0x24);
          *(void **)(iVar2 + 0x820) = pvVar3;
          iVar4 = vorbis_staticbook_unpack(auStack_38,pvVar3);
          iVar10 = iVar10 + 1;
          iVar2 = iVar2 + 4;
          if (iVar4 != 0) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 0x1c));
      }
      iVar2 = oggpack_read(auStack_38,6);
      *(int *)(iVar1 + 0x10) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          iVar4 = oggpack_read(auStack_38,0x10);
          *(int *)(iVar2 + 800) = iVar4;
          iVar10 = iVar10 + 1;
          iVar2 = iVar2 + 4;
          if (iVar4 != 0) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 0x10));
      }
      iVar2 = oggpack_read(auStack_38,6);
      *(int *)(iVar1 + 0x14) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          uVar7 = oggpack_read(auStack_38,0x10);
          iVar10 = iVar10 + 1;
          *(uint *)(iVar2 + 0x420) = uVar7;
          if (1 < uVar7) goto LAB_08970958;
          iVar4 = (**(code **)(&_floor_P)[uVar7])(param_1,auStack_38);
          *(int *)(iVar2 + 0x520) = iVar4;
          iVar2 = iVar2 + 4;
          if (iVar4 == 0) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 0x14));
      }
      iVar2 = oggpack_read(auStack_38,6);
      *(int *)(iVar1 + 0x18) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          uVar7 = oggpack_read(auStack_38,0x10);
          iVar10 = iVar10 + 1;
          *(uint *)(iVar2 + 0x620) = uVar7;
          if (2 < uVar7) goto LAB_08970958;
          iVar4 = (*(code *)**(undefined4 **)(_residue_P + uVar7 * 4))(param_1,auStack_38);
          *(int *)(iVar2 + 0x720) = iVar4;
          iVar2 = iVar2 + 4;
          if (iVar4 == 0) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 0x18));
      }
      iVar2 = oggpack_read(auStack_38,6);
      *(int *)(iVar1 + 0xc) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          iVar4 = oggpack_read(auStack_38,0x10);
          iVar10 = iVar10 + 1;
          *(int *)(iVar2 + 0x120) = iVar4;
          if (iVar4 != 0) goto LAB_08970958;
          iVar4 = (**(code **)_mapping_P)(param_1,auStack_38);
          *(int *)(iVar2 + 0x220) = iVar4;
          iVar2 = iVar2 + 4;
          if (iVar4 == 0) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 0xc));
      }
      iVar2 = oggpack_read(auStack_38,6);
      *(int *)(iVar1 + 8) = iVar2 + 1;
      if (0 < iVar2 + 1) {
        iVar10 = 0;
        iVar2 = iVar1;
        do {
          puVar5 = calloc(1,0x10);
          *(undefined4 **)(iVar2 + 0x20) = puVar5;
          uVar6 = oggpack_read(auStack_38,1);
          iVar11 = *(int *)(iVar2 + 0x20);
          *puVar5 = uVar6;
          uVar6 = oggpack_read(auStack_38,0x10);
          iVar4 = *(int *)(iVar2 + 0x20);
          *(undefined4 *)(iVar11 + 4) = uVar6;
          uVar6 = oggpack_read(auStack_38,0x10);
          *(undefined4 *)(iVar4 + 8) = uVar6;
          iVar9 = *(int *)(iVar2 + 0x20);
          uVar6 = oggpack_read(auStack_38,8);
          iVar11 = *(int *)(iVar2 + 0x20);
          iVar10 = iVar10 + 1;
          iVar2 = iVar2 + 4;
          iVar4 = *(int *)(iVar11 + 4);
          *(undefined4 *)(iVar9 + 0xc) = uVar6;
          if (((0 < iVar4) || (0 < *(int *)(iVar11 + 8))) ||
             (*(int *)(iVar1 + 0xc) <= *(int *)(iVar11 + 0xc))) goto LAB_08970958;
        } while (iVar10 < *(int *)(iVar1 + 8));
      }
      iVar1 = oggpack_read(auStack_38,1);
      if (iVar1 == 1) {
        return 0;
      }
      goto LAB_08970958;
    }
  }
  else {
    if (iVar1 != 1) {
      return 0xffffff7b;
    }
    if (param_3[2] == 0) {
      return 0xffffff7b;
    }
    if (param_1[2] != 0) {
      return 0xffffff7b;
    }
    piVar8 = (int *)param_1[7];
    if (piVar8 != (int *)0x0) {
      iVar1 = oggpack_read(auStack_38,0x20);
      *param_1 = iVar1;
      if (iVar1 != 0) {
        return 0xffffff7a;
      }
      iVar1 = oggpack_read(auStack_38,8);
      param_1[1] = iVar1;
      iVar1 = oggpack_read(auStack_38,0x20);
      param_1[2] = iVar1;
      iVar1 = oggpack_read(auStack_38,0x20);
      param_1[3] = iVar1;
      iVar1 = oggpack_read(auStack_38,0x20);
      param_1[4] = iVar1;
      iVar1 = oggpack_read(auStack_38,0x20);
      param_1[5] = iVar1;
      uVar7 = oggpack_read(auStack_38,4);
      *piVar8 = 1 << (uVar7 & 0x1f);
      uVar7 = oggpack_read(auStack_38,4);
      iVar1 = 1 << (uVar7 & 0x1f);
      piVar8[1] = iVar1;
      if ((((0 < param_1[2]) && (0 < param_1[1])) &&
          ((0x3f < *piVar8 && ((*piVar8 <= iVar1 && (iVar1 < 0x2001)))))) &&
         (iVar1 = oggpack_read(auStack_38,1), iVar1 == 1)) {
        return 0;
      }
LAB_08970958:
      vorbis_info_clear(param_1);
      return 0xffffff7b;
    }
  }
  return 0xffffff7f;
}



----------------------------------------

// Function: vorbis_comment_query_count @ 08970a70

int vorbis_comment_query_count(int *param_1,char *param_2)

{
  int iVar1;
  size_t sVar2;
  size_t sVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  char acStack_30 [16];
  
  sVar2 = strlen(param_2);
  iVar1 = -(sVar2 + 0x10 & 0xfffffff8);
  strcpy(acStack_30 + iVar1,param_2);
  sVar3 = strlen(acStack_30 + iVar1);
  iVar5 = param_1[2];
  (acStack_30 + sVar3 + iVar1)[1] = DAT_089e07d9;
  acStack_30[sVar3 + iVar1] = DAT_089e07d8;
  if (0 < iVar5) {
    iVar6 = 0;
    iVar7 = 0;
    iVar5 = *param_1;
    while( true ) {
      iVar4 = iVar6 * 4;
      iVar6 = iVar6 + 1;
      iVar5 = tagcompare(*(undefined4 *)(iVar4 + iVar5),acStack_30 + iVar1,sVar2 + 1);
      if (iVar5 == 0) {
        iVar7 = iVar7 + 1;
      }
      if (param_1[2] <= iVar6) break;
      iVar5 = *param_1;
    }
    return iVar7;
  }
  return 0;
}



----------------------------------------

// Function: vorbis_comment_query @ 08970b90

int vorbis_comment_query(int *param_1,char *param_2,int param_3)

{
  bool bVar1;
  int iVar2;
  size_t sVar3;
  size_t sVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  char acStack_38 [16];
  
  sVar3 = strlen(param_2);
  iVar2 = -(sVar3 + 0x10 & 0xfffffff8);
  strcpy(acStack_38 + iVar2,param_2);
  sVar4 = strlen(acStack_38 + iVar2);
  iVar5 = param_1[2];
  (acStack_38 + sVar4 + iVar2)[1] = DAT_089e07d9;
  acStack_38[sVar4 + iVar2] = DAT_089e07d8;
  if (0 < iVar5) {
    iVar6 = 0;
    iVar8 = 0;
    iVar5 = *param_1;
    while( true ) {
      iVar7 = iVar6 * 4;
      iVar6 = iVar6 + 1;
      iVar5 = tagcompare(*(undefined4 *)(iVar7 + iVar5),acStack_38 + iVar2,sVar3 + 1);
      if (iVar5 == 0) {
        bVar1 = param_3 == iVar8;
        iVar8 = iVar8 + 1;
        if (bVar1) {
          return sVar3 + 1 + *(int *)(iVar7 + *param_1);
        }
        iVar5 = param_1[2];
      }
      else {
        iVar5 = param_1[2];
      }
      if (iVar5 <= iVar6) break;
      iVar5 = *param_1;
    }
  }
  return 0;
}



----------------------------------------

// Function: bitreverse @ 08970cdc

uint bitreverse(uint param_1)

{
  uint uVar1;
  
  uVar1 = param_1 >> 0x10 | param_1 << 0x10;
  uVar1 = uVar1 >> 8 & 0xff00ff | (uVar1 & 0xff00ff) << 8;
  uVar1 = uVar1 >> 4 & 0xf0f0f0f | (uVar1 & 0xf0f0f0f) << 4;
  uVar1 = uVar1 >> 2 & 0x33333333 | (uVar1 & 0x33333333) << 2;
  return uVar1 >> 1 & 0x55555555 | (uVar1 & 0x55555555) << 1;
}



----------------------------------------

// Function: vorbis_staticbook_unpack @ 08970d7c

undefined4 vorbis_staticbook_unpack(undefined4 param_1,int *param_2)

{
  int iVar1;
  void *pvVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  size_t nbytes;
  
  *param_2 = 0;
  param_2[1] = 0;
  param_2[2] = 0;
  param_2[3] = 0;
  param_2[4] = 0;
  param_2[5] = 0;
  param_2[6] = 0;
  param_2[7] = 0;
  param_2[8] = 0;
  iVar1 = oggpack_read(param_1,0x18);
  if (iVar1 == 0x564342) {
    iVar1 = oggpack_read(param_1,0x10);
    *param_2 = iVar1;
    iVar1 = oggpack_read(param_1,0x18);
    param_2[1] = iVar1;
    if (iVar1 != -1) {
      iVar1 = oggpack_read(param_1,1);
      if (iVar1 == 0) {
        pvVar2 = malloc(param_2[1] << 2);
        param_2[2] = (int)pvVar2;
        iVar1 = oggpack_read(param_1,1);
        if (iVar1 == 0) {
          if (0 < param_2[1]) {
            iVar1 = 0;
            do {
              iVar6 = oggpack_read(param_1,5);
              iVar8 = iVar1 * 4;
              iVar1 = iVar1 + 1;
              if (iVar6 == -1) goto LAB_08970e0c;
              *(int *)(iVar8 + param_2[2]) = iVar6 + 1;
            } while (iVar1 < param_2[1]);
          }
        }
        else if (0 < param_2[1]) {
          iVar6 = 0;
          iVar1 = 0;
          do {
            iVar8 = oggpack_read(param_1,1);
            if (iVar8 == 0) {
              *(undefined4 *)(param_2[2] + iVar1) = 0;
            }
            else {
              iVar8 = oggpack_read(param_1,5);
              if (iVar8 == -1) goto LAB_08970e0c;
              *(int *)(param_2[2] + iVar1) = iVar8 + 1;
            }
            iVar6 = iVar6 + 1;
            iVar1 = iVar1 + 4;
          } while (iVar6 < param_2[1]);
        }
      }
      else {
        if (iVar1 != 1) {
          return 0xffffffff;
        }
        iVar1 = oggpack_read(param_1,5);
        pvVar2 = malloc(param_2[1] << 2);
        iVar6 = param_2[1];
        param_2[2] = (int)pvVar2;
        if (0 < iVar6) {
          iVar8 = 0;
          do {
            iVar1 = iVar1 + 1;
            uVar3 = _ilog(iVar6 - iVar8);
            iVar4 = oggpack_read(param_1,uVar3);
            if (iVar4 == -1) goto LAB_08970e0c;
            iVar6 = param_2[1];
            if ((0 < iVar4) && (iVar5 = iVar8 << 2, iVar8 < iVar6)) {
              iVar7 = param_2[2];
              iVar6 = 0;
              while( true ) {
                iVar6 = iVar6 + 1;
                *(int *)(iVar7 + iVar5) = iVar1;
                iVar8 = iVar8 + 1;
                if (iVar4 == iVar6) break;
                iVar5 = iVar5 + 4;
                if (param_2[1] <= iVar8) goto LAB_08970fdc;
              }
              iVar6 = param_2[1];
            }
          } while (iVar8 < iVar6);
        }
      }
LAB_08970fdc:
      iVar1 = oggpack_read(param_1,4);
      param_2[3] = iVar1;
      if (iVar1 == 0) {
        return 0;
      }
      if ((-1 < iVar1) && (iVar1 < 3)) {
        iVar1 = oggpack_read(param_1,0x20);
        param_2[4] = iVar1;
        iVar1 = oggpack_read(param_1,0x20);
        param_2[5] = iVar1;
        iVar1 = oggpack_read(param_1,4);
        param_2[6] = iVar1 + 1;
        iVar1 = oggpack_read(param_1,1);
        param_2[7] = iVar1;
        if (param_2[3] == 1) {
          iVar1 = _book_maptype1_quantvals(param_2);
          nbytes = iVar1 << 2;
        }
        else if (param_2[3] == 2) {
          iVar1 = param_2[1] * *param_2;
          nbytes = iVar1 * 4;
        }
        else {
          iVar1 = 0;
          nbytes = 0;
        }
        pvVar2 = malloc(nbytes);
        param_2[8] = (int)pvVar2;
        if (iVar1 < 1) {
          if (iVar1 == 0) {
            return 0;
          }
        }
        else {
          iVar6 = 0;
          do {
            iVar8 = param_2[8];
            iVar4 = iVar6 * 4;
            iVar6 = iVar6 + 1;
            uVar3 = oggpack_read(param_1,param_2[6]);
            *(undefined4 *)(iVar4 + iVar8) = uVar3;
          } while (iVar6 != iVar1);
        }
        if (*(int *)(param_2[8] + nbytes + -4) != -1) {
          return 0;
        }
      }
    }
  }
LAB_08970e0c:
  vorbis_staticbook_clear(param_2);
  return 0xffffffff;
}



----------------------------------------

// Function: vorbis_book_decode @ 089710ec

undefined4 vorbis_book_decode(int param_1,undefined4 param_2)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  
  if (*(int *)(param_1 + 8) < 1) {
    return 0xffffffff;
  }
  iVar6 = *(int *)(param_1 + 0x28);
  iVar1 = oggpack_look(param_2,*(undefined4 *)(param_1 + 0x24));
  if (iVar1 < 0) {
    iVar1 = *(int *)(param_1 + 8);
    uVar7 = 0;
  }
  else {
    uVar5 = *(uint *)(iVar1 * 4 + *(int *)(param_1 + 0x20));
    uVar7 = uVar5 - 1;
    if (-1 < (int)uVar5) {
      oggpack_adv(param_2,(int)*(char *)(*(int *)(param_1 + 0x1c) + uVar5 + -1));
      goto LAB_0897115c;
    }
    uVar7 = (uVar5 & 0x3fffffff) >> 0xf;
    iVar1 = *(int *)(param_1 + 8) - (uVar5 & 0x7fff);
  }
  iVar2 = oggpack_look(param_2,iVar6);
  if (iVar2 < 0) {
    if (1 < iVar6) {
      do {
        iVar6 = iVar6 + -1;
        iVar2 = oggpack_look(param_2,iVar6);
        if (-1 < iVar2) goto LAB_089711ec;
      } while (iVar6 != 1);
    }
    oggpack_adv(param_2,1);
    return 0xffffffff;
  }
LAB_089711ec:
  uVar5 = bitreverse(iVar2);
  iVar2 = iVar1 - uVar7;
  if (iVar2 < 2) {
    iVar1 = *(int *)(param_1 + 0x1c);
  }
  else {
    do {
      uVar4 = iVar2 >> 1;
      uVar3 = (uint)(uVar5 < *(uint *)((uVar4 + uVar7) * 4 + *(int *)(param_1 + 0x14)));
      iVar1 = iVar1 - (uVar4 & -uVar3);
      uVar7 = uVar7 + (uVar4 & uVar3 - 1);
      iVar2 = iVar1 - uVar7;
    } while (1 < iVar2);
    iVar1 = *(int *)(param_1 + 0x1c);
  }
  if (iVar6 < *(char *)(iVar1 + uVar7)) {
    oggpack_adv(param_2,iVar6 + 1);
    return 0xffffffff;
  }
  oggpack_adv(param_2);
LAB_0897115c:
  if ((int)uVar7 < 0) {
    return 0xffffffff;
  }
  return *(undefined4 *)(uVar7 * 4 + *(int *)(param_1 + 0x18));
}



----------------------------------------

// Function: vorbis_book_decodevv_add @ 0897130c

undefined4 vorbis_book_decodevv_add(int *param_1,int param_2,int param_3,int param_4)

{
  bool bVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  uint uVar5;
  int *piVar6;
  uint uVar7;
  uint uVar8;
  int in_t1;
  int iVar9;
  int in_t2;
  int iVar10;
  uint uVar11;
  uint uVar12;
  int local_40;
  int local_34;
  
  if (0 < param_1[2]) {
    uVar12 = in_t2 - param_1[3];
    if ((int)uVar12 < 0) {
      iVar9 = param_3 + in_t1;
      local_40 = 0;
      bVar1 = param_3 < iVar9;
      while (bVar1) {
        iVar10 = param_1[10];
        iVar2 = oggpack_look();
        if (iVar2 < 0) {
          iVar2 = param_1[2];
          uVar11 = 0;
LAB_089716b8:
          iVar4 = oggpack_look();
          if (iVar4 < 0) {
            if (iVar10 < 2) goto LAB_08971530;
            while( true ) {
              iVar10 = iVar10 + -1;
              iVar4 = oggpack_look();
              if (-1 < iVar4) break;
              if (iVar10 == 1) goto LAB_08971530;
            }
          }
          uVar8 = bitreverse(iVar4);
          iVar4 = iVar2 - uVar11;
          if (iVar4 < 2) {
            iVar2 = param_1[7];
          }
          else {
            do {
              uVar7 = iVar4 >> 1;
              uVar5 = (uint)(uVar8 < *(uint *)((uVar7 + uVar11) * 4 + param_1[5]));
              iVar2 = iVar2 - (uVar7 & -uVar5);
              uVar11 = uVar11 + (uVar7 & uVar5 - 1);
              iVar4 = iVar2 - uVar11;
            } while (1 < iVar4);
            iVar2 = param_1[7];
          }
          if (iVar10 < *(char *)(iVar2 + uVar11)) goto LAB_089717a0;
          oggpack_adv();
        }
        else {
          uVar8 = *(uint *)(iVar2 * 4 + param_1[8]);
          uVar11 = uVar8 - 1;
          if ((int)uVar8 < 0) {
            uVar11 = (uVar8 & 0x3fffffff) >> 0xf;
            iVar2 = param_1[2] - (uVar8 & 0x7fff);
            goto LAB_089716b8;
          }
          oggpack_adv();
        }
        if (uVar11 == 0xffffffff) {
          return 0xffffffff;
        }
        iVar2 = *param_1;
        piVar3 = (int *)(uVar11 * iVar2 * 4 + param_1[4]);
        if (0 < iVar2) {
          iVar10 = 0;
          do {
            iVar10 = iVar10 + 1;
            iVar4 = *piVar3;
            piVar3 = piVar3 + 1;
            piVar6 = (int *)(param_3 * 4 + *(int *)(local_40 * 4 + param_2));
            *piVar6 = *piVar6 + (iVar4 << (-uVar12 & 0x1f));
            local_40 = local_40 + 1;
            if (local_40 == param_4) {
              param_3 = param_3 + 1;
              local_40 = 0;
            }
          } while (iVar10 < iVar2);
          bVar1 = param_3 < iVar9;
        }
      }
    }
    else {
      iVar9 = param_3 + in_t1;
      local_34 = 0;
      bVar1 = param_3 < iVar9;
      while (bVar1) {
        iVar10 = param_1[10];
        iVar2 = oggpack_look();
        if (iVar2 < 0) {
          iVar2 = param_1[2];
          uVar11 = 0;
LAB_0897145c:
          iVar4 = oggpack_look();
          if (iVar4 < 0) {
            if (iVar10 < 2) {
LAB_08971530:
              oggpack_adv();
              return 0xffffffff;
            }
            while( true ) {
              iVar10 = iVar10 + -1;
              iVar4 = oggpack_look();
              if (-1 < iVar4) break;
              if (iVar10 == 1) goto LAB_08971530;
            }
          }
          uVar8 = bitreverse(iVar4);
          iVar4 = iVar2 - uVar11;
          if (iVar4 < 2) {
            iVar2 = param_1[7];
          }
          else {
            do {
              uVar7 = iVar4 >> 1;
              uVar5 = (uint)(uVar8 < *(uint *)((uVar7 + uVar11) * 4 + param_1[5]));
              iVar2 = iVar2 - (uVar7 & -uVar5);
              uVar11 = uVar11 + (uVar7 & uVar5 - 1);
              iVar4 = iVar2 - uVar11;
            } while (1 < iVar4);
            iVar2 = param_1[7];
          }
          if (iVar10 < *(char *)(iVar2 + uVar11)) {
LAB_089717a0:
            oggpack_adv();
            return 0xffffffff;
          }
          oggpack_adv();
        }
        else {
          uVar8 = *(uint *)(iVar2 * 4 + param_1[8]);
          uVar11 = uVar8 - 1;
          if ((int)uVar8 < 0) {
            uVar11 = (uVar8 & 0x3fffffff) >> 0xf;
            iVar2 = param_1[2] - (uVar8 & 0x7fff);
            goto LAB_0897145c;
          }
          oggpack_adv();
        }
        if (uVar11 == 0xffffffff) {
          return 0xffffffff;
        }
        iVar2 = *param_1;
        piVar3 = (int *)(uVar11 * iVar2 * 4 + param_1[4]);
        if (0 < iVar2) {
          iVar10 = 0;
          do {
            while( true ) {
              iVar10 = iVar10 + 1;
              iVar4 = *piVar3;
              piVar3 = piVar3 + 1;
              piVar6 = (int *)(param_3 * 4 + *(int *)(local_34 * 4 + param_2));
              *piVar6 = *piVar6 + (iVar4 >> (uVar12 & 0x1f));
              local_34 = local_34 + 1;
              if (param_4 != local_34) break;
              param_3 = param_3 + 1;
              local_34 = 0;
              if (iVar10 >= iVar2) goto LAB_08971440;
            }
          } while (iVar10 < iVar2);
LAB_08971440:
          bVar1 = param_3 < iVar9;
        }
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: vorbis_book_decodev_set @ 089717b0

undefined4 vorbis_book_decodev_set(int *param_1,int param_2,undefined4 param_3,int param_4)

{
  undefined4 *puVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  uint uVar6;
  int *piVar7;
  int iVar8;
  int in_t0;
  int iVar9;
  uint uVar10;
  uint uVar11;
  int iVar12;
  
  if (param_1[2] < 1) {
    if (0 < param_4) {
      iVar9 = *param_1;
      iVar12 = 0;
      if (0 < iVar9) goto LAB_08971a08;
      do {
        do {
          if (param_4 <= iVar12) {
            return 0;
          }
        } while (iVar9 < 1);
LAB_08971a08:
        puVar1 = (undefined4 *)(iVar12 * 4 + param_2);
        *puVar1 = 0;
        while( true ) {
          iVar12 = iVar12 + 1;
          puVar1 = puVar1 + 1;
          if (iVar9 < 1) break;
          *puVar1 = 0;
        }
      } while( true );
    }
  }
  else {
    uVar11 = in_t0 - param_1[3];
    if ((int)uVar11 < 0) {
      if (0 < param_4) {
        iVar9 = param_1[10];
        iVar5 = 0;
        iVar12 = oggpack_look(param_3,param_1[9]);
        if (-1 < iVar12) {
          iVar8 = param_1[8];
          goto LAB_08971a54;
        }
        iVar12 = param_1[2];
LAB_08971acc:
        uVar10 = 0;
        do {
          iVar8 = oggpack_look(param_3,iVar9);
          if (iVar8 < 0) {
            if (iVar9 < 2) goto LAB_08971998;
            while( true ) {
              iVar9 = iVar9 + -1;
              iVar8 = oggpack_look(param_3,iVar9);
              if (-1 < iVar8) break;
              if (iVar9 == 1) goto LAB_08971998;
            }
          }
          uVar6 = bitreverse(iVar8);
          iVar8 = iVar12 - uVar10;
          if (iVar8 < 2) {
            iVar12 = param_1[7];
          }
          else {
            do {
              uVar4 = iVar8 >> 1;
              uVar3 = (uint)(uVar6 < *(uint *)((uVar4 + uVar10) * 4 + param_1[5]));
              iVar12 = iVar12 - (uVar4 & -uVar3);
              uVar10 = uVar10 + (uVar4 & uVar3 - 1);
              iVar8 = iVar12 - uVar10;
            } while (1 < iVar8);
            iVar12 = param_1[7];
          }
          if (iVar9 < *(char *)(iVar12 + uVar10)) goto LAB_08971c34;
          oggpack_adv(param_3);
          while( true ) {
            if (uVar10 == 0xffffffff) {
              return 0xffffffff;
            }
            iVar12 = *param_1;
            piVar2 = (int *)(uVar10 * iVar12 * 4 + param_1[4]);
            if (0 < iVar12) {
              iVar8 = 0;
              piVar7 = (int *)(param_2 + iVar5 * 4);
              iVar9 = *piVar2;
              while( true ) {
                iVar8 = iVar8 + 1;
                *piVar7 = iVar9 << (-uVar11 & 0x1f);
                iVar5 = iVar5 + 1;
                piVar2 = piVar2 + 1;
                piVar7 = piVar7 + 1;
                if (iVar12 <= iVar8) break;
                iVar9 = *piVar2;
              }
            }
            if (param_4 <= iVar5) {
              return 0;
            }
            iVar9 = param_1[10];
            iVar12 = oggpack_look(param_3,param_1[9]);
            if (iVar12 < 0) {
              iVar12 = param_1[2];
              goto LAB_08971acc;
            }
            iVar8 = param_1[8];
LAB_08971a54:
            uVar6 = *(uint *)(iVar12 * 4 + iVar8);
            uVar10 = uVar6 - 1;
            if ((int)uVar6 < 0) break;
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar6 + -1));
          }
          uVar10 = (uVar6 & 0x3fffffff) >> 0xf;
          iVar12 = param_1[2] - (uVar6 & 0x7fff);
        } while( true );
      }
    }
    else {
      iVar12 = 0;
      if (0 < param_4) {
        iVar5 = param_1[9];
        do {
          iVar9 = param_1[10];
          iVar5 = oggpack_look(param_3,iVar5);
          if (iVar5 < 0) {
            iVar5 = param_1[2];
            uVar10 = 0;
LAB_089718c4:
            iVar8 = oggpack_look(param_3,iVar9);
            if (iVar8 < 0) {
              if (iVar9 < 2) {
LAB_08971998:
                oggpack_adv(param_3,1);
                return 0xffffffff;
              }
              while( true ) {
                iVar9 = iVar9 + -1;
                iVar8 = oggpack_look(param_3,iVar9);
                if (-1 < iVar8) break;
                if (iVar9 == 1) goto LAB_08971998;
              }
            }
            uVar6 = bitreverse(iVar8);
            iVar8 = iVar5 - uVar10;
            if (iVar8 < 2) {
              iVar5 = param_1[7];
            }
            else {
              do {
                uVar4 = iVar8 >> 1;
                uVar3 = (uint)(uVar6 < *(uint *)((uVar4 + uVar10) * 4 + param_1[5]));
                iVar5 = iVar5 - (uVar4 & -uVar3);
                uVar10 = uVar10 + (uVar4 & uVar3 - 1);
                iVar8 = iVar5 - uVar10;
              } while (1 < iVar8);
              iVar5 = param_1[7];
            }
            if (iVar9 < *(char *)(iVar5 + uVar10)) {
LAB_08971c34:
              oggpack_adv(param_3,iVar9 + 1);
              return 0xffffffff;
            }
            oggpack_adv(param_3);
          }
          else {
            uVar6 = *(uint *)(iVar5 * 4 + param_1[8]);
            uVar10 = uVar6 - 1;
            if ((int)uVar6 < 0) {
              uVar10 = (uVar6 & 0x3fffffff) >> 0xf;
              iVar5 = param_1[2] - (uVar6 & 0x7fff);
              goto LAB_089718c4;
            }
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar6 + -1));
          }
          if (uVar10 == 0xffffffff) {
            return 0xffffffff;
          }
          iVar9 = *param_1;
          piVar2 = (int *)(uVar10 * iVar9 * 4 + param_1[4]);
          if (0 < iVar9) {
            iVar8 = 0;
            piVar7 = (int *)(param_2 + iVar12 * 4);
            iVar5 = *piVar2;
            while( true ) {
              iVar8 = iVar8 + 1;
              *piVar7 = iVar5 >> (uVar11 & 0x1f);
              iVar12 = iVar12 + 1;
              piVar2 = piVar2 + 1;
              piVar7 = piVar7 + 1;
              if (iVar9 <= iVar8) break;
              iVar5 = *piVar2;
            }
          }
          if (param_4 <= iVar12) {
            return 0;
          }
          iVar5 = param_1[9];
        } while( true );
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: vorbis_book_decodev_add @ 08971c44

undefined4 vorbis_book_decodev_add(int *param_1,int param_2,undefined4 param_3,int param_4)

{
  uint uVar1;
  int *piVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  int *piVar6;
  int in_t0;
  int iVar7;
  int iVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  
  if (0 < param_1[2]) {
    uVar10 = in_t0 - param_1[3];
    if ((int)uVar10 < 0) {
      if (0 < param_4) {
        iVar8 = param_1[10];
        iVar4 = 0;
        iVar11 = oggpack_look(param_3,param_1[9]);
        if (-1 < iVar11) {
          iVar7 = param_1[8];
          goto LAB_08971ee4;
        }
        iVar11 = param_1[2];
LAB_08971f5c:
        uVar9 = 0;
        do {
          iVar7 = oggpack_look(param_3,iVar8);
          if (iVar7 < 0) {
            if (iVar8 < 2) goto LAB_08971e2c;
            while( true ) {
              iVar8 = iVar8 + -1;
              iVar7 = oggpack_look(param_3,iVar8);
              if (-1 < iVar7) break;
              if (iVar8 == 1) goto LAB_08971e2c;
            }
          }
          uVar5 = bitreverse(iVar7);
          iVar7 = iVar11 - uVar9;
          if (iVar7 < 2) {
            iVar11 = param_1[7];
          }
          else {
            do {
              uVar3 = iVar7 >> 1;
              uVar1 = (uint)(uVar5 < *(uint *)((uVar3 + uVar9) * 4 + param_1[5]));
              iVar11 = iVar11 - (uVar3 & -uVar1);
              uVar9 = uVar9 + (uVar3 & uVar1 - 1);
              iVar7 = iVar11 - uVar9;
            } while (1 < iVar7);
            iVar11 = param_1[7];
          }
          if (iVar8 < *(char *)(iVar11 + uVar9)) goto LAB_0897208c;
          oggpack_adv(param_3);
          while( true ) {
            if (uVar9 == 0xffffffff) {
              return 0xffffffff;
            }
            iVar11 = *param_1;
            piVar2 = (int *)(uVar9 * iVar11 * 4 + param_1[4]);
            if (0 < iVar11) {
              piVar6 = (int *)(param_2 + iVar4 * 4);
              iVar7 = 0;
              iVar8 = *piVar2;
              while( true ) {
                iVar7 = iVar7 + 1;
                *piVar6 = *piVar6 + (iVar8 << (-uVar10 & 0x1f));
                iVar4 = iVar4 + 1;
                piVar6 = piVar6 + 1;
                piVar2 = piVar2 + 1;
                if (iVar11 <= iVar7) break;
                iVar8 = *piVar2;
              }
            }
            if (param_4 <= iVar4) {
              return 0;
            }
            iVar8 = param_1[10];
            iVar11 = oggpack_look(param_3,param_1[9]);
            if (iVar11 < 0) {
              iVar11 = param_1[2];
              goto LAB_08971f5c;
            }
            iVar7 = param_1[8];
LAB_08971ee4:
            uVar5 = *(uint *)(iVar11 * 4 + iVar7);
            uVar9 = uVar5 - 1;
            if ((int)uVar5 < 0) break;
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar5 + -1));
          }
          uVar9 = (uVar5 & 0x3fffffff) >> 0xf;
          iVar11 = param_1[2] - (uVar5 & 0x7fff);
        } while( true );
      }
    }
    else {
      iVar11 = 0;
      if (0 < param_4) {
        iVar4 = param_1[9];
        do {
          iVar8 = param_1[10];
          iVar4 = oggpack_look(param_3,iVar4);
          if (iVar4 < 0) {
            iVar4 = param_1[2];
            uVar9 = 0;
LAB_08971d58:
            iVar7 = oggpack_look(param_3,iVar8);
            if (iVar7 < 0) {
              if (iVar8 < 2) {
LAB_08971e2c:
                oggpack_adv(param_3,1);
                return 0xffffffff;
              }
              while( true ) {
                iVar8 = iVar8 + -1;
                iVar7 = oggpack_look(param_3,iVar8);
                if (-1 < iVar7) break;
                if (iVar8 == 1) goto LAB_08971e2c;
              }
            }
            uVar5 = bitreverse(iVar7);
            iVar7 = iVar4 - uVar9;
            if (iVar7 < 2) {
              iVar4 = param_1[7];
            }
            else {
              do {
                uVar3 = iVar7 >> 1;
                uVar1 = (uint)(uVar5 < *(uint *)((uVar3 + uVar9) * 4 + param_1[5]));
                iVar4 = iVar4 - (uVar3 & -uVar1);
                uVar9 = uVar9 + (uVar3 & uVar1 - 1);
                iVar7 = iVar4 - uVar9;
              } while (1 < iVar7);
              iVar4 = param_1[7];
            }
            if (iVar8 < *(char *)(iVar4 + uVar9)) {
LAB_0897208c:
              oggpack_adv(param_3,iVar8 + 1);
              return 0xffffffff;
            }
            oggpack_adv(param_3);
          }
          else {
            uVar5 = *(uint *)(iVar4 * 4 + param_1[8]);
            uVar9 = uVar5 - 1;
            if ((int)uVar5 < 0) {
              uVar9 = (uVar5 & 0x3fffffff) >> 0xf;
              iVar4 = param_1[2] - (uVar5 & 0x7fff);
              goto LAB_08971d58;
            }
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar5 + -1));
          }
          if (uVar9 == 0xffffffff) {
            return 0xffffffff;
          }
          iVar8 = *param_1;
          piVar2 = (int *)(uVar9 * iVar8 * 4 + param_1[4]);
          if (0 < iVar8) {
            piVar6 = (int *)(param_2 + iVar11 * 4);
            iVar7 = 0;
            iVar4 = *piVar2;
            while( true ) {
              iVar7 = iVar7 + 1;
              *piVar6 = *piVar6 + (iVar4 >> (uVar10 & 0x1f));
              iVar11 = iVar11 + 1;
              piVar6 = piVar6 + 1;
              piVar2 = piVar2 + 1;
              if (iVar8 <= iVar7) break;
              iVar4 = *piVar2;
            }
          }
          if (param_4 <= iVar11) {
            return 0;
          }
          iVar4 = param_1[9];
        } while( true );
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: vorbis_book_decodevs_add @ 0897209c

undefined4 vorbis_book_decodevs_add(int *param_1,int *param_2,undefined4 param_3,int param_4)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  int *piVar6;
  int in_t0;
  int *piVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  uint local_58 [2];
  int *local_50;
  uint *local_4c;
  uint local_48;
  int local_44;
  int *local_40;
  
  if (0 < param_1[2]) {
    iVar8 = *param_1;
    uVar10 = param_4 / iVar8;
    if (iVar8 == 0) {
      trap(7);
    }
    local_48 = in_t0 - param_1[3];
    local_44 = uVar10 * 4;
    uVar1 = local_44 + 0xeU & 0xfffffff8;
    iVar9 = -uVar1;
    local_4c = (uint *)((int)local_58 + iVar9);
    iVar2 = uVar1 * -2;
    piVar6 = (int *)((int)local_58 + iVar2);
    piVar7 = (int *)((int)local_58 + iVar2);
    local_50 = (int *)((int)local_58 + iVar2);
    local_40 = param_2;
    if ((int)local_48 < 0) {
      if (0 < (int)uVar10) {
        local_58[1] = 0;
        local_50 = (int *)((int)local_58 + iVar2);
        do {
          iVar9 = param_1[10];
          iVar8 = oggpack_look(param_3,param_1[9]);
          if (iVar8 < 0) {
            iVar8 = param_1[2];
            uVar1 = 0;
LAB_08972520:
            iVar2 = oggpack_look(param_3,iVar9);
            if (iVar2 < 0) {
              if (iVar9 < 2) {
LAB_089723b4:
                oggpack_adv(param_3,1);
                goto LAB_089723c0;
              }
              while( true ) {
                iVar9 = iVar9 + -1;
                iVar2 = oggpack_look(param_3,iVar9);
                if (-1 < iVar2) break;
                if (iVar9 == 1) goto LAB_089723b4;
              }
            }
            uVar5 = bitreverse(iVar2);
            iVar2 = iVar8 - uVar1;
            if (iVar2 < 2) {
              iVar8 = param_1[7];
            }
            else {
              do {
                uVar4 = iVar2 >> 1;
                uVar3 = (uint)(uVar5 < *(uint *)((uVar4 + uVar1) * 4 + param_1[5]));
                iVar8 = iVar8 - (uVar4 & -uVar3);
                uVar1 = uVar1 + (uVar4 & uVar3 - 1);
                iVar2 = iVar8 - uVar1;
              } while (1 < iVar2);
              iVar8 = param_1[7];
            }
            if (iVar9 < *(char *)(iVar8 + uVar1)) {
              oggpack_adv(param_3,iVar9 + 1);
LAB_089723c0:
              *local_4c = 0xffffffff;
              return 0xffffffff;
            }
            oggpack_adv(param_3);
          }
          else {
            uVar5 = *(uint *)(iVar8 * 4 + param_1[8]);
            uVar1 = uVar5 - 1;
            if ((int)uVar5 < 0) {
              uVar1 = (uVar5 & 0x3fffffff) >> 0xf;
              iVar8 = param_1[2] - (uVar5 & 0x7fff);
              goto LAB_08972520;
            }
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar5 + -1));
          }
          *local_4c = uVar1;
          if (uVar1 == 0xffffffff) {
            return 0xffffffff;
          }
          iVar8 = *param_1;
          local_58[1] = local_58[1] + 1;
          local_4c = local_4c + 1;
          *piVar7 = param_1[4] + uVar1 * iVar8 * 4;
          piVar7 = piVar7 + 1;
        } while (uVar10 != local_58[1]);
      }
      iVar9 = 0;
      if (0 < iVar8) {
        do {
          if (0 < (int)uVar10) {
            uVar1 = 0;
            piVar6 = local_40;
            piVar7 = local_50;
            do {
              iVar2 = *piVar7;
              uVar1 = uVar1 + 1;
              piVar7 = piVar7 + 1;
              *piVar6 = *piVar6 + (*(int *)(iVar2 + iVar9 * 4) << (-local_48 & 0x1f));
              piVar6 = piVar6 + 1;
            } while (uVar10 != uVar1);
          }
          iVar9 = iVar9 + 1;
          local_40 = (int *)((int)local_40 + local_44);
        } while (iVar9 < iVar8);
      }
    }
    else {
      local_50 = (int *)((int)local_58 + iVar2);
      if (0 < (int)uVar10) {
        local_58[0] = 0;
        local_50 = (int *)((int)local_58 + iVar2);
        local_4c = (uint *)((int)local_58 + iVar9);
        do {
          iVar9 = param_1[10];
          iVar8 = oggpack_look(param_3,param_1[9]);
          if (iVar8 < 0) {
            iVar8 = param_1[2];
            uVar1 = 0;
LAB_08972280:
            iVar2 = oggpack_look(param_3,iVar9);
            if (iVar2 < 0) {
              if (iVar9 < 2) {
LAB_08972354:
                oggpack_adv(param_3,1);
                goto LAB_08972360;
              }
              while( true ) {
                iVar9 = iVar9 + -1;
                iVar2 = oggpack_look(param_3,iVar9);
                if (-1 < iVar2) break;
                if (iVar9 == 1) goto LAB_08972354;
              }
            }
            uVar5 = bitreverse(iVar2);
            iVar2 = iVar8 - uVar1;
            if (iVar2 < 2) {
              iVar8 = param_1[7];
            }
            else {
              do {
                uVar4 = iVar2 >> 1;
                uVar3 = (uint)(uVar5 < *(uint *)((uVar4 + uVar1) * 4 + param_1[5]));
                iVar8 = iVar8 - (uVar4 & -uVar3);
                uVar1 = uVar1 + (uVar4 & uVar3 - 1);
                iVar2 = iVar8 - uVar1;
              } while (1 < iVar2);
              iVar8 = param_1[7];
            }
            if (iVar9 < *(char *)(iVar8 + uVar1)) {
              oggpack_adv(param_3,iVar9 + 1);
LAB_08972360:
              *local_4c = 0xffffffff;
              return 0xffffffff;
            }
            oggpack_adv(param_3);
          }
          else {
            uVar5 = *(uint *)(iVar8 * 4 + param_1[8]);
            uVar1 = uVar5 - 1;
            if ((int)uVar5 < 0) {
              uVar1 = (uVar5 & 0x3fffffff) >> 0xf;
              iVar8 = param_1[2] - (uVar5 & 0x7fff);
              goto LAB_08972280;
            }
            oggpack_adv(param_3,(int)*(char *)(param_1[7] + uVar5 + -1));
          }
          *local_4c = uVar1;
          if (uVar1 == 0xffffffff) {
            return 0xffffffff;
          }
          iVar8 = *param_1;
          local_58[0] = local_58[0] + 1;
          local_4c = local_4c + 1;
          *piVar6 = param_1[4] + uVar1 * iVar8 * 4;
          piVar6 = piVar6 + 1;
        } while (uVar10 != local_58[0]);
      }
      if (0 < iVar8) {
        iVar9 = 0;
        do {
          if (0 < (int)uVar10) {
            uVar1 = 0;
            piVar6 = local_40;
            piVar7 = local_50;
            do {
              iVar2 = *piVar7;
              uVar1 = uVar1 + 1;
              piVar7 = piVar7 + 1;
              *piVar6 = *piVar6 + (*(int *)(iVar2 + iVar9 * 4) >> (local_48 & 0x1f));
              piVar6 = piVar6 + 1;
            } while (uVar10 != uVar1);
          }
          iVar9 = iVar9 + 1;
          local_40 = (int *)((int)local_40 + local_44);
        } while (iVar9 < iVar8);
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: _ilog @ 0897261c

int _ilog(uint param_1)

{
  int iVar1;
  
  if (param_1 != 0) {
    iVar1 = 0;
    do {
      param_1 = param_1 >> 1;
      iVar1 = iVar1 + 1;
    } while (param_1 != 0);
    return iVar1;
  }
  return 0;
}



----------------------------------------

// Function: _float32_unpack @ 08972644

uint _float32_unpack(uint param_1,int *param_2)

{
  uint uVar1;
  int iVar3;
  uint uVar2;
  
  if ((param_1 & 0x1fffff) != 0) {
    iVar3 = ((param_1 & 0x7fffffff) >> 0x15) - 0x314;
    uVar1 = param_1 & 0x1fffff;
    do {
      uVar2 = uVar1;
      uVar1 = uVar2 * 2;
      iVar3 = iVar3 + -1;
    } while ((uVar1 & 0x40000000) == 0);
    if ((int)param_1 < 0) {
      uVar1 = uVar2 * -2;
    }
    *param_2 = iVar3;
    return uVar1;
  }
  *param_2 = -9999;
  return 0;
}



----------------------------------------

// Function: _book_maptype1_quantvals @ 08972694

int _book_maptype1_quantvals(int *param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
  iVar1 = _ilog(param_1[1]);
  iVar5 = *param_1;
  iVar6 = param_1[1];
  if (iVar5 == 0) {
    trap(7);
  }
  iVar1 = iVar6 >> (((iVar1 + -1) * (iVar5 + -1)) / iVar5 & 0x1fU);
LAB_089726d8:
  do {
    if (iVar5 < 1) goto LAB_0897272c;
    while( true ) {
      iVar3 = 1;
      iVar4 = 1;
      iVar2 = 0;
      do {
        iVar3 = iVar3 * iVar1;
        iVar2 = iVar2 + 1;
        iVar4 = iVar4 * (iVar1 + 1);
      } while (iVar2 != iVar5);
      if (iVar6 < iVar3) break;
      while( true ) {
        if (iVar6 < iVar4) {
          return iVar1;
        }
        iVar1 = iVar1 + 1;
        if (0 < iVar5) break;
LAB_0897272c:
        iVar4 = 1;
        if (iVar6 < 1) {
          iVar1 = iVar1 + -1;
          goto LAB_089726d8;
        }
      }
    }
    iVar1 = iVar1 + -1;
  } while( true );
}



----------------------------------------

// Function: bitreverse @ 08972750

uint bitreverse(uint param_1)

{
  uint uVar1;
  
  uVar1 = param_1 >> 0x10 | param_1 << 0x10;
  uVar1 = uVar1 >> 8 & 0xff00ff | (uVar1 & 0xff00ff) << 8;
  uVar1 = uVar1 >> 4 & 0xf0f0f0f | (uVar1 & 0xf0f0f0f) << 4;
  uVar1 = uVar1 >> 2 & 0x33333333 | (uVar1 & 0x33333333) << 2;
  return uVar1 >> 1 & 0x55555555 | (uVar1 & 0x55555555) << 1;
}



----------------------------------------

// Function: sort32a @ 089727f0

int sort32a(undefined4 *param_1,undefined4 *param_2)

{
  return (uint)(*(uint *)*param_2 < *(uint *)*param_1) -
         (uint)(*(uint *)*param_1 < *(uint *)*param_2);
}



----------------------------------------

// Function: vorbis_book_clear @ 08972810

void vorbis_book_clear(undefined4 *param_1)

{
  void *pvVar1;
  
  if ((void *)param_1[4] == (void *)0x0) {
    pvVar1 = (void *)param_1[5];
  }
  else {
    free((void *)param_1[4]);
    pvVar1 = (void *)param_1[5];
  }
  if (pvVar1 == (void *)0x0) {
    pvVar1 = (void *)param_1[6];
  }
  else {
    free(pvVar1);
    pvVar1 = (void *)param_1[6];
  }
  if (pvVar1 == (void *)0x0) {
    pvVar1 = (void *)param_1[7];
  }
  else {
    free(pvVar1);
    pvVar1 = (void *)param_1[7];
  }
  if (pvVar1 == (void *)0x0) {
    pvVar1 = (void *)param_1[8];
  }
  else {
    free(pvVar1);
    pvVar1 = (void *)param_1[8];
  }
  if (pvVar1 == (void *)0x0) {
    param_1[0xc] = 0;
  }
  else {
    free(pvVar1);
    param_1[0xc] = 0;
  }
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[8] = 0;
  param_1[9] = 0;
  param_1[10] = 0;
  param_1[0xb] = 0;
  return;
}



----------------------------------------

// Function: vorbis_staticbook_clear @ 089728c8

void vorbis_staticbook_clear(undefined4 *param_1)

{
  if ((void *)param_1[8] != (void *)0x0) {
    free((void *)param_1[8]);
  }
  if ((void *)param_1[2] != (void *)0x0) {
    free((void *)param_1[2]);
  }
  param_1[8] = 0;
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  return;
}



----------------------------------------

// Function: vorbis_staticbook_destroy @ 08972934

void vorbis_staticbook_destroy(void *param_1)

{
  vorbis_staticbook_clear();
  free(param_1);
  return;
}



----------------------------------------

// Function: _make_words @ 0897295c

void * _make_words(uint *param_1,int param_2,int param_3)

{
  bool bVar1;
  uint uVar2;
  void *aptr;
  uint *puVar3;
  uint uVar4;
  int iVar5;
  uint *puVar6;
  int iVar7;
  uint uVar8;
  uint uVar9;
  int iVar10;
  uint *puVar11;
  int iVar12;
  uint auStack_a0 [34];
  
  iVar10 = param_2;
  if (param_3 != 0) {
    iVar10 = param_3;
  }
  aptr = malloc(iVar10 << 2);
  memset(auStack_a0,0,0x84);
  if (0 < param_2) {
    iVar12 = 0;
    puVar11 = param_1;
    iVar10 = 0;
    do {
      while( true ) {
        uVar8 = *puVar11;
        if ((int)uVar8 < 1) break;
        puVar3 = auStack_a0 + uVar8;
        uVar9 = *puVar3;
        if (((int)uVar8 < 0x20) && (uVar9 >> (uVar8 & 0x1f) != 0)) {
          free(aptr);
          return (void *)0x0;
        }
        *(uint *)(iVar12 * 4 + (int)aptr) = uVar9;
        iVar12 = iVar12 + 1;
        uVar4 = uVar8;
        puVar6 = puVar3;
        do {
          if ((*puVar3 & 1) != 0) {
            if (uVar4 == 1) {
              auStack_a0[1] = auStack_a0[1] + 1;
            }
            else {
              *puVar6 = puVar6[-1] << 1;
            }
            break;
          }
          uVar4 = uVar4 - 1;
          *puVar3 = *puVar3 + 1;
          puVar6 = puVar6 + -1;
          puVar3 = puVar3 + -1;
        } while (uVar4 != 0);
        iVar5 = uVar8 + 1;
        if ((iVar5 < 0x21) && (uVar9 == auStack_a0[iVar5] >> 1)) {
          puVar3 = auStack_a0 + uVar8;
          iVar7 = 0;
          uVar8 = auStack_a0[iVar5];
          do {
            puVar3[1] = *puVar3 << 1;
            if (iVar7 == 0x20 - iVar5) break;
            puVar6 = puVar3 + 2;
            iVar7 = iVar7 + 1;
            bVar1 = *puVar6 >> 1 == uVar8;
            puVar3 = puVar3 + 1;
            uVar8 = *puVar6;
          } while (bVar1);
        }
LAB_08972a88:
        iVar10 = iVar10 + 1;
        puVar11 = puVar11 + 1;
        if (param_2 == iVar10) goto LAB_08972a94;
      }
      iVar5 = iVar10 + 1;
      if (param_3 != 0) goto LAB_08972a88;
      iVar12 = iVar12 + 1;
      puVar11 = puVar11 + 1;
      iVar10 = iVar5;
    } while (param_2 != iVar5);
LAB_08972a94:
    iVar12 = 0;
    iVar10 = 0;
    do {
      uVar9 = *param_1;
      uVar8 = 0;
      if (0 < (int)uVar9) {
        uVar4 = 0;
        do {
          uVar2 = uVar4 & 0x1f;
          uVar4 = uVar4 + 1;
          uVar8 = uVar8 << 1 | *(uint *)(iVar10 * 4 + (int)aptr) >> uVar2 & 1;
        } while (uVar4 != uVar9);
      }
      if (param_3 == 0) {
        *(uint *)(iVar10 * 4 + (int)aptr) = uVar8;
LAB_08972af0:
        iVar10 = iVar10 + 1;
      }
      else if (uVar9 != 0) {
        *(uint *)(iVar10 * 4 + (int)aptr) = uVar8;
        goto LAB_08972af0;
      }
      iVar12 = iVar12 + 1;
      param_1 = param_1 + 1;
    } while (param_2 != iVar12);
  }
  return aptr;
}



----------------------------------------

// Function: _book_unquantize @ 08972b9c

int * _book_unquantize(int *param_1,int param_2,int *param_3,uint *param_4)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  int *piVar15;
  int iVar16;
  uint local_68;
  int local_64;
  int local_60;
  int *local_5c;
  int *local_58;
  int *local_54;
  int *local_50;
  int local_4c;
  int local_48;
  int local_44;
  int *local_40;
  int *local_3c;
  uint local_38;
  uint local_34;
  uint local_30;
  int local_2c;
  
  if (1 < param_1[3] - 1U) {
    return (int *)0x0;
  }
  local_44 = param_2;
  local_40 = param_3;
  uVar1 = _float32_unpack(param_1[4],&local_68);
  local_4c = _float32_unpack(param_1[5],&local_64);
  local_5c = calloc(local_44 * *param_1,4);
  local_50 = local_5c;
  local_58 = calloc(local_44 * *param_1,4);
  *param_4 = local_68;
  iVar11 = (int)uVar1 >> 1;
  local_54 = local_58;
  if (param_1[3] == 1) {
    iVar9 = _book_maptype1_quantvals(param_1);
    iVar16 = param_1[1];
    if (0 < iVar16) {
      iVar8 = *param_1;
      local_48 = 0;
      iVar4 = 0;
      local_3c = local_40;
      do {
        if ((local_40 == (int *)0x0) || (*(int *)(iVar4 * 4 + param_1[2]) != 0)) {
          iVar5 = 0;
          if (0 < iVar8) {
            uVar13 = 0;
            uVar14 = 0;
            iVar16 = 1;
            local_2c = 1;
            local_30 = 0xc0000000;
            do {
              iVar8 = local_64;
              if (iVar16 == 0) {
                trap(7);
              }
              if (iVar9 == 0) {
                trap(7);
              }
              local_38 = uVar13;
              local_34 = uVar14;
              iVar2 = _ilog(0);
              if (local_4c == 0) {
LAB_089730ac:
                uVar13 = 0;
                uVar14 = 0;
              }
              else {
                iVar3 = 0 << (-(iVar2 + -0x1f) & 0x1fU);
                if (iVar3 == 0) goto LAB_089730ac;
                uVar13 = (local_4c >> 0xf) * (iVar3 >> 0x10);
                uVar14 = iVar2 + -0x1f + iVar8 + 0x1f;
              }
              uVar6 = uVar14;
              uVar7 = uVar13;
              if ((uVar1 != 0) && (uVar6 = local_68, uVar7 = uVar1, uVar13 != 0)) {
                if ((int)uVar14 < (int)local_68) {
                  uVar7 = (local_68 - uVar14) + 1;
                  uVar6 = local_68 + 1;
                  iVar8 = iVar11;
                  if ((int)uVar7 < 0x20) {
                    iVar2 = (int)(uVar13 + (local_2c << (local_68 - uVar14 & 0x1f))) >>
                            (uVar7 & 0x1f);
                  }
                  else {
                    iVar2 = 0;
                  }
                }
                else {
                  uVar7 = (uVar14 - local_68) + 1;
                  uVar6 = uVar14 + 1;
                  iVar2 = (int)uVar13 >> 1;
                  if ((int)uVar7 < 0x20) {
                    iVar8 = (int)(uVar1 + (local_2c << (uVar14 - local_68 & 0x1f))) >>
                            (uVar7 & 0x1f);
                  }
                  else {
                    iVar8 = 0;
                  }
                }
                uVar7 = iVar8 + iVar2;
                if (((uVar7 & local_30) == local_30) || ((uVar7 & local_30) == 0)) {
                  uVar6 = uVar6 - 1;
                  uVar7 = uVar7 * 2;
                }
              }
              if (local_38 == 0) {
                iVar8 = param_1[7];
                uVar12 = uVar6;
                uVar10 = uVar7;
              }
              else {
                uVar12 = local_34;
                uVar10 = local_38;
                if (uVar7 != 0) {
                  if ((int)uVar6 < (int)local_34) {
                    uVar13 = (local_34 - uVar6) + 1;
                    uVar12 = local_34 + 1;
                    iVar2 = (int)local_38 >> 1;
                    if ((int)uVar13 < 0x20) {
                      iVar8 = (int)(uVar7 + (local_2c << (local_34 - uVar6 & 0x1f))) >>
                              (uVar13 & 0x1f);
                    }
                    else {
                      iVar8 = 0;
                    }
                  }
                  else {
                    uVar13 = (uVar6 - local_34) + 1;
                    uVar12 = uVar6 + 1;
                    iVar8 = (int)uVar7 >> 1;
                    if ((int)uVar13 < 0x20) {
                      iVar2 = (int)((local_2c << (uVar6 - local_34 & 0x1f)) + local_38) >>
                              (uVar13 & 0x1f);
                    }
                    else {
                      iVar2 = 0;
                    }
                  }
                  uVar10 = iVar2 + iVar8;
                  if (((uVar10 & local_30) != local_30) && ((uVar10 & local_30) != 0)) {
                    iVar8 = param_1[7];
                    goto LAB_08972e70;
                  }
                  uVar12 = uVar12 - 1;
                  uVar10 = uVar10 * 2;
                }
                iVar8 = param_1[7];
              }
LAB_08972e70:
              uVar13 = local_38;
              uVar14 = local_34;
              if (iVar8 != 0) {
                uVar13 = uVar10;
                uVar14 = uVar12;
              }
              if (local_40 == (int *)0x0) {
                iVar8 = *param_1;
                iVar2 = local_48 * iVar8;
              }
              else {
                iVar8 = *param_1;
                iVar2 = iVar8 * *local_3c;
              }
              local_50[iVar2 + iVar5] = uVar10;
              local_54[iVar2 + iVar5] = uVar12;
              if ((int)*param_4 < (int)uVar12) {
                *param_4 = uVar12;
              }
              iVar5 = iVar5 + 1;
              iVar16 = iVar16 * iVar9;
            } while (iVar5 < iVar8);
            iVar16 = param_1[1];
          }
          local_48 = local_48 + 1;
          local_3c = local_3c + 1;
        }
        iVar4 = iVar4 + 1;
      } while (iVar4 < iVar16);
      goto LAB_08972ca8;
    }
  }
  else if ((param_1[3] == 2) && (iVar9 = param_1[1], 0 < iVar9)) {
    iVar8 = *param_1;
    local_60 = 0;
    iVar16 = 0;
    piVar15 = local_40;
    do {
      if ((local_40 == (int *)0x0) || (*(int *)(iVar16 * 4 + param_1[2]) != 0)) {
        if (0 < iVar8) {
          iVar9 = 0;
          uVar14 = 0;
          uVar13 = 0;
          local_30 = 1;
          local_34 = 0xc0000000;
          do {
            iVar8 = local_64;
            local_38 = uVar13;
            iVar4 = _ilog(0);
            if (local_4c == 0) {
LAB_089730b8:
              uVar13 = 0;
              uVar6 = 0;
            }
            else {
              iVar5 = 0 << (-(iVar4 + -0x1f) & 0x1fU);
              if (iVar5 == 0) goto LAB_089730b8;
              uVar13 = (local_4c >> 0xf) * (iVar5 >> 0x10);
              uVar6 = iVar4 + -0x1f + iVar8 + 0x1f;
            }
            uVar7 = uVar6;
            uVar12 = uVar13;
            if ((uVar1 != 0) && (uVar7 = local_68, uVar12 = uVar1, uVar13 != 0)) {
              if ((int)uVar6 < (int)local_68) {
                uVar12 = (local_68 - uVar6) + 1;
                uVar7 = local_68 + 1;
                iVar8 = iVar11;
                if ((int)uVar12 < 0x20) {
                  iVar4 = (int)(uVar13 + (local_30 << (local_68 - uVar6 & 0x1f))) >> (uVar12 & 0x1f)
                  ;
                }
                else {
                  iVar4 = 0;
                }
              }
              else {
                uVar12 = (uVar6 - local_68) + 1;
                uVar7 = uVar6 + 1;
                iVar4 = (int)uVar13 >> 1;
                if ((int)uVar12 < 0x20) {
                  iVar8 = (int)(uVar1 + (local_30 << (uVar6 - local_68 & 0x1f))) >> (uVar12 & 0x1f);
                }
                else {
                  iVar8 = 0;
                }
              }
              uVar12 = iVar4 + iVar8;
              if (((uVar12 & local_34) == local_34) || ((uVar12 & local_34) == 0)) {
                uVar7 = uVar7 - 1;
                uVar12 = uVar12 * 2;
              }
            }
            if (uVar14 == 0) {
              iVar8 = param_1[7];
              uVar6 = uVar7;
              uVar10 = uVar12;
            }
            else {
              uVar6 = local_38;
              uVar10 = uVar14;
              if (uVar12 != 0) {
                if ((int)uVar7 < (int)local_38) {
                  uVar13 = (local_38 - uVar7) + 1;
                  uVar6 = local_38 + 1;
                  iVar4 = (int)uVar14 >> 1;
                  if ((int)uVar13 < 0x20) {
                    iVar8 = (int)(uVar12 + (local_30 << (local_38 - uVar7 & 0x1f))) >>
                            (uVar13 & 0x1f);
                  }
                  else {
                    iVar8 = 0;
                  }
                }
                else {
                  uVar13 = (uVar7 - local_38) + 1;
                  uVar6 = uVar7 + 1;
                  iVar8 = (int)uVar12 >> 1;
                  if ((int)uVar13 < 0x20) {
                    iVar4 = (int)((local_30 << (uVar7 - local_38 & 0x1f)) + uVar14) >>
                            (uVar13 & 0x1f);
                  }
                  else {
                    iVar4 = 0;
                  }
                }
                uVar10 = iVar8 + iVar4;
                if (((uVar10 & local_34) != local_34) && ((uVar10 & local_34) != 0)) {
                  iVar8 = param_1[7];
                  goto LAB_08973018;
                }
                uVar6 = uVar6 - 1;
                uVar10 = uVar10 * 2;
              }
              iVar8 = param_1[7];
            }
LAB_08973018:
            uVar13 = local_38;
            if (iVar8 != 0) {
              uVar13 = uVar6;
              uVar14 = uVar10;
            }
            iVar8 = *param_1;
            iVar4 = local_60;
            if (local_40 != (int *)0x0) {
              iVar4 = *piVar15;
            }
            iVar4 = iVar8 * iVar4 + iVar9;
            local_50[iVar4] = uVar10;
            local_54[iVar4] = uVar6;
            if ((int)*param_4 < (int)uVar6) {
              *param_4 = uVar6;
            }
            iVar9 = iVar9 + 1;
          } while (iVar9 < iVar8);
          iVar9 = param_1[1];
        }
        piVar15 = piVar15 + 1;
        local_60 = local_60 + 1;
      }
      iVar16 = iVar16 + 1;
    } while (iVar16 < iVar9);
    goto LAB_08972ca8;
  }
  iVar8 = *param_1;
LAB_08972ca8:
  iVar11 = 0;
  if (0 < local_44 * iVar8) {
    uVar1 = *param_4;
    do {
      iVar11 = iVar11 + 1;
      iVar9 = *local_58;
      local_58 = local_58 + 1;
      if (iVar9 < (int)uVar1) {
        *local_5c = *local_5c >> (uVar1 - iVar9 & 0x1f);
      }
      local_5c = local_5c + 1;
    } while (iVar11 != local_44 * iVar8);
  }
  free(local_54);
  return local_50;
}



----------------------------------------

// Function: vorbis_book_init_decode @ 089732ec

undefined4 vorbis_book_init_decode(undefined4 *param_1,undefined4 *param_2)

{
  uint *puVar1;
  int iVar2;
  undefined4 *aptr;
  undefined4 uVar3;
  void *pvVar4;
  uint uVar5;
  uint uVar6;
  int *piVar7;
  undefined4 *puVar8;
  char *pcVar9;
  int iVar10;
  int *piVar11;
  uint uVar12;
  int iVar13;
  int *piVar14;
  int *piVar15;
  uint *puVar16;
  undefined4 *puVar17;
  uint uVar18;
  size_t sVar19;
  size_t sVar20;
  char *pcVar21;
  size_t local_48 [3];
  uint local_3c;
  
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[8] = 0;
  param_1[9] = 0;
  param_1[10] = 0;
  param_1[0xb] = 0;
  param_1[0xc] = 0;
  iVar13 = param_2[1];
  if (iVar13 < 1) {
    param_1[1] = iVar13;
    param_1[2] = 0;
    *param_1 = *param_2;
    return 0;
  }
  piVar7 = (int *)param_2[2];
  sVar20 = 0;
  iVar10 = 0;
  iVar2 = *piVar7;
  piVar11 = piVar7;
  while( true ) {
    iVar10 = iVar10 + 1;
    piVar11 = piVar11 + 1;
    if (0 < iVar2) {
      sVar20 = sVar20 + 1;
    }
    if (iVar13 == iVar10) break;
    iVar2 = *piVar11;
  }
  param_1[1] = iVar13;
  param_1[2] = sVar20;
  *param_1 = *param_2;
  if ((int)sVar20 < 1) {
    return 0;
  }
  local_48[2] = sVar20 * 4;
  local_3c = local_48[2] + 0xe;
  aptr = (undefined4 *)_make_words(piVar7,param_2[1],sVar20);
  iVar13 = -(local_3c & 0xfffffff8);
  puVar8 = (undefined4 *)((int)local_48 + iVar13);
  piVar11 = (int *)((int)local_48 + iVar13);
  if (aptr == (undefined4 *)0x0) {
    vorbis_book_clear(param_1);
    return 0xffffffff;
  }
  sVar19 = 0;
  puVar17 = aptr;
  do {
    sVar19 = sVar19 + 1;
    uVar3 = bitreverse(*puVar17);
    *puVar17 = uVar3;
    *puVar8 = puVar17;
    puVar17 = puVar17 + 1;
    puVar8 = puVar8 + 1;
  } while (sVar20 != sVar19);
  qsort((void *)((int)local_48 + iVar13),sVar20,4,sort32a);
  iVar2 = -(local_3c & 0xfffffff8);
  piVar7 = (int *)((int)local_48 + iVar2 + iVar13);
  piVar14 = (int *)((int)local_48 + iVar2 + iVar13);
  piVar15 = (int *)((int)local_48 + iVar2 + iVar13);
  pvVar4 = malloc(local_48[2]);
  param_1[5] = pvVar4;
  sVar19 = 0;
  do {
    *(size_t *)((int)local_48 + (*piVar11 - (int)aptr >> 2) * 4 + iVar2 + iVar13) = sVar19;
    sVar19 = sVar19 + 1;
    piVar11 = piVar11 + 1;
  } while (sVar20 != sVar19);
  iVar10 = param_1[5];
  sVar19 = 0;
  puVar8 = aptr;
  do {
    sVar19 = sVar19 + 1;
    *(undefined4 *)(*piVar7 * 4 + iVar10) = *puVar8;
    piVar7 = piVar7 + 1;
    puVar8 = puVar8 + 1;
  } while (sVar20 != sVar19);
  free(aptr);
  uVar3 = _book_unquantize(param_2,sVar20,(int)local_48 + iVar2 + iVar13,param_1 + 3);
  param_1[4] = uVar3;
  pvVar4 = malloc(local_48[2]);
  iVar13 = param_2[1];
  param_1[6] = pvVar4;
  if (iVar13 < 1) {
    sVar20 = 0;
  }
  else {
    piVar11 = (int *)param_2[2];
    iVar10 = 0;
    sVar20 = 0;
    iVar2 = *piVar11;
    while( true ) {
      piVar11 = piVar11 + 1;
      if (0 < iVar2) {
        iVar2 = *piVar14;
        sVar20 = sVar20 + 1;
        piVar14 = piVar14 + 1;
        *(int *)(iVar2 * 4 + param_1[6]) = iVar10;
      }
      iVar10 = iVar10 + 1;
      if (iVar13 <= iVar10) break;
      iVar2 = *piVar11;
    }
  }
  pvVar4 = malloc(sVar20);
  iVar13 = param_2[1];
  param_1[7] = pvVar4;
  if (iVar13 < 1) {
    local_48[0] = 0;
  }
  else {
    iVar10 = 0;
    local_48[0] = 0;
    iVar2 = param_2[2];
    while( true ) {
      iVar2 = *(int *)(iVar10 * 4 + iVar2);
      iVar10 = iVar10 + 1;
      if (0 < iVar2) {
        iVar13 = *piVar15;
        piVar15 = piVar15 + 1;
        local_48[0] = local_48[0] + 1;
        *(char *)(param_1[7] + iVar13) = (char)iVar2;
        iVar13 = param_2[1];
      }
      if (iVar13 <= iVar10) break;
      iVar2 = param_2[2];
    }
  }
  iVar13 = _ilog(param_1[2]);
  iVar13 = iVar13 + -4;
  param_1[9] = iVar13;
  if (iVar13 < 5) {
    param_1[9] = 5;
  }
  else {
    if (iVar13 < 9) {
      uVar6 = param_1[9];
      goto LAB_089735a0;
    }
    param_1[9] = 8;
  }
  uVar6 = param_1[9];
LAB_089735a0:
  local_48[1] = 1 << (uVar6 & 0x1f);
  pvVar4 = calloc(local_48[1],4);
  param_1[8] = pvVar4;
  param_1[10] = 0;
  if ((int)local_48[0] < 1) {
    uVar6 = param_1[9];
  }
  else {
    pcVar21 = (char *)param_1[7];
    uVar6 = param_1[9];
    iVar13 = 0;
    pcVar9 = pcVar21;
    do {
      if ((int)param_1[10] < (int)*pcVar9) {
        param_1[10] = (int)*pcVar9;
      }
      uVar18 = (uint)*pcVar9;
      if ((int)uVar18 <= (int)uVar6) {
        uVar5 = bitreverse(*(undefined4 *)(iVar13 * 4 + param_1[5]));
        if (0 < 1 << (uVar6 - uVar18 & 0x1f)) {
          iVar10 = param_1[8];
          iVar2 = 0;
          uVar18 = 0 << (uVar18 & 0x1f);
          do {
            *(int *)((uVar5 | uVar18) * 4 + iVar10) = iVar13 + 1;
            uVar6 = param_1[9];
            iVar2 = iVar2 + 1;
            uVar18 = iVar2 << ((int)pcVar21[iVar13] & 0x1fU);
          } while (iVar2 < 1 << (uVar6 - (int)pcVar21[iVar13] & 0x1f));
        }
      }
      iVar13 = iVar13 + 1;
      pcVar9 = pcVar21 + iVar13;
    } while (iVar13 < (int)local_48[0]);
  }
  uVar18 = -2 << (~uVar6 & 0x1f);
  if ((int)local_48[1] < 1) {
    return 0;
  }
  iVar13 = param_1[8];
  sVar19 = 0;
  uVar5 = 0;
  sVar20 = 0;
  do {
    uVar6 = sVar19 << (-uVar6 & 0x1f);
    iVar2 = bitreverse(uVar6);
    puVar16 = (uint *)(iVar2 * 4 + iVar13);
    if (*puVar16 == 0) {
      iVar2 = uVar5 << 2;
      uVar12 = uVar5;
      do {
        uVar5 = uVar12;
        if ((int)local_48[0] <= (int)(uVar5 + 1)) break;
        iVar10 = param_1[5] + iVar2;
        iVar2 = iVar2 + 4;
        uVar12 = uVar5 + 1;
      } while (*(uint *)(iVar10 + 4) <= uVar6);
      if (((int)sVar20 < (int)local_48[0]) &&
         ((uVar18 & *(uint *)(sVar20 * 4 + param_1[5])) <= uVar6)) {
        iVar2 = sVar20 * 4 + param_1[5];
        do {
          sVar20 = sVar20 + 1;
          if (sVar20 == local_48[0]) break;
          puVar1 = (uint *)(iVar2 + 4);
          iVar2 = iVar2 + 4;
        } while ((uVar18 & *puVar1) <= uVar6);
      }
      uVar6 = 0x7fff;
      if (uVar5 < 0x8000) {
        uVar6 = uVar5;
      }
      uVar12 = 0x7fff;
      if (local_48[0] - sVar20 < 0x8000) {
        uVar12 = local_48[0] - sVar20;
      }
      *puVar16 = uVar6 << 0xf | 0x80000000 | uVar12;
    }
    sVar19 = sVar19 + 1;
    if (local_48[1] == sVar19) {
      return 0;
    }
    uVar6 = param_1[9];
  } while( true );
}



----------------------------------------

// Function: _adv_halt @ 0897387c

void _adv_halt(undefined4 *param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  
  puVar2 = (undefined4 *)param_1[3];
  *param_1 = 0;
  iVar3 = puVar2[1];
  iVar4 = puVar2[2];
  iVar1 = *(int *)*puVar2;
  param_1[2] = 0xffffffff;
  param_1[1] = iVar1 + iVar3 + iVar4;
  return;
}



----------------------------------------

// Function: _span @ 089738ac

void _span(int *param_1)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  undefined4 *puVar5;
  int iVar7;
  int iVar8;
  undefined4 *puVar6;
  
  iVar7 = param_1[2];
  if (0 < iVar7) {
    return;
  }
  if (((undefined4 *)param_1[3])[3] != 0) {
    iVar8 = param_1[5];
    puVar6 = (undefined4 *)param_1[3];
    do {
      puVar5 = (undefined4 *)puVar6[3];
      piVar3 = (int *)*puVar5;
      iVar8 = iVar8 + puVar6[2];
      param_1[5] = iVar8;
      iVar2 = puVar5[1];
      iVar1 = *piVar3;
      iVar4 = puVar5[2];
      param_1[3] = (int)puVar5;
      iVar1 = (iVar1 + iVar2) - iVar7;
      iVar7 = iVar7 + iVar4;
      param_1[1] = iVar1;
      param_1[2] = iVar7;
      if (0 < iVar7) {
        return;
      }
      puVar6 = puVar5;
    } while (puVar5[3] != 0);
  }
  if ((iVar7 == 0) && (*param_1 == 0)) {
    return;
  }
  _adv_halt(param_1);
  return;
}



----------------------------------------

// Function: oggpack_look @ 08973948

uint oggpack_look(uint *param_1,int param_2)

{
  int *piVar1;
  int iVar2;
  uint uVar3;
  byte *pbVar4;
  int iVar5;
  uint uVar6;
  undefined4 *puVar7;
  uint uVar8;
  
  uVar6 = *param_1;
  uVar3 = param_1[2];
  iVar5 = param_2 + uVar6;
  if (iVar5 < (int)(uVar3 << 3)) {
    pbVar4 = (byte *)param_1[1];
    uVar8 = (int)(uint)*pbVar4 >> (uVar6 & 0x1f);
    if ((((8 < iVar5) && (uVar8 = uVar8 | (uint)pbVar4[1] << (8 - uVar6 & 0x1f), 0x10 < iVar5)) &&
        (uVar8 = uVar8 | (uint)pbVar4[2] << (0x10 - uVar6 & 0x1f), 0x18 < iVar5)) &&
       ((uVar8 = uVar8 | (uint)pbVar4[3] << (0x18 - uVar6 & 0x1f), 0x20 < iVar5 && (uVar6 != 0)))) {
      uVar8 = uVar8 | (uint)pbVar4[4] << (-uVar6 & 0x1f);
    }
  }
  else {
    puVar7 = (undefined4 *)param_1[3];
    pbVar4 = (byte *)param_1[1];
    if ((int)uVar3 < 0) {
      return 0xffffffff;
    }
    uVar8 = 0xffffffff;
    if (iVar5 != 0) {
      if (uVar3 == 0) {
        puVar7 = (undefined4 *)puVar7[3];
        while( true ) {
          if (puVar7 == (undefined4 *)0x0) {
            return 0xffffffff;
          }
          uVar3 = puVar7[2];
          pbVar4 = (byte *)(*(int *)*puVar7 + puVar7[1]);
          if (uVar3 != 0) break;
          puVar7 = (undefined4 *)puVar7[3];
        }
      }
      uVar8 = (int)(uint)*pbVar4 >> (uVar6 & 0x1f);
      if (8 < iVar5) {
        iVar2 = uVar3 - 1;
        if (iVar2 == 0) {
          puVar7 = (undefined4 *)puVar7[3];
          while( true ) {
            if (puVar7 == (undefined4 *)0x0) {
              return 0xffffffff;
            }
            iVar2 = puVar7[2];
            pbVar4 = (byte *)(*(int *)*puVar7 + puVar7[1]);
            if (iVar2 != 0) break;
            puVar7 = (undefined4 *)puVar7[3];
          }
        }
        else {
          pbVar4 = pbVar4 + 1;
        }
        uVar8 = uVar8 | (uint)*pbVar4 << (8 - uVar6 & 0x1f);
        if (0x10 < iVar5) {
          iVar2 = iVar2 + -1;
          if (iVar2 == 0) {
            puVar7 = (undefined4 *)puVar7[3];
            while( true ) {
              if (puVar7 == (undefined4 *)0x0) {
                return 0xffffffff;
              }
              iVar2 = puVar7[2];
              pbVar4 = (byte *)(*(int *)*puVar7 + puVar7[1]);
              if (iVar2 != 0) break;
              puVar7 = (undefined4 *)puVar7[3];
            }
          }
          else {
            pbVar4 = pbVar4 + 1;
          }
          uVar8 = uVar8 | (uint)*pbVar4 << (0x10 - uVar6 & 0x1f);
          if (0x18 < iVar5) {
            iVar2 = iVar2 + -1;
            if (iVar2 == 0) {
              puVar7 = (undefined4 *)puVar7[3];
              while( true ) {
                if (puVar7 == (undefined4 *)0x0) {
                  return 0xffffffff;
                }
                iVar2 = puVar7[2];
                pbVar4 = (byte *)(*(int *)*puVar7 + puVar7[1]);
                if (iVar2 != 0) break;
                puVar7 = (undefined4 *)puVar7[3];
              }
            }
            else {
              pbVar4 = pbVar4 + 1;
            }
            uVar8 = uVar8 | (uint)*pbVar4 << (0x18 - uVar6 & 0x1f);
            if ((0x20 < iVar5) && (uVar6 != 0)) {
              if (iVar2 == 1) {
                puVar7 = (undefined4 *)puVar7[3];
                if (puVar7 == (undefined4 *)0x0) {
                  return 0xffffffff;
                }
                piVar1 = (int *)*puVar7;
                while (pbVar4 = (byte *)(*piVar1 + puVar7[1]), puVar7[2] == 0) {
                  puVar7 = (undefined4 *)puVar7[3];
                  if (puVar7 == (undefined4 *)0x0) {
                    return 0xffffffff;
                  }
                  piVar1 = (int *)*puVar7;
                }
              }
              else {
                pbVar4 = pbVar4 + 1;
              }
              uVar8 = uVar8 | (uint)*pbVar4 << (-uVar6 & 0x1f);
            }
          }
        }
      }
    }
  }
  return uVar8 & *(uint *)(mask + param_2 * 4);
}



----------------------------------------

// Function: oggpack_adv @ 08973bc0

/* WARNING: Removing unreachable block (ram,0x08973bd8) */

void oggpack_adv(uint *param_1,int param_2)

{
  uint uVar1;
  int iVar2;
  
  iVar2 = (int)(param_2 + *param_1) / 8;
  *param_1 = param_2 + *param_1 & 7;
  uVar1 = param_1[2] - iVar2;
  param_1[1] = param_1[1] + iVar2;
  param_1[2] = uVar1;
  if ((int)uVar1 < 1) {
    _span();
    return;
  }
  return;
}



----------------------------------------

// Function: _span_one @ 08973c10

void _span_one(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  undefined4 *puVar3;
  
  if ((*(int *)(param_1 + 8) < 1) && ((*(undefined4 **)(param_1 + 0xc))[3] != 0)) {
    iVar7 = *(int *)(param_1 + 0x14);
    puVar3 = *(undefined4 **)(param_1 + 0xc);
    while( true ) {
      puVar2 = (undefined4 *)puVar3[3];
      piVar4 = (int *)*puVar2;
      iVar7 = iVar7 + puVar3[2];
      *(int *)(param_1 + 0x14) = iVar7;
      iVar1 = *piVar4;
      iVar5 = puVar2[1];
      iVar6 = puVar2[2];
      *(undefined4 **)(param_1 + 0xc) = puVar2;
      *(int *)(param_1 + 4) = iVar1 + iVar5;
      *(int *)(param_1 + 8) = iVar6;
      if (0 < iVar6) break;
      puVar3 = puVar2;
      if (puVar2[3] == 0) {
        return;
      }
    }
  }
  return;
}



----------------------------------------

// Function: _halt_one @ 08973c8c

undefined4 _halt_one(int param_1)

{
  undefined4 uVar1;
  
  uVar1 = 0;
  if (*(int *)(param_1 + 8) < 1) {
    _adv_halt();
    uVar1 = 0xffffffff;
  }
  return uVar1;
}



----------------------------------------

// Function: oggpack_eop @ 08973cc0

undefined4 oggpack_eop(int param_1)

{
  undefined4 uVar1;
  
  uVar1 = 0xffffffff;
  if (-1 < *(int *)(param_1 + 8)) {
    uVar1 = 0;
  }
  return uVar1;
}



----------------------------------------

// Function: oggpack_read @ 08973cd4

/* WARNING: Removing unreachable block (ram,0x08973d40) */

uint oggpack_read(uint *param_1,int param_2)

{
  int iVar1;
  byte *pbVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  
  uVar3 = *param_1;
  uVar4 = param_1[2];
  uVar5 = param_2 + uVar3;
  uVar7 = *(uint *)(mask + param_2 * 4);
  if ((int)uVar5 < (int)(uVar4 << 3)) {
    pbVar2 = (byte *)param_1[1];
    uVar6 = (int)(uint)*pbVar2 >> (uVar3 & 0x1f);
    if ((((8 < (int)uVar5) &&
         (uVar6 = uVar6 | (uint)pbVar2[1] << (8 - uVar3 & 0x1f), 0x10 < (int)uVar5)) &&
        (uVar6 = uVar6 | (uint)pbVar2[2] << (0x10 - uVar3 & 0x1f), 0x18 < (int)uVar5)) &&
       ((uVar6 = uVar6 | (uint)pbVar2[3] << (0x18 - uVar3 & 0x1f), 0x20 < (int)uVar5 && (uVar3 != 0)
        ))) {
      uVar6 = uVar6 | (uint)pbVar2[4] << (-uVar3 & 0x1f);
    }
    param_1[1] = (uint)(pbVar2 + (int)uVar5 / 8);
    param_1[2] = uVar4 - (int)uVar5 / 8;
  }
  else {
    if ((int)uVar4 < 0) {
      return 0xffffffff;
    }
    uVar6 = 0xffffffff;
    if (uVar5 != 0) {
      iVar1 = _halt_one();
      if (iVar1 != 0) {
        return 0xffffffff;
      }
      uVar6 = (int)(uint)*(byte *)param_1[1] >> (*param_1 & 0x1f);
      if (7 < (int)uVar5) {
        param_1[1] = (uint)((byte *)param_1[1] + 1);
        param_1[2] = param_1[2] - 1;
        _span_one(param_1);
        if (uVar5 != 8) {
          iVar1 = _halt_one(param_1);
          if (iVar1 != 0) {
            return 0xffffffff;
          }
          uVar6 = uVar6 | (uint)*(byte *)param_1[1] << (8 - *param_1 & 0x1f);
          if (0xf < (int)uVar5) {
            param_1[1] = (uint)((byte *)param_1[1] + 1);
            param_1[2] = param_1[2] - 1;
            _span_one(param_1);
            if (uVar5 != 0x10) {
              iVar1 = _halt_one(param_1);
              if (iVar1 != 0) {
                return 0xffffffff;
              }
              uVar6 = uVar6 | (uint)*(byte *)param_1[1] << (0x10 - *param_1 & 0x1f);
              if (0x17 < (int)uVar5) {
                param_1[1] = (uint)((byte *)param_1[1] + 1);
                param_1[2] = param_1[2] - 1;
                _span_one(param_1);
                if (uVar5 != 0x18) {
                  iVar1 = _halt_one(param_1);
                  if (iVar1 != 0) {
                    return 0xffffffff;
                  }
                  uVar6 = uVar6 | (uint)*(byte *)param_1[1] << (0x18 - *param_1 & 0x1f);
                  if (0x1f < (int)uVar5) {
                    param_1[1] = (uint)((byte *)param_1[1] + 1);
                    param_1[2] = param_1[2] - 1;
                    _span_one(param_1);
                    if (uVar5 != 0x20) {
                      iVar1 = _halt_one(param_1);
                      if (iVar1 != 0) {
                        return 0xffffffff;
                      }
                      if (*param_1 != 0) {
                        uVar6 = uVar6 | (uint)*(byte *)param_1[1] << (0x20 - *param_1 & 0x1f);
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  *param_1 = uVar5 & 7;
  return uVar6 & uVar7;
}



----------------------------------------

// Function: oggpack_bytes @ 08973f94

/* WARNING: Removing unreachable block (ram,0x08973fac) */

int oggpack_bytes(int *param_1)

{
  return (((param_1[1] + param_1[5]) - **(int **)param_1[3]) - ((undefined4 *)param_1[3])[1]) +
         (*param_1 + 7) / 8;
}



----------------------------------------

// Function: oggpack_bits @ 08973fdc

int oggpack_bits(int *param_1)

{
  return (((param_1[1] + param_1[5]) - **(int **)param_1[3]) - ((undefined4 *)param_1[3])[1]) * 8 +
         *param_1;
}



----------------------------------------

// Function: oggpack_readinit @ 08974010

void oggpack_readinit(undefined4 *param_1,undefined4 *param_2)

{
  int iVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  
  param_1[1] = 0;
  param_1[2] = 0;
  *param_1 = 0;
  piVar2 = (int *)*param_2;
  param_1[5] = 0;
  iVar4 = param_2[1];
  iVar1 = *piVar2;
  uVar3 = param_2[2];
  param_1[3] = param_2;
  param_1[2] = uVar3;
  param_1[1] = iVar1 + iVar4;
  param_1[4] = param_2;
  _span();
  return;
}



----------------------------------------

// Function: ilog @ 08974048

int ilog(uint param_1)

{
  int iVar1;
  
  if (param_1 != 0) {
    iVar1 = 0;
    do {
      param_1 = param_1 >> 1;
      iVar1 = iVar1 + 1;
    } while (param_1 != 0);
    return iVar1;
  }
  return 0;
}



----------------------------------------

// Function: icomp @ 08974070

int icomp(undefined4 *param_1,undefined4 *param_2)

{
  return *(int *)*param_1 - *(int *)*param_2;
}



----------------------------------------

// Function: floor1_inverse1 @ 08974088

undefined4 * floor1_inverse1(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  uint uVar5;
  int iVar6;
  int *piVar7;
  int iVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  int iVar12;
  int *piVar13;
  int *local_48;
  undefined4 *local_44;
  int local_38;
  int local_34;
  
  iVar12 = param_1 + 4;
  iVar1 = *(int *)(*(int *)(*(int *)(*(int *)(param_1 + 0x48) + 4) + 0x1c) + 0xc20);
  piVar13 = *(int **)(param_2 + 0x308);
  iVar2 = oggpack_read(iVar12,1);
  if (iVar2 == 1) {
    puVar3 = (undefined4 *)_vorbis_block_alloc(param_1,*(int *)(param_2 + 0x2fc) << 2);
    uVar4 = ilog(*(int *)(param_2 + 0x304) + -1);
    uVar4 = oggpack_read(iVar12,uVar4);
    *puVar3 = uVar4;
    uVar4 = ilog(*(int *)(param_2 + 0x304) + -1);
    uVar4 = oggpack_read(iVar12,uVar4);
    puVar3[1] = uVar4;
    if (0 < *piVar13) {
      local_34 = 0;
      local_38 = 2;
      local_48 = piVar13;
      do {
        local_48 = local_48 + 1;
        iVar2 = *local_48;
        uVar10 = piVar13[iVar2 + 0x30];
        iVar11 = piVar13[iVar2 + 0x20];
        if (uVar10 == 0) {
          uVar9 = 0;
        }
        else {
          uVar9 = vorbis_book_decode(iVar1 + piVar13[iVar2 + 0x40] * 0x34,iVar12);
          if (uVar9 == 0xffffffff) goto LAB_089740f4;
        }
        if (0 < iVar11) {
          piVar7 = puVar3 + local_38;
          iVar8 = 0;
          do {
            while( true ) {
              uVar5 = (1 << (uVar10 & 0x1f)) - 1U & uVar9;
              iVar8 = iVar8 + 1;
              uVar9 = (int)uVar9 >> (uVar10 & 0x1f);
              if (piVar13[iVar2 * 8 + uVar5 + 0x50] < 0) break;
              iVar6 = vorbis_book_decode(iVar1 + piVar13[iVar2 * 8 + uVar5 + 0x50] * 0x34,iVar12);
              *piVar7 = iVar6;
              if (iVar6 == -1) goto LAB_089740f4;
              piVar7 = piVar7 + 1;
              if (iVar11 == iVar8) goto LAB_0897424c;
            }
            *piVar7 = 0;
            piVar7 = piVar7 + 1;
          } while (iVar11 != iVar8);
        }
LAB_0897424c:
        local_34 = local_34 + 1;
        if (*piVar13 <= local_34) break;
        local_38 = local_38 + iVar11;
      } while( true );
    }
    if (2 < *(int *)(param_2 + 0x2fc)) {
      iVar2 = 2;
      iVar1 = param_2;
      local_44 = puVar3;
      do {
        iVar12 = 0 / (piVar13[*(int *)(iVar1 + 0x104) + 0xd1] -
                     piVar13[*(int *)(iVar1 + 0x200) + 0xd1]);
        if (piVar13[*(int *)(iVar1 + 0x104) + 0xd1] - piVar13[*(int *)(iVar1 + 0x200) + 0xd1] == 0)
        {
          trap(7);
        }
        if ((int)((puVar3[*(int *)(iVar1 + 0x104)] & 0x7fff) -
                 (puVar3[*(int *)(iVar1 + 0x200)] & 0x7fff)) < 0) {
          iVar12 = -iVar12;
        }
        uVar9 = (puVar3[*(int *)(iVar1 + 0x200)] & 0x7fff) + iVar12;
        uVar10 = local_44[2];
        if (uVar10 == 0) {
          local_44[2] = uVar9 | 0x8000;
        }
        else {
          iVar12 = *(int *)(param_2 + 0x304) - uVar9;
          if ((int)uVar10 < (int)((uVar9 + iVar12) * 2)) {
            if ((uVar10 & 1) == 0) {
              uVar10 = (int)uVar10 >> 1;
            }
            else {
              uVar10 = -((int)(uVar10 + 1) >> 1);
            }
          }
          else if ((int)uVar9 < iVar12) {
            uVar10 = uVar10 - uVar9;
          }
          else {
            uVar10 = ~(uVar10 - iVar12);
          }
          local_44[2] = uVar9 + uVar10;
          puVar3[*(int *)(iVar1 + 0x200)] = puVar3[*(int *)(iVar1 + 0x200)] & 0x7fff;
          puVar3[*(int *)(iVar1 + 0x104)] = puVar3[*(int *)(iVar1 + 0x104)] & 0x7fff;
        }
        iVar2 = iVar2 + 1;
        local_44 = local_44 + 1;
        iVar1 = iVar1 + 4;
      } while (iVar2 < *(int *)(param_2 + 0x2fc));
    }
  }
  else {
LAB_089740f4:
    puVar3 = (undefined4 *)0x0;
  }
  return puVar3;
}



----------------------------------------

// Function: floor1_free_look @ 08974434

void floor1_free_look(void *param_1)

{
  if (param_1 != (void *)0x0) {
    memset(param_1,0,0x30c);
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: floor1_free_info @ 0897447c

void floor1_free_info(void *param_1)

{
  if (param_1 != (void *)0x0) {
    memset(param_1,0,0x448);
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: floor1_unpack @ 089744c4

int * floor1_unpack(int param_1,undefined4 param_2)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  int *piVar7;
  int iVar8;
  int *piVar9;
  int iVar10;
  int local_30;
  
  iVar10 = *(int *)(param_1 + 0x1c);
  piVar1 = calloc(1,0x448);
  iVar2 = oggpack_read(param_2,5);
  *piVar1 = iVar2;
  if (0 < iVar2) {
    iVar2 = 0;
    iVar8 = -1;
    piVar9 = piVar1;
    do {
      piVar9 = piVar9 + 1;
      iVar3 = oggpack_read(param_2,4);
      iVar6 = *piVar1;
      iVar2 = iVar2 + 1;
      *piVar9 = iVar3;
      iVar8 = iVar8 + iVar3;
    } while (iVar2 < iVar6);
    if (0 < iVar8 + 1) {
      iVar3 = 0;
      iVar2 = 0x140;
      piVar9 = piVar1;
      do {
        iVar6 = oggpack_read(param_2,3);
        piVar9[0x20] = iVar6 + 1;
        iVar6 = oggpack_read(param_2,2);
        piVar9[0x30] = iVar6;
        if (iVar6 < 0) {
LAB_08974618:
          floor1_free_info(piVar1);
          return (int *)0x0;
        }
        if (iVar6 != 0) {
          iVar6 = oggpack_read(param_2,8);
          piVar9[0x40] = iVar6;
        }
        if ((piVar9[0x40] < 0) || (*(int *)(iVar10 + 0x1c) <= piVar9[0x40])) goto LAB_08974618;
        piVar7 = (int *)((int)piVar1 + iVar2);
        if (0 < 1 << (piVar9[0x30] & 0x1fU)) {
          iVar6 = 0;
          do {
            iVar4 = oggpack_read(param_2,8);
            iVar4 = iVar4 + -1;
            *piVar7 = iVar4;
            iVar6 = iVar6 + 1;
            piVar7 = piVar7 + 1;
            if ((iVar4 < -1) || (*(int *)(iVar10 + 0x1c) <= iVar4)) goto LAB_08974618;
          } while (iVar6 < 1 << (piVar9[0x30] & 0x1fU));
        }
        iVar3 = iVar3 + 1;
        iVar2 = iVar2 + 0x20;
        piVar9 = piVar9 + 1;
      } while (iVar8 + 1 != iVar3);
    }
  }
  iVar2 = oggpack_read(param_2,2);
  piVar1[0xd0] = iVar2 + 1;
  uVar5 = oggpack_read(param_2,4);
  iVar2 = *piVar1;
  if (0 < iVar2) {
    local_30 = 0;
    iVar10 = 0;
    iVar8 = 0;
    piVar9 = piVar1;
    do {
      piVar9 = piVar9 + 1;
      iVar8 = iVar8 + piVar1[*piVar9 + 0x20];
      if (iVar10 < iVar8) {
        piVar7 = piVar1 + iVar10 + 0xd3;
        do {
          iVar2 = oggpack_read(param_2,uVar5);
          *piVar7 = iVar2;
          iVar10 = iVar10 + 1;
          piVar7 = piVar7 + 1;
          if ((iVar2 < 0) || (1 << (uVar5 & 0x1f) <= iVar2)) goto LAB_08974618;
        } while (iVar10 != iVar8);
        iVar2 = *piVar1;
      }
      local_30 = local_30 + 1;
    } while (local_30 < iVar2);
  }
  piVar1[0xd2] = 1 << (uVar5 & 0x1f);
  piVar1[0xd1] = 0;
  return piVar1;
}



----------------------------------------

// Function: floor1_look @ 0897476c

void * floor1_look(undefined4 param_1,undefined4 param_2,int *param_3)

{
  void *pvVar1;
  int iVar2;
  int *piVar3;
  int *piVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  size_t n;
  int iVar14;
  int iVar15;
  int local_118 [66];
  
  piVar4 = local_118;
  pvVar1 = calloc(1,0x30c);
  iVar13 = param_3[0xd2];
  iVar6 = *param_3;
  *(int **)((int)pvVar1 + 0x308) = param_3;
  *(int *)((int)pvVar1 + 0x300) = iVar13;
  if (iVar6 < 1) {
    n = 2;
    *(undefined4 *)((int)pvVar1 + 0x2fc) = 2;
  }
  else {
    iVar5 = 0;
    iVar13 = 0;
    piVar3 = param_3;
    do {
      piVar3 = piVar3 + 1;
      iVar5 = iVar5 + 1;
      iVar13 = iVar13 + param_3[*piVar3 + 0x20];
    } while (iVar6 != iVar5);
    n = iVar13 + 2;
    *(size_t *)((int)pvVar1 + 0x2fc) = n;
    if ((int)n < 1) {
      qsort(local_118,n,4,icomp);
      iVar6 = param_3[0xd0];
      goto LAB_08974858;
    }
  }
  iVar6 = 0;
  do {
    iVar13 = iVar6 + 1;
    *piVar4 = (int)(param_3 + iVar6 + 0xd1);
    piVar4 = piVar4 + 1;
    iVar6 = iVar13;
  } while (iVar13 < (int)n);
  qsort(local_118,n,4,icomp);
  iVar13 = 0;
  iVar6 = 0;
  do {
    iVar13 = iVar13 + 1;
    *(int *)((int)pvVar1 + iVar6) = *(int *)((int)local_118 + iVar6) - (int)(param_3 + 0xd1) >> 2;
    iVar6 = iVar6 + 4;
  } while (iVar13 < (int)n);
  iVar6 = param_3[0xd0];
LAB_08974858:
  if (iVar6 == 2) {
    *(undefined4 *)((int)pvVar1 + 0x304) = 0x80;
  }
  else if (iVar6 < 3) {
    if (iVar6 == 1) {
      *(undefined4 *)((int)pvVar1 + 0x304) = 0x100;
    }
  }
  else if (iVar6 == 3) {
    *(undefined4 *)((int)pvVar1 + 0x304) = 0x56;
  }
  else if (iVar6 == 4) {
    *(undefined4 *)((int)pvVar1 + 0x304) = 0x40;
  }
  if ((int)(n - 2) < 1) {
    return pvVar1;
  }
  iVar14 = *(int *)((int)pvVar1 + 0x300);
  iVar5 = param_3[0xd3];
  iVar13 = 2;
  iVar6 = 0;
  do {
    iVar7 = 0;
    iVar15 = 0;
    iVar10 = 0;
    iVar2 = param_3[0xd1];
    piVar4 = param_3 + 0xd1;
    iVar8 = iVar14;
    iVar11 = 1;
    while( true ) {
      piVar4 = piVar4 + 1;
      if ((iVar10 < iVar2) && (iVar2 < iVar5)) {
        iVar10 = iVar2;
        iVar15 = iVar7;
      }
      iVar9 = iVar8;
      iVar12 = iVar11;
      if ((iVar2 < iVar8) && (iVar9 = iVar2, iVar12 = iVar7, iVar2 <= iVar5)) {
        iVar9 = iVar8;
        iVar12 = iVar11;
      }
      iVar7 = iVar7 + 1;
      if (iVar13 <= iVar7) break;
      iVar2 = *piVar4;
      iVar8 = iVar9;
      iVar11 = iVar12;
    }
    piVar4 = (int *)((int)pvVar1 + iVar6 * 4 + 0x200);
    *piVar4 = iVar15;
    piVar4[-0x3f] = iVar12;
    piVar3 = param_3 + iVar6 + 0xd4;
    iVar13 = iVar6;
    while( true ) {
      iVar6 = iVar13 + 1;
      if ((int)(n - 2) <= iVar6) {
        return pvVar1;
      }
      iVar13 = iVar13 + 3;
      iVar5 = *piVar3;
      piVar3 = piVar3 + 1;
      if (0 < iVar13) break;
      piVar4[1] = 0;
      piVar4[-0x3e] = 1;
      piVar4 = piVar4 + 1;
      iVar13 = iVar6;
    }
  } while( true );
}



----------------------------------------

// Function: floor1_inverse2 @ 089749fc

/* WARNING: Removing unreachable block (ram,0x08974a5c) */

undefined4 floor1_inverse2(int param_1,int param_2,int *param_3,void *param_4)

{
  undefined4 uVar1;
  uint uVar2;
  int *piVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  int iVar16;
  int iVar17;
  
  iVar14 = *(int *)(param_2 + 0x308);
  iVar16 = *(int *)(*(int *)(param_1 + 0x20) * 4 +
                   *(int *)(*(int *)(*(int *)(param_1 + 0x48) + 4) + 0x1c)) / 2;
  if (param_3 == (int *)0x0) {
    memset(param_4,0,iVar16 << 2);
    uVar1 = 0;
  }
  else {
    iVar7 = *(int *)(param_2 + 0x2fc);
    iVar11 = *param_3 * *(int *)(iVar14 + 0x340);
    if (iVar7 < 2) {
      iVar6 = 0;
    }
    else {
      iVar15 = 1;
      iVar6 = 0;
      iVar9 = 0;
      iVar10 = iVar11;
      iVar13 = param_2;
      do {
        while( true ) {
          uVar2 = param_3[*(int *)(iVar13 + 4)];
          if (uVar2 == (uVar2 & 0x7fff)) break;
          iVar15 = iVar15 + 1;
          iVar13 = iVar13 + 4;
          iVar11 = iVar10;
          if (iVar7 <= iVar15) goto LAB_08974c08;
        }
        iVar6 = *(int *)(*(int *)(iVar13 + 4) * 4 + iVar14 + 0x344);
        iVar11 = uVar2 * *(int *)(iVar14 + 0x340);
        iVar7 = iVar6 - iVar9;
        iVar17 = (iVar11 - iVar10) / iVar7;
        if (iVar7 == 0) {
          trap(7);
        }
        if (iVar11 - iVar10 < 0) {
          iVar5 = iVar17 + -1;
        }
        else {
          iVar5 = iVar17 + 1;
        }
        iVar12 = iVar16 + iVar6;
        if (iVar9 < iVar12) {
          piVar3 = (int *)((int)param_4 + iVar9 * 4);
          *piVar3 = *(int *)(FLOOR_fromdB_LOOKUP + iVar10 * 4) * (*piVar3 >> 6);
        }
        iVar8 = iVar9 + 1;
        if (iVar8 < iVar12) {
          pvVar4 = (void *)(iVar9 * 4 + (int)param_4);
          iVar9 = 0;
          do {
            while (iVar7 <= iVar9) {
              iVar10 = iVar10 + iVar5;
              iVar8 = iVar8 + 1;
              iVar9 = iVar9 - iVar7;
              *(int *)((int)pvVar4 + 4) =
                   *(int *)(FLOOR_fromdB_LOOKUP + iVar10 * 4) * (*(int *)((int)pvVar4 + 4) >> 6);
              pvVar4 = (void *)((int)pvVar4 + 4);
              if (iVar12 <= iVar8) goto LAB_08974be8;
            }
            iVar10 = iVar10 + iVar17;
            iVar8 = iVar8 + 1;
            *(int *)((int)pvVar4 + 4) =
                 *(int *)(FLOOR_fromdB_LOOKUP + iVar10 * 4) * (*(int *)((int)pvVar4 + 4) >> 6);
            pvVar4 = (void *)((int)pvVar4 + 4);
          } while (iVar8 < iVar12);
        }
LAB_08974be8:
        iVar7 = *(int *)(param_2 + 0x2fc);
        iVar15 = iVar15 + 1;
        iVar13 = iVar13 + 4;
        iVar9 = iVar6;
        iVar10 = iVar11;
      } while (iVar15 < iVar7);
    }
LAB_08974c08:
    if (iVar6 < iVar16) {
      piVar3 = (int *)((int)param_4 + iVar6 * 4);
      iVar14 = 0;
      do {
        iVar14 = iVar14 + 1;
        *piVar3 = *piVar3 * iVar11;
        piVar3 = piVar3 + 1;
      } while (iVar14 != iVar16 - iVar6);
    }
    uVar1 = 1;
  }
  return uVar1;
}



----------------------------------------

// Function: floor0_inverse1 @ 08974c94

int floor0_inverse1(int param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int *piVar9;
  int iVar10;
  int iVar11;
  uint uVar12;
  
  iVar7 = *(int *)(param_2 + 0x10);
  iVar10 = param_1 + 4;
  iVar1 = oggpack_read(iVar10,*(undefined4 *)(iVar7 + 0xc));
  if (iVar1 < 1) {
    iVar4 = 0;
  }
  else {
    uVar12 = *(uint *)(iVar7 + 0xc);
    iVar11 = *(int *)(iVar7 + 0x10);
    uVar2 = _ilog(*(undefined4 *)(iVar7 + 0x14));
    iVar3 = oggpack_read(iVar10,uVar2);
    iVar4 = 0;
    if ((iVar3 != -1) && (iVar3 < *(int *)(iVar7 + 0x14))) {
      piVar9 = (int *)(*(int *)(iVar3 * 4 + iVar7 + 0x18) * 0x34 +
                      *(int *)(*(int *)(*(int *)(*(int *)(param_1 + 0x48) + 4) + 0x1c) + 0xc20));
      iVar4 = _vorbis_block_alloc(param_1,*(int *)(param_2 + 8) * 4 + 4);
      iVar7 = *(int *)(param_2 + 8);
      if (0 < iVar7) {
        iVar3 = *piVar9;
        iVar8 = 0;
        do {
          iVar7 = vorbis_book_decodev_set(piVar9,iVar4 + iVar8 * 4,iVar10,iVar3);
          if (iVar7 == -1) {
            return 0;
          }
          iVar3 = *piVar9;
          iVar7 = *(int *)(param_2 + 8);
          iVar8 = iVar8 + iVar3;
        } while (iVar8 < iVar7);
        if (0 < iVar7) {
          iVar10 = 0;
          iVar8 = 0;
          iVar6 = 0;
          do {
            iVar5 = 0;
            if (0 < iVar3) {
              piVar9 = (int *)(iVar6 + iVar4);
              do {
                iVar5 = iVar5 + 1;
                *piVar9 = *piVar9 + iVar8;
                iVar10 = iVar10 + 1;
                piVar9 = piVar9 + 1;
              } while (iVar5 < iVar3);
              iVar7 = *(int *)(param_2 + 8);
              iVar6 = iVar10 * 4;
            }
            iVar8 = *(int *)(iVar6 + iVar4 + -4);
          } while (iVar10 < iVar7);
        }
      }
      iVar10 = (1 << (uVar12 & 0x1f)) + -1;
      if (iVar10 == 0) {
        trap(7);
      }
      *(int *)(iVar7 * 4 + iVar4) = (iVar1 * iVar11 * 0x10) / iVar10;
    }
  }
  return iVar4;
}



----------------------------------------

// Function: floor0_free_look @ 08974e88

void floor0_free_look(undefined4 *param_1)

{
  if (param_1 != (undefined4 *)0x0) {
    if ((void *)param_1[3] != (void *)0x0) {
      free((void *)param_1[3]);
    }
    if ((void *)param_1[5] != (void *)0x0) {
      free((void *)param_1[5]);
    }
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
    param_1[4] = 0;
    param_1[5] = 0;
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: floor0_free_info @ 08974f00

void floor0_free_info(void *param_1)

{
  if (param_1 != (void *)0x0) {
    memset(param_1,0,0x58);
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: floor0_unpack @ 08974f48

int * floor0_unpack(int param_1,undefined4 param_2)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  
  iVar5 = *(int *)(param_1 + 0x1c);
  piVar1 = malloc(0x58);
  iVar2 = oggpack_read(param_2,8);
  *piVar1 = iVar2;
  iVar2 = oggpack_read(param_2,0x10);
  piVar1[1] = iVar2;
  iVar2 = oggpack_read(param_2,0x10);
  piVar1[2] = iVar2;
  iVar2 = oggpack_read(param_2,6);
  piVar1[3] = iVar2;
  iVar2 = oggpack_read(param_2,8);
  piVar1[4] = iVar2;
  iVar2 = oggpack_read(param_2,4);
  piVar1[5] = iVar2 + 1;
  if ((((0 < *piVar1) && (0 < piVar1[1])) && (0 < piVar1[2])) && (0 < iVar2 + 1)) {
    iVar2 = 0;
    piVar4 = piVar1;
    while( true ) {
      iVar3 = oggpack_read(param_2,8);
      piVar4[6] = iVar3;
      iVar2 = iVar2 + 1;
      piVar4 = piVar4 + 1;
      if ((iVar3 < 0) || (*(int *)(iVar5 + 0x1c) <= iVar3)) break;
      if (piVar1[5] <= iVar2) {
        return piVar1;
      }
    }
  }
  floor0_free_info(piVar1);
  return (int *)0x0;
}



----------------------------------------

// Function: vorbis_lsp_to_curve @ 08975098

void vorbis_lsp_to_curve(void *param_1,int param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  int *in_t0;
  int iVar7;
  uint in_t1;
  int in_t2;
  int iVar8;
  int in_t3;
  int iVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int local_res0;
  int local_50 [10];
  
  local_50[0] = in_t3 << 0xc;
  local_50[3] = in_t2;
  if ((int)in_t1 < 1) {
LAB_089751a8:
    if (0 < param_3) {
      iVar11 = 0;
      iVar9 = 0;
      do {
        iVar12 = *(int *)(iVar11 + param_2);
        iVar2 = *(int *)(iVar12 * 4 + local_res0);
        if ((int)in_t1 < 4) {
          iVar8 = 0;
        }
        else {
          iVar10 = 3;
          iVar8 = 0;
          do {
            uVar5 = (uint)MLOOP_1[0];
            if ((uVar5 == 0) && (uVar5 = (uint)MLOOP_2[0], uVar5 == 0)) {
              uVar5 = (uint)(byte)MLOOP_3;
            }
            iVar10 = iVar10 + 2;
            iVar8 = iVar8 + uVar5;
          } while (iVar10 < (int)in_t1);
        }
        uVar5 = (uint)MLOOP_1[0];
        if ((uVar5 == 0) && (uVar5 = (uint)MLOOP_2[0], uVar5 == 0)) {
          uVar5 = (uint)(byte)MLOOP_3;
          if ((in_t1 & 1) == 0) goto LAB_08975584;
LAB_08975348:
          uVar4 = 0 >> (uVar5 & 0x1f);
          uVar6 = (uint)(byte)MLOOP_1[(uVar4 & 0x3ffff) >> 0xb];
          if ((uVar6 == 0) && (uVar6 = (uint)(byte)MLOOP_2[(uVar4 & 0x3ffff) >> 5], uVar6 == 0)) {
            uVar6 = (uint)*(byte *)((int)&MLOOP_3 + ((uVar4 & 0x3ffff) >> 2));
          }
          uVar4 = (uVar4 << 0xe) >> (uVar6 & 0x1f);
          uVar3 = 0 >> (uVar6 & 0x1f);
          uVar6 = in_t1 + (uVar5 + uVar6 + ((int)(in_t1 + 1) >> 1) * -0xe + iVar8) * 2;
          uVar5 = (uVar3 * uVar3 >> 0x10) +
                  ((uVar4 * uVar4 >> 0x10) * (0x4000 - (iVar2 * iVar2 >> 0xe)) >> 0xe);
          uVar4 = uVar5 >> 1;
          if ((uVar5 & 0xffff0000) != 0) goto LAB_089755ec;
joined_r0x0897542c:
          for (; uVar5 != 0; uVar5 = uVar5 << 1) {
            if ((uVar5 & 0x8000) != 0) {
              uVar3 = uVar5 & 0x3ff;
              uVar5 = (uVar5 & 0x7fff) >> 9;
              goto LAB_08975464;
            }
            uVar6 = uVar6 - 1;
          }
          uVar5 = 0;
          uVar3 = 0;
        }
        else {
          if ((in_t1 & 1) != 0) goto LAB_08975348;
LAB_08975584:
          uVar4 = 0 >> (uVar5 & 0x1f);
          uVar3 = 0 >> (uVar5 & 0x1f);
          uVar6 = uVar5 * 2 + in_t1 * -0xd + iVar8 * 2;
          uVar4 = (uVar4 * uVar4 >> 0x10) * (0x4000 - iVar2) +
                  (uVar3 * uVar3 >> 0x10) * (iVar2 + 0x4000);
          uVar5 = uVar4 >> 0xe;
          uVar4 = uVar4 >> 0xf;
          if ((uVar5 & 0xffff0000) == 0) goto joined_r0x0897542c;
LAB_089755ec:
          uVar3 = uVar4 & 0x3ff;
          uVar6 = uVar6 + 1;
          uVar5 = (uVar4 & 0x7fff) >> 9;
        }
LAB_08975464:
        iVar2 = local_50[0] -
                local_50[3] *
                (((&INVSQ_LOOKUP_I)[uVar5] - ((int)(uVar3 * (&INVSQ_LOOKUP_IDel)[uVar5]) >> 10)) *
                 *(int *)((int)&ADJUST_SQRT2 + (uVar6 & 1) * 4) >>
                (((int)uVar6 >> 1) + 0x15U & 0x1f));
        uVar5 = iVar2 >> 9;
        if ((int)uVar5 < 0) {
          iVar2 = 0x3fffff;
LAB_089754f0:
          iVar8 = (iVar9 + 1) * 4;
          *(int *)(iVar11 + (int)param_1) = iVar2 * (*(int *)(iVar11 + (int)param_1) >> 6);
          iVar10 = *(int *)(param_2 + iVar8);
        }
        else {
          if (0x45f < (int)uVar5) {
            iVar2 = 0;
            goto LAB_089754f0;
          }
          iVar8 = (iVar9 + 1) * 4;
          iVar2 = *(int *)(FROMdB_LOOKUP + (iVar2 >> 0xe) * 4) *
                  *(int *)(FROMdB2_LOOKUP + (uVar5 & 0x1f) * 4) >> 9;
          *(int *)(iVar11 + (int)param_1) = iVar2 * (*(int *)(iVar11 + (int)param_1) >> 6);
          iVar10 = *(int *)(param_2 + iVar8);
        }
        iVar7 = iVar9 + 1;
        if (iVar12 == iVar10) {
          iVar7 = iVar9 + 1;
          iVar10 = param_2 + iVar11;
          iVar9 = iVar11 + 8;
          do {
            iVar11 = iVar9;
            iVar7 = iVar7 + 1;
            *(int *)((int)param_1 + iVar8) = iVar2 * (*(int *)((int)param_1 + iVar8) >> 6);
            piVar1 = (int *)(iVar10 + 8);
            iVar10 = iVar10 + 4;
            iVar9 = iVar11 + 4;
            iVar8 = iVar11;
          } while (iVar12 == *piVar1);
        }
        if (param_3 <= iVar7) {
          return;
        }
        iVar11 = iVar7 << 2;
        iVar9 = iVar7;
      } while( true );
    }
  }
  else {
    iVar9 = (*in_t0 >> 10) * 0x517d;
    uVar5 = iVar9 >> 0xe;
    if ((-1 < (int)uVar5) && (uVar6 = 0, iVar9 >> 0x17 < 0x80)) {
      iVar9 = 0;
      do {
        iVar2 = ((int)uVar5 >> 9) * 4;
        iVar11 = iVar9 - (in_t1 * 4 + 0xe & 0xfffffff8);
        uVar6 = uVar6 + 1;
        iVar9 = uVar6 * 4;
        *(int *)((int)local_50 + iVar11) =
             *(int *)(COS_LOOKUP_I + iVar2) -
             ((int)((uVar5 & 0x1ff) *
                   (*(int *)(COS_LOOKUP_I + iVar2) - *(int *)(COS_LOOKUP_I + iVar2 + 4))) >> 9);
        if (in_t1 == uVar6) goto LAB_089751a8;
        piVar1 = in_t0 + 1;
        in_t0 = in_t0 + 1;
        iVar11 = (*piVar1 >> 10) * 0x517d;
        uVar5 = iVar11 >> 0xe;
      } while ((-1 < (int)uVar5) && (iVar11 >> 0x17 < 0x80));
    }
    memset(param_1,0,param_3 << 2);
  }
  return;
}



----------------------------------------

// Function: floor0_inverse2 @ 089756c4

undefined4 floor0_inverse2(undefined4 param_1,int *param_2,int param_3,void *param_4)

{
  if (param_3 != 0) {
    vorbis_lsp_to_curve(param_4,param_2[3],*param_2,param_2[1]);
    return 1;
  }
  memset(param_4,0,*param_2 << 2);
  return 0;
}



----------------------------------------

// Function: floor0_look @ 08975740

/* WARNING: Removing unreachable block (ram,0x089757a4) */
/* WARNING: Removing unreachable block (ram,0x089757ec) */

int * floor0_look(int param_1,int *param_2,int *param_3)

{
  int *piVar1;
  int *piVar2;
  int iVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int *piVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  
  iVar11 = *(int *)(*(int *)(param_1 + 4) + 0x1c);
  piVar1 = calloc(1,0x18);
  iVar11 = *(int *)(*param_2 * 4 + iVar11);
  iVar7 = param_3[2];
  piVar1[2] = *param_3;
  iVar11 = iVar11 / 2;
  piVar1[1] = iVar7;
  piVar1[4] = (int)param_3;
  *piVar1 = iVar11;
  piVar2 = malloc(iVar11 * 4 + 4);
  iVar11 = *piVar1;
  piVar1[3] = (int)piVar2;
  if (iVar11 < 1) {
    iVar8 = piVar1[1];
    iVar7 = 0;
  }
  else {
    iVar8 = piVar1[1];
    iVar12 = param_3[1] / 2;
    iVar7 = 0;
    iVar10 = 0;
    piVar9 = piVar2;
    do {
      iVar13 = iVar10 / iVar11;
      if (iVar11 == 0) {
        trap(7);
      }
      iVar5 = 0;
      do {
        iVar6 = iVar5;
        iVar5 = iVar6 + 1;
        if (((int)(&barklook)[iVar6] <= iVar13) && (iVar3 = iVar5, iVar13 < (int)(&barklook)[iVar5])
           ) goto LAB_08975878;
      } while (iVar5 < 0x1b);
      iVar3 = iVar6 + 2;
      iVar6 = iVar5;
      if (iVar5 == 0x1b) {
        iVar13 = 0x6c000000;
      }
      else {
LAB_08975878:
        iVar5 = (&barklook)[iVar3] - (&barklook)[iVar6];
        if (iVar5 == 0) {
          trap(7);
        }
        iVar13 = (iVar6 * 0x8000 + ((iVar13 - (&barklook)[iVar6]) * 0x8000) / iVar5) * 0x800;
      }
      iVar5 = 0;
      do {
        iVar6 = iVar5;
        iVar5 = iVar6 + 1;
        if (((int)(&barklook)[iVar6] <= iVar12) && (iVar3 = iVar5, iVar12 < (int)(&barklook)[iVar5])
           ) goto LAB_08975904;
      } while (iVar5 < 0x1b);
      if (iVar5 == 0x1b) {
        iVar5 = 0xd8000;
      }
      else {
        iVar3 = iVar6 + 2;
        iVar6 = iVar5;
LAB_08975904:
        iVar5 = (&barklook)[iVar3] - (&barklook)[iVar6];
        if (iVar5 == 0) {
          trap(7);
        }
        iVar5 = iVar6 * 0x8000 + ((iVar12 - (&barklook)[iVar6]) * 0x8000) / iVar5;
      }
      if (iVar5 == 0) {
        trap(7);
      }
      iVar7 = iVar7 + 1;
      iVar10 = iVar10 + iVar12;
      iVar13 = iVar8 * (iVar13 / iVar5) >> 0xb;
      if (iVar8 <= iVar13) {
        iVar13 = iVar8 + -1;
      }
      *piVar9 = iVar13;
      piVar9 = piVar9 + 1;
    } while (iVar7 != iVar11);
    iVar7 = iVar7 * 4;
  }
  *(undefined4 *)((int)piVar2 + iVar7) = 0xffffffff;
  piVar2 = malloc(iVar8 << 2);
  iVar11 = piVar1[1];
  piVar1[5] = (int)piVar2;
  if (0 < iVar11) {
    iVar7 = 0;
    do {
      if (iVar11 == 0) {
        trap(7);
      }
      uVar4 = (iVar7 << 0x10) / iVar11 & 0x1ffff;
      iVar7 = iVar7 + 1;
      if (0x10000 < uVar4) {
        uVar4 = 0x20000 - uVar4;
      }
      iVar8 = ((int)uVar4 >> 9) * 4;
      *piVar2 = (int)(*(int *)(COS_LOOKUP_I + iVar8) * 0x200 -
                     (uVar4 & 0x1ff) *
                     (*(int *)(COS_LOOKUP_I + iVar8) - *(int *)(COS_LOOKUP_I + iVar8 + 4))) >> 9;
      piVar2 = piVar2 + 1;
    } while (iVar7 != iVar11);
  }
  return piVar1;
}



----------------------------------------

// Function: res2_inverse @ 08975a54

undefined4 res2_inverse(int param_1,undefined4 *param_2,undefined4 param_3,int *param_4)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int in_t0;
  int iVar6;
  int iVar7;
  int iVar8;
  int *piVar9;
  int iVar10;
  int *piVar11;
  uint local_44;
  
  piVar11 = (int *)*param_2;
  iVar10 = *(int *)param_2[5];
  iVar1 = ((in_t0 * *(int *)(param_1 + 0x28) >> 1) + piVar11[1]) - *piVar11;
  iVar6 = piVar11[2];
  if (iVar1 < 1) {
    return 0;
  }
  iVar1 = iVar1 / iVar6;
  if (iVar6 == 0) {
    trap(7);
  }
  if (iVar10 == 0) {
    trap(7);
  }
  piVar2 = (int *)_vorbis_block_alloc(param_1,(iVar10 + iVar1 + -1) / iVar10 << 2);
  iVar3 = *piVar11;
  if (in_t0 == 0) {
    trap(7);
  }
  if (in_t0 < 1) {
    iVar4 = 0;
  }
  else {
    iVar4 = 0;
    if (*param_4 != 0) goto LAB_08975b4c;
    do {
      iVar4 = iVar4 + 1;
      if (iVar4 == in_t0) break;
      piVar9 = param_4 + 1;
      param_4 = param_4 + 1;
    } while (*piVar9 == 0);
  }
  if (in_t0 == iVar4) {
    return 0;
  }
LAB_08975b4c:
  if (in_t0 == 0) {
    trap(7);
  }
  iVar4 = param_2[3];
  if (0 < iVar4) {
    local_44 = 0;
LAB_08975b6c:
    do {
      if (0 < iVar1) {
        iVar4 = 0;
        piVar9 = piVar2;
        do {
          if (local_44 == 0) {
            iVar5 = vorbis_book_decode(param_2[5],param_1 + 4);
            if (iVar5 == -1) {
              return 0;
            }
            iVar5 = *(int *)(iVar5 * 4 + param_2[8]);
            *piVar9 = iVar5;
            if (iVar5 == 0) {
              return 0;
            }
          }
          iVar5 = iVar4;
          if (0 < iVar10) {
            if (iVar1 <= iVar4) {
LAB_08975d04:
              iVar4 = param_2[3];
              local_44 = local_44 + 1;
              if (iVar4 <= (int)local_44) {
                return 0;
              }
              goto LAB_08975b6c;
            }
            iVar7 = 0;
            iVar8 = iVar3 / in_t0 + (iVar6 / in_t0) * iVar4;
            while( true ) {
              iVar5 = *(int *)(iVar7 * 4 + *piVar9);
              iVar7 = iVar7 + 1;
              if ((((piVar11[iVar5 + 5] >> (local_44 & 0x1f) & 1U) != 0) &&
                  (iVar5 = *(int *)(*(int *)(iVar5 * 4 + param_2[6]) + local_44 * 4), iVar5 != 0))
                 && (iVar5 = vorbis_book_decodevv_add(iVar5,param_3,iVar8), iVar5 == -1)) {
                return 0;
              }
              iVar8 = iVar8 + iVar6 / in_t0;
              iVar5 = iVar7 + iVar4;
              if (iVar10 == iVar7) break;
              if (iVar7 == iVar1 - iVar4) goto LAB_08975d04;
            }
          }
          piVar9 = piVar9 + 1;
          iVar4 = iVar5;
        } while (iVar5 < iVar1);
        iVar4 = param_2[3];
      }
      local_44 = local_44 + 1;
    } while ((int)local_44 < iVar4);
  }
  return 0;
}



----------------------------------------

// Function: _01inverse @ 08975d2c

undefined4 _01inverse(int param_1,undefined4 *param_2,int *param_3,int param_4)

{
  undefined4 uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  code *in_t0;
  undefined4 *puVar6;
  int *piVar7;
  int iVar8;
  int *piVar9;
  int *piVar10;
  int iVar11;
  int *local_70;
  int local_6c;
  int local_68;
  uint local_64;
  int local_60;
  int local_5c;
  int local_58;
  undefined4 *local_54;
  int *local_50;
  code *local_4c;
  int local_48;
  int local_40;
  
  piVar10 = (int *)*param_2;
  local_48 = ((*(int *)(param_1 + 0x28) >> 1) + piVar10[1]) - *piVar10;
  local_6c = *(int *)param_2[5];
  local_68 = piVar10[2];
  if (0 < local_48) {
    iVar3 = -(param_4 * 4 + 0xeU & 0xfffffff8);
    local_70 = (int *)((int)&local_70 + iVar3);
    puVar6 = (undefined4 *)((int)&local_70 + iVar3);
    local_48 = local_48 / local_68;
    if (local_68 == 0) {
      trap(7);
    }
    local_58 = param_1;
    local_54 = param_2;
    local_50 = param_3;
    local_4c = in_t0;
    if (0 < param_4) {
      iVar11 = (local_6c + local_48 + -1) / local_6c;
      if (local_6c == 0) {
        trap(7);
      }
      iVar8 = 0;
      local_70 = (int *)((int)&local_70 + iVar3);
      do {
        iVar8 = iVar8 + 1;
        uVar1 = _vorbis_block_alloc(local_58,iVar11 << 2);
        *puVar6 = uVar1;
        puVar6 = puVar6 + 1;
      } while (iVar8 != param_4);
    }
    iVar3 = local_54[3];
    if (0 < iVar3) {
      local_64 = 0;
      do {
        if (0 < local_48) {
          local_60 = 0;
          iVar3 = 0;
          local_5c = local_64 << 2;
          do {
            if ((local_64 == 0) && (0 < param_4)) {
              iVar11 = 0;
              iVar8 = local_58 + 4;
              piVar7 = local_70;
              do {
                iVar11 = iVar11 + 1;
                iVar2 = vorbis_book_decode(local_54[5],iVar8);
                if (iVar2 == -1) {
                  return 0;
                }
                iVar4 = *piVar7;
                piVar7 = piVar7 + 1;
                iVar2 = *(int *)(iVar2 * 4 + local_54[8]);
                *(int *)(iVar4 + iVar3) = iVar2;
                if (iVar2 == 0) {
                  return 0;
                }
              } while (iVar11 != param_4);
            }
            iVar11 = local_60;
            if (0 < local_6c) {
              if (local_48 <= local_60) {
                iVar3 = local_54[3];
                goto LAB_08976004;
              }
              iVar2 = 0;
              iVar8 = local_68 * local_60;
              while( true ) {
                if (0 < param_4) {
                  iVar4 = iVar2 * 4;
                  iVar11 = 0;
                  piVar7 = local_70;
                  piVar9 = local_50;
                  do {
                    iVar5 = *piVar7;
                    iVar11 = iVar11 + 1;
                    piVar7 = piVar7 + 1;
                    iVar5 = *(int *)(*(int *)(iVar5 + iVar3) + iVar4);
                    if ((piVar10[iVar5 + 5] >> (local_64 & 0x1f) & 1U) != 0) {
                      iVar5 = *(int *)(local_5c + *(int *)(iVar5 * 4 + local_54[6]));
                      if ((iVar5 != 0) &&
                         (local_40 = iVar2,
                         iVar5 = (*local_4c)(iVar5,(*piVar10 + iVar8) * 4 + *piVar9,local_58 + 4,
                                             local_68), iVar2 = local_40, iVar5 == -1)) {
                        return 0;
                      }
                    }
                    piVar9 = piVar9 + 1;
                  } while (iVar11 != param_4);
                }
                iVar2 = iVar2 + 1;
                iVar11 = local_60 + iVar2;
                if (iVar2 == local_6c) break;
                iVar8 = iVar8 + local_68;
                if (iVar2 == local_48 - local_60) {
                  iVar3 = local_54[3];
                  goto LAB_08976004;
                }
              }
            }
            local_60 = iVar11;
            iVar3 = iVar3 + 4;
          } while (local_60 < local_48);
          iVar3 = local_54[3];
        }
LAB_08976004:
        local_64 = local_64 + 1;
      } while ((int)local_64 < iVar3);
    }
  }
  return 0;
}



----------------------------------------

// Function: res1_inverse @ 08976054

undefined4 res1_inverse(undefined4 param_1,undefined4 param_2,undefined4 *param_3,int *param_4)

{
  int iVar1;
  undefined4 uVar2;
  int in_t0;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  
  if (0 < in_t0) {
    iVar4 = 0;
    iVar5 = 0;
    puVar3 = param_3;
    do {
      iVar1 = *param_4;
      iVar4 = iVar4 + 1;
      param_4 = param_4 + 1;
      if (iVar1 != 0) {
        iVar5 = iVar5 + 1;
        *puVar3 = *param_3;
        puVar3 = puVar3 + 1;
      }
      param_3 = param_3 + 1;
    } while (in_t0 != iVar4);
    if (iVar5 != 0) {
      uVar2 = _01inverse();
      return uVar2;
    }
  }
  return 0;
}



----------------------------------------

// Function: res0_inverse @ 089760ac

undefined4 res0_inverse(undefined4 param_1,undefined4 param_2,undefined4 *param_3,int *param_4)

{
  int iVar1;
  undefined4 uVar2;
  int in_t0;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  
  if (0 < in_t0) {
    iVar4 = 0;
    iVar5 = 0;
    puVar3 = param_3;
    do {
      iVar1 = *param_4;
      iVar4 = iVar4 + 1;
      param_4 = param_4 + 1;
      if (iVar1 != 0) {
        iVar5 = iVar5 + 1;
        *puVar3 = *param_3;
        puVar3 = puVar3 + 1;
      }
      param_3 = param_3 + 1;
    } while (in_t0 != iVar4);
    if (iVar5 != 0) {
      uVar2 = _01inverse();
      return uVar2;
    }
  }
  return 0;
}



----------------------------------------

// Function: res0_look @ 08976104

/* WARNING: Control flow encountered bad instruction data */

int * res0_look(int param_1,int param_2,int param_3)

{
  int *piVar1;
  int iVar2;
  void *pvVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  int *piVar7;
  int iVar8;
  uint uVar9;
  size_t sVar10;
  uint uVar11;
  int iVar12;
  int iVar13;
  int iVar14;
  
  piVar1 = calloc(1,0x24);
  iVar6 = *(int *)(param_3 + 0x10);
  sVar10 = *(size_t *)(param_3 + 0xc);
  iVar14 = *(int *)(*(int *)(param_1 + 4) + 0x1c);
  piVar1[1] = *(int *)(param_2 + 0xc);
  iVar2 = *(int *)(iVar14 + 0xc20);
  piVar1[2] = sVar10;
  piVar1[4] = iVar2;
  iVar2 = *(int *)(iVar14 + 0xc20);
  *piVar1 = param_3;
  piVar7 = (int *)(iVar6 * 0x34 + iVar2);
  piVar1[5] = (int)piVar7;
  iVar6 = *piVar7;
  pvVar3 = calloc(sVar10,4);
  iVar2 = piVar1[2];
  piVar1[6] = (int)pvVar3;
  if (iVar2 < 1) {
    iVar12 = 0;
    piVar1[7] = iVar2;
  }
  else {
    iVar13 = 0;
    iVar12 = 0;
    iVar5 = param_3;
    do {
      uVar4 = *(uint *)(param_3 + 0x14);
      if (uVar4 != 0) {
        sVar10 = 0;
        do {
          uVar4 = uVar4 >> 1;
          sVar10 = sVar10 + 1;
        } while (uVar4 != 0);
        if (sVar10 != 0) {
          iVar2 = piVar1[6];
          pvVar3 = calloc(sVar10,4);
          *(void **)(iVar13 * 4 + iVar2) = pvVar3;
          iVar12 = iVar12 + sVar10;
          if (0 < (int)sVar10) {
            uVar11 = *(uint *)(param_3 + 0x14);
            uVar9 = 0;
            piVar7 = (int *)(iVar5 + 0x114);
            uVar4 = uVar11;
            do {
              iVar2 = uVar9 * 4;
              uVar9 = uVar9 + 1;
              if ((uVar4 & 1) != 0) {
                iVar8 = *piVar7;
                iVar5 = iVar5 + 4;
                piVar7 = piVar7 + 1;
                *(int *)(iVar2 + *(int *)(piVar1[6] + iVar13 * 4)) =
                     *(int *)(iVar14 + 0xc20) + iVar8 * 0x34;
              }
              uVar4 = (int)uVar11 >> (uVar9 & 0x1f);
            } while (uVar9 != sVar10);
          }
          iVar2 = piVar1[2];
        }
      }
      iVar13 = iVar13 + 1;
      param_3 = param_3 + 4;
    } while (iVar13 < iVar2);
    piVar1[7] = iVar2;
  }
  if (iVar6 < 2) {
    iVar14 = piVar1[7];
  }
  else {
    iVar5 = 1;
    iVar14 = iVar2;
    do {
      iVar14 = iVar14 * iVar2;
      iVar5 = iVar5 + 1;
      piVar1[7] = iVar14;
    } while (iVar6 != iVar5);
  }
  piVar1[3] = iVar12;
  pvVar3 = malloc(iVar14 << 2);
  iVar2 = piVar1[7];
  piVar1[8] = (int)pvVar3;
  if (0 < iVar2) {
    iVar12 = 0;
    iVar14 = piVar1[8];
    while( true ) {
      iVar5 = piVar1[2];
      pvVar3 = malloc(iVar6 << 2);
      *(void **)(iVar12 * 4 + iVar14) = pvVar3;
      if (0 < iVar6) {
        iVar2 = iVar2 / iVar5;
        if (iVar5 == 0) {
          trap(7);
        }
        if (iVar2 == 0) {
          trap(7);
        }
        **(int **)(piVar1[8] + iVar12 * 4) = iVar12 / iVar2;
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      iVar2 = piVar1[7];
      iVar12 = iVar12 + 1;
      if (iVar2 <= iVar12) break;
      iVar14 = piVar1[8];
    }
  }
  return piVar1;
}



----------------------------------------

// Function: res0_free_look @ 089763b0

void res0_free_look(undefined4 *param_1)

{
  int iVar1;
  void *aptr;
  int iVar2;
  int iVar3;
  
  if (param_1 != (undefined4 *)0x0) {
    iVar2 = param_1[2];
    iVar3 = 0;
    if (iVar2 < 1) {
      aptr = (void *)param_1[6];
    }
    else {
      aptr = (void *)param_1[6];
      iVar1 = 0;
      do {
        iVar3 = iVar3 + 1;
        if (*(void **)(iVar1 + (int)aptr) != (void *)0x0) {
          free(*(void **)(iVar1 + (int)aptr));
          iVar2 = param_1[2];
          aptr = (void *)param_1[6];
        }
        iVar1 = iVar3 * 4;
      } while (iVar3 < iVar2);
    }
    free(aptr);
    iVar2 = 0;
    if (0 < (int)param_1[7]) {
      iVar3 = param_1[8];
      while( true ) {
        iVar1 = iVar2 * 4;
        iVar2 = iVar2 + 1;
        free(*(void **)(iVar1 + iVar3));
        if ((int)param_1[7] <= iVar2) break;
        iVar3 = param_1[8];
      }
    }
    free((void *)param_1[8]);
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = 0;
    param_1[7] = 0;
    param_1[8] = 0;
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: res0_free_info @ 089764a8

void res0_free_info(void *param_1)

{
  if (param_1 != (void *)0x0) {
    memset(param_1,0,0x514);
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: res0_unpack @ 089764f0

undefined4 * res0_unpack(int param_1,undefined4 param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  undefined4 *puVar8;
  int iVar9;
  int iVar10;
  
  puVar2 = calloc(1,0x514);
  iVar10 = *(int *)(param_1 + 0x1c);
  uVar3 = oggpack_read(param_2,0x18);
  *puVar2 = uVar3;
  uVar3 = oggpack_read(param_2,0x18);
  puVar2[1] = uVar3;
  iVar4 = oggpack_read(param_2,0x18);
  puVar2[2] = iVar4 + 1;
  iVar4 = oggpack_read(param_2,6);
  puVar2[3] = iVar4 + 1;
  uVar3 = oggpack_read(param_2,8);
  puVar2[4] = uVar3;
  if ((int)puVar2[3] < 1) {
    iVar4 = 0;
  }
  else {
    iVar4 = 0;
    iVar9 = 0;
    puVar8 = puVar2;
    do {
      while( true ) {
        uVar5 = oggpack_read(param_2,3);
        iVar6 = oggpack_read(param_2,1);
        if (iVar6 == 0) break;
        iVar6 = oggpack_read(param_2,5);
        uVar5 = uVar5 | iVar6 << 3;
        puVar8[5] = uVar5;
        if (uVar5 == 0) goto LAB_089766b8;
LAB_089765c8:
        iVar6 = 0;
        do {
          uVar7 = uVar5 & 1;
          uVar5 = uVar5 >> 1;
          iVar6 = iVar6 + uVar7;
        } while (uVar5 != 0);
        iVar9 = iVar9 + 1;
        iVar4 = iVar4 + iVar6;
        puVar8 = puVar8 + 1;
        if ((int)puVar2[3] <= iVar9) goto LAB_089765f8;
      }
      puVar8[5] = uVar5;
      if (uVar5 != 0) goto LAB_089765c8;
LAB_089766b8:
      iVar9 = iVar9 + 1;
      puVar8 = puVar8 + 1;
    } while (iVar9 < (int)puVar2[3]);
LAB_089765f8:
    if (iVar4 < 1) {
      iVar10 = *(int *)(iVar10 + 0x1c);
      goto LAB_08976628;
    }
    iVar9 = 0;
    puVar8 = puVar2;
    do {
      uVar3 = oggpack_read(param_2,8);
      iVar9 = iVar9 + 1;
      puVar8[0x45] = uVar3;
      puVar8 = puVar8 + 1;
    } while (iVar9 != iVar4);
  }
  iVar10 = *(int *)(iVar10 + 0x1c);
LAB_08976628:
  if ((int)puVar2[4] < iVar10) {
    if (iVar4 < 1) {
      return puVar2;
    }
    if ((int)puVar2[0x45] < iVar10) {
      iVar9 = 0;
      puVar8 = puVar2;
      do {
        iVar9 = iVar9 + 1;
        if (iVar9 == iVar4) {
          return puVar2;
        }
        piVar1 = puVar8 + 0x46;
        puVar8 = puVar8 + 1;
      } while (*piVar1 < iVar10);
    }
  }
  res0_free_info(puVar2);
  return (undefined4 *)0x0;
}



----------------------------------------

// Function: ilog @ 08976718

int ilog(int param_1)

{
  int iVar1;
  uint uVar2;
  
  uVar2 = param_1 - 1;
  if ((param_1 != 0) && (uVar2 != 0)) {
    iVar1 = 0;
    do {
      uVar2 = uVar2 >> 1;
      iVar1 = iVar1 + 1;
    } while (uVar2 != 0);
    return iVar1;
  }
  return 0;
}



----------------------------------------

// Function: mapping0_inverse @ 08976748

/* WARNING: Removing unreachable block (ram,0x089769d8) */

undefined4 mapping0_inverse(int *param_1,int param_2)

{
  int iVar1;
  size_t n;
  uint uVar2;
  int *piVar3;
  undefined4 *puVar4;
  uint uVar5;
  int iVar6;
  int *piVar7;
  int iVar8;
  void *m;
  int iVar9;
  int iVar10;
  undefined4 uVar11;
  int *piVar12;
  int iVar13;
  uint *puVar14;
  int *piVar15;
  int iVar16;
  uint uVar17;
  int iVar18;
  int iVar19;
  size_t local_58 [4];
  undefined1 *local_48;
  undefined1 *local_44;
  undefined1 *local_40;
  
  iVar19 = *(int *)(param_1[0x12] + 4);
  local_58[1] = *(undefined4 *)(param_1[0x12] + 0x48);
  local_58[3] = param_2;
  piVar15 = *(int **)(param_2 + 4);
  uVar17 = *(uint *)(param_1[8] * 4 + *(int *)(iVar19 + 0x1c));
  local_58[2] = *(int *)(iVar19 + 0x1c);
  param_1[10] = uVar17;
  uVar2 = *(int *)(iVar19 + 4) * 4 + 0xeU & 0xfffffff8;
  puVar14 = (uint *)((int)local_58 + uVar2 * -3);
  local_48 = (undefined1 *)((int)local_58 - uVar2);
  local_44 = (undefined1 *)((int)local_58 + uVar2 * -2);
  local_40 = (undefined1 *)(local_58 + -uVar2);
  if (0 < *(int *)(iVar19 + 4)) {
    local_58[0] = (uVar17 & 0x3fffffff) << 1;
    iVar18 = 0;
    iVar16 = 0;
    do {
      iVar8 = *(int *)((int)piVar15 + iVar16 + 4) * 4;
      iVar18 = iVar18 + 1;
      iVar8 = (**(code **)(*(int *)(*(int *)(local_58[3] + 0x10) + iVar8) + 0x10))
                        (param_1,*(undefined4 *)(*(int *)(local_58[3] + 8) + iVar8));
      n = local_58[0];
      piVar12 = (int *)(local_40 + iVar16);
      m = *(void **)(*param_1 + iVar16);
      *puVar14 = (uint)(iVar8 != 0);
      *piVar12 = iVar8;
      memset(m,0,n);
      iVar16 = iVar16 + 4;
      puVar14 = puVar14 + 1;
    } while (iVar18 < *(int *)(iVar19 + 4));
  }
  iVar16 = piVar15[0x123];
  if (iVar16 < 1) {
    iVar16 = *piVar15;
  }
  else {
    iVar18 = 0;
    piVar12 = piVar15;
    do {
      piVar3 = (int *)((int)local_58 + piVar12[0x124] * 4 + uVar2 * -3);
      iVar18 = iVar18 + 1;
      if ((*piVar3 != 0) || (*(int *)((int)local_58 + piVar12[0x224] * 4 + uVar2 * -3) != 0)) {
        *piVar3 = 1;
        *(undefined4 *)((int)local_58 + piVar12[0x224] * 4 + uVar2 * -3) = 1;
      }
      piVar12 = piVar12 + 1;
    } while (iVar18 != iVar16);
    iVar16 = *piVar15;
  }
  if (0 < iVar16) {
    iVar18 = 0;
    iVar8 = 0;
    iVar16 = *(int *)(iVar19 + 4);
    do {
      iVar13 = 0;
      if (0 < iVar16) {
        iVar10 = 0;
        iVar9 = 0;
        do {
          while (*(int *)((int)piVar15 + iVar9 + 4) != iVar18) {
            iVar13 = iVar13 + 1;
            iVar9 = iVar9 + 4;
            if (iVar16 <= iVar13) goto LAB_08976978;
          }
          iVar6 = iVar10 * 4;
          if (*(int *)((int)local_58 + iVar9 + uVar2 * -3) == 0) {
            *(undefined4 *)(local_44 + iVar6) = 0;
          }
          else {
            *(undefined4 *)(local_44 + iVar6) = 1;
          }
          iVar13 = iVar13 + 1;
          iVar16 = *(int *)(iVar19 + 4);
          iVar10 = iVar10 + 1;
          *(undefined4 *)(local_48 + iVar6) = *(undefined4 *)(*param_1 + iVar9);
          iVar9 = iVar9 + 4;
        } while (iVar13 < iVar16);
      }
LAB_08976978:
      iVar18 = iVar18 + 1;
      piVar12 = (int *)(*(int *)(local_58[3] + 0x14) + iVar8);
      puVar4 = (undefined4 *)(*(int *)(local_58[3] + 0xc) + iVar8);
      iVar8 = iVar8 + 4;
      (**(code **)(*piVar12 + 0x10))(param_1,*puVar4,local_48,local_44);
      if (*piVar15 <= iVar18) goto code_r0x089769c0;
      iVar16 = *(int *)(iVar19 + 4);
    } while( true );
  }
  iVar16 = piVar15[0x123];
LAB_089769c4:
  if (-1 < iVar16 + -1) {
    iVar8 = *param_1;
    piVar12 = piVar15 + iVar16 + 0x123;
    iVar18 = 0;
    do {
      piVar3 = *(int **)(*piVar12 * 4 + iVar8);
      piVar7 = *(int **)(piVar12[0x100] * 4 + iVar8);
      if (0 < (int)uVar17 / 2) {
        iVar13 = 0;
        do {
          iVar9 = *piVar3;
          iVar10 = *piVar7;
          if (iVar9 < 1) {
            iVar6 = -iVar10;
            if (0 < iVar10) {
              *piVar3 = iVar9;
              iVar1 = iVar10;
              goto LAB_08976a34;
            }
LAB_08976bac:
            *piVar7 = iVar9;
            *piVar3 = iVar9 + iVar6;
          }
          else {
            iVar1 = -iVar10;
            iVar6 = iVar10;
            if (iVar10 < 1) goto LAB_08976bac;
LAB_08976a34:
            *piVar7 = iVar9 + iVar1;
          }
          iVar13 = iVar13 + 1;
          piVar3 = piVar3 + 1;
          piVar7 = piVar7 + 1;
        } while (iVar13 != (int)uVar17 / 2);
      }
      iVar18 = iVar18 + 1;
      piVar12 = piVar12 + -1;
    } while (iVar18 != iVar16);
  }
  iVar16 = *(int *)(iVar19 + 4);
  iVar18 = 0;
  if (0 < iVar16) {
    iVar8 = 0;
    do {
      iVar16 = *(int *)((int)piVar15 + iVar8 + 4) * 4;
      iVar18 = iVar18 + 1;
      (**(code **)(*(int *)(*(int *)(local_58[3] + 0x10) + iVar16) + 0x14))
                (param_1,*(undefined4 *)(*(int *)(local_58[3] + 8) + iVar16),
                 *(undefined4 *)(local_40 + iVar8),*(undefined4 *)(iVar8 + *param_1));
      iVar16 = *(int *)(iVar19 + 4);
      iVar8 = iVar8 + 4;
    } while (iVar18 < iVar16);
    if (0 < iVar16) {
      iVar18 = 0;
      iVar16 = *param_1;
      while( true ) {
        uVar11 = *(undefined4 *)(iVar18 * 4 + iVar16);
        iVar18 = iVar18 + 1;
        mdct_backward(uVar17,uVar11,uVar11);
        iVar16 = *(int *)(iVar19 + 4);
        if (iVar16 <= iVar18) break;
        iVar16 = *param_1;
      }
      if (0 < iVar16) {
        iVar8 = 0;
        iVar18 = 0;
        do {
          puVar4 = *(undefined4 **)(*param_1 + iVar18);
          if (*(int *)((int)local_58 + iVar18 + uVar2 * -3) == 0) {
            if (0 < (int)uVar17) {
              uVar5 = 0;
              do {
                uVar5 = uVar5 + 1;
                *puVar4 = 0;
                puVar4 = puVar4 + 1;
              } while (uVar5 != uVar17);
              iVar16 = *(int *)(iVar19 + 4);
            }
          }
          else {
            _vorbis_apply_window(puVar4,local_58[1],local_58[2],param_1[7]);
            iVar16 = *(int *)(iVar19 + 4);
          }
          iVar8 = iVar8 + 1;
          iVar18 = iVar18 + 4;
        } while (iVar8 < iVar16);
      }
    }
  }
  seq = seq + iVar16;
  return 0;
code_r0x089769c0:
  iVar16 = piVar15[0x123];
  goto LAB_089769c4;
}



----------------------------------------

// Function: mapping0_free_look @ 08976c00

void mapping0_free_look(undefined4 *param_1)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  
  if (param_1 != (undefined4 *)0x0) {
    iVar5 = 0;
    if (0 < *(int *)param_1[1]) {
      iVar4 = 0;
      iVar1 = param_1[4];
      while( true ) {
        iVar5 = iVar5 + 1;
        (**(code **)(*(int *)(iVar1 + iVar4) + 0xc))(*(undefined4 *)(param_1[2] + iVar4));
        piVar2 = (int *)(param_1[5] + iVar4);
        puVar3 = (undefined4 *)(param_1[3] + iVar4);
        iVar4 = iVar4 + 4;
        (**(code **)(*piVar2 + 0xc))(*puVar3);
        if (*(int *)param_1[1] <= iVar5) break;
        iVar1 = param_1[4];
      }
    }
    free((void *)param_1[4]);
    free((void *)param_1[5]);
    free((void *)param_1[2]);
    free((void *)param_1[3]);
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
    param_1[4] = 0;
    param_1[5] = 0;
    param_1[6] = 0;
    param_1[7] = 0;
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: mapping0_free_info @ 08976d00

void mapping0_free_info(void *param_1)

{
  if (param_1 != (void *)0x0) {
    memset(param_1,0,0xc90);
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: mapping0_look @ 08976d48

undefined4 * mapping0_look(int param_1,undefined4 param_2,size_t *param_3)

{
  int iVar1;
  undefined4 *puVar2;
  void *pvVar3;
  code *pcVar4;
  int iVar5;
  int iVar6;
  size_t sVar7;
  undefined4 uVar8;
  int iVar9;
  int iVar10;
  size_t *psVar11;
  int iVar12;
  int iVar13;
  
  iVar1 = *(int *)(param_1 + 4);
  iVar5 = *(int *)(iVar1 + 0x1c);
  puVar2 = calloc(1,0x20);
  sVar7 = *param_3;
  puVar2[1] = param_3;
  *puVar2 = param_2;
  pvVar3 = calloc(sVar7,4);
  sVar7 = *param_3;
  puVar2[2] = pvVar3;
  pvVar3 = calloc(sVar7,4);
  sVar7 = *param_3;
  puVar2[3] = pvVar3;
  pvVar3 = calloc(sVar7,4);
  sVar7 = *param_3;
  puVar2[4] = pvVar3;
  pvVar3 = calloc(sVar7,4);
  sVar7 = *param_3;
  puVar2[5] = pvVar3;
  if (0 < (int)sVar7) {
    iVar13 = 0;
    iVar12 = 0;
    psVar11 = param_3;
    do {
      iVar6 = psVar11[0x101] * 4 + iVar5;
      uVar8 = *(undefined4 *)(iVar6 + 0x520);
      sVar7 = psVar11[0x111];
      pcVar4 = *(code **)((&_floor_P)[*(int *)(iVar6 + 0x420)] + 4);
      *(undefined **)(puVar2[4] + iVar12) = (&_floor_P)[*(int *)(iVar6 + 0x420)];
      iVar9 = puVar2[2];
      uVar8 = (*pcVar4)(param_1,param_2,uVar8);
      iVar10 = sVar7 * 4 + iVar5;
      iVar6 = *(int *)(iVar10 + 0x620);
      *(undefined4 *)(iVar12 + iVar9) = uVar8;
      uVar8 = *(undefined4 *)(iVar10 + 0x720);
      pcVar4 = *(code **)(*(int *)(_residue_P + iVar6 * 4) + 4);
      *(int *)(puVar2[5] + iVar12) = *(int *)(_residue_P + iVar6 * 4);
      iVar6 = puVar2[3];
      uVar8 = (*pcVar4)(param_1,param_2,uVar8);
      sVar7 = *param_3;
      iVar13 = iVar13 + 1;
      *(undefined4 *)(iVar12 + iVar6) = uVar8;
      iVar12 = iVar12 + 4;
      psVar11 = psVar11 + 1;
    } while (iVar13 < (int)sVar7);
  }
  puVar2[6] = *(undefined4 *)(iVar1 + 4);
  return puVar2;
}



----------------------------------------

// Function: mapping0_unpack @ 08976efc

int * mapping0_unpack(int param_1,undefined4 param_2)

{
  int *m;
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int iVar4;
  int *piVar5;
  int iVar6;
  int iVar7;
  
  m = calloc(1,0xc90);
  iVar7 = *(int *)(param_1 + 0x1c);
  memset(m,0,0xc90);
  iVar1 = oggpack_read(param_2,1);
  if (iVar1 == 0) {
    *m = 1;
  }
  else {
    iVar1 = oggpack_read(param_2,4);
    *m = iVar1 + 1;
  }
  iVar1 = oggpack_read(param_2,1);
  if (iVar1 != 0) {
    iVar1 = oggpack_read(param_2,8);
    m[0x123] = iVar1 + 1;
    if (0 < iVar1 + 1) {
      iVar1 = *(int *)(param_1 + 4);
      iVar6 = 0;
      piVar5 = m;
      do {
        iVar6 = iVar6 + 1;
        uVar2 = ilog(iVar1);
        iVar3 = oggpack_read(param_2,uVar2);
        uVar2 = *(undefined4 *)(param_1 + 4);
        piVar5[0x124] = iVar3;
        uVar2 = ilog(uVar2);
        iVar4 = oggpack_read(param_2,uVar2);
        piVar5[0x224] = iVar4;
        piVar5 = piVar5 + 1;
        if (((iVar3 < 0) || (iVar4 < 0)) || (iVar3 == iVar4)) goto LAB_08977014;
        iVar1 = *(int *)(param_1 + 4);
        if ((iVar1 <= iVar3) || (iVar1 <= iVar4)) goto LAB_08977014;
      } while (iVar6 < m[0x123]);
    }
  }
  iVar1 = oggpack_read(param_2,2);
  if (0 < iVar1) goto LAB_08977014;
  iVar1 = *m;
  if (iVar1 < 2) {
LAB_089770d8:
    if (iVar1 < 1) {
      return m;
    }
  }
  else if (0 < *(int *)(param_1 + 4)) {
    iVar6 = 0;
    piVar5 = m;
    do {
      piVar5 = piVar5 + 1;
      iVar3 = oggpack_read(param_2,4);
      iVar1 = *m;
      *piVar5 = iVar3;
      iVar6 = iVar6 + 1;
      if (iVar1 <= iVar3) goto LAB_08977014;
    } while (iVar6 < *(int *)(param_1 + 4));
    goto LAB_089770d8;
  }
  iVar1 = 0;
  piVar5 = m;
  while( true ) {
    iVar6 = oggpack_read(param_2,8);
    iVar1 = iVar1 + 1;
    if (*(int *)(iVar7 + 0x10) <= iVar6) break;
    iVar6 = oggpack_read(param_2,8);
    piVar5[0x101] = iVar6;
    if (*(int *)(iVar7 + 0x14) <= iVar6) break;
    iVar6 = oggpack_read(param_2,8);
    piVar5[0x111] = iVar6;
    piVar5 = piVar5 + 1;
    if (*(int *)(iVar7 + 0x18) <= iVar6) break;
    if (*m <= iVar1) {
      return m;
    }
  }
LAB_08977014:
  mapping0_free_info(m);
  return (int *)0x0;
}



----------------------------------------

// Function: mdct_backward @ 08977168

void mdct_backward(uint param_1,int *param_2,int *param_3)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  byte bVar4;
  undefined *puVar5;
  undefined *puVar6;
  int iVar7;
  int iVar8;
  byte *pbVar9;
  int iVar10;
  uint uVar11;
  int iVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  int iVar16;
  int iVar17;
  int *piVar18;
  int *piVar19;
  int *piVar20;
  int iVar21;
  int iVar22;
  int iVar23;
  int iVar24;
  int iVar25;
  int iVar26;
  int iVar27;
  int iVar28;
  uint uVar29;
  int *piVar30;
  int iVar31;
  int *piVar32;
  int iVar33;
  byte *pbVar34;
  int *piVar35;
  int iVar36;
  uint uVar37;
  int iVar38;
  int iVar39;
  int iVar40;
  byte *pbVar41;
  int iVar42;
  byte *pbVar43;
  int iVar44;
  int iVar45;
  int iVar46;
  int iVar47;
  int iVar48;
  undefined1 *puVar49;
  byte *pbVar50;
  int iVar51;
  int iVar52;
  int iVar53;
  uint uVar54;
  int iVar55;
  int iVar56;
  int iVar57;
  int iVar58;
  int iVar59;
  int iVar60;
  int iVar61;
  int iVar62;
  int iVar63;
  int iVar64;
  int iVar65;
  int iVar66;
  int local_f8;
  int local_f4;
  int local_dc;
  uint local_d8;
  int local_ac;
  uint local_a8;
  int local_a4;
  
  iVar8 = (int)param_1 >> 1;
  if ((param_1 & 0x40) == 0) {
    for (local_d8 = 7; ((int)param_1 >> (local_d8 & 0x1f) & 1U) == 0; local_d8 = local_d8 + 1) {
    }
    local_d8 = 0xd - local_d8;
    local_dc = 2 << (local_d8 & 0x1f);
  }
  else {
    local_d8 = 7;
    local_dc = 0x100;
  }
  iVar7 = (int)param_1 >> 2;
  piVar18 = param_3 + iVar8 + iVar7;
  pbVar9 = &sincos_lookup0;
  iVar33 = local_dc * 2;
  piVar19 = param_2 + iVar8 + -7;
  pbVar34 = &sincos_lookup0 + local_dc;
  piVar30 = piVar18;
  do {
    iVar21 = piVar19[6];
    bVar1 = *pbVar9;
    iVar12 = piVar19[4];
    bVar2 = pbVar9[1];
    piVar32 = piVar30 + -4;
    pbVar9 = pbVar9 + iVar33;
    piVar30[-1] = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar12 >> 8);
    piVar30[-2] = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    iVar21 = piVar19[2];
    bVar1 = *pbVar34;
    iVar12 = *piVar19;
    bVar2 = pbVar34[1];
    pbVar34 = pbVar34 + iVar33;
    piVar19 = piVar19 + -8;
    piVar30[-3] = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar12 >> 8);
    *piVar32 = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    piVar30 = piVar32;
  } while (param_2 + iVar7 <= piVar19);
  iVar12 = local_dc * -2;
  pbVar34 = pbVar9 + -local_dc;
  do {
    iVar22 = piVar19[6];
    bVar1 = pbVar9[1];
    iVar21 = piVar19[4];
    bVar2 = *pbVar9;
    pbVar9 = pbVar9 + iVar12;
    piVar32[-1] = (uint)bVar1 * (iVar22 >> 8) - (uint)bVar2 * (iVar21 >> 8);
    piVar32[-2] = (uint)bVar1 * (iVar21 >> 8) + (uint)bVar2 * (iVar22 >> 8);
    iVar22 = piVar19[2];
    bVar1 = pbVar34[1];
    iVar21 = *piVar19;
    bVar2 = *pbVar34;
    pbVar34 = pbVar34 + iVar12;
    piVar19 = piVar19 + -8;
    piVar32[-3] = (uint)bVar1 * (iVar22 >> 8) - (uint)bVar2 * (iVar21 >> 8);
    piVar32[-4] = (uint)bVar1 * (iVar21 >> 8) + (uint)bVar2 * (iVar22 >> 8);
    piVar32 = piVar32 + -4;
  } while (param_2 <= piVar19);
  piVar19 = param_2 + iVar8 + -8;
  pbVar34 = &sincos_lookup0 + local_dc;
  pbVar9 = &sincos_lookup0 + iVar33;
  piVar30 = piVar18;
  do {
    iVar22 = piVar19[4];
    bVar1 = *pbVar34;
    iVar21 = piVar19[6];
    bVar2 = pbVar34[1];
    pbVar34 = pbVar34 + iVar33;
    piVar30[1] = (uint)bVar1 * (iVar22 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    *piVar30 = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar22 >> 8);
    iVar22 = *piVar19;
    bVar1 = *pbVar9;
    iVar21 = piVar19[2];
    bVar2 = pbVar9[1];
    pbVar9 = pbVar9 + iVar33;
    piVar19 = piVar19 + -8;
    piVar30[3] = (uint)bVar1 * (iVar22 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    piVar30[2] = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar22 >> 8);
    piVar30 = piVar30 + 4;
  } while (param_2 + iVar7 <= piVar19);
  pbVar9 = pbVar9 + local_dc * -3;
  pbVar34 = pbVar9 + -local_dc;
  do {
    iVar22 = piVar19[4];
    bVar1 = pbVar9[1];
    iVar21 = piVar19[6];
    bVar2 = *pbVar9;
    pbVar9 = pbVar9 + iVar12;
    piVar30[1] = (uint)bVar1 * (iVar22 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    *piVar30 = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar22 >> 8);
    iVar22 = *piVar19;
    bVar1 = pbVar34[1];
    iVar21 = piVar19[2];
    bVar2 = *pbVar34;
    pbVar34 = pbVar34 + iVar12;
    piVar19 = piVar19 + -8;
    piVar30[3] = (uint)bVar1 * (iVar22 >> 8) + (uint)bVar2 * (iVar21 >> 8);
    piVar30[2] = (uint)bVar1 * (iVar21 >> 8) - (uint)bVar2 * (iVar22 >> 8);
    piVar30 = piVar30 + 4;
  } while (param_2 <= piVar19);
  local_f4 = ~local_d8 + 8;
  piVar30 = param_3 + iVar8;
  if (0 < local_f4) {
    local_ac = 1;
    local_a8 = 0;
    do {
      iVar52 = 4 << (local_a8 + local_d8 & 0x1f);
      iVar13 = iVar8 >> (local_a8 & 0x1f);
      iVar21 = iVar52 * -4;
      piVar32 = piVar30 + (iVar13 >> 1) + -8;
      piVar19 = piVar30 + iVar13 + -8;
      local_a4 = 0;
      iVar22 = iVar52 * 4;
      do {
        puVar49 = &sincos_lookup0 + iVar22;
        pbVar43 = &sincos_lookup0 + iVar52;
        pbVar41 = &sincos_lookup0 + iVar52 * 2;
        pbVar34 = &sincos_lookup0 + iVar52 * 3;
        piVar20 = piVar32;
        piVar35 = piVar19;
        pbVar9 = &sincos_lookup0;
        do {
          iVar15 = piVar20[6];
          iVar14 = piVar35[6];
          iVar24 = piVar35[7];
          puVar49 = puVar49 + iVar22;
          piVar35[6] = iVar14 + iVar15;
          iVar10 = piVar20[7];
          iVar14 = iVar14 - iVar15 >> 8;
          piVar35[7] = iVar10 + iVar24;
          bVar1 = *pbVar9;
          bVar2 = pbVar9[1];
          iVar10 = iVar10 - iVar24 >> 8;
          iVar24 = piVar20[4];
          pbVar9 = pbVar9 + iVar22;
          piVar20[7] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar10;
          piVar20[6] = (uint)bVar1 * iVar10 + (uint)bVar2 * iVar14;
          iVar14 = piVar35[4];
          iVar15 = piVar35[5];
          piVar35[4] = iVar14 + iVar24;
          iVar10 = piVar20[5];
          iVar14 = iVar14 - iVar24 >> 8;
          piVar35[5] = iVar10 + iVar15;
          bVar1 = *pbVar43;
          bVar2 = pbVar43[1];
          iVar10 = iVar10 - iVar15 >> 8;
          iVar24 = piVar20[2];
          pbVar43 = pbVar43 + iVar22;
          piVar20[5] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar10;
          piVar20[4] = (uint)bVar1 * iVar10 + (uint)bVar2 * iVar14;
          iVar14 = piVar35[2];
          iVar15 = piVar35[3];
          piVar35[2] = iVar14 + iVar24;
          iVar10 = piVar20[3];
          iVar14 = iVar14 - iVar24 >> 8;
          piVar35[3] = iVar10 + iVar15;
          bVar1 = *pbVar41;
          bVar2 = pbVar41[1];
          iVar10 = iVar10 - iVar15 >> 8;
          iVar24 = *piVar20;
          pbVar41 = pbVar41 + iVar22;
          piVar20[3] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar10;
          piVar20[2] = (uint)bVar1 * iVar10 + (uint)bVar2 * iVar14;
          iVar14 = *piVar35;
          iVar15 = piVar35[1];
          *piVar35 = iVar14 + iVar24;
          iVar10 = piVar20[1];
          iVar14 = iVar14 - iVar24 >> 8;
          piVar35[1] = iVar10 + iVar15;
          bVar1 = *pbVar34;
          bVar2 = pbVar34[1];
          iVar10 = iVar10 - iVar15 >> 8;
          piVar35 = piVar35 + -8;
          pbVar34 = pbVar34 + iVar22;
          piVar20[1] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar10;
          *piVar20 = (uint)bVar1 * iVar10 + (uint)bVar2 * iVar14;
          puVar5 = PTR_sincos_lookup0_089ea6f8;
          piVar20 = piVar20 + -8;
        } while (puVar49 + iVar52 * -4 < &DAT_089eab00);
        pbVar34 = pbVar9 + -iVar52;
        pbVar41 = pbVar34 + -iVar52;
        pbVar43 = pbVar41 + -iVar52;
        iVar10 = (int)pbVar43 - iVar52;
        do {
          iVar24 = piVar20[6];
          iVar14 = piVar35[6];
          iVar15 = piVar35[7];
          iVar10 = iVar10 + iVar21;
          piVar35[6] = iVar14 + iVar24;
          iVar25 = piVar20[7];
          iVar14 = iVar14 - iVar24 >> 8;
          piVar35[7] = iVar15 + iVar25;
          bVar1 = *pbVar9;
          iVar15 = iVar15 - iVar25 >> 8;
          bVar2 = pbVar9[1];
          iVar25 = piVar20[4];
          pbVar9 = pbVar9 + iVar21;
          piVar20[7] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[6] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar14 = piVar35[4];
          iVar15 = piVar35[5];
          piVar35[4] = iVar14 + iVar25;
          iVar24 = piVar20[5];
          iVar14 = iVar14 - iVar25 >> 8;
          piVar35[5] = iVar15 + iVar24;
          bVar1 = *pbVar34;
          iVar15 = iVar15 - iVar24 >> 8;
          bVar2 = pbVar34[1];
          iVar25 = piVar20[2];
          pbVar34 = pbVar34 + iVar21;
          piVar20[5] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[4] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar14 = piVar35[2];
          iVar15 = piVar35[3];
          piVar35[2] = iVar14 + iVar25;
          iVar24 = piVar20[3];
          iVar14 = iVar14 - iVar25 >> 8;
          piVar35[3] = iVar15 + iVar24;
          bVar1 = *pbVar41;
          iVar15 = iVar15 - iVar24 >> 8;
          bVar2 = pbVar41[1];
          iVar25 = *piVar20;
          pbVar41 = pbVar41 + iVar21;
          piVar20[3] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[2] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar14 = *piVar35;
          iVar15 = piVar35[1];
          *piVar35 = iVar14 + iVar25;
          iVar24 = piVar20[1];
          iVar14 = iVar14 - iVar25 >> 8;
          piVar35[1] = iVar15 + iVar24;
          bVar1 = *pbVar43;
          iVar15 = iVar15 - iVar24 >> 8;
          bVar2 = pbVar43[1];
          piVar35 = piVar35 + -8;
          pbVar43 = pbVar43 + iVar21;
          piVar20[1] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          *piVar20 = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          puVar6 = PTR_DAT_089ea6fc;
          piVar20 = piVar20 + -8;
        } while (puVar5 < (undefined *)(iVar10 + iVar52 * 4));
        pbVar34 = pbVar9 + iVar52;
        pbVar41 = pbVar34 + iVar52;
        pbVar43 = pbVar41 + iVar52;
        pbVar50 = pbVar43 + iVar52;
        do {
          iVar15 = piVar35[6];
          iVar14 = piVar20[6];
          iVar24 = piVar35[7];
          pbVar50 = pbVar50 + iVar22;
          piVar35[6] = iVar14 + iVar15;
          iVar10 = piVar20[7];
          iVar14 = iVar14 - iVar15 >> 8;
          piVar35[7] = iVar10 + iVar24;
          bVar1 = *pbVar9;
          iVar10 = iVar10 - iVar24 >> 8;
          bVar2 = pbVar9[1];
          iVar24 = piVar20[4];
          pbVar9 = pbVar9 + iVar22;
          piVar20[7] = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar14;
          piVar20[6] = (uint)bVar1 * iVar14 + (uint)bVar2 * iVar10;
          iVar14 = piVar35[4];
          iVar15 = piVar35[5];
          piVar35[4] = iVar24 + iVar14;
          iVar10 = piVar20[5];
          iVar14 = iVar24 - iVar14 >> 8;
          piVar35[5] = iVar10 + iVar15;
          bVar1 = *pbVar34;
          iVar10 = iVar10 - iVar15 >> 8;
          bVar2 = pbVar34[1];
          iVar15 = piVar20[2];
          pbVar34 = pbVar34 + iVar22;
          piVar20[5] = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar14;
          piVar20[4] = (uint)bVar1 * iVar14 + (uint)bVar2 * iVar10;
          iVar14 = piVar35[2];
          iVar24 = piVar35[3];
          piVar35[2] = iVar15 + iVar14;
          iVar10 = piVar20[3];
          iVar14 = iVar15 - iVar14 >> 8;
          piVar35[3] = iVar10 + iVar24;
          bVar1 = *pbVar41;
          iVar10 = iVar10 - iVar24 >> 8;
          bVar2 = pbVar41[1];
          iVar15 = *piVar20;
          pbVar41 = pbVar41 + iVar22;
          piVar20[3] = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar14;
          piVar20[2] = (uint)bVar1 * iVar14 + (uint)bVar2 * iVar10;
          iVar14 = *piVar35;
          iVar24 = piVar35[1];
          *piVar35 = iVar15 + iVar14;
          iVar10 = piVar20[1];
          iVar14 = iVar15 - iVar14 >> 8;
          piVar35[1] = iVar10 + iVar24;
          bVar1 = *pbVar43;
          iVar10 = iVar10 - iVar24 >> 8;
          bVar2 = pbVar43[1];
          piVar35 = piVar35 + -8;
          pbVar43 = pbVar43 + iVar22;
          piVar20[1] = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar14;
          *piVar20 = (uint)bVar1 * iVar14 + (uint)bVar2 * iVar10;
          puVar5 = PTR_sincos_lookup0_089ea6f8;
          piVar20 = piVar20 + -8;
        } while (pbVar50 + iVar52 * -4 < puVar6);
        pbVar34 = pbVar9 + -iVar52;
        pbVar41 = pbVar34 + -iVar52;
        pbVar43 = pbVar41 + -iVar52;
        iVar10 = (int)pbVar43 - iVar52;
        do {
          iVar24 = piVar20[6];
          iVar15 = piVar35[6];
          iVar25 = piVar35[7];
          iVar10 = iVar10 + iVar21;
          piVar35[6] = iVar15 + iVar24;
          iVar14 = piVar20[7];
          iVar15 = iVar15 - iVar24 >> 8;
          piVar35[7] = iVar14 + iVar25;
          bVar1 = *pbVar9;
          bVar2 = pbVar9[1];
          iVar14 = iVar14 - iVar25 >> 8;
          iVar25 = piVar20[4];
          pbVar9 = pbVar9 + iVar21;
          piVar20[7] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[6] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar15 = piVar35[4];
          iVar24 = piVar35[5];
          piVar35[4] = iVar15 + iVar25;
          iVar14 = piVar20[5];
          iVar15 = iVar15 - iVar25 >> 8;
          piVar35[5] = iVar14 + iVar24;
          bVar1 = *pbVar34;
          bVar2 = pbVar34[1];
          iVar14 = iVar14 - iVar24 >> 8;
          iVar25 = piVar20[2];
          pbVar34 = pbVar34 + iVar21;
          piVar20[5] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[4] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar15 = piVar35[2];
          iVar24 = piVar35[3];
          piVar35[2] = iVar15 + iVar25;
          iVar14 = piVar20[3];
          iVar15 = iVar15 - iVar25 >> 8;
          piVar35[3] = iVar14 + iVar24;
          bVar1 = *pbVar41;
          bVar2 = pbVar41[1];
          iVar14 = iVar14 - iVar24 >> 8;
          iVar25 = *piVar20;
          pbVar41 = pbVar41 + iVar21;
          piVar20[3] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          piVar20[2] = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          iVar15 = *piVar35;
          iVar24 = piVar35[1];
          *piVar35 = iVar15 + iVar25;
          iVar14 = piVar20[1];
          iVar15 = iVar15 - iVar25 >> 8;
          piVar35[1] = iVar14 + iVar24;
          bVar1 = *pbVar43;
          bVar2 = pbVar43[1];
          iVar14 = iVar14 - iVar24 >> 8;
          piVar35 = piVar35 + -8;
          pbVar43 = pbVar43 + iVar21;
          piVar20[1] = (uint)bVar1 * iVar15 + (uint)bVar2 * iVar14;
          *piVar20 = (uint)bVar1 * iVar14 - (uint)bVar2 * iVar15;
          piVar20 = piVar20 + -8;
        } while (puVar5 < (undefined *)(iVar10 + iVar52 * 4));
        piVar32 = piVar32 + iVar13;
        local_a4 = local_a4 + 1;
        piVar19 = piVar19 + iVar13;
      } while (local_a4 < local_ac);
      do {
        local_f4 = local_f4 + -1;
        if (local_f4 < 1) goto LAB_08977e34;
        local_a8 = local_a8 + 1;
        local_ac = 1 << (local_a8 & 0x1f);
      } while (local_ac < 1);
    } while( true );
  }
LAB_08977e34:
  if (0 < iVar8) {
    local_f8 = 0;
    piVar19 = piVar30;
    do {
      iVar16 = piVar19[0x19] - piVar19[9] >> 8;
      iVar15 = piVar19[0x1d] - piVar19[0xd] >> 8;
      iVar31 = piVar19[0x1d] + piVar19[0xd];
      iVar27 = piVar19[5] - piVar19[0x15] >> 8;
      iVar55 = piVar19[0x18] + piVar19[8];
      iVar28 = piVar19[0x1a] - piVar19[10];
      iVar57 = piVar19[0x19] + piVar19[9];
      iVar45 = piVar19[4] + piVar19[0x14];
      iVar21 = piVar19[5] + piVar19[0x15];
      iVar61 = piVar19[0x18] - piVar19[8] >> 8;
      iVar38 = piVar19[1] - piVar19[0x11] >> 8;
      iVar23 = piVar19[0x1c] - piVar19[0xc] >> 8;
      iVar26 = piVar19[0x1c] + piVar19[0xc];
      iVar62 = piVar19[0x1b];
      iVar22 = piVar19[3] - piVar19[0x13];
      iVar51 = *piVar19 + piVar19[0x10];
      iVar42 = piVar19[1] + piVar19[0x11];
      iVar47 = iVar28 + (iVar62 - piVar19[0xb]) >> 8;
      iVar52 = iVar51 - iVar55;
      iVar13 = iVar42 - iVar57;
      iVar10 = iVar15 * 0xed + iVar23 * 0x62;
      iVar39 = iVar13 - iVar52 >> 8;
      iVar48 = piVar19[0x1e] - piVar19[0xe];
      iVar17 = piVar19[0x1a] + piVar19[10];
      iVar56 = iVar26 - iVar45;
      iVar24 = iVar31 - iVar21;
      iVar13 = iVar52 + iVar13 >> 8;
      iVar63 = piVar19[0x16] - piVar19[6];
      iVar53 = piVar19[4] - piVar19[0x14] >> 8;
      iVar44 = piVar19[0x1f] - piVar19[0xf];
      iVar46 = piVar19[0x1f] + piVar19[0xf];
      iVar59 = piVar19[7] - piVar19[0x17];
      iVar52 = piVar19[7] + piVar19[0x17];
      iVar14 = piVar19[0x16] + piVar19[6];
      iVar25 = piVar19[3] + piVar19[0x13];
      iVar40 = piVar19[0x1e] + piVar19[0xe];
      iVar66 = iVar40 - iVar14;
      iVar60 = iVar44 + iVar63;
      iVar51 = iVar51 + iVar55;
      iVar58 = iVar48 - iVar59;
      iVar40 = iVar40 + iVar14;
      iVar36 = *piVar19 - piVar19[0x10] >> 8;
      iVar42 = iVar42 + iVar57;
      iVar57 = (piVar19[2] - piVar19[0x12]) + iVar22 >> 8;
      iVar26 = iVar26 + iVar45;
      iVar48 = iVar48 + iVar59;
      iVar64 = iVar16 * 0x62 + iVar61 * 0xed;
      iVar55 = iVar17 - (piVar19[2] + piVar19[0x12]);
      iVar45 = iVar46 + iVar52;
      iVar46 = iVar46 - iVar52;
      iVar59 = iVar25 - (piVar19[0x1b] + piVar19[0xb]);
      iVar52 = iVar46 - iVar55;
      iVar31 = iVar31 + iVar21;
      iVar44 = iVar44 - iVar63;
      iVar17 = iVar17 + piVar19[2] + piVar19[0x12];
      iVar25 = iVar25 + piVar19[0x1b] + piVar19[0xb];
      iVar63 = iVar66 - iVar59;
      iVar65 = iVar45 - iVar25;
      iVar14 = iVar40 - iVar17;
      iVar40 = iVar40 + iVar17;
      local_f8 = local_f8 + 0x20;
      iVar66 = iVar66 + iVar59;
      iVar59 = iVar26 - iVar51;
      iVar45 = iVar45 + iVar25;
      iVar21 = iVar31 - iVar42;
      iVar46 = iVar46 + iVar55;
      piVar19[0x1a] = iVar14 - iVar21;
      piVar19[0x1b] = iVar59 + iVar65;
      iVar26 = iVar26 + iVar51;
      piVar19[0x1e] = iVar26 + iVar40;
      iVar31 = iVar31 + iVar42;
      piVar19[0x1f] = iVar31 + iVar45;
      iVar25 = iVar27 * 0x62 + iVar53 * -0xed;
      piVar19[0x18] = iVar21 + iVar14;
      iVar17 = iVar10 - iVar25;
      iVar10 = iVar10 + iVar25;
      piVar19[0x1d] = iVar45 - iVar31;
      piVar19[0x19] = iVar65 - iVar59;
      iVar21 = iVar38 * 0xed + iVar36 * -0x62;
      iVar45 = iVar21 - iVar64;
      iVar21 = iVar21 + iVar64;
      iVar31 = iVar10 - iVar21;
      iVar10 = iVar10 + iVar21;
      iVar55 = iVar23 * 0xed + iVar15 * -0x62;
      iVar15 = iVar61 * 0x62 + iVar16 * -0xed;
      iVar21 = iVar53 * 0x62 + iVar27 * 0xed;
      iVar25 = iVar55 - iVar21;
      iVar55 = iVar55 + iVar21;
      iVar16 = iVar36 * 0xed + iVar38 * 0x62;
      iVar14 = iVar16 - iVar15;
      iVar21 = (iVar28 - (iVar62 - piVar19[0xb]) >> 8) * 0xb5;
      iVar16 = iVar16 + iVar15;
      iVar36 = iVar55 - iVar16;
      iVar55 = iVar55 + iVar16;
      iVar15 = iVar14 + iVar45 >> 8;
      iVar27 = iVar45 - iVar14 >> 8;
      iVar22 = (iVar22 - (piVar19[2] - piVar19[0x12]) >> 8) * 0xb5;
      iVar14 = iVar21 + iVar57 * -0xb5;
      iVar21 = iVar21 + iVar57 * 0xb5;
      iVar45 = iVar48 - iVar21;
      iVar28 = iVar44 - iVar14;
      iVar44 = iVar44 + iVar14;
      piVar19[10] = iVar45 - iVar31;
      iVar48 = iVar48 + iVar21;
      piVar19[0xe] = iVar55 + iVar48;
      iVar21 = iVar22 + iVar47 * -0xb5;
      iVar23 = iVar58 - iVar21;
      iVar58 = iVar58 + iVar21;
      iVar22 = iVar22 + iVar47 * 0xb5;
      iVar16 = iVar60 - iVar22;
      iVar60 = iVar60 + iVar22;
      iVar21 = (iVar25 - iVar17 >> 8) * 0xb5;
      iVar22 = (iVar25 + iVar17 >> 8) * 0xb5;
      iVar25 = iVar21 + iVar15 * -0xb5;
      iVar21 = iVar21 + iVar15 * 0xb5;
      piVar19[1] = iVar28 - iVar25;
      iVar14 = iVar22 + iVar27 * -0xb5;
      *piVar19 = iVar14 + iVar23;
      piVar19[2] = iVar23 - iVar14;
      iVar22 = iVar22 + iVar27 * 0xb5;
      piVar19[7] = iVar22 + iVar44;
      piVar19[3] = iVar25 + iVar28;
      piVar19[6] = iVar21 + iVar58;
      piVar19[9] = iVar16 - iVar36;
      piVar19[0x1c] = iVar40 - iVar26;
      piVar19[4] = iVar58 - iVar21;
      piVar19[5] = iVar44 - iVar22;
      piVar19[8] = iVar31 + iVar45;
      piVar19[0xb] = iVar36 + iVar16;
      piVar19[0xc] = iVar48 - iVar55;
      piVar19[0xd] = iVar60 - iVar10;
      piVar19[0xf] = iVar10 + iVar60;
      iVar21 = (iVar56 - iVar24 >> 8) * 0xb5;
      iVar22 = (iVar56 + iVar24 >> 8) * 0xb5;
      iVar10 = iVar21 + iVar13 * -0xb5;
      iVar21 = iVar21 + iVar13 * 0xb5;
      piVar19[0x11] = iVar52 - iVar10;
      piVar19[0x13] = iVar10 + iVar52;
      piVar19[0x16] = iVar21 + iVar66;
      piVar19[0x14] = iVar66 - iVar21;
      iVar21 = iVar22 + iVar39 * -0xb5;
      iVar22 = iVar22 + iVar39 * 0xb5;
      piVar19[0x10] = iVar21 + iVar63;
      piVar19[0x12] = iVar63 - iVar21;
      piVar19[0x15] = iVar46 - iVar22;
      piVar19[0x17] = iVar22 + iVar46;
      piVar19 = piVar19 + 0x20;
    } while (local_f8 < iVar8);
  }
  if (local_dc < 4) {
    pbVar9 = &sincos_lookup1;
  }
  else {
    pbVar9 = &sincos_lookup0 + (local_dc >> 1);
  }
  pbVar34 = pbVar9 + local_dc;
  pbVar43 = pbVar9 + 0x400;
  pbVar41 = pbVar34 + local_dc;
  uVar54 = 0;
  piVar19 = param_3;
  piVar32 = piVar30;
  do {
    uVar11 = (uint)(byte)(&bitrev)[(uVar54 & 0xff) >> 4] << 4 |
             (uint)CONCAT11((&bitrev)[uVar54 & 0xf],(&bitrev)[(int)uVar54 >> 8]);
    iVar22 = piVar30[(int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)];
    iVar21 = (piVar30 + ((int)uVar11 >> (local_d8 & 0x1f)))[1];
    bVar1 = pbVar9[1];
    iVar8 = (piVar30 + ((int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)))[-1];
    iVar10 = iVar21 - iVar22 >> 9;
    iVar13 = piVar30[(int)uVar11 >> (local_d8 & 0x1f)];
    bVar2 = *pbVar9;
    uVar11 = uVar54 + 1;
    iVar52 = iVar8 + iVar13 >> 9;
    uVar11 = (uint)(byte)(&bitrev)[(uVar11 & 0xff) >> 4] << 4 |
             (uint)CONCAT11((&bitrev)[uVar11 & 0xf],(&bitrev)[(int)uVar11 >> 8]);
    iVar22 = iVar21 + iVar22 >> 1;
    iVar21 = iVar8 - iVar13 >> 1;
    piVar20 = piVar32 + -4;
    pbVar9 = pbVar9 + iVar33;
    iVar13 = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar52;
    piVar19[1] = iVar13 + iVar21;
    uVar54 = uVar54 + 2;
    pbVar41 = pbVar41 + iVar33;
    iVar8 = (uint)bVar1 * iVar52 + (uint)bVar2 * iVar10;
    *piVar19 = iVar8 + iVar22;
    piVar32[-1] = iVar13 - iVar21;
    piVar32[-2] = iVar22 - iVar8;
    iVar22 = (piVar30 + ((int)uVar11 >> (local_d8 & 0x1f)))[1];
    iVar52 = piVar30[(int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)];
    iVar8 = (piVar30 + ((int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)))[-1];
    bVar1 = pbVar34[1];
    iVar10 = iVar22 - iVar52 >> 9;
    iVar21 = piVar30[(int)uVar11 >> (local_d8 & 0x1f)];
    bVar2 = *pbVar34;
    iVar13 = iVar8 + iVar21 >> 9;
    iVar21 = iVar8 - iVar21 >> 1;
    iVar52 = iVar22 + iVar52 >> 1;
    pbVar34 = pbVar34 + iVar33;
    iVar22 = (uint)bVar1 * iVar10 - (uint)bVar2 * iVar13;
    piVar19[3] = iVar22 + iVar21;
    iVar8 = (uint)bVar1 * iVar13 + (uint)bVar2 * iVar10;
    piVar19[2] = iVar8 + iVar52;
    *piVar20 = iVar52 - iVar8;
    piVar19 = piVar19 + 4;
    piVar32[-3] = iVar22 - iVar21;
    piVar32 = piVar20;
  } while (pbVar41 + local_dc * -2 < pbVar43);
  pbVar9 = pbVar9 + -local_dc;
  pbVar34 = pbVar9 + -local_dc;
  do {
    uVar11 = (uint)(byte)(&bitrev)[(uVar54 & 0xff) >> 4] << 4 |
             (uint)CONCAT11((&bitrev)[uVar54 & 0xf],(&bitrev)[(int)uVar54 >> 8]);
    iVar21 = piVar30[(int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)];
    iVar33 = (piVar30 + ((int)uVar11 >> (local_d8 & 0x1f)))[1];
    bVar1 = *pbVar9;
    iVar8 = (piVar30 + ((int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)))[-1];
    iVar52 = iVar33 - iVar21 >> 9;
    iVar22 = piVar30[(int)uVar11 >> (local_d8 & 0x1f)];
    bVar2 = pbVar9[1];
    uVar11 = uVar54 + 1;
    iVar13 = iVar8 + iVar22 >> 9;
    uVar11 = (uint)(byte)(&bitrev)[(uVar11 & 0xff) >> 4] << 4 |
             (uint)CONCAT11((&bitrev)[uVar11 & 0xf],(&bitrev)[(int)uVar11 >> 8]);
    iVar21 = iVar33 + iVar21 >> 1;
    iVar33 = iVar8 - iVar22 >> 1;
    piVar32 = piVar20 + -4;
    uVar54 = uVar54 + 2;
    iVar22 = (uint)bVar1 * iVar52 - (uint)bVar2 * iVar13;
    piVar19[1] = iVar22 + iVar33;
    pbVar9 = pbVar9 + iVar12;
    iVar8 = (uint)bVar1 * iVar13 + (uint)bVar2 * iVar52;
    *piVar19 = iVar8 + iVar21;
    piVar20[-2] = iVar21 - iVar8;
    piVar20[-1] = iVar22 - iVar33;
    iVar21 = (piVar30 + ((int)uVar11 >> (local_d8 & 0x1f)))[1];
    iVar52 = piVar30[(int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)];
    bVar1 = *pbVar34;
    iVar22 = piVar30[(int)uVar11 >> (local_d8 & 0x1f)];
    iVar13 = iVar21 - iVar52 >> 9;
    iVar33 = (piVar30 + ((int)(uVar11 ^ 0xfff) >> (local_d8 & 0x1f)))[-1];
    bVar2 = pbVar34[1];
    iVar8 = iVar33 + iVar22 >> 9;
    iVar33 = iVar33 - iVar22 >> 1;
    iVar21 = iVar21 + iVar52 >> 1;
    pbVar34 = pbVar34 + iVar12;
    iVar22 = (uint)bVar1 * iVar13 - (uint)bVar2 * iVar8;
    piVar19[3] = iVar22 + iVar33;
    iVar8 = (uint)bVar1 * iVar8 + (uint)bVar2 * iVar13;
    piVar19[2] = iVar8 + iVar21;
    piVar19 = piVar19 + 4;
    *piVar32 = iVar21 - iVar8;
    piVar20[-3] = iVar22 - iVar33;
    piVar20 = piVar32;
  } while (piVar19 < piVar32);
  iVar8 = local_dc >> 2;
  if (iVar8 == 0) {
    pbVar34 = &DAT_089ea702;
    pbVar9 = &sincos_lookup1;
    uVar11 = 0;
    uVar54 = 0xff;
    piVar19 = param_3;
    piVar32 = piVar18;
    piVar20 = piVar18;
    do {
      uVar29 = (uint)*pbVar9;
      iVar22 = piVar19[1];
      uVar37 = (uint)pbVar9[1];
      iVar12 = (int)(uVar29 - uVar11) >> 2;
      iVar8 = uVar11 + iVar12;
      iVar13 = *piVar19;
      iVar21 = (int)(uVar37 - uVar54) >> 2;
      iVar33 = uVar54 + iVar21;
      piVar35 = piVar32 + -4;
      iVar12 = uVar29 - iVar12;
      iVar21 = uVar37 - iVar21;
      pbVar9 = pbVar9 + 2;
      piVar32[-1] = iVar8 * (iVar13 >> 8) + iVar33 * (-iVar22 >> 8);
      *piVar20 = iVar8 * (-iVar22 >> 8) - iVar33 * (iVar13 >> 8);
      iVar33 = piVar19[3];
      iVar8 = piVar19[2];
      piVar32[-2] = iVar12 * (iVar8 >> 8) + iVar21 * (-iVar33 >> 8);
      piVar20[1] = iVar12 * (-iVar33 >> 8) - iVar21 * (iVar8 >> 8);
      uVar11 = (uint)*pbVar34;
      iVar8 = piVar19[5];
      uVar54 = (uint)pbVar34[1];
      iVar12 = (int)(uVar11 - uVar29) >> 2;
      iVar22 = uVar29 + iVar12;
      iVar33 = piVar19[4];
      iVar21 = (int)(uVar54 - uVar37) >> 2;
      iVar13 = uVar37 + iVar21;
      iVar12 = uVar11 - iVar12;
      iVar21 = uVar54 - iVar21;
      pbVar34 = pbVar34 + 2;
      piVar32[-3] = iVar22 * (iVar33 >> 8) + iVar13 * (-iVar8 >> 8);
      piVar20[2] = iVar22 * (-iVar8 >> 8) - iVar13 * (iVar33 >> 8);
      iVar8 = piVar19[7];
      iVar33 = piVar19[6];
      piVar19 = piVar19 + 8;
      *piVar35 = iVar12 * (iVar33 >> 8) + iVar21 * (-iVar8 >> 8);
      piVar20[3] = iVar12 * (-iVar8 >> 8) - iVar21 * (iVar33 >> 8);
      piVar20 = piVar20 + 4;
      piVar32 = piVar35;
    } while (piVar19 < piVar35);
  }
  else if (iVar8 == 1) {
    pbVar9 = &DAT_089ea702;
    pbVar34 = &sincos_lookup1;
    uVar11 = 0;
    uVar54 = 0x7f;
    piVar19 = param_3;
    piVar32 = piVar18;
    piVar20 = piVar18;
    do {
      bVar1 = *pbVar34;
      iVar33 = piVar19[1];
      bVar2 = pbVar34[1];
      iVar8 = uVar11 + (bVar1 >> 1);
      iVar21 = *piVar19;
      iVar12 = uVar54 + (bVar2 >> 1);
      piVar35 = piVar32 + -4;
      piVar32[-1] = iVar8 * (iVar21 >> 8) + iVar12 * (-iVar33 >> 8);
      *piVar20 = iVar8 * (-iVar33 >> 8) - iVar12 * (iVar21 >> 8);
      bVar3 = *pbVar9;
      iVar8 = piVar19[3];
      bVar4 = pbVar9[1];
      iVar12 = (uint)(bVar1 >> 1) + (uint)(bVar3 >> 1);
      iVar33 = piVar19[2];
      iVar21 = (uint)(bVar2 >> 1) + (uint)(bVar4 >> 1);
      piVar32[-2] = iVar12 * (iVar33 >> 8) + iVar21 * (-iVar8 >> 8);
      piVar20[1] = iVar12 * (-iVar8 >> 8) - iVar21 * (iVar33 >> 8);
      bVar1 = pbVar34[2];
      iVar8 = piVar19[5];
      bVar2 = pbVar34[3];
      iVar33 = (uint)(bVar3 >> 1) + (uint)(bVar1 >> 1);
      iVar12 = piVar19[4];
      iVar21 = (uint)(bVar4 >> 1) + (uint)(bVar2 >> 1);
      pbVar34 = pbVar34 + 4;
      piVar32[-3] = iVar33 * (iVar12 >> 8) + iVar21 * (-iVar8 >> 8);
      piVar20[2] = iVar33 * (-iVar8 >> 8) - iVar21 * (iVar12 >> 8);
      iVar8 = piVar19[7];
      uVar11 = (uint)(pbVar9[2] >> 1);
      iVar33 = (bVar1 >> 1) + uVar11;
      iVar12 = piVar19[6];
      uVar54 = (uint)(pbVar9[3] >> 1);
      iVar21 = (bVar2 >> 1) + uVar54;
      piVar19 = piVar19 + 8;
      pbVar9 = pbVar9 + 4;
      *piVar35 = iVar33 * (iVar12 >> 8) + iVar21 * (-iVar8 >> 8);
      piVar20[3] = iVar33 * (-iVar8 >> 8) - iVar21 * (iVar12 >> 8);
      piVar20 = piVar20 + 4;
      piVar32 = piVar35;
    } while (piVar19 < piVar35);
  }
  else {
    if (iVar8 < 4) {
      pbVar9 = &sincos_lookup1;
    }
    else {
      pbVar9 = &sincos_lookup0 + (local_dc >> 3);
    }
    pbVar43 = pbVar9 + iVar8;
    pbVar41 = pbVar43 + iVar8;
    pbVar34 = pbVar41 + iVar8;
    iVar8 = iVar8 * 4;
    piVar19 = param_3;
    piVar32 = piVar18;
    piVar20 = piVar18;
    do {
      iVar33 = piVar19[1];
      bVar1 = *pbVar9;
      iVar12 = *piVar19;
      bVar2 = pbVar9[1];
      piVar35 = piVar32 + -4;
      pbVar9 = pbVar9 + iVar8;
      piVar32[-1] = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (-iVar33 >> 8);
      *piVar20 = (uint)bVar1 * (-iVar33 >> 8) - (uint)bVar2 * (iVar12 >> 8);
      iVar33 = piVar19[3];
      bVar1 = *pbVar43;
      iVar12 = piVar19[2];
      bVar2 = pbVar43[1];
      pbVar43 = pbVar43 + iVar8;
      piVar32[-2] = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (-iVar33 >> 8);
      piVar20[1] = (uint)bVar1 * (-iVar33 >> 8) - (uint)bVar2 * (iVar12 >> 8);
      iVar33 = piVar19[5];
      bVar1 = *pbVar41;
      iVar12 = piVar19[4];
      bVar2 = pbVar41[1];
      pbVar41 = pbVar41 + iVar8;
      piVar32[-3] = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (-iVar33 >> 8);
      piVar20[2] = (uint)bVar1 * (-iVar33 >> 8) - (uint)bVar2 * (iVar12 >> 8);
      iVar33 = piVar19[7];
      bVar1 = *pbVar34;
      iVar12 = piVar19[6];
      bVar2 = pbVar34[1];
      piVar19 = piVar19 + 8;
      pbVar34 = pbVar34 + iVar8;
      *piVar35 = (uint)bVar1 * (iVar12 >> 8) + (uint)bVar2 * (-iVar33 >> 8);
      piVar20[3] = (uint)bVar1 * (-iVar33 >> 8) - (uint)bVar2 * (iVar12 >> 8);
      piVar20 = piVar20 + 4;
      piVar32 = piVar35;
    } while (piVar19 < piVar35);
  }
  param_3 = param_3 + iVar7;
  piVar19 = param_3;
  piVar32 = piVar18;
  do {
    piVar35 = piVar32 + -4;
    iVar8 = piVar32[-1];
    piVar19[-1] = iVar8;
    *param_3 = -iVar8;
    iVar8 = piVar32[-2];
    piVar19[-2] = iVar8;
    param_3[1] = -iVar8;
    iVar8 = piVar32[-3];
    piVar19[-3] = iVar8;
    param_3[2] = -iVar8;
    iVar8 = *piVar35;
    piVar19[-4] = iVar8;
    param_3[3] = -iVar8;
    param_3 = param_3 + 4;
    piVar20 = piVar18;
    piVar19 = piVar19 + -4;
    piVar32 = piVar35;
  } while (param_3 < piVar35);
  do {
    piVar19 = piVar18 + -4;
    *piVar19 = piVar20[3];
    piVar18[-3] = piVar20[2];
    piVar18[-2] = piVar20[1];
    piVar18[-1] = *piVar20;
    piVar18 = piVar19;
    piVar20 = piVar20 + 4;
  } while (piVar30 < piVar19);
  return;
}



----------------------------------------

// Function: sin @ 08978edc

double sin(double x)

{
  uint uVar1;
  uint in_a1;
  int unaff_retaddr;
  double dVar2;
  double in_f14_15;
  double local_18 [2];
  
                    /* Unresolved local var: double[2] y@[???]
                       Unresolved local var: double z@[???]
                       Unresolved local var: __int32_t n@[???]
                       Unresolved local var: __int32_t ix@[???] */
  if (0x3fe921fb < (in_a1 & 0x7fffffff)) {
    if ((in_a1 & 0x7fffffff) < 0x7ff00000) {
      uVar1 = __ieee754_rem_pio2(x,local_18);
      uVar1 = uVar1 & 3;
      if (uVar1 == 1) {
        dVar2 = __kernel_cos(x,in_f14_15);
      }
      else if (uVar1 == 2) {
        dVar2 = __kernel_sin(x,in_f14_15,unaff_retaddr);
      }
      else if (uVar1 == 0) {
        dVar2 = __kernel_sin(x,in_f14_15,unaff_retaddr);
      }
      else {
        dVar2 = __kernel_cos(x,in_f14_15);
      }
    }
    else {
      dVar2 = __subdf3(x,in_f14_15);
    }
    return dVar2;
  }
  dVar2 = __kernel_sin(x,in_f14_15,unaff_retaddr);
  return dVar2;
}



----------------------------------------

// Function: tan @ 08979008

double tan(double x)

{
  uint in_a1;
  int unaff_retaddr;
  FLO_type_conflict FVar1;
  double dVar2;
  double in_f14_15;
  double local_18 [2];
  
                    /* Unresolved local var: double[2] y@[???]
                       Unresolved local var: double z@[???]
                       Unresolved local var: __int32_t n@[???]
                       Unresolved local var: __int32_t ix@[???] */
  if (0x3fe921fb < (in_a1 & 0x7fffffff)) {
    if (0x7fefffff < (in_a1 & 0x7fffffff)) {
      FVar1 = __subdf3(x,in_f14_15);
      return FVar1;
    }
    __ieee754_rem_pio2(x,local_18);
  }
  dVar2 = __kernel_tan(x,in_f14_15,unaff_retaddr);
  return dVar2;
}



----------------------------------------

// Function: exp @ 0897909c

double exp(double x)

{
  int iVar1;
  SItype SVar2;
  int *piVar3;
  double dVar4;
  FLO_type_conflict in_f14_15;
  exception local_40;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: exception exc@[???] */
  dVar4 = __ieee754_exp(x);
  if (__fdlib_version == __fdlibm_ieee) {
    return dVar4;
  }
  iVar1 = finite(x);
  if (iVar1 == 0) {
    return dVar4;
  }
  SVar2 = __gtdf2(x,in_f14_15);
  if (SVar2 < 1) {
    SVar2 = __ltdf2(x,in_f14_15);
    if (-1 < SVar2) {
      return dVar4;
    }
    local_40.name = "exp";
    local_40.type = 4;
    local_40.err = 0;
    local_40.retval._0_4_ = 0;
    local_40.retval._4_4_ = 0;
    if (__fdlib_version != __fdlibm_posix) goto LAB_08979204;
  }
  else {
    local_40.type = 3;
    local_40.name = "exp";
    local_40.err = 0;
    if (__fdlib_version == __fdlibm_svid) {
      local_40.retval._0_4_ = DAT_089eaf20;
      local_40.retval._4_4_ = DAT_089eaf24;
    }
    else {
      local_40.retval._0_4_ = DAT_089eaf28;
      local_40.retval._4_4_ = DAT_089eaf2c;
      if (__fdlib_version == __fdlibm_posix) goto LAB_08979160;
    }
LAB_08979204:
    local_40.err = 0;
    local_40.name = "exp";
    iVar1 = matherr(&local_40);
    if (iVar1 != 0) goto joined_r0x08979214;
  }
LAB_08979160:
  piVar3 = __errno();
  *piVar3 = 0x22;
joined_r0x08979214:
  if (local_40.err != 0) {
    piVar3 = __errno();
    *piVar3 = local_40.err;
  }
  return dVar4;
}



----------------------------------------

// Function: log @ 08979254

double log(double x)

{
  __fdlibm_version _Var1;
  int iVar2;
  SItype SVar3;
  int *piVar4;
  double dVar5;
  FLO_type_conflict in_f14_15;
  exception local_40;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: exception exc@[???] */
  dVar5 = __ieee754_log(x);
                    /* Unresolved local var: double __x@[???] */
  if (((__fdlib_version == __fdlibm_ieee) || (iVar2 = __isnand(x), iVar2 != 0)) ||
     (SVar3 = __gtdf2(x,in_f14_15), _Var1 = __fdlib_version, 0 < SVar3)) {
    return dVar5;
  }
  local_40.name = "log";
  local_40.err = 0;
  if (__fdlib_version == __fdlibm_svid) {
    local_40.retval._0_4_ = DAT_089eaf40;
    local_40.retval._4_4_ = DAT_089eaf44;
  }
  else {
    local_40.retval._0_4_ = DAT_089eaf48;
    local_40.retval._4_4_ = DAT_089eaf4c;
  }
  SVar3 = __eqdf2(x,in_f14_15);
  if (SVar3 == 0) {
    local_40.type = 2;
    if (_Var1 == __fdlibm_posix) {
      piVar4 = __errno();
      *piVar4 = 0x22;
      goto LAB_0897935c;
    }
LAB_0897934c:
    iVar2 = matherr(&local_40);
    if (iVar2 != 0) goto LAB_0897935c;
  }
  else {
    local_40.type = 1;
    if (_Var1 != __fdlibm_posix) goto LAB_0897934c;
  }
  piVar4 = __errno();
  *piVar4 = 0x21;
LAB_0897935c:
  if (local_40.err != 0) {
    piVar4 = __errno();
    *piVar4 = local_40.err;
  }
  return dVar5;
}



----------------------------------------

// Function: pow @ 08979400

double pow(double x,double y)

{
  __fdlibm_version _Var1;
  int iVar2;
  SItype SVar3;
  int *piVar4;
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  undefined4 in_a0;
  undefined4 in_a1;
  double dVar5;
  exception local_48;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: exception exc@[???] */
  dVar5 = __ieee754_pow(x,y);
                    /* Unresolved local var: double __x@[???] */
  if ((__fdlib_version == __fdlibm_ieee) || (iVar2 = __isnand(x), iVar2 != 0)) {
    return dVar5;
  }
                    /* Unresolved local var: double __x@[???] */
  iVar2 = __isnand(x);
  if (iVar2 == 0) {
    SVar3 = __eqdf2(x,y);
    if (SVar3 == 0) {
      SVar3 = __eqdf2(x,y);
      if (SVar3 == 0) {
        local_48.retval._0_4_ = 0;
        local_48.retval._4_4_ = 0;
        if (__fdlib_version != __fdlibm_svid) {
          return dVar5;
        }
        goto LAB_08979574;
      }
      iVar2 = finite(x);
      if (iVar2 == 0) {
        return dVar5;
      }
      SVar3 = __ltdf2(x,y);
      if (-1 < SVar3) {
        return dVar5;
      }
      local_48.type = 1;
      local_48.name = "pow";
      local_48.err = 0;
      if (__fdlib_version == __fdlibm_svid) {
LAB_089797c0:
        local_48.err = 0;
        local_48.name = "pow";
        local_48.type = 1;
        local_48.retval._0_4_ = 0;
        local_48.retval._4_4_ = 0;
      }
      else {
        local_48.retval._0_4_ = DAT_089eaf48;
        local_48.retval._4_4_ = DAT_089eaf4c;
        if (__fdlib_version == __fdlibm_posix) goto LAB_08979660;
      }
LAB_08979650:
      iVar2 = matherr(&local_48);
      goto joined_r0x089795a4;
    }
    iVar2 = finite(x);
    if (((iVar2 != 0) || (iVar2 = finite(x), iVar2 == 0)) || (iVar2 = finite(x), iVar2 == 0)) {
      SVar3 = __eqdf2(x,y);
      if (SVar3 != 0) {
        return dVar5;
      }
      iVar2 = finite(x);
      if (iVar2 == 0) {
        return dVar5;
      }
      iVar2 = finite(x);
      if (iVar2 == 0) {
        return dVar5;
      }
      local_48.name = "pow";
      local_48.type = 4;
      local_48.err = 0;
      local_48.retval._0_4_ = 0;
      local_48.retval._4_4_ = 0;
      _Var1 = __fdlib_version;
      goto joined_r0x0897989c;
    }
                    /* Unresolved local var: double __x@[???] */
    iVar2 = __isnand(x);
    _Var1 = __fdlib_version;
    if (iVar2 == 0) {
      local_48.type = 3;
      local_48.name = "pow";
      local_48.err = 0;
      if (__fdlib_version == __fdlibm_svid) {
        local_48.retval._0_4_ = DAT_089eaf20;
        local_48.retval._4_4_ = DAT_089eaf24;
        SVar3 = __ltdf2(x,y);
        if (SVar3 < 0) {
          __muldf3(x,y);
          dVar5 = rint(x);
          SVar3 = __nedf2(x,y);
          _Var1 = __fdlib_version;
          if (SVar3 != 0) {
            local_48.retval._0_4_ = DAT_089eaf40;
            local_48.retval._4_4_ = DAT_089eaf44;
          }
          goto joined_r0x0897989c;
        }
LAB_08979708:
        iVar2 = matherr(&local_48);
        if (iVar2 != 0) goto LAB_089795b0;
      }
      else {
        local_48.retval._0_4_ = DAT_089eaf28;
        local_48.retval._4_4_ = DAT_089eaf2c;
        SVar3 = __ltdf2(x,y);
        if (SVar3 < 0) {
          __muldf3(x,y);
          dVar5 = rint(x);
          SVar3 = __nedf2(x,y);
          _Var1 = __fdlib_version;
          if (SVar3 != 0) {
            local_48.retval._0_4_ = DAT_089eaf48;
            local_48.retval._4_4_ = DAT_089eaf4c;
          }
        }
joined_r0x0897989c:
        if (_Var1 != __fdlibm_posix) goto LAB_08979708;
      }
      piVar4 = __errno();
      *piVar4 = 0x22;
      goto LAB_089795b0;
    }
    local_48.type = 1;
    local_48.name = "pow";
    local_48.err = 0;
    if (__fdlib_version == __fdlibm_svid) goto LAB_089797c0;
    dVar5 = __divdf3(x,y);
    local_48.retval._0_4_ = extraout_v0;
    local_48.retval._4_4_ = extraout_v1;
    if (_Var1 != __fdlibm_posix) goto LAB_08979650;
  }
  else {
    SVar3 = __eqdf2(x,y);
    if (SVar3 != 0) {
      return dVar5;
    }
    if (__fdlib_version == __fdlibm_ieee) {
      return dVar5;
    }
    local_48.retval._0_4_ = in_a0;
    local_48.retval._4_4_ = in_a1;
    if (__fdlib_version == __fdlibm_posix) {
      return dVar5;
    }
LAB_08979574:
    local_48.name = "pow";
    local_48.type = 1;
    local_48.err = 0;
    iVar2 = matherr(&local_48);
joined_r0x089795a4:
    if (iVar2 != 0) goto LAB_089795b0;
  }
LAB_08979660:
  piVar4 = __errno();
  *piVar4 = 0x21;
LAB_089795b0:
  if (local_48.err != 0) {
    piVar4 = __errno();
    *piVar4 = local_48.err;
  }
  return dVar5;
}



----------------------------------------

// Function: sqrt @ 08979960

double sqrt(double x)

{
  __fdlibm_version _Var1;
  int iVar2;
  SItype SVar3;
  undefined4 extraout_v0;
  int *piVar4;
  undefined4 extraout_v1;
  double dVar5;
  FLO_type_conflict in_f14_15;
  exception local_40;
  
                    /* Unresolved local var: exception exc@[???]
                       Unresolved local var: double z@[???] */
  dVar5 = __ieee754_sqrt(x);
                    /* Unresolved local var: double __x@[???] */
  if (((__fdlib_version == __fdlibm_ieee) || (iVar2 = __isnand(x), iVar2 != 0)) ||
     (SVar3 = __ltdf2(x,in_f14_15), _Var1 = __fdlib_version, -1 < SVar3)) {
    return dVar5;
  }
  local_40.type = 1;
  local_40.name = "sqrt";
  local_40.err = 0;
  if (__fdlib_version == __fdlibm_svid) {
    local_40.retval._0_4_ = 0;
    local_40.retval._4_4_ = 0;
LAB_08979a24:
    iVar2 = matherr(&local_40);
    if (iVar2 != 0) goto LAB_08979a34;
  }
  else {
    dVar5 = __divdf3(x,in_f14_15);
    local_40.retval._0_4_ = extraout_v0;
    local_40.retval._4_4_ = extraout_v1;
    if (_Var1 != __fdlibm_posix) goto LAB_08979a24;
  }
  piVar4 = __errno();
  *piVar4 = 0x21;
LAB_08979a34:
  if (local_40.err != 0) {
    piVar4 = __errno();
    *piVar4 = local_40.err;
  }
  return dVar5;
}



----------------------------------------

// Function: __ieee754_exp @ 08979ac0

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

double __ieee754_exp(double x)

{
  SItype SVar1;
  uint uVar2;
  int in_a0;
  uint in_a1;
  SItype unaff_s6;
  double in_f0_1;
  FLO_type_conflict FVar3;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double y@[DW_OP_reg4(a0); DW_OP_piece: 4;
                       DW_OP_reg5(a1); DW_OP_piece: 4]
                       Unresolved local var: double hi@[???]
                       Unresolved local var: double lo@[???]
                       Unresolved local var: double c@[???]
                       Unresolved local var: double t@[???]
                       Unresolved local var: __int32_t k@[???]
                       Unresolved local var: __int32_t xsb@[???]
                       Unresolved local var: __uint32_t hx@[???] */
  uVar2 = in_a1 & 0x7fffffff;
  if (uVar2 < 0x40862e42) {
    if (uVar2 < 0x3fd62e43) {
      if (uVar2 < 0x3e300000) {
        __adddf3(x,in_f14_15);
        SVar1 = __gtdf2(x,in_f14_15);
        if (0 < SVar1) goto LAB_08979e78;
      }
      else {
        unaff_s6 = 0;
      }
      goto LAB_08979c34;
    }
    if (0x3ff0a2b1 < uVar2) goto LAB_08979b5c;
    __subdf3(x,in_f14_15);
    unaff_s6 = ((int)in_a1 >> 0x1f) * 2 + 1;
  }
  else {
    if (0x7fefffff < uVar2) {
                    /* Unresolved local var: __uint32_t lx@[???] */
                    /* Unresolved local var: ieee_double_shape_type gl_u@[???] */
      if ((in_a1 & 0xfffff) == 0 && in_a0 == 0) {
        return in_f0_1;
      }
LAB_08979e78:
      FVar3 = __adddf3(x,in_f14_15);
      return FVar3;
    }
    SVar1 = __gtdf2(x,in_f14_15);
    if (0 < SVar1) {
      FVar3 = __muldf3(x,in_f14_15);
      return FVar3;
    }
    SVar1 = __ltdf2(x,in_f14_15);
    if (SVar1 < 0) {
      return in_f0_1;
    }
LAB_08979b5c:
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    unaff_s6 = __fixdfsi(x);
    __floatsidf(unaff_s6);
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
  }
  __subdf3(x,in_f14_15);
LAB_08979c34:
  __muldf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  __adddf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  __adddf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  if (unaff_s6 == 0) {
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __divdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    FVar3 = __subdf3(x,in_f14_15);
    return FVar3;
  }
  __muldf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  __divdf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  FVar3 = __subdf3(x,in_f14_15);
  if (-0x3fe < unaff_s6) {
                    /* Unresolved local var: __uint32_t hy@[???]
                       Unresolved local var: ieee_double_shape_type sh_u@[???] */
    return FVar3;
  }
                    /* Unresolved local var: __uint32_t hy@[???]
                       Unresolved local var: ieee_double_shape_type sh_u@[???] */
  FVar3 = __muldf3(x,in_f14_15);
  return FVar3;
}



----------------------------------------

// Function: __ieee754_log @ 0897a0d4

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

double __ieee754_log(double x)

{
  SItype SVar1;
  uint extraout_v1;
  int in_a0;
  uint in_a1;
  int iVar2;
  uint uVar3;
  FLO_type_conflict FVar4;
  double dVar5;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double hfsq@[???]
                       Unresolved local var: double f@[???]
                       Unresolved local var: double s@[???]
                       Unresolved local var: double z@[???]
                       Unresolved local var: double R@[???]
                       Unresolved local var: double w@[???]
                       Unresolved local var: double t1@[???]
                       Unresolved local var: double t2@[???]
                       Unresolved local var: double dk@[???]
                       Unresolved local var: __int32_t k@[???]
                       Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: __int32_t i@[???]
                       Unresolved local var: __int32_t j@[???]
                       Unresolved local var: __uint32_t lx@[???] */
  if ((int)in_a1 < 0x100000) {
    if (in_a0 == 0 && (in_a1 & 0x7fffffff) == 0) {
      FVar4 = __divdf3(x,in_f14_15);
      return FVar4;
    }
    if ((int)in_a1 < 0) {
      __subdf3(x,in_f14_15);
      FVar4 = __divdf3(x,in_f14_15);
      return FVar4;
    }
    __muldf3(x,in_f14_15);
    iVar2 = -0x36;
    in_a1 = extraout_v1;
                    /* Unresolved local var: ieee_double_shape_type gh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  }
  else {
    iVar2 = 0;
  }
  if (0x7fefffff < (int)in_a1) {
    FVar4 = __adddf3(x,in_f14_15);
    return FVar4;
  }
  uVar3 = in_a1 & 0xfffff;
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
  iVar2 = iVar2 + ((int)in_a1 >> 0x14) + -0x3ff + ((int)(uVar3 + 0x95f64 & 0x100000) >> 0x14);
  dVar5 = __subdf3(x,in_f14_15);
  if ((uVar3 + 2 & 0xfffff) < 3) {
    SVar1 = __eqdf2(x,in_f14_15);
    if (SVar1 == 0) {
      if (iVar2 == 0) {
        return dVar5;
      }
      __floatsidf(iVar2);
      __muldf3(x,in_f14_15);
      __muldf3(x,in_f14_15);
      FVar4 = __adddf3(x,in_f14_15);
      return FVar4;
    }
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    if (iVar2 == 0) {
      FVar4 = __subdf3(x,in_f14_15);
      return FVar4;
    }
    __floatsidf(iVar2);
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
  }
  else {
    __adddf3(x,in_f14_15);
    __divdf3(x,in_f14_15);
    __floatsidf(iVar2);
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __adddf3(x,in_f14_15);
    if (0 < (int)(uVar3 - 0x6147a | 0x6b851 - uVar3)) {
      __muldf3(x,in_f14_15);
      __muldf3(x,in_f14_15);
      if (iVar2 == 0) {
        __adddf3(x,in_f14_15);
        __muldf3(x,in_f14_15);
        __subdf3(x,in_f14_15);
LAB_0897a49c:
        FVar4 = __subdf3(x,in_f14_15);
        return FVar4;
      }
      __muldf3(x,in_f14_15);
      __adddf3(x,in_f14_15);
      __muldf3(x,in_f14_15);
      __muldf3(x,in_f14_15);
      __adddf3(x,in_f14_15);
      __subdf3(x,in_f14_15);
      goto LAB_0897a728;
    }
    if (iVar2 == 0) {
      __subdf3(x,in_f14_15);
      __muldf3(x,in_f14_15);
      goto LAB_0897a49c;
    }
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
  }
  __adddf3(x,in_f14_15);
LAB_0897a728:
  __subdf3(x,in_f14_15);
  FVar4 = __subdf3(x,in_f14_15);
  return FVar4;
}



----------------------------------------

// Function: __ieee754_pow @ 0897a850

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

double __ieee754_pow(double x,double y)

{
  int extraout_v0;
  SItype SVar1;
  uint uVar2;
  uint extraout_v1;
  int extraout_v1_00;
  uint extraout_v1_01;
  int in_a0;
  int iVar3;
  uint in_a1;
  uint in_a2;
  uint in_a3;
  uint uVar4;
  uint uVar5;
  int iVar6;
  double in_f0_1;
  FLO_type_conflict FVar7;
  double dVar8;
  SItype local_88;
  int local_84;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: double ax@[???]
                       Unresolved local var: double z_h@[???]
                       Unresolved local var: double z_l@[???]
                       Unresolved local var: double p_h@[???]
                       Unresolved local var: double p_l@[???]
                       Unresolved local var: double y1@[???]
                       Unresolved local var: double t1@[???]
                       Unresolved local var: double t2@[???]
                       Unresolved local var: double r@[???]
                       Unresolved local var: double s@[???]
                       Unresolved local var: double t@[???]
                       Unresolved local var: double u@[???]
                       Unresolved local var: double v@[???]
                       Unresolved local var: double w@[???]
                       Unresolved local var: __int32_t i@[???]
                       Unresolved local var: __int32_t j@[???]
                       Unresolved local var: __int32_t k@[???]
                       Unresolved local var: __int32_t yisint@[???]
                       Unresolved local var: __int32_t n@[???]
                       Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: __int32_t hy@[???]
                       Unresolved local var: __int32_t ix@[???]
                       Unresolved local var: __int32_t iy@[???]
                       Unresolved local var: __uint32_t lx@[???]
                       Unresolved local var: __uint32_t ly@[???] */
                    /* Unresolved local var: ieee_double_shape_type ew_u@[???] */
  uVar4 = in_a3 & 0x7fffffff;
  if (in_a2 == 0 && uVar4 == 0) {
    return in_f0_1;
  }
  uVar5 = in_a1 & 0x7fffffff;
  if ((0x7ff00000 < uVar5) || (((uVar5 == 0x7ff00000 && (in_a0 != 0)) || (0x7ff00000 < uVar4)))) {
LAB_0897a8c8:
    FVar7 = __adddf3(x,y);
    return FVar7;
  }
  if (uVar4 == 0x7ff00000) {
    if (in_a2 != 0) goto LAB_0897a8c8;
    iVar6 = 0;
    if ((int)in_a1 < 0) goto LAB_0897aab4;
LAB_0897a93c:
    if (in_a2 == 0) {
      if (uVar4 == 0x7ff00000) {
        if (in_a0 != 0 || uVar5 != 0x3ff00000) {
          return in_f0_1;
        }
        FVar7 = __subdf3(x,y);
        return FVar7;
      }
LAB_0897a954:
      if (uVar4 == 0x3ff00000) {
        if (-1 < (int)in_a3) {
          return in_f0_1;
        }
        FVar7 = __divdf3(x,y);
        return FVar7;
      }
      if (in_a3 == 0x40000000) goto LAB_0897ab68;
      if ((in_a3 == 0x3fe00000) && (-1 < (int)in_a1)) {
        dVar8 = __ieee754_sqrt(x);
        return dVar8;
      }
    }
  }
  else {
    if (-1 < (int)in_a1) {
      iVar6 = 0;
      goto LAB_0897a93c;
    }
LAB_0897aab4:
    if (0x433fffff < uVar4) {
      iVar6 = 2;
      goto LAB_0897a93c;
    }
    iVar6 = 0;
    if (uVar4 < 0x3ff00000) goto LAB_0897a93c;
    iVar3 = ((int)uVar4 >> 0x14) + -0x3ff;
    if (0x14 < iVar3) {
      uVar2 = in_a2 >> (0x34U - iVar3 & 0x1f);
      if (in_a2 == uVar2 << (0x34U - iVar3 & 0x1f)) {
        iVar6 = 2 - (uVar2 & 1);
      }
      goto LAB_0897a93c;
    }
    iVar6 = 0;
    if (in_a2 == 0) {
      uVar2 = (int)uVar4 >> (0x14U - iVar3 & 0x1f);
      if (uVar4 == uVar2 << (0x14U - iVar3 & 0x1f)) {
        iVar6 = 2 - (uVar2 & 1);
      }
      goto LAB_0897a954;
    }
  }
  dVar8 = fabs(x);
  if ((in_a0 == 0) && (((uVar5 == 0x7ff00000 || (uVar5 == 0)) || (uVar5 == 0x3ff00000)))) {
    if ((int)in_a3 < 0) {
      dVar8 = __divdf3(x,y);
    }
    if (-1 < (int)in_a1) {
      return dVar8;
    }
    if (iVar6 != 0 || uVar5 != 0x3ff00000) {
      return dVar8;
    }
LAB_0897aa38:
    __subdf3(x,y);
    FVar7 = __divdf3(x,y);
    return FVar7;
  }
  if ((int)in_a1 < 0 && iVar6 == 0) goto LAB_0897aa38;
  if (0x41e00000 < uVar4) {
    if (uVar4 < 0x43f00001) {
      if (0x3feffffe < uVar5) {
        if (0x3ff00000 < uVar5) goto LAB_0897ab50;
        __subdf3(x,y);
        __muldf3(x,y);
        __muldf3(x,y);
        __muldf3(x,y);
        __muldf3(x,y);
        __adddf3(x,y);
        __muldf3(x,y);
        __subdf3(x,y);
        __muldf3(x,y);
        __muldf3(x,y);
        __adddf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
        __adddf3(x,y);
        __subdf3(x,y);
        goto LAB_0897b1d0;
      }
    }
    else if (0x3fefffff < uVar5) {
LAB_0897ab50:
      if ((int)in_a3 < 1) {
        return dVar8;
      }
      goto LAB_0897ab68;
    }
    if (-1 < (int)in_a3) {
      return dVar8;
    }
LAB_0897ab68:
    FVar7 = __muldf3(x,y);
    return FVar7;
  }
                    /* Unresolved local var: double s2@[???]
                       Unresolved local var: double s_h@[???]
                       Unresolved local var: double s_l@[???]
                       Unresolved local var: double t_h@[???]
                       Unresolved local var: double t_l@[???] */
  if (uVar5 < 0x100000) {
    __muldf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type gh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
    iVar6 = -0x35;
    uVar5 = extraout_v1_01;
  }
  else {
    iVar6 = 0;
  }
  iVar6 = iVar6 + ((int)uVar5 >> 0x14);
  local_88 = iVar6 + -0x3ff;
  if ((0x3988e < (uVar5 & 0xfffff)) && (0xbb679 < (uVar5 & 0xfffff))) {
    local_88 = iVar6 + -0x3fe;
  }
                    /* Unresolved local var: ieee_double_shape_type sh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  __subdf3(x,y);
  __adddf3(x,y);
  __divdf3(x,y);
  __muldf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
  __muldf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[DW_OP_reg4(a0);
                       DW_OP_piece: 4; DW_OP_reg5(a1); DW_OP_piece: 4] */
  __adddf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
  __adddf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __adddf3(x,y);
  __floatsidf(local_88);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
  __adddf3(x,y);
  __adddf3(x,y);
  __adddf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
LAB_0897b1d0:
  __subdf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
  __subdf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type ew_u@[???] */
  if ((int)extraout_v1 < 0x40900000) {
    if ((extraout_v1 & 0x7fffffff) < 0x4090cc00) goto LAB_0897b338;
    if (extraout_v1 != 0xc090cc00 || extraout_v0 != 0) goto LAB_0897b714;
    __subdf3(x,y);
    SVar1 = __ledf2(x,y);
    if (SVar1 < 1) goto LAB_0897b714;
  }
  else {
    if (extraout_v0 != 0 || extraout_v1 != 0x40900000) {
LAB_0897b714:
      __muldf3(x,y);
      FVar7 = __muldf3(x,y);
      return FVar7;
    }
    __adddf3(x,y);
    __subdf3(x,y);
    SVar1 = __gtdf2(x,y);
    if (0 < SVar1) goto LAB_0897b714;
LAB_0897b338:
    if ((extraout_v1 & 0x7fffffff) < 0x3fe00001) {
      iVar6 = 0;
      local_84 = 0;
      goto LAB_0897b34c;
    }
  }
  uVar4 = extraout_v1 + (0x100000 >> (((int)(extraout_v1 & 0x7fffffff) >> 0x14) - 0x3feU & 0x1f));
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
  iVar6 = (int)(uVar4 & 0xfffff | 0x100000) >>
          (0x14 - (((uVar4 & 0x7fffffff) >> 0x14) - 0x3ff) & 0x1f);
  if ((int)extraout_v1 < 0) {
    iVar6 = -iVar6;
  }
  __subdf3(x,y);
  __adddf3(x,y);
  local_84 = iVar6 << 0x14;
LAB_0897b34c:
                    /* Unresolved local var: ieee_double_shape_type sl_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  __muldf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __adddf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __divdf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  if (local_84 + extraout_v1_00 >> 0x14 < 1) {
    scalbn(x,iVar6);
  }
  FVar7 = __muldf3(x,y);
  return FVar7;
}



----------------------------------------

// Function: __ieee754_rem_pio2 @ 0897baa0

__int32_t __ieee754_rem_pio2(double x,double *y)

{
  int iVar1;
  undefined4 extraout_v0;
  undefined4 extraout_v0_00;
  undefined4 extraout_v0_01;
  undefined4 extraout_v0_02;
  undefined4 extraout_v0_03;
  undefined4 extraout_v0_04;
  undefined4 extraout_v0_05;
  undefined4 extraout_v0_06;
  SItype SVar2;
  int extraout_v0_07;
  int iVar3;
  undefined4 extraout_v0_08;
  undefined4 extraout_v0_09;
  undefined4 extraout_v0_10;
  undefined4 extraout_v0_11;
  undefined4 extraout_v0_12;
  undefined4 extraout_v1;
  undefined4 extraout_v1_00;
  undefined4 extraout_v1_01;
  uint extraout_v1_02;
  uint extraout_v1_03;
  undefined4 extraout_v1_04;
  undefined4 extraout_v1_05;
  undefined4 extraout_v1_06;
  __int32_t *extraout_v1_07;
  undefined4 extraout_v1_08;
  undefined4 extraout_v1_09;
  undefined4 extraout_v1_10;
  undefined4 extraout_v1_11;
  undefined4 extraout_v1_12;
  undefined4 in_a0;
  uint in_a1;
  uint uVar4;
  int nx;
  FLO_type_conflict in_f14_15;
  double local_58 [2];
  int prec;
  __int32_t *ipio2;
  int local_38;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: double w@[???]
                       Unresolved local var: double t@[???]
                       Unresolved local var: double r@[???]
                       Unresolved local var: double fn@[???]
                       Unresolved local var: double[3] tx@[???]
                       Unresolved local var: __int32_t i@[???]
                       Unresolved local var: __int32_t j@[???]
                       Unresolved local var: __int32_t n@[???]
                       Unresolved local var: __int32_t ix@[???]
                       Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: int e0@[???]
                       Unresolved local var: int nx@[???]
                       Unresolved local var: __uint32_t low@[???] */
  uVar4 = in_a1 & 0x7fffffff;
                    /* Unresolved local var: ieee_double_shape_type gh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  if (uVar4 < 0x3fe921fc) {
    *(undefined4 *)y = in_a0;
    *(uint *)((int)y + 4) = in_a1;
    *(undefined4 *)(y + 1) = 0;
    *(undefined4 *)((int)y + 0xc) = 0;
    return 0;
  }
  if (uVar4 < 0x4002d97c) {
    if ((int)in_a1 < 1) {
      __adddf3(x,in_f14_15);
      if (uVar4 != 0x3ff921fb) {
        __adddf3(x,in_f14_15);
        *(undefined4 *)y = extraout_v0_05;
        *(undefined4 *)((int)y + 4) = extraout_v1_05;
        __subdf3(x,in_f14_15);
        __adddf3(x,in_f14_15);
        *(undefined4 *)(y + 1) = extraout_v0_06;
        *(undefined4 *)((int)y + 0xc) = extraout_v1_06;
        return -1;
      }
      __adddf3(x,in_f14_15);
      __adddf3(x,in_f14_15);
      *(undefined4 *)y = extraout_v0_11;
      *(undefined4 *)((int)y + 4) = extraout_v1_11;
      __subdf3(x,in_f14_15);
      __adddf3(x,in_f14_15);
      *(undefined4 *)(y + 1) = extraout_v0_12;
      *(undefined4 *)((int)y + 0xc) = extraout_v1_12;
      return -1;
    }
    __subdf3(x,in_f14_15);
    if (uVar4 == 0x3ff921fb) {
      __subdf3(x,in_f14_15);
      __subdf3(x,in_f14_15);
      *(undefined4 *)y = extraout_v0_08;
      *(undefined4 *)((int)y + 4) = extraout_v1_08;
      __subdf3(x,in_f14_15);
      __subdf3(x,in_f14_15);
      *(undefined4 *)(y + 1) = extraout_v0_09;
      *(undefined4 *)((int)y + 0xc) = extraout_v1_09;
      return 1;
    }
    __subdf3(x,in_f14_15);
    *(undefined4 *)y = extraout_v0_00;
    *(undefined4 *)((int)y + 4) = extraout_v1_00;
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    *(undefined4 *)(y + 1) = extraout_v0_01;
    *(undefined4 *)((int)y + 0xc) = extraout_v1_01;
    return 1;
  }
  iVar3 = (int)uVar4 >> 0x14;
  if (0x413921fb < uVar4) {
    if (0x7fefffff < uVar4) {
      __subdf3(x,in_f14_15);
      *(undefined4 *)y = extraout_v0;
      *(undefined4 *)((int)y + 4) = extraout_v1;
      *(undefined4 *)(y + 1) = extraout_v0;
      *(undefined4 *)((int)y + 0xc) = extraout_v1;
      return 0;
    }
                    /* Unresolved local var: ieee_double_shape_type sl_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
    SVar2 = __fixdfsi(x);
    __floatsidf(SVar2);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    SVar2 = __fixdfsi(x);
    __floatsidf(SVar2);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    iVar1 = 3;
    prec = extraout_v0_07;
    ipio2 = extraout_v1_07;
    do {
      nx = iVar1;
      SVar2 = __eqdf2(x,in_f14_15);
      iVar1 = nx + -1;
    } while (SVar2 == 0);
    iVar3 = __kernel_rem_pio2(local_58,y,iVar3 + -0x416,nx,prec,ipio2);
    if (-1 < (int)in_a1) {
      return iVar3;
    }
    *(uint *)((int)y + 4) = *(uint *)((int)y + 4) ^ 0x80000000;
    *(uint *)((int)y + 0xc) = *(uint *)((int)y + 0xc) ^ 0x80000000;
    return -iVar3;
  }
  fabs(x);
  __muldf3(x,in_f14_15);
  __adddf3(x,in_f14_15);
  local_38 = __fixdfsi(x);
  __floatsidf(local_38);
  __muldf3(x,in_f14_15);
  __adddf3(x,in_f14_15);
  __muldf3(x,in_f14_15);
  if ((0x1f < local_38) || (uVar4 == (&DAT_089eb154)[local_38])) {
    __subdf3(x,in_f14_15);
    *(undefined4 *)y = extraout_v0_02;
    *(uint *)((int)y + 4) = extraout_v1_02;
    if ((int)(iVar3 - ((extraout_v1_02 & 0x7fffffff) >> 0x14)) < 0x11) goto LAB_0897be38;
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    *(undefined4 *)y = extraout_v0_03;
    *(uint *)((int)y + 4) = extraout_v1_03;
    if ((int)(iVar3 - ((extraout_v1_03 & 0x7fffffff) >> 0x14)) < 0x32) goto LAB_0897be38;
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __muldf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
    __subdf3(x,in_f14_15);
  }
  __subdf3(x,in_f14_15);
  *(undefined4 *)y = extraout_v0_10;
  *(undefined4 *)((int)y + 4) = extraout_v1_10;
LAB_0897be38:
  __subdf3(x,in_f14_15);
  __subdf3(x,in_f14_15);
  *(undefined4 *)(y + 1) = extraout_v0_04;
  *(undefined4 *)((int)y + 0xc) = extraout_v1_04;
  if ((int)in_a1 < 0) {
    local_38 = -local_38;
    *(uint *)((int)y + 4) = *(uint *)((int)y + 4) ^ 0x80000000;
    *(uint *)((int)y + 0xc) = *(uint *)((int)y + 0xc) ^ 0x80000000;
  }
  return local_38;
}



----------------------------------------

// Function: __ieee754_sqrt @ 0897c270

double __ieee754_sqrt(double x)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  uint in_a0;
  int iVar5;
  uint uVar6;
  uint in_a1;
  uint uVar7;
  int iVar8;
  uint uVar9;
  double in_f0_1;
  FLO_type_conflict FVar10;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: __int32_t sign@[???]
                       Unresolved local var: __uint32_t r@[???]
                       Unresolved local var: __uint32_t t1@[???]
                       Unresolved local var: __uint32_t s1@[???]
                       Unresolved local var: __uint32_t ix1@[???]
                       Unresolved local var: __uint32_t q1@[???]
                       Unresolved local var: __int32_t ix0@[???]
                       Unresolved local var: __int32_t s0@[???]
                       Unresolved local var: __int32_t q@[???]
                       Unresolved local var: __int32_t m@[???]
                       Unresolved local var: __int32_t t@[???]
                       Unresolved local var: __int32_t i@[???] */
                    /* Unresolved local var: ieee_double_shape_type ew_u@[???] */
  if ((in_a1 & 0x7ff00000) == 0x7ff00000) {
    __muldf3(x,in_f14_15);
    FVar10 = __adddf3(x,in_f14_15);
    return FVar10;
  }
  iVar4 = (int)in_a1 >> 0x14;
  if ((int)in_a1 < 1) {
    if (in_a0 == 0 && (in_a1 & 0x7fffffff) == 0) {
      return in_f0_1;
    }
    if (in_a1 != 0) {
      __subdf3(x,in_f14_15);
      FVar10 = __divdf3(x,in_f14_15);
      return FVar10;
    }
  }
  if (iVar4 == 0) {
    iVar4 = 0;
    while (in_a1 == 0) {
      iVar4 = iVar4 + -0x15;
      in_a1 = in_a0 >> 0xb;
      in_a0 = in_a0 << 0x15;
    }
    if ((in_a1 & 0x100000) == 0) {
      uVar7 = 0;
      do {
        in_a1 = in_a1 << 1;
        uVar7 = uVar7 + 1;
      } while ((in_a1 & 0x100000) == 0);
      uVar1 = 0x20 - uVar7;
    }
    else {
      uVar7 = 0;
      uVar1 = 0;
    }
    in_a1 = in_a1 | in_a0 >> (uVar1 & 0x1f);
    in_a0 = in_a0 << (uVar7 & 0x1f);
    iVar4 = (iVar4 - uVar7) + 1;
  }
  uVar1 = in_a1 & 0xfffff | 0x100000;
  if ((iVar4 - 0x3ffU & 1) != 0) {
    uVar1 = uVar1 * 2 - ((int)in_a0 >> 0x1f);
    in_a0 = in_a0 << 1;
  }
  iVar2 = uVar1 * 2 - ((int)in_a0 >> 0x1f);
  uVar1 = in_a0 << 1;
  uVar7 = 0x200000;
  iVar4 = 0;
  iVar8 = 0;
  do {
    iVar5 = uVar7 + iVar4;
    iVar3 = (int)uVar1 >> 0x1f;
    iVar8 = iVar8 + 1;
    uVar1 = uVar1 << 1;
    if (iVar5 <= iVar2) {
      iVar2 = iVar2 - iVar5;
      iVar4 = uVar7 + iVar5;
    }
    iVar2 = iVar2 * 2 - iVar3;
    uVar7 = uVar7 >> 1;
  } while (iVar8 != 0x16);
  uVar7 = 0x80000000;
  uVar9 = 0;
  iVar8 = 0;
  do {
    while ((uVar6 = uVar7 + uVar9, iVar2 <= iVar4 &&
           ((iVar3 = iVar4, iVar2 != iVar4 || (iVar3 = iVar2, uVar1 < uVar6))))) {
      iVar2 = iVar2 * 2 - ((int)uVar1 >> 0x1f);
      iVar8 = iVar8 + 1;
      uVar1 = uVar1 << 1;
      uVar7 = uVar7 >> 1;
      iVar4 = iVar3;
      if (iVar8 == 0x20) {
        return in_f0_1;
      }
    }
    uVar9 = uVar6 + uVar7;
    iVar3 = iVar4;
    if (((uVar6 & 0x80000000) == 0x80000000) && ((uVar9 & 0x80000000) == 0)) {
      iVar3 = iVar4 + 1;
    }
    iVar2 = iVar2 - iVar4;
    if (uVar1 < uVar6) {
      iVar2 = iVar2 + -1;
    }
    iVar2 = iVar2 * 2 - ((int)(uVar1 - uVar6) >> 0x1f);
    iVar8 = iVar8 + 1;
    uVar1 = (uVar1 - uVar6) * 2;
    uVar7 = uVar7 >> 1;
    iVar4 = iVar3;
  } while (iVar8 != 0x20);
  return in_f0_1;
}



----------------------------------------

// Function: __kernel_cos @ 0897c568

double __kernel_cos(double x,double y)

{
  SItype SVar1;
  uint in_a1;
  uint uVar2;
  double in_f0_1;
  FLO_type_conflict FVar3;
  
                    /* Unresolved local var: double a@[???]
                       Unresolved local var: double hz@[???]
                       Unresolved local var: double z@[???]
                       Unresolved local var: double r@[???]
                       Unresolved local var: double qx@[???]
                       Unresolved local var: __int32_t ix@[???] */
  uVar2 = in_a1 & 0x7fffffff;
  if (uVar2 < 0x3e400000) {
    SVar1 = __fixdfsi(x);
    if (SVar1 == 0) {
      return in_f0_1;
    }
    __muldf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
  }
  else {
    __muldf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    if (0x3fd33332 < uVar2) {
      if (uVar2 < 0x3fe90001) {
                    /* Unresolved local var: ieee_double_shape_type iw_u@[???] */
        __subdf3(x,y);
      }
      __muldf3(x,y);
      __subdf3(x,y);
      __muldf3(x,y);
      __muldf3(x,y);
      __subdf3(x,y);
      __subdf3(x,y);
      FVar3 = __subdf3(x,y);
      return FVar3;
    }
  }
  __muldf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __subdf3(x,y);
  __subdf3(x,y);
  FVar3 = __subdf3(x,y);
  return FVar3;
}



----------------------------------------

// Function: __kernel_rem_pio2 @ 0897ca8c

/* WARNING: Removing unreachable block (ram,0x0897ca9c) */
/* WARNING: Removing unreachable block (ram,0x0897d47c) */

int __kernel_rem_pio2(double *x,double *y,int e0,int nx,int prec,__int32_t *ipio2)

{
  bool bVar1;
  undefined4 extraout_v0;
  undefined4 extraout_v0_00;
  SItype SVar2;
  uint uVar3;
  undefined4 extraout_v0_01;
  undefined4 extraout_v0_02;
  undefined4 extraout_v0_03;
  uint extraout_v0_04;
  undefined4 extraout_v0_05;
  undefined4 extraout_v0_06;
  undefined4 extraout_v0_07;
  uint extraout_v0_08;
  uint extraout_v0_09;
  uint extraout_v0_10;
  uint extraout_v0_11;
  undefined4 extraout_v0_12;
  undefined4 extraout_v0_13;
  undefined4 extraout_v1;
  undefined4 extraout_v1_00;
  uint *puVar4;
  int *piVar5;
  undefined4 extraout_v1_01;
  undefined4 extraout_v1_02;
  undefined4 extraout_v1_03;
  uint extraout_v1_04;
  uint extraout_v1_05;
  uint extraout_v1_06;
  uint extraout_v1_07;
  uint extraout_v1_08;
  uint extraout_v1_09;
  uint extraout_v1_10;
  uint extraout_v1_11;
  uint extraout_v1_12;
  uint extraout_v1_13;
  undefined4 uVar6;
  undefined4 uVar7;
  uint uVar8;
  int in_t0;
  int in_t1;
  SItype *pSVar9;
  int iVar10;
  int iVar11;
  undefined4 *puVar12;
  int iVar13;
  int iVar14;
  int iVar15;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  uint auStack_2a8 [22];
  undefined4 local_250 [38];
  uint auStack_1b8 [42];
  undefined4 local_110 [40];
  int local_70;
  undefined4 *local_6c;
  undefined4 *local_68;
  SItype *local_64;
  int local_60;
  int local_5c;
  uint local_58;
  int local_54;
  uint local_50;
  double *local_4c;
  double *local_48;
  int local_44;
  int local_40;
  int local_3c;
  uint local_38;
  int local_34;
  int local_30;
  
                    /* Unresolved local var: __int32_t jz@[???]
                       Unresolved local var: __int32_t jx@[???]
                       Unresolved local var: __int32_t jv@[???]
                       Unresolved local var: __int32_t jp@[???]
                       Unresolved local var: __int32_t jk@[???]
                       Unresolved local var: __int32_t carry@[???]
                       Unresolved local var: __int32_t n@[???]
                       Unresolved local var: __int32_t[20] iq@[???]
                       Unresolved local var: __int32_t i@[???]
                       Unresolved local var: __int32_t j@[???]
                       Unresolved local var: __int32_t k@[???]
                       Unresolved local var: __int32_t m@[???]
                       Unresolved local var: __int32_t q0@[???]
                       Unresolved local var: __int32_t ih@[???]
                       Unresolved local var: double z@[???]
                       Unresolved local var: double fw@[???]
                       Unresolved local var: double[20] f@[???]
                       Unresolved local var: double[20] fq@[???]
                       Unresolved local var: double[20] q@[???] */
  local_70 = (e0 + -3) / 0x18;
  iVar15 = init_jk[in_t0];
  local_54 = nx + -1;
  iVar14 = iVar15 + local_54;
  local_5c = e0 + local_70 * -0x18 + -0x18;
  local_4c = x;
  local_48 = y;
  local_44 = nx;
  local_40 = in_t0;
  local_3c = in_t1;
  if (-1 < iVar14) {
    iVar13 = 0;
    puVar12 = local_250;
    iVar11 = local_70 - local_54;
    pSVar9 = (SItype *)(in_t1 + iVar11 * 4);
    do {
      uVar6 = 0;
      uVar7 = 0;
      if (-1 < iVar11) {
        __floatsidf(*pSVar9);
        uVar6 = extraout_v0;
        uVar7 = extraout_v1;
      }
      iVar13 = iVar13 + 1;
      *puVar12 = uVar6;
      puVar12[1] = uVar7;
      iVar11 = iVar11 + 1;
      pSVar9 = pSVar9 + 1;
      puVar12 = puVar12 + 2;
    } while (iVar13 <= iVar14);
  }
  iVar14 = 0;
  if (-1 < iVar15) {
    puVar12 = local_110;
    do {
      while (-1 < local_54) {
        iVar11 = 0;
        do {
          iVar11 = iVar11 + 1;
          __muldf3(in_f12_13,in_f14_15);
          __adddf3(in_f12_13,in_f14_15);
        } while (iVar11 <= local_54);
        iVar14 = iVar14 + 1;
        *puVar12 = extraout_v0_00;
        puVar12[1] = extraout_v1_00;
        puVar12 = puVar12 + 2;
        if (iVar15 < iVar14) goto LAB_0897cc1c;
      }
      iVar14 = iVar14 + 1;
      *puVar12 = 0;
      puVar12[1] = 0;
      puVar12 = puVar12 + 2;
    } while (iVar14 <= iVar15);
  }
LAB_0897cc1c:
  local_50 = 0x18 - local_5c;
  local_38 = 0x17 - local_5c;
  local_30 = iVar15 << 2;
  iVar14 = iVar15;
LAB_0897cc40:
  iVar11 = iVar14;
  iVar14 = iVar11;
  puVar4 = auStack_2a8 + 2;
  if (0 < iVar11) {
    do {
      __muldf3(in_f12_13,in_f14_15);
      SVar2 = __fixdfsi(in_f12_13);
      __floatsidf(SVar2);
      __muldf3(in_f12_13,in_f14_15);
      __adddf3(in_f12_13,in_f14_15);
      SVar2 = __fixdfsi(in_f12_13);
      *puVar4 = SVar2;
      __adddf3(in_f12_13,in_f14_15);
      iVar14 = iVar14 + -1;
      puVar4 = puVar4 + 1;
    } while (iVar14 != 0);
  }
  scalbn(in_f12_13,local_5c);
  __muldf3(in_f12_13,in_f14_15);
  floor(in_f12_13);
  __muldf3(in_f12_13,in_f14_15);
  __adddf3(in_f12_13,in_f14_15);
  local_58 = __fixdfsi(in_f12_13);
  __floatsidf(local_58);
  __subdf3(in_f12_13,in_f14_15);
  uVar8 = local_38;
  if (local_5c < 1) {
    if (local_5c == 0) {
      local_60 = (int)auStack_2a8[iVar11 + 1] >> 0x17;
      goto LAB_0897cdfc;
    }
    SVar2 = __gedf2(in_f12_13,in_f14_15);
    if (-1 < SVar2) {
      local_60 = 2;
      goto LAB_0897ce08;
    }
    local_60 = 0;
LAB_0897cea0:
    iVar14 = __eqdf2(in_f12_13,in_f14_15);
  }
  else {
    uVar3 = auStack_2a8[iVar11 + 1];
    iVar14 = (int)uVar3 >> (local_50 & 0x1f);
    uVar3 = uVar3 - (iVar14 << (local_50 & 0x1f));
    auStack_2a8[iVar11 + 1] = uVar3;
    local_58 = local_58 + iVar14;
    local_60 = (int)uVar3 >> (uVar8 & 0x1f);
LAB_0897cdfc:
    if (local_60 < 1) goto LAB_0897cea0;
LAB_0897ce08:
    local_58 = local_58 + 1;
    if (iVar11 < 1) {
      bVar1 = false;
    }
    else {
      bVar1 = false;
      iVar14 = 0;
      puVar4 = auStack_2a8 + 2;
      do {
        while (iVar13 = *puVar4, bVar1) {
          iVar14 = iVar14 + 1;
          *puVar4 = DAT_089eb340 - iVar13;
          puVar4 = puVar4 + 1;
          if (iVar11 == iVar14) goto LAB_0897ce6c;
        }
        if (iVar13 != 0) {
          bVar1 = true;
          *puVar4 = 0x1000000 - iVar13;
        }
        iVar14 = iVar14 + 1;
        puVar4 = puVar4 + 1;
      } while (iVar11 != iVar14);
    }
LAB_0897ce6c:
    if (0 < local_5c) {
      if (local_5c == 1) {
        auStack_2a8[iVar11 + 1] = auStack_2a8[iVar11 + 1] & 0x7fffff;
      }
      else if (local_5c == 2) {
        auStack_2a8[iVar11 + 1] = auStack_2a8[iVar11 + 1] & 0x3fffff;
      }
    }
    if ((local_60 != 2) || (__subdf3(in_f12_13,in_f14_15), !bVar1)) goto LAB_0897cea0;
    scalbn(in_f12_13,local_5c);
    __subdf3(in_f12_13,in_f14_15);
    iVar14 = __eqdf2(in_f12_13,in_f14_15);
  }
  if (iVar14 != 0) {
    SVar2 = __eqdf2(in_f12_13,in_f14_15);
    if (SVar2 != 0) {
      scalbn(in_f12_13,-local_5c);
      SVar2 = __gedf2(in_f12_13,in_f14_15);
      if (SVar2 < 0) {
        uVar8 = __fixdfsi(in_f12_13);
        auStack_2a8[iVar11 + 2] = uVar8;
        iVar14 = iVar11;
      }
      else {
        local_5c = local_5c + 0x18;
        __muldf3(in_f12_13,in_f14_15);
        SVar2 = __fixdfsi(in_f12_13);
        __floatsidf(SVar2);
        __muldf3(in_f12_13,in_f14_15);
        __adddf3(in_f12_13,in_f14_15);
        uVar8 = __fixdfsi(in_f12_13);
        auStack_2a8[iVar11 + 2] = uVar8;
        uVar8 = __fixdfsi(in_f12_13);
        auStack_2a8[iVar11 + 3] = uVar8;
        iVar14 = iVar11 + 1;
      }
      goto LAB_0897d16c;
    }
    goto LAB_0897d130;
  }
  iVar14 = iVar11 + -1;
  if (iVar15 <= iVar14) {
    puVar4 = auStack_2a8 + iVar11 + 1;
    uVar8 = 0;
    do {
      iVar14 = iVar14 + -1;
      uVar8 = uVar8 | *puVar4;
      puVar4 = puVar4 + -1;
    } while (iVar15 <= iVar14);
    if (uVar8 != 0) goto LAB_0897d130;
  }
  if (*(int *)((int)auStack_2a8 + local_30 + 4) == 0) goto code_r0x0897cf08;
  iVar14 = iVar11 + 1;
  goto LAB_0897cf40;
code_r0x0897cf08:
  iVar14 = 1;
  piVar5 = (int *)((int)auStack_2a8 + local_30);
  do {
    iVar13 = *piVar5;
    iVar14 = iVar14 + 1;
    piVar5 = piVar5 + -1;
  } while (iVar13 == 0);
  iVar14 = iVar11 + iVar14;
  if (iVar11 + 1 <= iVar14) {
LAB_0897cf40:
    iVar13 = iVar11 + 1;
    local_64 = (SItype *)((iVar11 + local_70) * 4 + local_3c + 4);
    local_68 = local_250 + (iVar11 + local_44) * 2;
    local_6c = local_110 + iVar13 * 2;
    do {
      while( true ) {
        __floatsidf(*local_64);
        iVar11 = local_54;
        puVar12 = local_68;
        *local_68 = extraout_v0_01;
        puVar12[1] = extraout_v1_01;
        if (-1 < iVar11) break;
        iVar13 = iVar13 + 1;
        *local_6c = 0;
        local_6c[1] = 0;
        local_64 = local_64 + 1;
        local_68 = local_68 + 2;
        local_6c = local_6c + 2;
        if (iVar14 < iVar13) goto LAB_0897cc40;
      }
      iVar11 = 0;
      do {
        iVar11 = iVar11 + 1;
        __muldf3(in_f12_13,in_f14_15);
        __adddf3(in_f12_13,in_f14_15);
      } while (iVar11 <= local_54);
      iVar13 = iVar13 + 1;
      *local_6c = extraout_v0_02;
      local_6c[1] = extraout_v1_02;
      local_64 = local_64 + 1;
      local_68 = local_68 + 2;
      local_6c = local_6c + 2;
    } while (iVar13 <= iVar14);
  }
  goto LAB_0897cc40;
LAB_0897d130:
  iVar14 = iVar11 + -1;
  local_5c = local_5c + -0x18;
  if (auStack_2a8[iVar11 + 1] == 0) {
    puVar4 = auStack_2a8 + iVar11;
    do {
      uVar8 = *puVar4;
      iVar14 = iVar14 + -1;
      local_5c = local_5c + -0x18;
      puVar4 = puVar4 + -1;
    } while (uVar8 == 0);
  }
LAB_0897d16c:
  scalbn(in_f12_13,local_5c);
  if (-1 < iVar14) {
    puVar4 = auStack_2a8 + iVar14 + 2;
    puVar12 = local_110 + iVar14 * 2;
    iVar11 = iVar14;
    do {
      uVar8 = *puVar4;
      iVar11 = iVar11 + -1;
      puVar4 = puVar4 + -1;
      __floatsidf(uVar8);
      __muldf3(in_f12_13,in_f14_15);
      *puVar12 = extraout_v0_03;
      puVar12[1] = extraout_v1_03;
      __muldf3(in_f12_13,in_f14_15);
      puVar12 = puVar12 + -2;
    } while (iVar11 != -1);
    iVar13 = 0;
    iVar11 = iVar14;
    do {
      while ((-1 < iVar15 && (-1 < iVar13))) {
        iVar10 = 0;
        do {
          iVar10 = iVar10 + 1;
          __muldf3(in_f12_13,in_f14_15);
          __adddf3(in_f12_13,in_f14_15);
          if (iVar15 < iVar10) break;
        } while (iVar10 <= iVar13);
        auStack_1b8[iVar13 * 2 + 2] = extraout_v0_04;
        auStack_1b8[iVar13 * 2 + 3] = extraout_v1_04;
        iVar11 = iVar11 + -1;
        iVar13 = iVar13 + 1;
        if (iVar11 == -1) goto LAB_0897d2b0;
      }
      auStack_1b8[iVar13 * 2 + 2] = 0;
      auStack_1b8[iVar13 * 2 + 3] = 0;
      iVar11 = iVar11 + -1;
      iVar13 = iVar13 + 1;
    } while (iVar11 != -1);
  }
LAB_0897d2b0:
  if (local_40 < 3) {
    if (local_40 < 1) {
      if (local_40 == 0) {
        if (iVar14 < 0) {
          uVar6 = 0;
          uVar8 = 0;
        }
        else {
          do {
            __adddf3(in_f12_13,in_f14_15);
            iVar14 = iVar14 + -1;
            uVar6 = extraout_v0_13;
            uVar8 = extraout_v1_13;
          } while (iVar14 != -1);
        }
        if (local_60 != 0) {
          uVar8 = uVar8 ^ 0x80000000;
        }
        *(undefined4 *)local_48 = uVar6;
        *(uint *)((int)local_48 + 4) = uVar8;
      }
    }
    else {
      iVar15 = iVar14;
      if (iVar14 < 0) {
        uVar6 = 0;
        uVar8 = 0;
      }
      else {
        do {
          __adddf3(in_f12_13,in_f14_15);
          iVar15 = iVar15 + -1;
          uVar6 = extraout_v0_05;
          uVar8 = extraout_v1_05;
        } while (iVar15 != -1);
      }
      if (local_60 != 0) {
        uVar8 = uVar8 ^ 0x80000000;
      }
      *(undefined4 *)local_48 = uVar6;
      *(uint *)((int)local_48 + 4) = uVar8;
      __subdf3(in_f12_13,in_f14_15);
      uVar6 = extraout_v0_06;
      uVar8 = extraout_v1_06;
      if (0 < iVar14) {
        iVar15 = 1;
        do {
          __adddf3(in_f12_13,in_f14_15);
          iVar15 = iVar15 + 1;
          uVar6 = extraout_v0_07;
          uVar8 = extraout_v1_07;
        } while (iVar15 <= iVar14);
      }
      if (local_60 != 0) {
        uVar8 = uVar8 ^ 0x80000000;
      }
      *(undefined4 *)(local_48 + 1) = uVar6;
      *(uint *)((int)local_48 + 0xc) = uVar8;
    }
  }
  else if (local_40 == 3) {
    if (0 < iVar14) {
      puVar4 = auStack_1b8 + iVar14 * 2;
      iVar15 = iVar14;
      do {
        __adddf3(in_f12_13,in_f14_15);
        __subdf3(in_f12_13,in_f14_15);
        __adddf3(in_f12_13,in_f14_15);
        iVar15 = iVar15 + -1;
        puVar4[2] = extraout_v0_09;
        puVar4[3] = extraout_v1_09;
        *puVar4 = extraout_v0_08;
        puVar4[1] = extraout_v1_08;
        puVar4 = puVar4 + -2;
      } while (iVar15 != 0);
    }
    local_34 = iVar14 * 8;
    if (iVar14 < 2) {
      uVar6 = 0;
      uVar8 = 0;
    }
    else {
      puVar4 = auStack_1b8 + iVar14 * 2;
      iVar15 = iVar14;
      do {
        __adddf3(in_f12_13,in_f14_15);
        __subdf3(in_f12_13,in_f14_15);
        __adddf3(in_f12_13,in_f14_15);
        iVar15 = iVar15 + -1;
        puVar4[2] = extraout_v0_11;
        puVar4[3] = extraout_v1_11;
        *puVar4 = extraout_v0_10;
        puVar4[1] = extraout_v1_10;
        puVar4 = puVar4 + -2;
      } while (iVar15 != 1);
      do {
        __adddf3(in_f12_13,in_f14_15);
        iVar14 = iVar14 + -1;
        uVar6 = extraout_v0_12;
        uVar8 = extraout_v1_12;
      } while (iVar14 != 1);
    }
    if (local_60 == 0) {
      *(undefined4 *)(local_48 + 2) = uVar6;
      *(uint *)((int)local_48 + 0x14) = uVar8;
      *(uint *)local_48 = auStack_1b8[2];
      *(uint *)((int)local_48 + 4) = auStack_1b8[3];
      *(uint *)(local_48 + 1) = auStack_1b8[4];
      *(uint *)((int)local_48 + 0xc) = auStack_1b8[5];
    }
    else {
      *(uint *)((int)local_48 + 0x14) = uVar8 ^ 0x80000000;
      *(uint *)local_48 = auStack_1b8[2];
      *(uint *)((int)local_48 + 4) = auStack_1b8[3] ^ 0x80000000;
      *(uint *)(local_48 + 1) = auStack_1b8[4];
      *(uint *)((int)local_48 + 0xc) = auStack_1b8[5] ^ 0x80000000;
      *(undefined4 *)(local_48 + 2) = uVar6;
    }
  }
  return local_58 & 7;
}



----------------------------------------

// Function: __kernel_sin @ 0897d884

double __kernel_sin(double x,double y,int iy)

{
  SItype SVar1;
  uint in_a1;
  int in_t0;
  double in_f0_1;
  FLO_type_conflict FVar2;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: double r@[???]
                       Unresolved local var: double v@[???]
                       Unresolved local var: __int32_t ix@[???] */
  if ((0x3e3fffff < (in_a1 & 0x7fffffff)) || (SVar1 = __fixdfsi(x), SVar1 != 0)) {
    __muldf3(x,y);
    __muldf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    if (in_t0 == 0) {
      __muldf3(x,y);
      __subdf3(x,y);
      __muldf3(x,y);
      FVar2 = __adddf3(x,y);
      return FVar2;
    }
    __muldf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    in_f0_1 = __subdf3(x,y);
  }
  return in_f0_1;
}



----------------------------------------

// Function: __kernel_tan @ 0897db8c

double __kernel_tan(double x,double y,int iy)

{
  SItype SVar1;
  int in_a0;
  uint in_a1;
  int in_t0;
  uint uVar2;
  double in_f0_1;
  double dVar3;
  FLO_type_conflict FVar4;
  
                    /* Unresolved local var: double z@[???]
                       Unresolved local var: double r@[???]
                       Unresolved local var: double v@[???]
                       Unresolved local var: double w@[???]
                       Unresolved local var: double s@[???]
                       Unresolved local var: __int32_t ix@[???]
                       Unresolved local var: __int32_t hx@[???] */
  uVar2 = in_a1 & 0x7fffffff;
                    /* Unresolved local var: ieee_double_shape_type gh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  if (uVar2 < 0x3e300000) {
    SVar1 = __fixdfsi(x);
    if (SVar1 == 0) {
                    /* Unresolved local var: __uint32_t low@[???] */
      if ((uVar2 == 0 && in_a0 == 0) && in_t0 == -1) {
        fabs(x);
        FVar4 = __divdf3(x,y);
        return FVar4;
      }
      if (in_t0 == 1) {
        return in_f0_1;
      }
      FVar4 = __divdf3(x,y);
      return FVar4;
    }
  }
  else if (0x3fe59427 < uVar2) {
    __subdf3(x,y);
    __subdf3(x,y);
    __adddf3(x,y);
  }
  __muldf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  __muldf3(x,y);
  __adddf3(x,y);
  dVar3 = __adddf3(x,y);
  if (uVar2 < 0x3fe59428) {
    if (in_t0 != 1) {
                    /* Unresolved local var: double a@[???]
                       Unresolved local var: double t@[???] */
                    /* Unresolved local var: ieee_double_shape_type sl_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
      __divdf3(x,y);
                    /* Unresolved local var: ieee_double_shape_type sl_u@[???] */
      __muldf3(x,y);
      __adddf3(x,y);
      __subdf3(x,y);
      __subdf3(x,y);
      __muldf3(x,y);
      __adddf3(x,y);
      __muldf3(x,y);
      FVar4 = __adddf3(x,y);
      return FVar4;
    }
  }
  else {
    __floatsidf(in_t0);
    __floatsidf(1 - ((int)in_a1 >> 0x1e & 2U));
    __muldf3(x,y);
    __adddf3(x,y);
    __divdf3(x,y);
    __subdf3(x,y);
    __subdf3(x,y);
    __muldf3(x,y);
    __adddf3(x,y);
    dVar3 = __muldf3(x,y);
  }
  return dVar3;
}



----------------------------------------

// Function: fabs @ 0897e2f8

double fabs(double x)

{
  double in_f0_1;
  
                    /* Unresolved local var: __uint32_t high@[DW_OP_reg5(a1)]
                       Unresolved local var: ieee_double_shape_type sh_u@[DW_OP_reg4(a0);
                       DW_OP_piece: 4; DW_OP_reg9(t1); DW_OP_piece: 4] */
  return in_f0_1;
}



----------------------------------------

// Function: finite @ 0897e310

int finite(double x)

{
  uint in_a1;
  
                    /* Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: ieee_double_shape_type gh_u@[???] */
  return (in_a1 & 0x7fffffff) + 0x80100000 >> 0x1f;
}



----------------------------------------

// Function: floor @ 0897e32c

double floor(double x)

{
  uint uVar1;
  uint in_a0;
  uint in_a1;
  uint uVar2;
  double in_f0_1;
  FLO_type_conflict FVar3;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: __int32_t i0@[???]
                       Unresolved local var: __int32_t i1@[???]
                       Unresolved local var: __int32_t j0@[???]
                       Unresolved local var: __uint32_t i@[???]
                       Unresolved local var: __uint32_t j@[???] */
  uVar1 = (in_a1 & 0x7fffffff) >> 0x14;
  uVar2 = uVar1 - 0x3ff;
                    /* Unresolved local var: ieee_double_shape_type ew_u@[???] */
  if ((int)uVar2 < 0x14) {
    if ((int)uVar2 < 0) {
      in_f0_1 = __adddf3(x,in_f14_15);
      __gtdf2(x,in_f14_15);
    }
    else if ((0xfffff >> (uVar2 & 0x1f) & in_a1) != 0 || in_a0 != 0) {
      in_f0_1 = __adddf3(x,in_f14_15);
      __gtdf2(x,in_f14_15);
    }
  }
  else if ((int)uVar2 < 0x34) {
    if ((0xffffffffU >> (uVar1 - 0x413 & 0x1f) & in_a0) != 0) {
      in_f0_1 = __adddf3(x,in_f14_15);
      __gtdf2(x,in_f14_15);
    }
  }
  else if (uVar2 == 0x400) {
    FVar3 = __adddf3(x,in_f14_15);
    return FVar3;
  }
  return in_f0_1;
}



----------------------------------------

// Function: __isnand @ 0897e598

int __isnand(double x)

{
  uint in_a0;
  uint in_a1;
  
                    /* Unresolved local var: __int32_t hx@[DW_OP_reg4(a0)]
                       Unresolved local var: __int32_t lx@[???]
                       Unresolved local var: ieee_double_shape_type ew_u@[???] */
  return 0x7ff00000 - ((-in_a0 | in_a0) >> 0x1f | in_a1 & 0x7fffffff) >> 0x1f;
}



----------------------------------------

// Function: matherr @ 0897e5cc

int matherr(exception *x)

{
                    /* Unresolved local var: int n@[???] */
  return 0;
}



----------------------------------------

// Function: rint @ 0897e5d4

double rint(double x)

{
  uint uVar1;
  uint in_a0;
  uint in_a1;
  uint uVar2;
  double in_f0_1;
  FLO_type_conflict FVar3;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: __int32_t i0@[DW_OP_reg5(a1)]
                       Unresolved local var: __int32_t j0@[???]
                       Unresolved local var: __int32_t sx@[???]
                       Unresolved local var: __uint32_t i@[???]
                       Unresolved local var: __uint32_t i1@[???]
                       Unresolved local var: double t@[???]
                       Unresolved local var: double w@[???] */
  uVar1 = (in_a1 & 0x7fffffff) >> 0x14;
  uVar2 = uVar1 - 0x3ff;
                    /* Unresolved local var: ieee_double_shape_type ew_u@[???] */
  if ((int)uVar2 < 0x14) {
    if ((int)uVar2 < 0) {
      if (in_a0 == 0 && (in_a1 & 0x7fffffff) == 0) {
        return in_f0_1;
      }
                    /* Unresolved local var: ieee_double_shape_type sh_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
      __adddf3(x,in_f14_15);
      FVar3 = __subdf3(x,in_f14_15);
      return FVar3;
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
    }
    if (in_a0 == 0 && (0xfffff >> (uVar2 & 0x1f) & in_a1) == 0) {
      return in_f0_1;
    }
  }
  else {
    if (0x33 < (int)uVar2) {
      if (uVar2 != 0x400) {
        return in_f0_1;
      }
      FVar3 = __adddf3(x,in_f14_15);
      return FVar3;
    }
    if ((in_a0 & 0xffffffffU >> (uVar1 - 0x413 & 0x1f)) == 0) {
      return in_f0_1;
    }
  }
  __adddf3(x,in_f14_15);
  FVar3 = __subdf3(x,in_f14_15);
  return FVar3;
}



----------------------------------------

// Function: scalbn @ 0897e804

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

double scalbn(double x,int n)

{
  uint extraout_v1;
  int iVar1;
  int in_a0;
  uint in_a1;
  uint uVar2;
  double in_f0_1;
  FLO_type_conflict FVar3;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: __int32_t k@[???]
                       Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: __int32_t lx@[???] */
  uVar2 = (in_a1 & 0x7fffffff) >> 0x14;
                    /* Unresolved local var: ieee_double_shape_type ew_u@[DW_OP_reg2(v0);
                       DW_OP_piece: 4; DW_OP_reg3(v1); DW_OP_piece: 4] */
  if (uVar2 == 0) {
    if (in_a0 == 0 && (in_a1 & 0x7fffffff) == 0) {
      return in_f0_1;
    }
    in_f0_1 = __muldf3(x,in_f14_15);
    if (n < -50000) {
      FVar3 = __muldf3(x,in_f14_15);
      return FVar3;
    }
                    /* Unresolved local var: ieee_double_shape_type gh_u@[DW_OP_reg4(a0);
                       DW_OP_piece: 4; DW_OP_reg5(a1); DW_OP_piece: 4] */
    uVar2 = ((extraout_v1 & 0x7fffffff) >> 0x14) - 0x36;
  }
  iVar1 = uVar2 + n;
  if (uVar2 == 0x7ff) {
    FVar3 = __adddf3(x,in_f14_15);
    return FVar3;
  }
  if (iVar1 < 0x7ff) {
    if (0 < iVar1) {
                    /* Unresolved local var: ieee_double_shape_type sh_u@[DW_OP_reg4(a0);
                       DW_OP_piece: 4; DW_OP_reg5(a1); DW_OP_piece: 4] */
      return in_f0_1;
    }
    if (-0x36 < iVar1) {
                    /* Unresolved local var: ieee_double_shape_type sh_u@[???] */
      FVar3 = __muldf3(x,in_f14_15);
      return FVar3;
    }
  }
  copysign(x,in_f14_15);
  FVar3 = __muldf3(x,in_f14_15);
  return FVar3;
}



----------------------------------------

// Function: copysign @ 0897ea14

double copysign(double x,double y)

{
  double in_f0_1;
  
                    /* Unresolved local var: __uint32_t hx@[DW_OP_reg5(a1)]
                       Unresolved local var: __uint32_t hy@[DW_OP_reg7(a3)]
                       Unresolved local var: ieee_double_shape_type sh_u@[DW_OP_reg4(a0);
                       DW_OP_piece: 4; DW_OP_reg10(t2); DW_OP_piece: 4] */
  return in_f0_1;
}



----------------------------------------

// Function: SDL_MixAudio @ 0897ea38

/* WARNING: Removing unreachable block (ram,0x0897eae4) */
/* WARNING: Removing unreachable block (ram,0x0897ec74) */
/* WARNING: Removing unreachable block (ram,0x0897ec00) */
/* WARNING: Removing unreachable block (ram,0x0897eb6c) */

void SDL_MixAudio(Uint8 *dst,Uint8 *src,Uint32 len,int volume)

{
  Uint8 UVar1;
  ushort uVar2;
  short sVar3;
  int iVar4;
  byte *pbVar5;
  Uint8 *pUVar6;
  uint uVar7;
  
                    /* Unresolved local var: Uint16 format@[???] */
  if (volume == 0) {
    return;
  }
  if (current_audio == (SDL_AudioDevice *)0x0) {
LAB_0897ebac:
    uVar7 = 0;
    if (len >> 1 == 0) {
      return;
    }
    do {
      sVar3 = *(short *)src;
      uVar7 = uVar7 + 1;
      src = (Uint8 *)((int)src + 2);
      iVar4 = (int)(short)((volume * sVar3) / 0x80) + (int)*(short *)dst + -1;
      *(char *)((int)dst + 1) = (char)((uint)iVar4 >> 8);
      *dst = (char)iVar4;
      dst = (Uint8 *)((int)dst + 2);
    } while (uVar7 != len >> 1);
    return;
  }
  if ((current_audio->convert).needed == 0) {
    uVar2 = (current_audio->spec).format;
  }
  else {
    uVar2 = (current_audio->convert).src_format;
  }
  if (uVar2 == 0x8008) {
                    /* Unresolved local var: Sint8 * dst8@[???]
                       Unresolved local var: Sint8 * src8@[???]
                       Unresolved local var: Sint8 src_sample@[???]
                       Unresolved local var: int dst_sample@[???]
                       Unresolved local var: int max_audioval@[???]
                       Unresolved local var: int min_audioval@[???] */
    if (len == 0) {
      return;
    }
    pUVar6 = dst + (len - 1);
    while( true ) {
      iVar4 = (int)(char)*dst + (int)(char)((volume * (char)*src) / 0x80);
      if (iVar4 < 0x80) {
        if (iVar4 < -0x80) {
          *dst = 0x80;
        }
        else {
          *dst = (Uint8)iVar4;
        }
      }
      else {
        *dst = '\x7f';
      }
      src = src + 1;
      if (pUVar6 == dst) break;
      dst = dst + 1;
    }
    return;
  }
  if (uVar2 < 0x8009) {
    if (uVar2 == 8) {
                    /* Unresolved local var: Uint8 src_sample@[???] */
      if (len == 0) {
        return;
      }
      pbVar5 = dst + len;
      do {
        *dst = ""[((int)(volume * (*src - 0x80)) / 0x80 - 0x80U & 0xff) + (uint)*dst];
        dst = dst + 1;
        src = src + 1;
      } while (dst != pbVar5);
      return;
    }
  }
  else {
    if (uVar2 == 0x8010) goto LAB_0897ebac;
    if (uVar2 == 0x9010) {
                    /* Unresolved local var: Sint16 src1@[???]
                       Unresolved local var: Sint16 src2@[???]
                       Unresolved local var: int dst_sample@[???]
                       Unresolved local var: int max_audioval@[???]
                       Unresolved local var: int min_audioval@[???] */
      uVar7 = 0;
      if (len >> 1 == 0) {
        return;
      }
      do {
        UVar1 = *src;
        pUVar6 = src + 1;
        uVar7 = uVar7 + 1;
        src = src + 2;
        iVar4 = (int)(short)((volume * CONCAT11(UVar1,*pUVar6)) / 0x80) + (int)CONCAT11(*dst,dst[1])
                + -1;
        *dst = (Uint8)((uint)iVar4 >> 8);
        dst[1] = (Uint8)iVar4;
        dst = dst + 2;
      } while (uVar7 != len >> 1);
      return;
    }
  }
  SDL_SetError("SDL_MixAudio(): unknown audio format");
  return;
}



----------------------------------------

// Function: MS_ADPCM_nibble @ 0897eca4

/* WARNING: Removing unreachable block (ram,0x0897ece4) */
/* WARNING: Removing unreachable block (ram,0x0897ed38) */

Sint32 MS_ADPCM_nibble(MS_ADPCM_decodestate *state,Uint8 nybble,Sint16 *coeff)

{
  Sint16 SVar1;
  uint uVar2;
  int iVar3;
  uint uVar4;
  Uint16 UVar5;
  int iVar6;
  
                    /* Unresolved local var: Sint32 max_audioval@[???]
                       Unresolved local var: Sint32 min_audioval@[???]
                       Unresolved local var: Sint32 new_sample@[???]
                       Unresolved local var: Sint32 delta@[???] */
  uVar2 = (uint)nybble;
  if ((nybble & 8) == 0) {
    uVar4 = (uint)state->iDelta;
    iVar3 = uVar2 * uVar4;
  }
  else {
    uVar4 = (uint)state->iDelta;
    iVar3 = uVar4 * (uVar2 - 0x10);
  }
  iVar3 = ((int)state->iSamp1 * (int)*coeff + (int)state->iSamp2 * (int)coeff[1]) / 0x100 + iVar3 +
          -1;
  iVar6 = (int)(uVar4 * MS_ADPCM_nibble::adaptive[uVar2]) / 0x100;
  UVar5 = 0x10;
  if (0xf < iVar6) {
    UVar5 = (Uint16)iVar6;
  }
  SVar1 = state->iSamp1;
  state->iDelta = UVar5;
  state->iSamp1 = (Sint16)iVar3;
  state->iSamp2 = SVar1;
  return iVar3;
}



----------------------------------------

// Function: IMA_ADPCM_nibble @ 0897ed7c

Sint32 IMA_ADPCM_nibble(IMA_ADPCM_decodestate *state,Uint8 nybble)

{
  char cVar1;
  int iVar2;
  Sint32 SVar3;
  int iVar4;
  
                    /* Unresolved local var: Sint32 max_audioval@[???]
                       Unresolved local var: Sint32 min_audioval@[???]
                       Unresolved local var: Sint32 delta@[DW_OP_reg7(a3)]
                       Unresolved local var: Sint32 step@[???] */
  iVar2 = IMA_ADPCM_nibble::step_table[state->index];
  iVar4 = iVar2 >> 3;
  if ((nybble & 4) != 0) {
    iVar4 = iVar4 + iVar2;
  }
  if ((nybble & 2) != 0) {
    iVar4 = iVar4 + (iVar2 >> 1);
  }
  if ((nybble & 1) != 0) {
    iVar4 = iVar4 + (iVar2 >> 2);
  }
  if ((nybble & 8) != 0) {
    iVar4 = -iVar4;
  }
  cVar1 = (char)IMA_ADPCM_nibble::index_table[nybble] + state->index;
  SVar3 = state->sample + iVar4;
  state->sample = SVar3;
  state->index = cVar1;
  if (cVar1 < 'Y') {
    if (cVar1 < '\0') {
      state->index = '\0';
    }
  }
  else {
    state->index = 'X';
  }
  if (SVar3 < 0x8000) {
    if (SVar3 < -0x8000) {
      state->sample = -0x8000;
      return -0x8000;
    }
  }
  else {
    SVar3 = 0x7fff;
    state->sample = 0x7fff;
  }
  return SVar3;
}



----------------------------------------

// Function: SDL_FreeWAV @ 0897ee70

void SDL_FreeWAV(Uint8 *audio_buf)

{
  if (audio_buf != (Uint8 *)0x0) {
    free(audio_buf);
    return;
  }
  return;
}



----------------------------------------

// Function: ReadChunk @ 0897ee88

int ReadChunk(SDL_RWops *src,Chunk *chunk)

{
  Uint32 UVar1;
  Uint8 *pUVar2;
  int iVar3;
  
  UVar1 = SDL_ReadLE32(src);
  chunk->magic = UVar1;
  UVar1 = SDL_ReadLE32(src);
  chunk->length = UVar1;
  pUVar2 = malloc(UVar1);
  chunk->data = pUVar2;
  if (pUVar2 == (Uint8 *)0x0) {
    SDL_Error(SDL_ENOMEM);
    UVar1 = 0xffffffff;
  }
  else {
    iVar3 = (*src->read)(src,pUVar2,chunk->length,1);
    if (iVar3 == 1) {
      UVar1 = chunk->length;
    }
    else {
      SDL_Error(SDL_EFREAD);
      free(chunk->data);
      UVar1 = 0xffffffff;
    }
  }
  return UVar1;
}



----------------------------------------

// Function: SDL_LoadWAV_RW @ 0897ef28

/* WARNING: Removing unreachable block (ram,0x0897f5c4) */

SDL_AudioSpec *
SDL_LoadWAV_RW(SDL_RWops *src,int freesrc,SDL_AudioSpec *spec,Uint8 **audio_buf,Uint32 *audio_len)

{
  Uint8 UVar1;
  Uint8 UVar2;
  Uint8 UVar3;
  byte bVar4;
  byte bVar5;
  ushort uVar6;
  undefined2 uVar7;
  Sint16 SVar8;
  bool bVar9;
  undefined *puVar10;
  Uint32 UVar11;
  Uint32 UVar12;
  int iVar13;
  Uint8 *pUVar14;
  size_t sVar15;
  Sint32 SVar16;
  IMA_ADPCM_decodestate *pIVar17;
  Sint16 (*paSVar18) [2];
  uint *in_t0;
  uint uVar19;
  ushort *puVar20;
  Uint8 *pUVar21;
  Uint8 *pUVar22;
  ushort *puVar23;
  ushort *puVar24;
  int iVar25;
  MS_ADPCM_decodestate *state;
  Uint8 *pUVar26;
  Chunk local_80;
  ushort *local_70;
  Uint8 *local_6c;
  int local_68;
  ushort *local_64;
  uint local_60;
  int local_5c;
  uint local_58;
  int local_54;
  uint local_50;
  uint local_4c;
  ushort *local_48;
  int local_44;
  SDL_RWops *local_40;
  int local_3c;
  SDL_AudioSpec *local_38;
  uint *local_34;
  ushort *local_30;
  Uint8 *local_2c;
  
                    /* Unresolved local var: int was_error@[???]
                       Unresolved local var: Chunk chunk@[???]
                       Unresolved local var: int lenread@[???]
                       Unresolved local var: int MS_ADPCM_encoded@[???]
                       Unresolved local var: int IMA_ADPCM_encoded@[???]
                       Unresolved local var: int samplesize@[???]
                       Unresolved local var: Uint32 RIFFchunk@[???]
                       Unresolved local var: Uint32 wavelen@[???]
                       Unresolved local var: Uint32 WAVEmagic@[???]
                       Unresolved local var: WaveFMT * format@[???] */
  local_40 = src;
  local_3c = freesrc;
  local_38 = spec;
  if (src != (SDL_RWops *)0x0) {
    local_34 = in_t0;
    UVar11 = SDL_ReadLE32(src);
    UVar12 = SDL_ReadLE32(local_40);
    if ((UVar12 == 0x45564157) ||
       ((UVar12 = SDL_ReadLE32(local_40), UVar11 == 0x46464952 && (UVar12 == 0x45564157)))) {
      local_80.data = (Uint8 *)0x0;
      do {
        if ((ushort *)local_80.data != (ushort *)0x0) {
          free(local_80.data);
        }
        iVar13 = ReadChunk(local_40,&local_80);
        if (iVar13 < 0) goto LAB_0897efb8;
      } while ((local_80.magic == 0x74636166) || (local_80.magic == 0x5453494c));
      local_48 = (ushort *)local_80.data;
      if (local_80.magic == 0x20746d66) {
        uVar6 = *(ushort *)local_80.data;
        uVar19 = (uint)uVar6;
        if (uVar19 == 2) {
                    /* Unresolved local var: Uint8 * rogue_feel@[???]
                       Unresolved local var: Uint16 extra_info@[???]
                       Unresolved local var: int i@[???] */
          MS_ADPCM_state.wavefmt.frequency = *(Uint32 *)((int)local_80.data + 4);
          MS_ADPCM_state.wavefmt.channels = *(ushort *)((int)local_80.data + 2);
          MS_ADPCM_state.wavefmt.byterate = *(Uint32 *)((int)local_80.data + 8);
          MS_ADPCM_state.wavefmt.blockalign = *(ushort *)((int)local_80.data + 0xc);
          MS_ADPCM_state.wavefmt.bitspersample = *(ushort *)((int)local_80.data + 0xe);
          MS_ADPCM_state.wSamplesPerBlock = *(ushort *)((int)local_80.data + 0x12);
          MS_ADPCM_state.wNumCoef = *(ushort *)((int)local_80.data + 0x14);
          MS_ADPCM_state.wavefmt.encoding = uVar6;
          if (MS_ADPCM_state.wNumCoef != 7) {
            SDL_SetError("Unknown set of MS_ADPCM coefficients");
            bVar9 = true;
            goto LAB_0897f100;
          }
          paSVar18 = MS_ADPCM_state.aCoeff;
          puVar20 = (ushort *)((int)local_80.data + 0x16);
          iVar13 = 0;
          do {
            iVar13 = iVar13 + 1;
            (*paSVar18)[0] = *puVar20;
            (*paSVar18)[1] = puVar20[1];
            puVar20 = puVar20 + 2;
            paSVar18 = paSVar18 + 1;
          } while (iVar13 < 7);
          bVar9 = true;
          local_44 = 0;
        }
        else if (uVar19 == 0x11) {
                    /* Unresolved local var: Uint8 * rogue_feel@[???]
                       Unresolved local var: Uint16 extra_info@[???] */
          IMA_ADPCM_state.wavefmt.channels = *(ushort *)((int)local_80.data + 2);
          IMA_ADPCM_state.wavefmt.byterate = *(Uint32 *)((int)local_80.data + 8);
          IMA_ADPCM_state.wavefmt.blockalign = *(ushort *)((int)local_80.data + 0xc);
          IMA_ADPCM_state.wavefmt.bitspersample = *(ushort *)((int)local_80.data + 0xe);
          IMA_ADPCM_state.wavefmt.frequency = *(Uint32 *)((int)local_80.data + 4);
          IMA_ADPCM_state.wSamplesPerBlock = *(ushort *)((int)local_80.data + 0x12);
          bVar9 = false;
          local_44 = 1;
          IMA_ADPCM_state.wavefmt.encoding = uVar6;
        }
        else {
          if (uVar19 != 1) {
            SDL_SetError("Unknown WAVE data format: 0x%.4x",uVar19);
            bVar9 = true;
            goto LAB_0897f100;
          }
          bVar9 = false;
          local_44 = 0;
        }
        local_38->freq = 0;
        local_38->format = 0;
        local_38->channels = '\0';
        local_38->silence = '\0';
        local_38->samples = 0;
        local_38->padding = 0;
        local_38->size = 0;
        local_38->callback = (_func_void_void_ptr_Uint8_ptr_int *)0x0;
        local_38->userdata = (void *)0x0;
        uVar6 = *(ushort *)((int)local_80.data + 0xe);
        local_38->freq = *(int *)((int)local_80.data + 4);
        if (uVar6 == 8) {
          local_38->format = 8;
        }
        else if (uVar6 == 0x10) {
          local_38->format = 0x8010;
        }
        else {
          if ((uVar6 != 4) || ((!bVar9 && (local_44 == 0)))) {
            SDL_SetError("Unknown %d-bit PCM data format");
            bVar9 = true;
            goto LAB_0897f100;
          }
          local_38->format = 0x8010;
        }
        uVar6 = *(ushort *)((int)local_80.data + 2);
        local_38->samples = 0x1000;
        local_38->channels = (Uint8)uVar6;
        *audio_buf = (Uint8 *)0x0;
        do {
          if (*audio_buf != (Uint8 *)0x0) {
            free(*audio_buf);
          }
          uVar19 = ReadChunk(local_40,&local_80);
          puVar20 = (ushort *)local_80.data;
          if ((int)uVar19 < 0) goto LAB_0897f0fc;
          *local_34 = uVar19;
          *audio_buf = local_80.data;
        } while (local_80.magic != 0x61746164);
        local_70 = (ushort *)local_80.data;
        if (bVar9) {
                    /* Unresolved local var: MS_ADPCM_decodestate *[2] state@[???]
                       Unresolved local var: Uint8 * freeable@[???]
                       Unresolved local var: Uint8 * encoded@[???]
                       Unresolved local var: Uint8 * decoded@[???]
                       Unresolved local var: Sint32 encoded_len@[???]
                       Unresolved local var: Sint32 samplesleft@[???]
                       Unresolved local var: Sint8 nybble@[???]
                       Unresolved local var: Sint8 stereo@[???]
                       Unresolved local var: Sint16 *[2] coeff@[???]
                       Unresolved local var: Sint32 new_sample@[???] */
          if (MS_ADPCM_state.wavefmt.blockalign == 0) {
            trap(7);
          }
          sVar15 = ((int)uVar19 / (int)(uint)MS_ADPCM_state.wavefmt.blockalign) *
                   (uint)MS_ADPCM_state.wSamplesPerBlock * (uint)MS_ADPCM_state.wavefmt.channels * 2
          ;
          *local_34 = sVar15;
          local_50 = uVar19;
          pUVar14 = malloc(sVar15);
          *audio_buf = pUVar14;
          if (pUVar14 == (Uint8 *)0x0) {
            SDL_Error(SDL_ENOMEM);
            bVar9 = true;
            goto LAB_0897f100;
          }
          uVar19 = (uint)(MS_ADPCM_state.wavefmt.channels == 2);
          state = MS_ADPCM_state.state + uVar19;
          puVar23 = local_70;
          local_4c = uVar19;
          if ((int)(uint)MS_ADPCM_state.wavefmt.blockalign <= (int)local_50) {
            do {
              MS_ADPCM_state.state[0].hPredictor = (Uint8)*puVar23;
              if (local_4c == 0) {
                puVar24 = puVar20 + 1;
                puVar20 = (ushort *)((int)puVar20 + 7);
                MS_ADPCM_state.state[0].iDelta =
                     CONCAT11((byte)*puVar24,*(byte *)((int)puVar23 + 1));
                MS_ADPCM_state.state[0].iSamp1 = *(Sint16 *)((int)puVar23 + 3);
                MS_ADPCM_state.state[0].iSamp2 = *(Sint16 *)((int)puVar23 + 5);
                puVar24 = (ushort *)((int)puVar23 + 7);
              }
              else {
                puVar20 = puVar20 + 7;
                state->hPredictor = *(byte *)((int)puVar23 + 1);
                MS_ADPCM_state.state[0].iDelta = puVar23[1];
                MS_ADPCM_state.state[uVar19].iDelta = puVar23[2];
                MS_ADPCM_state.state[0].iSamp1 = puVar23[3];
                MS_ADPCM_state.state[uVar19].iSamp1 = puVar23[4];
                MS_ADPCM_state.state[0].iSamp2 = puVar23[5];
                puVar24 = puVar23 + 7;
                MS_ADPCM_state.state[uVar19].iSamp2 = puVar23[6];
              }
              puVar10 = PTR_MS_ADPCM_state_089eb724;
              bVar4 = state->hPredictor;
              UVar1 = PTR_MS_ADPCM_state_089eb724[0x37];
              bVar5 = PTR_MS_ADPCM_state_089eb724[0x30];
              *pUVar14 = (Uint8)*(undefined2 *)(PTR_MS_ADPCM_state_089eb724 + 0x36);
              pUVar14[1] = UVar1;
              if (local_4c == 0) {
                UVar1 = MS_ADPCM_state.state[0].iSamp1._1_1_;
                pUVar14[2] = (Uint8)MS_ADPCM_state.state[0].iSamp1;
                pUVar26 = pUVar14 + 4;
                pUVar14[3] = UVar1;
              }
              else {
                UVar1 = puVar10[0x35];
                uVar7 = *(undefined2 *)(puVar10 + 0x34);
                UVar2 = *(Uint8 *)((int)&MS_ADPCM_state.state[uVar19].iSamp2 + 1);
                SVar8 = MS_ADPCM_state.state[uVar19].iSamp1;
                UVar3 = *(Uint8 *)((int)&MS_ADPCM_state.state[uVar19].iSamp1 + 1);
                pUVar14[2] = (Uint8)MS_ADPCM_state.state[uVar19].iSamp2;
                pUVar14[3] = UVar2;
                pUVar14[4] = (Uint8)uVar7;
                pUVar14[5] = UVar1;
                pUVar14[6] = (Uint8)SVar8;
                pUVar14[7] = UVar3;
                pUVar26 = pUVar14 + 8;
              }
              pUVar14 = pUVar26;
              for (iVar13 = (MS_ADPCM_state.wSamplesPerBlock - 2) *
                            (uint)MS_ADPCM_state.wavefmt.channels; 0 < iVar13; iVar13 = iVar13 + -2)
              {
                SVar16 = MS_ADPCM_nibble(MS_ADPCM_state.state,(byte)*puVar24 >> 4,
                                         MS_ADPCM_state.aCoeff[bVar5]);
                pUVar14[1] = (Uint8)((uint)SVar16 >> 8);
                *pUVar14 = (Uint8)SVar16;
                SVar16 = MS_ADPCM_nibble(state,(byte)*puVar24 & 0xf,MS_ADPCM_state.aCoeff[bVar4]);
                pUVar14[3] = (Uint8)((uint)SVar16 >> 8);
                pUVar14[2] = (Uint8)SVar16;
                puVar20 = (ushort *)((int)puVar20 + 1);
                pUVar14 = pUVar14 + 4;
                puVar24 = (ushort *)((int)puVar24 + 1);
              }
              local_50 = local_50 - MS_ADPCM_state.wavefmt.blockalign;
              puVar23 = puVar24;
            } while ((int)(uint)MS_ADPCM_state.wavefmt.blockalign <= (int)local_50);
          }
          free(local_70);
        }
        if (local_44 == 0) {
LAB_0897f5ac:
          bVar9 = false;
          *local_34 = *local_34 & -(((byte)local_38->format / 8) * (uint)local_38->channels);
        }
        else {
                    /* Unresolved local var: IMA_ADPCM_decodestate * state@[???]
                       Unresolved local var: Uint8 * freeable@[???]
                       Unresolved local var: Uint8 * encoded@[???]
                       Unresolved local var: Uint8 * decoded@[???]
                       Unresolved local var: Sint32 encoded_len@[???]
                       Unresolved local var: Sint32 samplesleft@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int channels@[???] */
          local_60 = (uint)IMA_ADPCM_state.wavefmt.channels;
          if (local_60 < 3) {
            local_64 = (ushort *)*audio_buf;
            local_58 = *local_34;
            if (IMA_ADPCM_state.wavefmt.blockalign == 0) {
              trap(7);
            }
            sVar15 = ((int)local_58 / (int)(uint)IMA_ADPCM_state.wavefmt.blockalign) *
                     local_60 * IMA_ADPCM_state.wSamplesPerBlock * 2;
            *local_34 = sVar15;
            pUVar14 = malloc(sVar15);
            *audio_buf = pUVar14;
            if (pUVar14 != (Uint8 *)0x0) {
              if ((int)(uint)IMA_ADPCM_state.wavefmt.blockalign <= (int)local_58) {
                local_68 = local_60 << 1;
                local_5c = local_60 << 4;
                puVar20 = local_64;
                do {
                  if (0 < (int)local_60) {
                    pIVar17 = IMA_ADPCM_state.state;
                    uVar19 = 0;
                    do {
                      uVar6 = *puVar20;
                      uVar19 = uVar19 + 1;
                      pIVar17->sample = (uint)uVar6;
                      if ((uVar6 & 0x8000) != 0) {
                        pIVar17->sample = uVar6 - 0x10000;
                      }
                      SVar16 = pIVar17->sample;
                      puVar23 = puVar20 + 1;
                      puVar20 = puVar20 + 2;
                      pIVar17->index = (byte)*puVar23;
                      pUVar14[1] = (Uint8)((uint)SVar16 >> 8);
                      *pUVar14 = (Uint8)SVar16;
                      pIVar17 = pIVar17 + 1;
                      pUVar14 = pUVar14 + 2;
                    } while (local_60 != uVar19);
                  }
                  local_54 = local_60 * (IMA_ADPCM_state.wSamplesPerBlock - 1);
                  if (0 < local_54) {
                    local_6c = pUVar14 + local_68;
                    do {
                      if (0 < (int)local_60) {
                        pIVar17 = IMA_ADPCM_state.state;
                        uVar19 = 0;
                        iVar13 = local_68 * 2;
                        local_2c = pUVar14;
                        pUVar26 = local_6c;
                        do {
                          iVar25 = 0;
                          local_30 = puVar20;
                          pUVar21 = pUVar26;
                          pUVar22 = pUVar14;
                          do {
                            SVar16 = IMA_ADPCM_nibble(pIVar17,(byte)*puVar20 & 0xf);
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: Sint8 nybble@[???]
                       Unresolved local var: Sint32 new_sample@[???] */
                            pUVar22[1] = (Uint8)((uint)SVar16 >> 8);
                            *pUVar22 = (Uint8)SVar16;
                            iVar25 = iVar25 + 1;
                            SVar16 = IMA_ADPCM_nibble(pIVar17,(byte)*puVar20 >> 4);
                            pUVar21[1] = (Uint8)((uint)SVar16 >> 8);
                            *pUVar21 = (Uint8)SVar16;
                            pUVar22 = pUVar22 + iVar13;
                            puVar20 = (ushort *)((int)puVar20 + 1);
                            pUVar21 = pUVar21 + iVar13;
                          } while (iVar25 != 4);
                          uVar19 = uVar19 + 1;
                          puVar20 = local_30 + 2;
                          pUVar26 = pUVar26 + 2;
                          pUVar14 = pUVar14 + 2;
                          pIVar17 = pIVar17 + 1;
                        } while (local_60 != uVar19);
                        local_54 = local_54 + local_60 * -8;
                        pUVar14 = local_2c;
                      }
                      pUVar14 = pUVar14 + local_5c;
                      local_6c = local_6c + local_5c;
                    } while (0 < local_54);
                  }
                  local_58 = local_58 - IMA_ADPCM_state.wavefmt.blockalign;
                } while ((int)(uint)IMA_ADPCM_state.wavefmt.blockalign <= (int)local_58);
              }
              free(local_64);
              goto LAB_0897f5ac;
            }
            SDL_Error(SDL_ENOMEM);
            bVar9 = true;
          }
          else {
            SDL_SetError("IMA ADPCM decoder can only handle %d channels",2);
            bVar9 = true;
          }
        }
LAB_0897f100:
        free(local_48);
        goto LAB_0897efbc;
      }
      SDL_SetError("Complex WAVE files not supported");
      if (local_48 != (ushort *)0x0) {
LAB_0897f0fc:
        bVar9 = true;
        goto LAB_0897f100;
      }
    }
    else {
      SDL_SetError("Unrecognized file type (not WAVE)");
    }
  }
LAB_0897efb8:
  bVar9 = true;
LAB_0897efbc:
  if ((local_3c != 0) && (local_40 != (SDL_RWops *)0x0)) {
    (*local_40->close)(local_40);
  }
  if (!bVar9) {
    return local_38;
  }
  return (SDL_AudioSpec *)0x0;
}



----------------------------------------

// Function: SDL_ReadLE16 @ 0897f8e8

Uint16 SDL_ReadLE16(SDL_RWops *src)

{
  Uint16 local_10 [4];
  
                    /* Unresolved local var: Uint16 value@[???] */
  (*src->read)(src,local_10,2,1);
  return local_10[0];
}



----------------------------------------

// Function: SDL_ReadBE16 @ 0897f914

Uint16 SDL_ReadBE16(SDL_RWops *src)

{
  ushort local_10 [4];
  
                    /* Unresolved local var: Uint16 value@[???] */
  (*src->read)(src,local_10,2,1);
  return local_10[0] << 8 | local_10[0] >> 8;
}



----------------------------------------

// Function: SDL_ReadLE32 @ 0897f950

Uint32 SDL_ReadLE32(SDL_RWops *src)

{
  Uint32 local_10 [2];
  
                    /* Unresolved local var: Uint32 value@[???] */
  (*src->read)(src,local_10,4,1);
  return local_10[0];
}



----------------------------------------

// Function: SDL_ReadLE64 @ 0897f97c

Uint64 SDL_ReadLE64(SDL_RWops *src)

{
  Uint64 local_10;
  
                    /* Unresolved local var: Uint64 value@[???] */
  (*src->read)(src,&local_10,8,1);
  return local_10;
}



----------------------------------------

// Function: SDL_WriteLE16 @ 0897f9ac

int SDL_WriteLE16(SDL_RWops *dst,Uint16 value)

{
  int iVar1;
  Uint16 local_10 [4];
  
  local_10[0] = value;
  iVar1 = (*dst->write)(dst,local_10,2,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_WriteLE32 @ 0897f9d8

int SDL_WriteLE32(SDL_RWops *dst,Uint32 value)

{
  int iVar1;
  Uint32 local_10 [2];
  
  local_10[0] = value;
  iVar1 = (*dst->write)(dst,local_10,4,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_WriteLE64 @ 0897fa04

int SDL_WriteLE64(SDL_RWops *dst,Uint64 value)

{
  int iVar1;
  Uint64 local_10;
  
  local_10 = value;
  iVar1 = (*dst->write)(dst,&local_10,8,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_WriteBE64 @ 0897fa34

int SDL_WriteBE64(SDL_RWops *dst,Uint64 value)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  uint local_10;
  uint local_c;
  
                    /* Unresolved local var: Uint32 hi@[???]
                       Unresolved local var: Uint32 lo@[???] */
  uVar3 = (uint)(value >> 0x20);
  uVar2 = (uint)value;
  local_c = uVar2 >> 8 & 0xff00 | uVar2 << 0x18 | (int)(value & 0xff000000ff00) << 8 | uVar2 >> 0x18
  ;
  local_10 = uVar3 >> 8 & 0xff00 |
             uVar3 << 0x18 | (int)((value & 0xff000000ff00) >> 0x20) << 8 | uVar3 >> 0x18;
  iVar1 = (*dst->write)(dst,&local_10,8,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_WriteBE32 @ 0897facc

int SDL_WriteBE32(SDL_RWops *dst,Uint32 value)

{
  int iVar1;
  uint local_10 [2];
  
  local_10[0] = value >> 8 & 0xff00 | value << 0x18 | (value & 0xff00) << 8 | value >> 0x18;
  iVar1 = (*dst->write)(dst,local_10,4,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_ReadBE32 @ 0897fb20

Uint32 SDL_ReadBE32(SDL_RWops *src)

{
  uint local_10 [2];
  
                    /* Unresolved local var: Uint32 value@[???] */
  (*src->read)(src,local_10,4,1);
  return local_10[0] >> 8 & 0xff00 |
         local_10[0] << 0x18 | (local_10[0] & 0xff00) << 8 | local_10[0] >> 0x18;
}



----------------------------------------

// Function: SDL_WriteBE16 @ 0897fb74

int SDL_WriteBE16(SDL_RWops *dst,Uint16 value)

{
  int iVar1;
  ushort local_10 [4];
  
  local_10[0] = value << 8 | value >> 8;
  iVar1 = (*dst->write)(dst,local_10,2,1);
  return iVar1;
}



----------------------------------------

// Function: SDL_ReadBE64 @ 0897fbb0

Uint64 SDL_ReadBE64(SDL_RWops *src)

{
  uint local_10;
  uint local_c;
  
                    /* Unresolved local var: Uint64 value@[???] */
  (*src->read)(src,&local_10,8,1);
                    /* Unresolved local var: Uint32 hi@[???]
                       Unresolved local var: Uint32 lo@[???] */
  return CONCAT44(local_10 >> 8 & 0xff00 |
                  local_10 << 0x18 | (local_10 & 0xff00) << 8 | local_10 >> 0x18,
                  local_c >> 8 & 0xff00 |
                  local_c << 0x18 | (local_c & 0xff00) << 8 | local_c >> 0x18);
}



----------------------------------------

// Function: eglChooseConfig @ 0897fc44

EGLBoolean
eglChooseConfig(EGLDisplay dpy,EGLint *attrib_list,EGLConfig *configs,EGLint config_size,
               EGLint *num_config)

{
  uint uVar1;
  char *pcVar2;
  uint *puVar3;
  int iVar4;
  int *in_t0;
  uint uVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  int iVar11;
  
                    /* Unresolved local var: int alpha_size@[???]
                       Unresolved local var: int blue_size@[???]
                       Unresolved local var: int green_size@[???]
                       Unresolved local var: int red_size@[???]
                       Unresolved local var: int depth_size@[???]
                       Unresolved local var: int stencil_size@[???]
                       Unresolved local var: int nconfig@[DW_OP_reg5(a1)]
                       Unresolved local var: int i@[DW_OP_reg9(t1)] */
  iVar11 = 0;
  iVar10 = 0;
  iVar9 = 0;
  iVar8 = 0;
  iVar7 = 0;
  iVar6 = 0;
  for (; (attrib_list != (int *)0x0 && (*attrib_list != 0x3038)); attrib_list = attrib_list + 2) {
    switch(*attrib_list) {
    case 0x3020:
    case 0x3027:
    case 0x3028:
    case 0x3029:
    case 0x302a:
    case 0x302b:
    case 0x302c:
    case 0x302d:
    case 0x302e:
    case 0x302f:
    case 0x3031:
    case 0x3032:
    case 0x3033:
    case 0x3034:
    case 0x3035:
    case 0x3036:
    case 0x3037:
    case 0x3039:
    case 0x303a:
    case 0x303b:
    case 0x303c:
      break;
    case 0x3021:
      iVar10 = attrib_list[1];
      break;
    case 0x3022:
      iVar9 = attrib_list[1];
      break;
    case 0x3023:
      iVar8 = attrib_list[1];
      break;
    case 0x3024:
      iVar7 = attrib_list[1];
      break;
    case 0x3025:
      iVar6 = attrib_list[1];
      break;
    case 0x3026:
      iVar11 = attrib_list[1];
      break;
    case 0x3030:
    case 0x3038:
    default:
      __pspgl_log("*** EGL error 0x%04x ***\n",0x3004);
      __pspgl_eglerror = 0x3004;
      return 0;
    }
  }
  iVar4 = 0;
  uVar5 = 0;
  puVar3 = (uint *)configs;
  for (pcVar2 = &__pspgl_pixconfigs[0].hwformat; *pcVar2 != -1; pcVar2 = pcVar2 + 6) {
                    /* Unresolved local var: pspgl_pixconfig * p@[???] */
    if ((((iVar6 < 0x11) && (iVar7 <= (int)(uint)((pspgl_pixconfig *)(pcVar2 + -5))->red_bits)) &&
        (iVar8 <= (int)(uint)(byte)pcVar2[-4])) &&
       (((iVar9 <= (int)(uint)(byte)pcVar2[-3] && (iVar10 <= (int)(uint)(byte)pcVar2[-2])) &&
        (iVar11 <= (int)(uint)(byte)pcVar2[-1])))) {
      if (configs != (EGLConfig *)0x0) {
        uVar1 = 0x10;
        if (config_size <= iVar4) break;
        if (iVar6 == 0) {
          uVar1 = 0;
        }
        *puVar3 = uVar1 | uVar5;
      }
      iVar4 = iVar4 + 1;
      puVar3 = puVar3 + 1;
    }
    uVar5 = uVar5 + 1;
  }
  *in_t0 = iVar4;
  return 1;
}



----------------------------------------

// Function: init_matrix_stack @ 0897fdc4

GLboolean init_matrix_stack(pspgl_matrix_stack *mstk,int limit,uint flags)

{
  float fVar1;
  GLboolean GVar2;
  pspgl_matrix *ppVar3;
  GLfloat GVar4;
  GLfloat GVar5;
  GLfloat GVar6;
  GLfloat GVar7;
  GLfloat *pGVar8;
  
  ppVar3 = memalign(0x10,limit * 0x50);
  mstk->stack = ppVar3;
  if (ppVar3 == (pspgl_matrix *)0x0) {
    GVar2 = '\0';
  }
  else {
    pGVar8 = __pspgl_identity;
    do {
      GVar4 = *pGVar8;
      GVar5 = pGVar8[1];
      GVar6 = pGVar8[2];
      GVar7 = pGVar8[3];
      pGVar8 = pGVar8 + 4;
      ppVar3->mat[0] = GVar4;
      ppVar3->mat[1] = GVar5;
      ppVar3->mat[2] = GVar6;
      ppVar3->mat[3] = GVar7;
      fVar1 = DAT_089dbce4;
      ppVar3 = (pspgl_matrix *)(ppVar3->mat + 4);
    } while (pGVar8 != (GLfloat *)"glLoadIdentity");
    mstk->stack->flags = 4;
    mstk->scale[0] = fVar1;
    mstk->limit = limit;
    mstk->flags = flags | 1;
    mstk->trans[0] = 0.0;
    mstk->depth = 0;
    mstk->scale[3] = fVar1;
    mstk->scale[2] = fVar1;
    mstk->scale[1] = fVar1;
    mstk->trans[3] = 0.0;
    mstk->trans[2] = 0.0;
    mstk->trans[1] = 0.0;
    GVar2 = '\x01';
  }
  return GVar2;
}



----------------------------------------

// Function: eglCreateContext @ 0897fea8

EGLContext
eglCreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_context,EGLint *attrib_list)

{
  GLboolean GVar1;
  pspgl_context *c;
  pspvfpu_context *ppVar2;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  undefined3 extraout_var_02;
  undefined3 extraout_var_03;
  pspgl_shared_context *ppVar3;
  pspgl_matrix_stack *mstk;
  int iVar4;
  
                    /* Unresolved local var: pspgl_context * ctx@[???] */
  c = memalign(0x10,0x910);
  if (c != (pspgl_context *)0x0) {
    memset(c,0,0x910);
    c->refcount = 1;
    ppVar2 = pspvfpu_initcontext();
    c->vfpu_context = ppVar2;
    if (((ppVar2 != (pspvfpu_context *)0x0) &&
        (GVar1 = init_matrix_stack(&c->projection_stack,2,0), CONCAT31(extraout_var,GVar1) != 0)) &&
       (GVar1 = init_matrix_stack(&c->texture_stack,2,0), CONCAT31(extraout_var_00,GVar1) != 0)) {
      GVar1 = init_matrix_stack(&c->modelview_stack,0x10,0);
      if ((CONCAT31(extraout_var_01,GVar1) != 0) &&
         (GVar1 = init_matrix_stack(&c->view_stack,8,0), CONCAT31(extraout_var_02,GVar1) != 0)) {
        iVar4 = 0;
        mstk = c->bone_stacks;
                    /* Unresolved local var: int i@[???] */
        do {
          GVar1 = init_matrix_stack(mstk,1,2);
          iVar4 = iVar4 + 1;
          mstk = mstk + 1;
          if (CONCAT31(extraout_var_03,GVar1) == 0) goto LAB_08980014;
        } while (iVar4 != 8);
        c->current_matrix_stack = (pspgl_matrix_stack *)0x0;
        __pspgl_matrix_select(c,&c->modelview_stack);
        (c->vertexblend).enabled = '\0';
        if (share_context != (EGLContext)0x0) {
          c->shared = *(pspgl_shared_context **)((int)share_context + 0x808);
          ppVar3 = c->shared;
LAB_0897ffe8:
          ppVar3->refcount = ppVar3->refcount + 1;
          (c->unpack).alignment = 4;
          c->attribstackdepth = 0;
          c->clattribstackdepth = 0;
          (c->pack).alignment = 4;
          return c;
        }
        ppVar3 = malloc(400);
        c->shared = ppVar3;
        if (ppVar3 != (pspgl_shared_context *)0x0) {
          memset(ppVar3,0,400);
          ppVar3 = c->shared;
          goto LAB_0897ffe8;
        }
      }
    }
LAB_08980014:
    eglDestroyContext(dpy,c);
  }
  __pspgl_log("*** EGL error 0x%04x ***\n",0x3003);
  __pspgl_eglerror = 0x3003;
  return (EGLContext)0x0;
}



----------------------------------------

// Function: eglCreateWindowSurface @ 08980064

EGLSurface
eglCreateWindowSurface(EGLDisplay dpy,EGLConfig config,NativeWindowType window,EGLint *attrib_list)

{
  char cVar1;
  byte bVar2;
  byte bVar3;
  ushort uVar4;
  undefined4 *m;
  pspgl_buffer *ppVar5;
  uint uVar6;
  int iVar7;
  int iVar8;
  
                    /* Unresolved local var: pspgl_surface * s@[???]
                       Unresolved local var: ulong bytesperpixel@[???]
                       Unresolved local var: ulong bufferlen@[???]
                       Unresolved local var: pspgl_pixconfig * pixconf@[???]
                       Unresolved local var: int has_depthbuffer@[???]
                       Unresolved local var: int has_frontbuffer@[???]
                       Unresolved local var: int has_backbuffer@[???] */
  m = malloc(0x48);
  if (m != (undefined4 *)0x0) {
    uVar6 = config & 0xf;
    memset(m,0,0x48);
    iVar8 = 4;
    if (__pspgl_pixconfigs[uVar6].hwformat != '\x03') {
      iVar8 = 2;
    }
    do {
      if (attrib_list == (int *)0x0) break;
      iVar7 = *attrib_list;
      attrib_list = attrib_list + 2;
    } while (iVar7 != 0x3038);
    bVar2 = __pspgl_pixconfigs[uVar6].stencil_bits;
    bVar3 = __pspgl_pixconfigs[uVar6].alpha_bits;
    cVar1 = __pspgl_pixconfigs[uVar6].hwformat;
    *(undefined2 *)(m + 2) = 0x1e0;
    *(undefined2 *)((int)m + 10) = 0x110;
    m[9] = (1 << (bVar3 & 0x1f)) + -1;
    *(undefined2 *)(m + 3) = 0x200;
    m[1] = (int)cVar1;
    m[10] = (1 << (bVar2 & 0x1f)) + -1;
    m[8] = m + 5;
    *m = 1;
    *(undefined1 *)((int)m + 0xe) = 1;
    m[7] = m + 5;
    ppVar5 = __pspgl_buffer_new(iVar8 * 0x22000,0x88e6);
    m[4] = ppVar5;
    if (ppVar5 != (pspgl_buffer *)0x0) {
      ppVar5->flags = ppVar5->flags | 4;
      ppVar5 = __pspgl_buffer_new(iVar8 * 0x22000,0x88e6);
      m[5] = ppVar5;
      if (ppVar5 != (pspgl_buffer *)0x0) {
        uVar4 = *(ushort *)((int)m + 10);
        ppVar5->flags = ppVar5->flags | 4;
        if (-1 < config << 0x1b) {
          return m;
        }
        ppVar5 = __pspgl_buffer_new((uint)*(ushort *)(m + 3) * (uint)uVar4 * 2,0x88e6);
        m[6] = ppVar5;
        if (ppVar5 != (pspgl_buffer *)0x0) {
          ppVar5->flags = ppVar5->flags | 4;
          return m;
        }
      }
    }
  }
  eglDestroySurface(dpy,m);
  __pspgl_log("*** EGL error 0x%04x ***\n",0x3003);
  __pspgl_eglerror = 0x3003;
  return (EGLSurface)0x0;
}



----------------------------------------

// Function: eglDestroyContext @ 08980230

EGLBoolean eglDestroyContext(EGLDisplay dpy,EGLContext ctx)

{
  int iVar1;
  EGLContext pvVar2;
  EGLBoolean EVar3;
  int *piVar4;
  void *aptr;
  EGLSurface surface;
  void *unaff_retaddr;
  int in_stack_00000000;
  
                    /* Unresolved local var: pspgl_context * c@[???] */
  if (ctx == (EGLContext)0x0) {
    __pspgl_log("*** EGL error 0x%04x ***\n",0x3006);
    EVar3 = 0;
    __pspgl_eglerror = 0x3006;
  }
  else {
    iVar1 = *(int *)((int)ctx + 0x8a8);
    if (iVar1 < 1) {
      __pspgl_assert_fail("c->refcount > 0",unaff_retaddr,"eglDestroyContext","eglDestroyContext.c",
                          in_stack_00000000);
      iVar1 = *(int *)((int)ctx + 0x8a8);
    }
    *(int *)((int)ctx + 0x8a8) = iVar1 + -1;
    if (iVar1 + -1 == 0) {
      piVar4 = *(int **)((int)ctx + 0x808);
      iVar1 = *piVar4;
      *piVar4 = iVar1 + -1;
      if (iVar1 + -1 == 0) {
        __pspgl_hash_foreach_free((hashtable *)(piVar4 + 1),__pspgl_texobj_free);
        __pspgl_hash_foreach_free((hashtable *)(*(int *)((int)ctx + 0x808) + 0x88),free);
        free(*(void **)((int)ctx + 0x808));
      }
      if (*(EGLSurface *)((int)ctx + 0x810) == (EGLSurface)0x0) {
        surface = *(EGLSurface *)((int)ctx + 0x80c);
      }
      else {
        eglDestroySurface(dpy,*(EGLSurface *)((int)ctx + 0x810));
        surface = *(EGLSurface *)((int)ctx + 0x80c);
      }
      if (surface == (EGLSurface)0x0) {
        aptr = *(void **)((int)ctx + 0x5e0);
      }
      else {
        eglDestroySurface(dpy,surface);
        aptr = *(void **)((int)ctx + 0x5e0);
      }
      iVar1 = 0;
      free(aptr);
      free(*(void **)((int)ctx + 0x610));
      free(*(void **)((int)ctx + 0x640));
      free(*(void **)((int)ctx + 0x670));
                    /* Unresolved local var: int i@[???] */
      pvVar2 = ctx;
      do {
        iVar1 = iVar1 + 0x30;
        free(*(void **)((int)pvVar2 + 0x6a0));
        pvVar2 = (EGLContext)((int)ctx + iVar1);
      } while (iVar1 != 0x180);
      if (*(pspvfpu_context **)ctx != (pspvfpu_context *)0x0) {
        pspvfpu_deletecontext(*(pspvfpu_context **)ctx);
      }
      free(ctx);
    }
    EVar3 = 1;
  }
  return EVar3;
}



----------------------------------------

// Function: eglDestroySurface @ 08980390

EGLBoolean eglDestroySurface(EGLDisplay dpy,EGLSurface surface)

{
  int iVar1;
  EGLBoolean EVar2;
  void *unaff_retaddr;
  int in_stack_00000008;
  
                    /* Unresolved local var: pspgl_surface * s@[???] */
  EVar2 = 0;
  if (surface != (EGLSurface)0x0) {
    iVar1 = *(int *)surface;
    if (iVar1 == 0) {
      __pspgl_assert_fail("s->refcount > 0",unaff_retaddr,"eglDestroySurface","eglDestroySurface.c",
                          in_stack_00000008);
      iVar1 = *(int *)surface;
    }
    EVar2 = 1;
    *(int *)surface = iVar1 + -1;
    if (iVar1 + -1 == 0) {
      __pspgl_buffer_free(*(pspgl_buffer **)((int)surface + 0x10));
      __pspgl_buffer_free(*(pspgl_buffer **)((int)surface + 0x14));
      if (*(pspgl_buffer **)((int)surface + 0x18) != (pspgl_buffer *)0x0) {
        __pspgl_buffer_free(*(pspgl_buffer **)((int)surface + 0x18));
      }
      free(surface);
      EVar2 = 1;
    }
  }
  return EVar2;
}



----------------------------------------

// Function: eglGetError @ 08980430

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

EGLint eglGetError(void)

{
  EGLint EVar1;
  
  EVar1 = __pspgl_eglerror;
                    /* Unresolved local var: EGLint err@[???] */
  __pspgl_eglerror = 0x3000;
  return EVar1;
}



----------------------------------------

// Function: eglGetDisplay @ 08980444

EGLDisplay eglGetDisplay(NativeDisplayType display)

{
  return &DAT_089eba3c;
}



----------------------------------------

// Function: eglInitialize @ 08980450

EGLBoolean eglInitialize(EGLDisplay dpy,EGLint *major,EGLint *minor)

{
  if (eglInitialize::initialized == 0) {
    atexit(eglTerminate);
    sceDisplaySetMode(0,0x1e0,0x110);
    eglInitialize::initialized = 1;
  }
  if (major != (EGLint *)0x0) {
    *major = 1;
  }
  if (minor != (EGLint *)0x0) {
    *minor = 1;
  }
  return 1;
}



----------------------------------------

// Function: eglMakeCurrent @ 089804d4

EGLBoolean eglMakeCurrent(EGLDisplay dpy,EGLSurface drawsurf,EGLSurface readsurf,EGLContext ctx)

{
  bool bVar1;
  EGLBoolean EVar2;
  uint uVar3;
  pspgl_surface *s;
  EGLContext pvVar4;
  int iVar5;
  EGLSurface pvVar6;
  uint32_t *puVar7;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_surface * read@[???]
                       Unresolved local var: pspgl_surface * draw@[???]
                       Unresolved local var: int changed@[???] */
  bVar1 = ctx != __pspgl_curctx;
  if (ctx != (EGLContext)0x0) {
    *(int *)((int)ctx + 0x8a8) = *(int *)((int)ctx + 0x8a8) + 1;
    if (drawsurf != (EGLSurface)0x0) {
      *(int *)drawsurf = *(int *)drawsurf + 1;
    }
    if (readsurf == (EGLSurface)0x0) {
      pvVar6 = *(EGLSurface *)((int)ctx + 0x810);
    }
    else {
      *(int *)readsurf = *(int *)readsurf + 1;
      pvVar6 = *(EGLSurface *)((int)ctx + 0x810);
    }
    if (pvVar6 == (EGLSurface)0x0) {
      pvVar6 = *(EGLSurface *)((int)ctx + 0x80c);
    }
    else {
      eglDestroySurface(dpy,pvVar6);
      pvVar6 = *(EGLSurface *)((int)ctx + 0x80c);
    }
    if (pvVar6 == (EGLSurface)0x0) {
      *(EGLSurface *)((int)ctx + 0x810) = drawsurf;
    }
    else {
      eglDestroySurface(dpy,pvVar6);
      *(EGLSurface *)((int)ctx + 0x810) = drawsurf;
    }
    *(EGLSurface *)((int)ctx + 0x80c) = readsurf;
  }
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    if (bVar1) {
      glFinish();
    }
    eglDestroyContext(dpy,__pspgl_curctx);
  }
  __pspgl_curctx = ctx;
  if (ctx != (EGLContext)0x0) {
    if (*(int *)((int)ctx + 0x8a4) == 0) {
      __pspgl_dlist_init();
      __pspgl_ge_init(ctx);
      *(undefined4 *)((int)ctx + 0x8a4) = 1;
    }
    if (bVar1) {
      puVar7 = __pspgl_context_register;
      pvVar4 = ctx;
      do {
                    /* Unresolved local var: int i@[???] */
        uVar3 = *puVar7;
        puVar7 = puVar7 + 1;
        *(uint *)((int)pvVar4 + 0x408) = *(uint *)((int)pvVar4 + 0x408) | uVar3;
        pvVar4 = (EGLContext)((int)pvVar4 + 4);
      } while ((GuDrawBuffer *)puVar7 != &gu_draw_buffer);
      *(uint *)((int)ctx + 0x61c) = *(uint *)((int)ctx + 0x61c) | 1;
      *(uint *)((int)ctx + 0x64c) = *(uint *)((int)ctx + 0x64c) | 1;
      *(uint *)((int)ctx + 0x67c) = *(uint *)((int)ctx + 0x67c) | 1;
      *(uint *)((int)ctx + 0x5ec) = *(uint *)((int)ctx + 0x5ec) | 1;
      iVar5 = 0;
      pvVar4 = ctx;
      do {
                    /* Unresolved local var: int i@[???] */
        iVar5 = iVar5 + 1;
        *(uint *)((int)pvVar4 + 0x6ac) = *(uint *)((int)pvVar4 + 0x6ac) | 1;
        pvVar4 = (EGLContext)((int)pvVar4 + 0x30);
      } while (iVar5 != 8);
      s = *(pspgl_surface **)((int)ctx + 0x810);
    }
    else {
      s = *(pspgl_surface **)((int)ctx + 0x810);
    }
    EVar2 = __pspgl_vidmem_setup_write_and_display_buffer(s);
    return EVar2;
  }
  return 1;
}



----------------------------------------

// Function: eglSwapBuffers @ 089806a4

EGLBoolean eglSwapBuffers(EGLDisplay dpy,EGLSurface draw)

{
  EGLBoolean EVar1;
  undefined4 uVar2;
  
                    /* Unresolved local var: pspgl_surface * s@[???]
                       Unresolved local var: pspgl_buffer * t@[???] */
  uVar2 = *(undefined4 *)((int)draw + 0x14);
  *(undefined4 *)((int)draw + 0x14) = *(undefined4 *)((int)draw + 0x10);
  *(undefined4 *)((int)draw + 0x10) = uVar2;
  EVar1 = __pspgl_vidmem_setup_write_and_display_buffer(draw);
  return EVar1;
}



----------------------------------------

// Function: eglTerminate @ 089806bc

EGLBoolean eglTerminate(EGLDisplay dpy)

{
  __pspgl_dlist_cancel();
  return 1;
}



----------------------------------------

// Function: glFlush @ 089806dc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glFlush(void)

{
  uint uVar1;
  ulong *puVar2;
  ulong uVar3;
  int iVar4;
  pspgl_dlist *ppVar5;
  void *unaff_retaddr;
  int in_stack_00000000;
  
  uVar1 = dlist_current;
  ppVar5 = dlists + dlist_current;
  if ((0x200 < ppVar5->len + 4) &&
     (__pspgl_log("d->len=%d DLIST_SIZE=%d\n",ppVar5->len,0x200), 0x200 < ppVar5->len + 4)) {
    __pspgl_assert_fail("(d->len + DLIST_EXTRA) <= DLIST_SIZE",unaff_retaddr,"dlist_finish",
                        "pspgl_dlist.c",in_stack_00000000);
  }
  uVar3 = ppVar5->len;
  puVar2 = dlists[uVar1].cmd_buf;
  iVar4 = dlists[uVar1].qid;
  puVar2[uVar3] = 0xf000000;
  puVar2[uVar3 + 1] = 0xc000000;
  puVar2[uVar3 + 2] = 0;
  puVar2[uVar3 + 3] = 0;
  ppVar5->len = uVar3 + 4;
  if (iVar4 != -1) {
    __pspgl_assert_fail("d->qid == -1",unaff_retaddr,"__pspgl_dlist_submit","pspgl_dlist.c",
                        in_stack_00000000);
  }
  if ((__pspgl_curctx->stats).enabled != '\0') {
    (__pspgl_curctx->stats).buffer_issues = (__pspgl_curctx->stats).buffer_issues + 1;
  }
  iVar4 = sceGeListEnQueue(dlists[uVar1].cmd_buf,dlists[uVar1].cmd_buf + (ppVar5->len - 1),0,0);
  dlists[uVar1].qid = iVar4;
  dlist_current = dlist_current + 1 & 0xf;
  if (dlists[dlist_current].qid != -1) {
    sync_list(dlists + dlist_current);
    return;
  }
  return;
}



----------------------------------------

// Function: glGenTextures @ 089806e4

void glGenTextures(GLsizei n,GLuint *textures)

{
  bool bVar1;
  ulong id;
  pspgl_texobj *value;
  int iVar2;
  hashtable *h;
  
                    /* Unresolved local var: hashtable * hash@[???]
                       Unresolved local var: GLsizei i@[???]
                       Unresolved local var: GLenum error@[???] */
  h = &__pspgl_curctx->shared->texture_objects;
  if (n < 0) {
LAB_08980770:
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x501,"glGenTextures");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x501;
    }
  }
  else {
    iVar2 = 0;
    while (bVar1 = iVar2 < n, iVar2 = iVar2 + 1, bVar1) {
                    /* Unresolved local var: uint id@[???]
                       Unresolved local var: pspgl_texobj * tobj@[???] */
      id = __pspgl_hash_uniquekey(h);
      value = __pspgl_texobj_new(id,0);
      if (value == (pspgl_texobj *)0x0) goto LAB_08980770;
      __pspgl_hash_insert(h,id,value);
      *textures = id;
      textures = textures + 1;
    }
  }
  return;
}



----------------------------------------

// Function: glGetString @ 089807bc

GLubyte * glGetString(GLenum name)

{
  GLubyte *pGVar1;
  
                    /* Unresolved local var: ulong idx@[???]
                       Unresolved local var: char * s@[???] */
  if (name - 0x1f00 < 4) {
    pGVar1 = (GLubyte *)gl_strings[name - 0x1f00];
  }
  else {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glGetString");
    pGVar1 = (GLubyte *)0x0;
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x500;
      pGVar1 = (GLubyte *)0x0;
    }
  }
  return pGVar1;
}



----------------------------------------

// Function: glOrtho @ 0898082c

void glOrtho(GLdouble left,GLdouble right,GLdouble bottom,GLdouble top,GLdouble zNear,GLdouble zFar)

{
  SFtype left_00;
  SFtype right_00;
  SFtype bottom_00;
  SFtype top_00;
  SFtype near;
  SFtype far;
  
  left_00 = __truncdfsf2(left);
  right_00 = __truncdfsf2(left);
  bottom_00 = __truncdfsf2(left);
  top_00 = __truncdfsf2(left);
  near = __truncdfsf2(left);
  far = __truncdfsf2(left);
  glOrthof(left_00,right_00,bottom_00,top_00,near,far);
  return;
}



----------------------------------------

// Function: glOrthof @ 0898091c

/* WARNING: Unknown calling convention */

void glOrthof(GLfloat left,GLfloat right,GLfloat bottom,GLfloat top,GLfloat near,GLfloat far)

{
  float local_48 [6];
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  float local_20;
  undefined4 local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  
                    /* Unresolved local var: GLfloat[16] m@[???]
                       Unresolved local var: GLfloat rml@[???]
                       Unresolved local var: GLfloat fmn@[???]
                       Unresolved local var: GLfloat tmb@[???]
                       Unresolved local var: GLfloat _1over_rml@[???]
                       Unresolved local var: GLfloat _1over_fmn@[???]
                       Unresolved local var: GLfloat _1over_tmb@[???] */
  if (((right - left == 0.0) || (far - near == 0.0)) || (top - bottom == 0.0)) {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x501,"glOrthof");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x501;
    }
  }
  else {
    local_48[0] = DAT_089dbce4 / (right - left);
    local_20 = DAT_089dbce4 / (far - near);
    local_48[5] = DAT_089dbce4 / (top - bottom);
    local_c = DAT_089dbce4;
    local_1c = 0;
    local_48[1] = 0.0;
    local_48[2] = 0.0;
    local_48[3] = 0.0;
    local_48[4] = 0.0;
    local_30 = 0;
    local_2c = 0;
    local_28 = 0;
    local_24 = 0;
    local_18 = -(right + left) * local_48[0];
    local_10 = -(far + near) * local_20;
    local_14 = -(top + bottom) * local_48[5];
    local_20 = local_20 * DAT_089ebc50;
    local_48[0] = local_48[0] + local_48[0];
    local_48[5] = local_48[5] + local_48[5];
    glMultMatrixf(local_48);
  }
  return;
}



----------------------------------------

// Function: glPixelStorei @ 08980a2c

void glPixelStorei(GLenum pname,GLint param)

{
  GLenum GVar1;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: GLenum error@[???] */
  if (param < 0) {
    GVar1 = 0x501;
  }
  else {
    if (pname == 0xd02) {
      (__pspgl_curctx->pack).row_length = param;
      return;
    }
    if (pname < 0xd03) {
      if (pname == 0xcf3) {
        (__pspgl_curctx->unpack).skip_rows = param;
        return;
      }
      if (pname < 0xcf4) {
        GVar1 = 0x500;
        if (pname == 0xcf2) {
          (__pspgl_curctx->unpack).row_length = param;
          return;
        }
      }
      else {
        if (pname == 0xcf4) {
          (__pspgl_curctx->unpack).skip_pixels = param;
          return;
        }
        GVar1 = 0x500;
        if (((pname == 0xcf5) && (GVar1 = 0x501, (param & param - 1U) == 0)) &&
           ((param != 0 && (param < 9)))) {
          (__pspgl_curctx->unpack).alignment = param;
          return;
        }
      }
    }
    else {
      if (pname == 0xd04) {
        (__pspgl_curctx->pack).skip_pixels = param;
        return;
      }
      if (pname < 0xd04) {
        (__pspgl_curctx->pack).skip_rows = param;
        return;
      }
      if (pname == 0xd05) {
        GVar1 = 0x501;
        if ((((param & param - 1U) == 0) && (param != 0)) && (param < 9)) {
          (__pspgl_curctx->pack).alignment = param;
          return;
        }
      }
      else {
        GVar1 = 0x500;
        if (pname == 0x8758) {
          (__pspgl_curctx->pack).invert = (GLboolean)param;
          return;
        }
      }
    }
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar1,"glPixelStorei");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar1;
  }
  return;
}



----------------------------------------

// Function: glPixelStoref @ 08980b74

void glPixelStoref(GLenum pname,GLfloat param)

{
  float in_f12;
  
  glPixelStorei(pname,(int)in_f12);
  return;
}



----------------------------------------

// Function: glPopClientAttrib @ 08980b84

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void glPopClientAttrib(void)

{
  GLboolean GVar1;
  undefined3 uVar2;
  pspgl_context *ppVar3;
  varray *pvVar4;
  uint uVar5;
  GLint GVar6;
  uint uVar7;
  pspgl_bufferobj *ppVar8;
  pspgl_buffer *data;
  GLenum GVar9;
  uint uVar10;
  GLsizei GVar11;
  uint uVar12;
  varray *pvVar13;
  varray *pvVar14;
  varray *pvVar15;
  pspgl_bufferobj *bufp;
  pspgl_saved_clattrib *aptr;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_saved_clattrib * a@[???]
                       Unresolved local var: uint mask@[???] */
  ppVar3 = __pspgl_curctx;
  uVar5 = __pspgl_curctx->clattribstackdepth;
  if (uVar5 == 0) {
    __pspgl_log("*** GL error 0x%04x in %s ***\n",0x504,"glPopClientAttrib");
    if (__pspgl_curctx != (pspgl_context *)0x0) {
      __pspgl_curctx->glerror = 0x504;
    }
    return;
  }
  aptr = __pspgl_curctx->clattribstack[uVar5 - 1];
  __pspgl_curctx->clattribstackdepth = uVar5 - 1;
  uVar5 = aptr->attrmask;
  if ((uVar5 & 2) != 0) {
                    /* Unresolved local var: varray * va@[???] */
    ppVar8 = (ppVar3->vertex_array).vertex.buffer;
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).normal.buffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).normal.buffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).color.buffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).color.buffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).texcoord.buffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).texcoord.buffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).weight.buffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).weight.buffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).arraybuffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).arraybuffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      ppVar8 = (ppVar3->vertex_array).indexbuffer;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      ppVar8 = (ppVar3->vertex_array).indexbuffer;
    }
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      data = (ppVar3->vertex_array).locked.cached_array;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      data = (ppVar3->vertex_array).locked.cached_array;
    }
    if (data != (pspgl_buffer *)0x0) {
      __pspgl_buffer_free(data);
    }
    pvVar14 = &aptr->varray;
    pvVar4 = &ppVar3->vertex_array;
    do {
      pvVar15 = pvVar4;
      pvVar13 = pvVar14;
      GVar6 = (pvVar13->vertex).size;
      GVar9 = (pvVar13->vertex).type;
      GVar11 = (pvVar13->vertex).stride;
      pvVar14 = (varray *)&(pvVar13->vertex).native;
      (pvVar15->vertex).enabled = (pvVar13->vertex).enabled;
      (pvVar15->vertex).size = GVar6;
      (pvVar15->vertex).type = GVar9;
      (pvVar15->vertex).stride = GVar11;
      pvVar4 = (varray *)&(pvVar15->vertex).native;
    } while (pvVar14 != (varray *)&(aptr->varray).arraybuffer);
    GVar1 = (pvVar13->vertex).native;
    uVar2 = *(undefined3 *)&(pvVar13->vertex).field_0x11;
    (pvVar15->vertex).ptr = (pvVar13->vertex).ptr;
    (pvVar15->vertex).native = GVar1;
    *(undefined3 *)&(pvVar15->vertex).field_0x11 = uVar2;
  }
  if ((uVar5 & 1) != 0) {
    ppVar8 = (ppVar3->pack).pbo;
    if (ppVar8 == (pspgl_bufferobj *)0x0) {
      uVar5 = (aptr->pack).row_length;
    }
    else {
      __pspgl_bufferobj_free(ppVar8);
      uVar5 = (aptr->pack).row_length;
    }
    uVar7 = (aptr->pack).alignment;
    uVar10 = (aptr->pack).skip_pixels;
    uVar12 = (aptr->pack).skip_rows;
    GVar1 = (aptr->pack).invert;
    uVar2 = *(undefined3 *)&(aptr->pack).field_0x11;
    ppVar8 = (aptr->pack).pbo;
    bufp = (ppVar3->unpack).pbo;
    (ppVar3->pack).row_length = uVar5;
    (ppVar3->pack).alignment = uVar7;
    (ppVar3->pack).skip_pixels = uVar10;
    (ppVar3->pack).skip_rows = uVar12;
    (ppVar3->pack).invert = GVar1;
    *(undefined3 *)&(ppVar3->pack).field_0x11 = uVar2;
    (ppVar3->pack).pbo = ppVar8;
    if (bufp != (pspgl_bufferobj *)0x0) {
      __pspgl_bufferobj_free(bufp);
    }
    uVar5 = (aptr->unpack).alignment;
    uVar7 = (aptr->unpack).skip_pixels;
    uVar10 = (aptr->unpack).skip_rows;
    GVar1 = (aptr->unpack).invert;
    uVar2 = *(undefined3 *)&(aptr->unpack).field_0x11;
    ppVar8 = (aptr->unpack).pbo;
    (ppVar3->unpack).row_length = (aptr->unpack).row_length;
    (ppVar3->unpack).alignment = uVar5;
    (ppVar3->unpack).pbo = ppVar8;
    (ppVar3->unpack).skip_pixels = uVar7;
    (ppVar3->unpack).skip_rows = uVar10;
    (ppVar3->unpack).invert = GVar1;
    *(undefined3 *)&(ppVar3->unpack).field_0x11 = uVar2;
  }
  free(aptr);
  return;
}



----------------------------------------

// Function: glPushClientAttrib @ 08980db0

void glPushClientAttrib(GLbitfield mask)

{
  undefined3 uVar1;
  GLboolean GVar2;
  pspgl_context *ppVar3;
  varray *pvVar4;
  pspgl_saved_clattrib *m;
  GLvoid *pGVar5;
  GLint GVar6;
  pspgl_bufferobj *ppVar7;
  pspgl_buffer *ppVar8;
  uint uVar9;
  uint uVar10;
  GLsizei GVar11;
  uint uVar12;
  varray *pvVar13;
  varray *pvVar14;
  varray *pvVar15;
  pspgl_bufferobj *ppVar16;
  GLenum GVar17;
  
                    /* Unresolved local var: pspgl_context * c@[???]
                       Unresolved local var: pspgl_saved_clattrib * a@[???]
                       Unresolved local var: GLenum error@[???] */
  ppVar3 = __pspgl_curctx;
  if (__pspgl_curctx->attribstackdepth < 0x10) {
    m = malloc(0x13c);
    if (m != (pspgl_saved_clattrib *)0x0) {
      memset(m,0,0x13c);
      m->attrmask = mask;
      if ((mask & 2) != 0) {
        pvVar14 = &ppVar3->vertex_array;
        pvVar4 = &m->varray;
        do {
          pvVar15 = pvVar4;
          pvVar13 = pvVar14;
          GVar6 = (pvVar13->vertex).size;
          GVar17 = (pvVar13->vertex).type;
          GVar11 = (pvVar13->vertex).stride;
          pvVar14 = (varray *)&(pvVar13->vertex).native;
          (pvVar15->vertex).enabled = (pvVar13->vertex).enabled;
          (pvVar15->vertex).size = GVar6;
          (pvVar15->vertex).type = GVar17;
          (pvVar15->vertex).stride = GVar11;
          pvVar4 = (varray *)&(pvVar15->vertex).native;
        } while (pvVar14 != (varray *)&(ppVar3->vertex_array).arraybuffer);
        uVar1 = *(undefined3 *)&(pvVar13->vertex).field_0x11;
        pGVar5 = (pvVar13->vertex).ptr;
        (pvVar15->vertex).native = (pvVar13->vertex).native;
        *(undefined3 *)&(pvVar15->vertex).field_0x11 = uVar1;
        (pvVar15->vertex).ptr = pGVar5;
        ppVar7 = (m->varray).vertex.buffer;
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).normal.buffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).normal.buffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).color.buffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).color.buffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).texcoord.buffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).texcoord.buffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).weight.buffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).weight.buffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).arraybuffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).arraybuffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar7 = (m->varray).indexbuffer;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar7 = (m->varray).indexbuffer;
        }
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          ppVar8 = (m->varray).locked.cached_array;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          ppVar8 = (m->varray).locked.cached_array;
        }
        if (ppVar8 != (pspgl_buffer *)0x0) {
          ppVar8->refcount = ppVar8->refcount + 1;
        }
      }
      if ((mask & 1) == 0) {
        uVar9 = ppVar3->clattribstackdepth;
      }
      else {
        uVar9 = (ppVar3->pack).alignment;
        uVar10 = (ppVar3->pack).skip_pixels;
        uVar12 = (ppVar3->pack).skip_rows;
        GVar2 = (ppVar3->pack).invert;
        uVar1 = *(undefined3 *)&(ppVar3->pack).field_0x11;
        ppVar16 = (ppVar3->pack).pbo;
        (m->pack).row_length = (ppVar3->pack).row_length;
        (m->pack).alignment = uVar9;
        (m->pack).skip_pixels = uVar10;
        (m->pack).skip_rows = uVar12;
        (m->pack).invert = GVar2;
        *(undefined3 *)&(m->pack).field_0x11 = uVar1;
        (m->pack).pbo = ppVar16;
        uVar9 = (ppVar3->unpack).alignment;
        uVar10 = (ppVar3->unpack).skip_pixels;
        uVar12 = (ppVar3->unpack).skip_rows;
        GVar2 = (ppVar3->unpack).invert;
        uVar1 = *(undefined3 *)&(ppVar3->unpack).field_0x11;
        ppVar7 = (ppVar3->unpack).pbo;
        (m->unpack).row_length = (ppVar3->unpack).row_length;
        (m->unpack).alignment = uVar9;
        (m->unpack).skip_pixels = uVar10;
        (m->unpack).skip_rows = uVar12;
        (m->unpack).invert = GVar2;
        *(undefined3 *)&(m->unpack).field_0x11 = uVar1;
        (m->unpack).pbo = ppVar7;
        if (ppVar16 != (pspgl_bufferobj *)0x0) {
          ppVar16->refcount = ppVar16->refcount + 1;
        }
        ppVar7 = (m->unpack).pbo;
        if (ppVar7 == (pspgl_bufferobj *)0x0) {
          uVar9 = ppVar3->clattribstackdepth;
        }
        else {
          ppVar7->refcount = ppVar7->refcount + 1;
          uVar9 = ppVar3->clattribstackdepth;
        }
      }
      ppVar3->clattribstack[uVar9] = m;
      ppVar3->clattribstackdepth = uVar9 + 1;
      return;
    }
    GVar17 = 0x505;
  }
  else {
    GVar17 = 0x503;
  }
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar17,"glPushClientAttrib");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar17;
  }
  return;
}



----------------------------------------

// Function: glTexCoord2f @ 0898100c

/* WARNING: Unknown calling convention */

void glTexCoord2f(GLfloat s,GLfloat t)

{
  pspgl_context *ppVar1;
  
  ppVar1 = __pspgl_curctx;
  (__pspgl_curctx->current).texcoord[1] = t;
  (ppVar1->current).texcoord[0] = s;
  return;
}



----------------------------------------

// Function: glTexCoord2fv @ 08981020

void glTexCoord2fv(GLfloat *v)

{
  pspgl_context *ppVar1;
  
  ppVar1 = __pspgl_curctx;
  (__pspgl_curctx->current).texcoord[0] = *v;
  (ppVar1->current).texcoord[1] = v[1];
  return;
}



----------------------------------------

// Function: glTexCoord4fv @ 0898103c

void glTexCoord4fv(GLfloat *v)

{
  pspgl_context *ppVar1;
  
  ppVar1 = __pspgl_curctx;
  (__pspgl_curctx->current).texcoord[0] = *v;
  (ppVar1->current).texcoord[1] = v[1];
  (ppVar1->current).texcoord[2] = v[2];
  (ppVar1->current).texcoord[3] = v[3];
  return;
}



----------------------------------------

// Function: glTexEnvfv @ 08981068

void glTexEnvfv(GLenum target,GLenum pname,GLfloat *params)

{
  uint uVar1;
  uint32_t argi;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  
                    /* Unresolved local var: int mode@[???] */
  if (target == 0x2300) {
    if (pname == 0x2200) {
      fVar2 = *params;
      if (fVar2 < DAT_089ebc98) {
        uVar1 = (uint)fVar2;
      }
      else {
        uVar1 = (int)(fVar2 - DAT_089ebc98) | 0x80000000;
      }
      if (uVar1 == 0x1e01) {
        argi = 3;
      }
      else if (uVar1 < 0x1e02) {
        if (uVar1 == 0x104) {
          argi = 4;
        }
        else {
          if (uVar1 != 0xbe2) goto LAB_08981248;
          argi = 2;
        }
      }
      else if (uVar1 == 0x2100) {
        argi = 0;
      }
      else {
        if (uVar1 != 0x2101) goto LAB_08981248;
        argi = 1;
      }
      __pspgl_context_writereg_masked(__pspgl_curctx,0xc9,argi,0xff);
      return;
    }
    if (pname == 0x2201) {
      fVar4 = params[2];
      fVar2 = 0.0;
      if ((fVar4 < 0.0) || (fVar2 = DAT_089dbce4, DAT_089dbce4 < fVar4)) {
        fVar3 = params[1];
        fVar4 = fVar2;
      }
      else {
        fVar3 = params[1];
      }
      fVar2 = 0.0;
      if ((fVar3 < 0.0) || (fVar2 = DAT_089dbce4, DAT_089dbce4 < fVar3)) {
        fVar5 = *params;
        fVar3 = fVar2;
      }
      else {
        fVar5 = *params;
      }
      fVar2 = 0.0;
      if ((fVar5 < 0.0) || (fVar2 = DAT_089dbce4, DAT_089dbce4 < fVar5)) {
        fVar5 = fVar2;
      }
      __pspgl_context_writereg
                (__pspgl_curctx,0xca,
                 (int)(fVar4 * DAT_089df258) << 0x10 |
                 (int)(fVar5 * DAT_089df258) | (int)(fVar3 * DAT_089df258) << 8);
      return;
    }
  }
LAB_08981248:
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,"glTexEnvfv");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x500;
  }
  return;
}



----------------------------------------

// Function: glTexEnvi @ 0898127c

void glTexEnvi(GLenum target,GLenum pname,GLint param)

{
  float local_10 [2];
  
                    /* Unresolved local var: GLfloat p@[???] */
  local_10[0] = (float)param;
  glTexEnvfv(target,pname,local_10);
  return;
}



----------------------------------------

// Function: glTexEnvf @ 089812a4

void glTexEnvf(GLenum target,GLenum pname,GLfloat param)

{
  GLfloat local_10 [2];
  
  glTexEnvfv(target,pname,local_10);
  return;
}



----------------------------------------

// Function: glTexSubImage2D @ 089812c4

/* WARNING: Control flow encountered bad instruction data */

void glTexSubImage2D(GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,
                    GLsizei height,GLenum format,GLenum type,GLvoid *pixels)

{
  pspgl_texfmt *ppVar1;
  void *pvVar2;
  uint uVar3;
  uint in_t0;
  int in_t1;
  uint uVar4;
  GLenum in_t2;
  GLenum in_t3;
  GLenum GVar5;
  int iVar6;
  pspgl_teximg *ppVar7;
  _func_void_pspgl_texfmt_ptr_void_ptr_void_ptr_uint *p_Var8;
  pspgl_texobj *ppVar9;
  void *unaff_retaddr;
  void *local_res0;
  int in_stack_ffffffb8;
  void *local_30;
  
                    /* Unresolved local var: pspgl_texobj * tobj@[???]
                       Unresolved local var: pspgl_teximg * timg@[???]
                       Unresolved local var: pspgl_texfmt * texfmt@[???]
                       Unresolved local var: void * p@[???]
                       Unresolved local var: GLenum error@[???] */
  ppVar9 = (__pspgl_curctx->texture).bound;
  local_30 = local_res0;
  if (ppVar9 == (pspgl_texobj *)0x0) {
    glBindTexture(target,0);
    ppVar9 = (__pspgl_curctx->texture).bound;
    if (ppVar9 == (pspgl_texobj *)0x0) {
      GVar5 = 0x505;
      goto LAB_08981684;
    }
  }
  if (ppVar9->target != target) {
    GVar5 = 0x500;
    goto LAB_08981684;
  }
  if (ppVar9->texfmt == (pspgl_texfmt *)0x0) {
LAB_08981678:
    GVar5 = 0x502;
  }
  else {
    if (7 < (uint)level) {
      GVar5 = 0x501;
      goto LAB_08981684;
    }
    if ((-1 < (int)in_t0) && (-1 < in_t1)) {
      if (xoffset < 0) {
        GVar5 = 0x501;
        goto LAB_08981684;
      }
      if (-1 < yoffset) {
        ppVar7 = ppVar9->images[level];
        if (ppVar7 != (pspgl_teximg *)0x0) {
          if (ppVar7->width < xoffset + in_t0) {
            GVar5 = 0x501;
          }
          else if (ppVar7->height < (uint)(yoffset + in_t1)) {
            GVar5 = 0x501;
          }
          else {
            ppVar1 = __pspgl_hardware_format(__pspgl_texformats,in_t2,in_t3);
            if (ppVar1 == ppVar9->texfmt) {
              if (ppVar1->hwformat < 8) {
                if (ppVar1->hwformat != 4) {
                  if (ppVar7->image->refcount < 1) {
                    __pspgl_assert_fail("timg->image->refcount > 0",unaff_retaddr,"glTexSubImage2D",
                                        "glTexSubImage2D.c",in_stack_ffffffb8);
                  }
                  __pspgl_buffer_dlist_sync(ppVar7->image);
                  pvVar2 = __pspgl_buffer_map(ppVar7->image,0x88b9);
                  uVar4 = ppVar7->width;
                  if ((ppVar9->flags & 4) != 0) {
                    /* Unresolved local var: int lg2_hwsize@[???]
                       Unresolved local var: int lg2_pixsize@[???]
                       Unresolved local var: uint lg2_w@[???]
                       Unresolved local var: uint chunkpix@[???]
                       Unresolved local var: uint src@[???]
                       Unresolved local var: uint dst@[???]
                       Unresolved local var: uint srcstride@[???]
                       Unresolved local var: uint dststride@[???]
                       Unresolved local var: _func_void_pspgl_texfmt_ptr_void_ptr_void_ptr_uint *
                       convert@[???] */
                    /* WARNING: Bad instruction - Truncating control flow here */
                    halt_baddata();
                  }
                    /* Unresolved local var: uint pixsz@[???]
                       Unresolved local var: uint tostride@[???]
                       Unresolved local var: uint fromstride@[???]
                       Unresolved local var: _func_void_pspgl_texfmt_ptr_void_ptr_void_ptr_uint *
                       convert@[???] */
                  uVar3 = ppVar7->texfmt->hwsize;
                  p_Var8 = ppVar7->texfmt->convert;
                  iVar6 = 0;
                  pvVar2 = (void *)((int)pvVar2 +
                                   (yoffset * uVar4 + xoffset) * uVar3 + ppVar7->offset);
                  while( true ) {
                    if (iVar6 == in_t1) break;
                    iVar6 = iVar6 + 1;
                    (*p_Var8)(ppVar7->texfmt,pvVar2,local_30,in_t0);
                    pvVar2 = (void *)((int)pvVar2 + uVar4 * uVar3);
                    local_30 = (void *)((int)local_30 + in_t0 * uVar3);
                  }
                  __pspgl_buffer_unmap(ppVar7->image,0x88b9);
                  if (level != 0) {
                    return;
                  }
                  if ((ppVar9->flags & 1) == 0) {
                    return;
                  }
                  __pspgl_update_mipmaps();
                  return;
                }
                GVar5 = 0x502;
              }
              else {
                GVar5 = 0x502;
              }
            }
            else {
              GVar5 = 0x500;
            }
          }
          goto LAB_08981684;
        }
        goto LAB_08981678;
      }
    }
    GVar5 = 0x501;
  }
LAB_08981684:
  __pspgl_log("*** GL error 0x%04x in %s ***\n",GVar5,"glTexSubImage2D");
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = GVar5;
  }
  return;
}



----------------------------------------

// Function: glTexParameterfv @ 089816dc

void glTexParameterfv(GLenum target,GLenum pname,GLfloat *params)

{
  int iVar1;
  pspgl_texobj *ppVar2;
  uint uVar3;
  uint32_t cmd;
  int iVar4;
  uint uVar5;
  uint32_t argi;
  char *pcVar6;
  float fVar7;
  
  if (target == 0xde1) {
    if ((__pspgl_curctx->texture).bound == (pspgl_texobj *)0x0) {
      glBindTexture(0xde1,0);
    }
    if (pname < 0x2804) {
      if (0x2801 < pname) {
                    /* Unresolved local var: uint clamp@[???] */
        fVar7 = *params;
        iVar1 = 8;
        if (pname == 0x2802) {
          iVar1 = 0;
        }
        if (fVar7 < DAT_089ebc98) {
          uVar5 = (uint)fVar7;
        }
        else {
          uVar5 = (int)(fVar7 - DAT_089ebc98) | 0x80000000;
        }
        if (uVar5 == 0x2901) {
          iVar4 = 0;
        }
        else if (uVar5 == 0x812f) {
          iVar4 = 1;
        }
        else {
          if (uVar5 != 0x2900) {
            pcVar6 = "update_clamp";
            goto LAB_08981954;
          }
          iVar4 = 1;
        }
        argi = iVar4 << iVar1;
        cmd = 199;
LAB_0898189c:
        __pspgl_context_writereg_masked(__pspgl_curctx,cmd,argi,0xff << iVar1);
        return;
      }
      if (0x27ff < pname) {
        fVar7 = *params;
        iVar1 = 8;
        if (pname == 0x2801) {
          iVar1 = 0;
        }
        if (fVar7 < DAT_089ebc98) {
          uVar5 = (uint)fVar7;
        }
        else {
          uVar5 = (int)(fVar7 - DAT_089ebc98) | 0x80000000;
        }
        if ((0x25ff < uVar5) && ((uVar5 < 0x2602 || (uVar5 - 0x2700 < 4)))) {
          if (0x26ff < uVar5) {
            uVar5 = uVar5 - 0x26fc;
          }
          argi = (uVar5 & 7) << iVar1;
          cmd = 0xc6;
          goto LAB_0898189c;
        }
        pcVar6 = "update_texfilter";
        goto LAB_08981954;
      }
    }
    else {
      if (pname == 0x8191) {
        if (*params != 0.0) {
          ppVar2 = (__pspgl_curctx->texture).bound;
          uVar5 = ppVar2->flags | 1;
LAB_08981924:
          ppVar2->flags = uVar5;
          return;
        }
        ppVar2 = (__pspgl_curctx->texture).bound;
        uVar3 = 0xfffffffe;
        uVar5 = ppVar2->flags;
LAB_08981938:
        ppVar2->flags = uVar5 & uVar3;
        return;
      }
      if (pname == 0x11301) {
        if (*params != 0.0) {
          ppVar2 = (__pspgl_curctx->texture).bound;
          uVar5 = ppVar2->flags | 2;
          goto LAB_08981924;
        }
        ppVar2 = (__pspgl_curctx->texture).bound;
        uVar3 = 0xfffffffd;
        uVar5 = ppVar2->flags;
        goto LAB_08981938;
      }
    }
  }
  pcVar6 = "glTexParameterfv";
LAB_08981954:
  __pspgl_log("*** GL error 0x%04x in %s ***\n",0x500,pcVar6);
  if (__pspgl_curctx != (pspgl_context *)0x0) {
    __pspgl_curctx->glerror = 0x500;
  }
  return;
}



----------------------------------------

// Function: glTexParameteri @ 08981988

void glTexParameteri(GLenum target,GLenum pname,GLint param)

{
  float local_10 [2];
  
                    /* Unresolved local var: GLfloat p@[???] */
  local_10[0] = (float)param;
  glTexParameterfv(target,pname,local_10);
  return;
}



----------------------------------------

// Function: glTexParameterf @ 089819b0

void glTexParameterf(GLenum target,GLenum pname,GLfloat param)

{
  GLfloat local_10 [2];
  
  glTexParameterfv(target,pname,local_10);
  return;
}



----------------------------------------

// Function: glVertex2i @ 089819d0

void glVertex2i(GLint x,GLint y)

{
  glVertex3f((float)x,(float)y,0.0);
  return;
}



----------------------------------------

// Function: glVertex3i @ 089819e8

void glVertex3i(GLint x,GLint y,GLint z)

{
  glVertex3f((float)x,(float)y,(float)z);
  return;
}



----------------------------------------

// Function: __pspgl_ge_init @ 08981a0c

/* WARNING: Removing unreachable block (ram,0x08981a9c) */

void __pspgl_ge_init(pspgl_context *c)

{
  uint32_t uVar1;
  uint32_t cmd;
  uint32_t *puVar2;
  void *unaff_retaddr;
  GLclampd in_f12_13;
  GLclampd in_f14_15;
  int in_stack_00000000;
  
                    /* Unresolved local var: int reg@[???] */
  if (c != __pspgl_curctx) {
    __pspgl_assert_fail("c == pspgl_curctx",unaff_retaddr,"__pspgl_ge_init","pspgl_ge_init.c",
                        in_stack_00000000);
  }
  puVar2 = ge_init_state;
  cmd = 0;
                    /* Unresolved local var: ulong val@[???] */
  uVar1 = ge_init_state[0];
  while( true ) {
    puVar2 = puVar2 + 1;
    if ((uVar1 & 0xff000000) != 0) {
      __pspgl_context_writereg_uncached(c,cmd,uVar1 & 0xffffff);
      __pspgl_context_register[(int)cmd / 0x20] =
           __pspgl_context_register[(int)cmd / 0x20] | 1 << ((int)cmd % 0x20 & 0x1fU);
    }
    cmd = cmd + 1;
    if (cmd == 0x100) break;
    uVar1 = *puVar2;
  }
  glScissor(0,0,(uint)c->draw->width,(uint)c->draw->height);
  glViewport(0,0,(uint)c->draw->width,(uint)c->draw->height);
  glDepthRange(in_f12_13,in_f14_15);
  (c->material).ambient = 0xff333333;
  c->swap_interval = 1;
  (c->current).color = 0xffffffff;
  (c->clear).depth = 0;
  (c->viewport).depth_offset = 0.0;
  glStencilMask(0xffffffff);
  glColorMask('\x01','\x01','\x01','\x01');
  glDisable(0xb90);
  return;
}



----------------------------------------

// Function: glColorMask @ 08981b80

void glColorMask(GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)

{
  uchar uVar1;
  uint32_t argi;
  
                    /* Unresolved local var: ulong mask@[???] */
  if (red == '\0') {
    argi = 0xffffff;
  }
  else {
    argi = 0xffff00;
  }
  if (green != '\0') {
    argi = argi & 0xff00ff;
  }
  if (blue != '\0') {
    argi = argi & 0xffff;
  }
  if (alpha == '\0') {
    uVar1 = '\0';
  }
  else {
    uVar1 = (uchar)__pspgl_curctx->draw->alpha_mask;
  }
  (__pspgl_curctx->write_mask).alpha = uVar1;
  __pspgl_context_writereg(__pspgl_curctx,0xe8,argi);
  if (((__pspgl_curctx->hw).ge_reg[0x24] & 1) == 0) {
    __pspgl_context_writereg(__pspgl_curctx,0xe9,~(uint)(__pspgl_curctx->write_mask).alpha);
    return;
  }
  return;
}



----------------------------------------

// Function: glDepthRange @ 08981c34

void glDepthRange(GLclampd zNear,GLclampd zFar)

{
  SFtype zNear_00;
  SFtype zFar_00;
  
  zNear_00 = __truncdfsf2(zNear);
  zFar_00 = __truncdfsf2(zNear);
  glDepthRangef(zNear_00,zFar_00);
  return;
}



----------------------------------------

// Function: glDepthRangef @ 08981c84

/* WARNING: Unknown calling convention */

void glDepthRangef(GLclampf zNear,GLclampf zFar)

{
  float fVar1;
  float fVar2;
  float fVar3;
  
                    /* Unresolved local var: float mid@[???] */
  fVar1 = 0.0;
  if ((zNear < 0.0) || (fVar1 = DAT_089dbce4, DAT_089dbce4 < zNear)) {
    zNear = fVar1;
  }
  fVar1 = zNear * DAT_089ec154;
  if (zFar < 0.0) {
    zFar = 0.0;
  }
  else if (DAT_089dbce4 < zFar) {
    zFar = DAT_089dbce4;
  }
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
  fVar3 = zFar * DAT_089ec154;
  fVar2 = (fVar1 + fVar3) * DAT_089dc448;
  __pspgl_context_writereg(__pspgl_curctx,0x44,(int)(fVar2 - fVar3) >> 8);
                    /* Unresolved local var: anon_union_4_2_947300a4 arg@[???] */
  __pspgl_context_writereg
            (__pspgl_curctx,0x47,(int)(fVar2 + (__pspgl_curctx->viewport).depth_offset) >> 8);
  fVar2 = fVar1;
  if (fVar1 <= fVar3) {
    fVar2 = fVar3;
    fVar3 = fVar1;
  }
  __pspgl_context_writereg(__pspgl_curctx,0xd6,(int)fVar3);
  __pspgl_context_writereg(__pspgl_curctx,0xd7,(int)fVar2);
  return;
}



----------------------------------------

// Function: glStencilMask @ 08981dac

void glStencilMask(GLuint mask)

{
  (__pspgl_curctx->write_mask).stencil = (byte)mask & (byte)__pspgl_curctx->draw->stencil_mask;
  if (((__pspgl_curctx->hw).ge_reg[0x24] & 1) != 0) {
    __pspgl_context_writereg(__pspgl_curctx,0xe9,(uint)(__pspgl_curctx->write_mask).stencil);
    return;
  }
  return;
}



----------------------------------------

// Function: pspvfpu_deletecontext @ 08981dec

void pspvfpu_deletecontext(pspvfpu_context *c)

{
  pspvfpu_context *ppVar1;
  pspvfpu_context **pppVar2;
  
  pppVar2 = users;
  do {
    ppVar1 = *pppVar2;
    while (c == ppVar1) {
      *pppVar2 = (pspvfpu_context *)0x0;
      pppVar2 = pppVar2 + 1;
      if (pppVar2 == (pspvfpu_context **)&__malloc_top_pad) goto LAB_08981e24;
      ppVar1 = *pppVar2;
    }
    pppVar2 = pppVar2 + 1;
                    /* Unresolved local var: int i@[???] */
  } while (pppVar2 != (pspvfpu_context **)&__malloc_top_pad);
LAB_08981e24:
  free(c);
  return;
}



----------------------------------------

// Function: pspvfpu_initcontext @ 08981e2c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

pspvfpu_context * pspvfpu_initcontext(void)

{
  int iVar1;
  pspvfpu_context *ppVar2;
  
                    /* Unresolved local var: pspvfpu_context * c@[???] */
  iVar1 = sceKernelChangeCurrentThreadAttr(0,0x4000);
  ppVar2 = (pspvfpu_context *)0x0;
  if ((-1 < iVar1) && (ppVar2 = memalign(0x10,0x210), ppVar2 != (pspvfpu_context *)0x0)) {
    ppVar2->owned = '\0';
    ppVar2->valid = '\0';
  }
  return ppVar2;
}



----------------------------------------

// Function: pspvfpu_use_matrices @ 08981e78

/* WARNING: Control flow encountered bad instruction data */

void pspvfpu_use_matrices(pspvfpu_context *c,vfpumatrixset_t keepset,vfpumatrixset_t tempset)

{
  byte bVar1;
  byte bVar2;
  byte bVar3;
  
                    /* Unresolved local var: vfpumatrixset_t saveset@[???]
                       Unresolved local var: vfpumatrixset_t loadset@[???]
                       Unresolved local var: int m@[???] */
  bVar2 = ~keepset & tempset;
  if (c == (pspvfpu_context *)0x0) {
    bVar3 = keepset | bVar2;
  }
  else {
    bVar1 = ~c->owned;
    bVar3 = bVar1 & (keepset | bVar2);
    c->owned = c->owned | bVar3;
    c->valid = (keepset & bVar1 | c->valid) & ~(bVar1 & bVar2);
  }
  if (bVar3 != 0) {
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  return;
}



----------------------------------------

// Function: sceGuClear @ 089822d8

void sceGuClear(int flags)

{
  undefined2 uVar1;
  ushort uVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  undefined4 *puVar6;
  uint *puVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  int iVar11;
  void *unaff_s4;
  
                    /* Unresolved local var: GuContext * context@[???]
                       Unresolved local var: uint filter@[???]
                       Unresolved local var: Vertex * vertices@[???]
                       Unresolved local var: int count@[???] */
  iVar11 = gu_curr_context;
  if (gu_draw_buffer.pixel_size == 1) {
    uVar10 = gu_contexts[gu_curr_context].clear_color & 0xffffff |
             gu_contexts[gu_curr_context].clear_stencil << 0x1f;
  }
  else if (gu_draw_buffer.pixel_size < 2) {
    if (gu_draw_buffer.pixel_size == 0) {
      uVar10 = gu_contexts[gu_curr_context].clear_color & 0xffffff;
    }
    else {
      uVar10 = 0;
    }
  }
  else if (gu_draw_buffer.pixel_size == 2) {
    uVar10 = gu_contexts[gu_curr_context].clear_color & 0xffffff |
             gu_contexts[gu_curr_context].clear_stencil << 0x1c;
  }
  else if (gu_draw_buffer.pixel_size == 3) {
    uVar10 = gu_contexts[gu_curr_context].clear_color & 0xffffff |
             gu_contexts[gu_curr_context].clear_stencil << 0x18;
  }
  else {
    uVar10 = 0;
  }
  if ((flags & 0x10U) == 0) {
    puVar6 = sceGuGetMemory(0x18);
    iVar5 = gu_draw_buffer.height;
    iVar4 = gu_draw_buffer.width;
    uVar1 = (undefined2)gu_contexts[iVar11].clear_depth;
    *(undefined2 *)(puVar6 + 1) = 0;
    *(undefined2 *)((int)puVar6 + 6) = 0;
    *(undefined2 *)(puVar6 + 2) = uVar1;
    iVar11 = 2;
    puVar6[3] = uVar10;
    *(short *)(puVar6 + 4) = (short)iVar4;
    *(short *)((int)puVar6 + 0x12) = (short)iVar5;
    *(undefined2 *)(puVar6 + 5) = uVar1;
    *puVar6 = 0;
  }
  else {
                    /* Unresolved local var: Vertex * curr@[???]
                       Unresolved local var: uint i@[???] */
    puVar7 = sceGuGetMemory(0xc0);
    iVar4 = gu_draw_buffer.height;
                    /* Unresolved local var: uint j@[???]
                       Unresolved local var: uint k@[???] */
    uVar3 = gu_contexts[iVar11].clear_depth;
    uVar9 = 0;
    do {
      uVar2 = (ushort)uVar9 & 1;
      uVar8 = uVar9 >> 1;
      uVar9 = uVar9 + 1;
      *(ushort *)(puVar7 + 1) = ((short)uVar8 + uVar2) * 0x40;
      *puVar7 = uVar10;
      *(short *)(puVar7 + 2) = (short)uVar3;
      *(ushort *)((int)puVar7 + 6) = uVar2 * (short)iVar4;
      puVar7 = puVar7 + 3;
    } while (uVar9 != 0x10);
    iVar11 = 0x10;
  }
  sendCommandi(0xd3,(flags & 7U) << 8 | 1);
  sceGuDrawArray(6,0x80011c,iVar11,(void *)0x0,unaff_s4);
  sendCommandi(0xd3,0);
  return;
}



----------------------------------------

// Function: sceGuClutLoad @ 089824c8

void sceGuClutLoad(int num_blocks,void *cbp)

{
  sendCommandi(0xb0,(uint)cbp & 0xffffff);
  sendCommandi(0xb1,(uint)cbp >> 8 & 0xf0000);
  sendCommandi(0xc4,num_blocks);
  return;
}



----------------------------------------

// Function: sceGuClutMode @ 08982524

void sceGuClutMode(uint cpsm,uint shift,uint mask,uint a3)

{
                    /* Unresolved local var: uint argument@[???] */
  sendCommandi(0xc5,shift << 2 | cpsm | mask << 8 | a3 << 0x10);
  return;
}



----------------------------------------

// Function: sceGuColor @ 08982544

void sceGuColor(uint color)

{
  sceGuMaterial(7,color);
  return;
}



----------------------------------------

// Function: sceGuCopyImage @ 08982550

void sceGuCopyImage(int psm,int sx,int sy,int width,int height,int srcw,void *src,int dx,int dy,
                   int destw,void *dest)

{
  int in_t0;
  uint in_t1;
  uint in_t2;
  uint in_t3;
  undefined4 local_res0;
  undefined4 local_res4;
  undefined4 local_res8;
  
  sendCommandi(0xb2,in_t2 & 0xffffff);
  sendCommandi(0xb3,(in_t2 & 0xff000000) >> 8 | in_t1);
  sendCommandi(0xeb,sy << 10 | sx);
  sendCommandi(0xb4,local_res8 & 0xffffff);
  sendCommandi(0xb5,(local_res8 & 0xff000000) >> 8 | local_res4);
  sendCommandi(0xec,local_res0 << 10 | in_t3);
  sendCommandi(0xee,(in_t0 + -1) * 0x400 | width - 1U);
  sendCommandi(0xea,(uint)(psm == 3));
  return;
}



----------------------------------------

// Function: drawRegion @ 0898267c

void drawRegion(int x,int y,int width,int height)

{
  sendCommandi(0x15,y << 10 | x);
  sendCommandi(0x16,(y + height + -1) * 0x400 | (x + width) - 1U);
  return;
}



----------------------------------------

// Function: sceGuDispBuffer @ 089826ec

void sceGuDispBuffer(int width,int height,void *dispbp,int dispbw)

{
  if ((gu_draw_buffer.frame_width == 0) || (gu_draw_buffer.frame_width != dispbw)) {
    gu_draw_buffer.frame_width = dispbw;
  }
  gu_draw_buffer.disp_buffer = dispbp;
  gu_draw_buffer.width = width;
  gu_draw_buffer.height = height;
  drawRegion(0,0,width,height);
  sceDisplaySetMode(0,gu_draw_buffer.width,gu_draw_buffer.height);
  if (gu_display_on == 0) {
    return;
  }
  sceDisplaySetFrameBuf
            ((int)gu_draw_buffer.disp_buffer + (int)ge_edram_address,dispbw,
             gu_draw_buffer.pixel_size,1);
  return;
}



----------------------------------------

// Function: sceGuDisplay @ 089827b0

int sceGuDisplay(int state)

{
  if (state != 0) {
    sceDisplaySetFrameBuf
              ((int)gu_draw_buffer.disp_buffer + (int)ge_edram_address,gu_draw_buffer.frame_width,
               gu_draw_buffer.pixel_size,1);
    gu_display_on = state;
    return state;
  }
  sceDisplaySetFrameBuf(0,0,0,1);
  gu_display_on = state;
  return 0;
}



----------------------------------------

// Function: sceGuDrawArray @ 08982834

void sceGuDrawArray(int prim,int vtype,int count,void *indices,void *vertices)

{
  uint in_t0;
  
  if (vtype != 0) {
    sendCommandi(0x12,vtype);
  }
  if (indices != (void *)0x0) {
    sendCommandi(0x10,(uint)indices >> 8 & 0xf0000);
    sendCommandi(2,(uint)indices & 0xffffff);
  }
  if (in_t0 != 0) {
    sendCommandi(0x10,in_t0 >> 8 & 0xf0000);
    sendCommandi(1,in_t0 & 0xffffff);
  }
  sendCommandiStall(4,prim << 0x10 | count);
  return;
}



----------------------------------------

// Function: sceGuDrawBuffer @ 089828f4

void sceGuDrawBuffer(int psm,void *fbp,int frame_width)

{
  if ((gu_draw_buffer.depth_buffer == (void *)0x0) && (gu_draw_buffer.height != 0)) {
    gu_draw_buffer.depth_buffer = (void *)(frame_width * gu_draw_buffer.height * 4 + (int)fbp);
  }
  if (gu_draw_buffer.depth_width == 0) {
    gu_draw_buffer.depth_width = frame_width;
  }
  gu_draw_buffer.pixel_size = psm;
  gu_draw_buffer.frame_width = frame_width;
  gu_draw_buffer.frame_buffer = fbp;
  sendCommandi(0xd2,psm);
  sendCommandi(0x9c,(uint)gu_draw_buffer.frame_buffer & 0xffffff);
  sendCommandi(0x9d,((uint)gu_draw_buffer.frame_buffer & 0xff000000) >> 8 |
                    gu_draw_buffer.frame_width);
  sendCommandi(0x9e,(uint)gu_draw_buffer.depth_buffer & 0xffffff);
  sendCommandi(0x9f,((uint)gu_draw_buffer.depth_buffer & 0xff000000) >> 8 |
                    gu_draw_buffer.depth_width);
  return;
}



----------------------------------------

// Function: sceGuEnable @ 089829e0

void sceGuEnable(int state)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  
  iVar1 = gu_curr_context;
  switch(state) {
  case 0:
    sendCommandi(0x22,1);
    break;
  case 1:
    sendCommandi(0x23,1);
    break;
  case 2:
                    /* Unresolved local var: GuContext * context@[???] */
    iVar2 = gu_contexts[gu_curr_context].scissor_start[1];
    uVar3 = gu_contexts[gu_curr_context].scissor_start[0];
    gu_contexts[gu_curr_context].scissor_enable = 1;
    sendCommandi(0xd4,iVar2 << 10 | uVar3);
    sendCommandi(0xd5,gu_contexts[iVar1].scissor_end[1] << 10 | gu_contexts[iVar1].scissor_end[0]);
    break;
  case 3:
    sendCommandi(0x24,1);
    break;
  case 4:
    sendCommandi(0x21,1);
    break;
  case 5:
    sendCommandi(0x1d,1);
    break;
  case 6:
    sendCommandi(0x20,1);
    break;
  case 7:
    sendCommandi(0x1f,1);
    break;
  case 8:
    sendCommandi(0x1c,1);
    break;
  case 9:
    sendCommandi(0x1e,1);
    break;
  case 10:
    sendCommandi(0x17,1);
    break;
  case 0xb:
    sendCommandi(0x18,1);
    break;
  case 0xc:
    sendCommandi(0x19,1);
    break;
  case 0xd:
    sendCommandi(0x1a,1);
    break;
  case 0xe:
    sendCommandi(0x1b,1);
    break;
  case 0xf:
    sendCommandi(0x25,1);
    break;
  case 0x10:
    sendCommandi(0x26,1);
    break;
  case 0x11:
    sendCommandi(0x27,1);
    break;
  case 0x12:
    sendCommandi(0x28,1);
    break;
  case 0x13:
    sendCommandi(0x51,1);
    break;
  case 0x14:
    sendCommandi(0x38,1);
    break;
  case 0x15:
                    /* Unresolved local var: GuContext * context@[???] */
    uVar3 = gu_contexts[gu_curr_context].texture_function;
    gu_contexts[gu_curr_context].fragment_2x = 0x10000;
    sendCommandi(0xc9,uVar3 | 0x10000);
    break;
  default:
    if (0x15 < state) {
      return;
    }
  }
  gu_states = 1 << (state & 0x1fU) | gu_states;
  return;
}



----------------------------------------

// Function: sceGuFinishId @ 08982c7c

int sceGuFinishId(uint id)

{
  uint **ppuVar1;
  uint **ppuVar2;
  
                    /* Unresolved local var: uint size@[???] */
  if (gu_curr_context == 1) {
    if (gu_call_mode == 1) {
      sendCommandi(0xe,0x120000);
      sendCommandi(0xc,0);
      sendCommandiStall(0,0);
    }
    else {
      sendCommandi(0xb,0);
    }
  }
  else if ((gu_curr_context == 2) || (gu_curr_context == 0)) {
    sendCommandi(0xf,id & 0xffff);
    sendCommandiStall(0xc,0);
  }
  ppuVar1 = &gu_list->current;
  ppuVar2 = &gu_list->start;
  gu_curr_context = gu_list->parent_context;
  gu_list = &gu_contexts[gu_list->parent_context].list;
  return (int)*ppuVar1 - (int)*ppuVar2;
}



----------------------------------------

// Function: sceGuFinish @ 08982d64

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int sceGuFinish(void)

{
  uint **ppuVar1;
  uint **ppuVar2;
  
                    /* Unresolved local var: uint size@[???] */
  if (gu_curr_context == 1) {
    if (gu_call_mode == 1) {
      sendCommandi(0xe,0x120000);
      sendCommandi(0xc,0);
      sendCommandiStall(0,0);
    }
    else {
      sendCommandi(0xb,0);
    }
  }
  else if ((gu_curr_context == 2) || (gu_curr_context == 0)) {
    sendCommandi(0xf,0);
    sendCommandiStall(0xc,0);
  }
  ppuVar1 = &gu_list->current;
  ppuVar2 = &gu_list->start;
  gu_curr_context = gu_list->parent_context;
  gu_list = &gu_contexts[gu_list->parent_context].list;
  return (int)*ppuVar1 - (int)*ppuVar2;
}



----------------------------------------

// Function: sceGuFrontFace @ 08982e4c

void sceGuFrontFace(int order)

{
  if (order != 0) {
    sendCommandi(0x9b,0);
    return;
  }
  sendCommandi(0x9b,1);
  return;
}



----------------------------------------

// Function: sceGuGetMemory @ 08982e68

void * sceGuGetMemory(int size)

{
  bool bVar1;
  GuDisplayList *pGVar2;
  uint *puVar3;
  uint *puVar4;
  
                    /* Unresolved local var: uint * orig_ptr@[???]
                       Unresolved local var: uint * new_ptr@[???]
                       Unresolved local var: int lo@[???]
                       Unresolved local var: int hi@[???] */
  pGVar2 = gu_list;
  puVar4 = gu_list->current;
  puVar3 = (uint *)((size + 3U & 0xfffffffc) + (int)(puVar4 + 2));
  puVar4[1] = (uint)puVar3 & 0xffffff | 0x8000000;
  *puVar4 = (uint)puVar3 >> 8 & 0xf0000 | 0x10000000;
  bVar1 = gu_curr_context == 0;
  pGVar2->current = puVar3;
  if (bVar1) {
    sceGeListUpdateStallAddr(ge_list_executed[0],puVar3);
  }
  return puVar4 + 2;
}



----------------------------------------

// Function: sceGuInit @ 08982ef8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void sceGuInit(void)

{
  code *local_20;
  GuSettings *local_1c;
  code *local_18;
  GuSettings *local_14;
  
                    /* Unresolved local var: PspGeCallbackData callback@[???] */
  local_18 = callbackFin;
  local_1c = &gu_settings;
  local_14 = &gu_settings;
  local_20 = callbackSig;
  gu_settings.ge_callback_id = sceGeSetCallback(&local_20);
  gu_settings.swapBuffersCallback = (GuSwapBuffersCallback)0x0;
  gu_settings.swapBuffersBehaviour = 0;
  ge_edram_address = (void *)sceGeEdramGetAddr();
  ge_list_executed[0] = sceGeListEnQueue(ge_init_list,0,gu_settings.ge_callback_id,0);
  resetValues();
  gu_settings.kernel_event_flag = sceKernelCreateEventFlag("SceGuSignal",0x200,3,0);
  sceGeListSync(ge_list_executed[0],0);
  return;
}



----------------------------------------

// Function: sceGuMaterial @ 08982fbc

void sceGuMaterial(int mode,int color)

{
  if ((mode & 1U) != 0) {
    sendCommandi(0x55,color & 0xffffff);
    sendCommandi(0x58,color >> 0x18);
  }
  if ((mode & 2U) != 0) {
    sendCommandi(0x56,color & 0xffffff);
  }
  if ((mode & 4U) != 0) {
    sendCommandi(0x57,color & 0xffffff);
    return;
  }
  return;
}



----------------------------------------

// Function: sceGuOffset @ 08983070

void sceGuOffset(uint x,uint y)

{
  sendCommandi(0x4c,x << 4);
  sendCommandi(0x4d,y << 4);
  return;
}



----------------------------------------

// Function: sceGuScissor @ 089830a8

void sceGuScissor(int x,int y,int w,int h)

{
  int iVar1;
  int iVar2;
  
                    /* Unresolved local var: GuContext * context@[???] */
  iVar1 = gu_curr_context;
  iVar2 = gu_contexts[gu_curr_context].scissor_enable;
  gu_contexts[gu_curr_context].scissor_end[0] = w + -1;
  gu_contexts[iVar1].scissor_end[1] = h + -1;
  gu_contexts[iVar1].scissor_start[0] = x;
  gu_contexts[iVar1].scissor_start[1] = y;
  if (iVar2 == 0) {
    return;
  }
  sendCommandi(0xd4,y << 10 | x);
  sendCommandi(0xd5,gu_contexts[iVar1].scissor_end[1] << 10 | gu_contexts[iVar1].scissor_end[0]);
  return;
}



----------------------------------------

// Function: sceGuStart @ 08983144

void sceGuStart(int cid,void *list)

{
  float u;
  int iVar1;
  uint *puVar2;
  
                    /* Unresolved local var: GuContext * context@[???]
                       Unresolved local var: uint * local_list@[???] */
  puVar2 = (uint *)((uint)list | 0x40000000);
  gu_list = &gu_contexts[cid].list;
  iVar1 = cid;
  gu_contexts[cid].list.parent_context = gu_curr_context;
  gu_curr_context = iVar1;
  gu_contexts[cid].list.start = puVar2;
  gu_contexts[cid].list.current = puVar2;
  if (cid == 0) {
    ge_list_executed[0] = sceGeListEnQueue(puVar2,puVar2,gu_settings.ge_callback_id,0);
    gu_settings.signal_offset = 0;
  }
  if (gu_init == 0) {
    sceGuSetDither((ScePspIMatrix4 *)sceGuStart::dither_matrix);
    sceGuPatchDivide(0x10,0x10);
    sceGuColorMaterial(7);
    u = DAT_089dbce4;
    sceGuSpecular(DAT_089dbce4);
    sceGuTexScale(u,u);
    gu_init = 1;
  }
  if ((gu_curr_context == 0) && (gu_draw_buffer.frame_width != 0)) {
    sendCommandi(0x9c,(uint)gu_draw_buffer.frame_buffer & 0xffffff);
    sendCommandi(0x9d,((uint)gu_draw_buffer.frame_buffer & 0xff000000) >> 8 |
                      gu_draw_buffer.frame_width);
    return;
  }
  return;
}



----------------------------------------

// Function: guSwapBuffersBehaviour @ 089832ac

void guSwapBuffersBehaviour(int behaviour)

{
  gu_settings.swapBuffersBehaviour = behaviour;
  return;
}



----------------------------------------

// Function: guSwapBuffersCallback @ 089832b8

void guSwapBuffersCallback(GuSwapBuffersCallback callback)

{
  gu_settings.swapBuffersCallback = callback;
  return;
}



----------------------------------------

// Function: sceGuSwapBuffers @ 089832c4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void * sceGuSwapBuffers(void)

{
  void *pvVar1;
  
                    /* Unresolved local var: void * temp@[???] */
  pvVar1 = gu_draw_buffer.disp_buffer;
  gu_draw_buffer.disp_buffer = gu_draw_buffer.frame_buffer;
  gu_draw_buffer.frame_buffer = pvVar1;
  if (gu_settings.swapBuffersCallback != (GuSwapBuffersCallback)0x0) {
    (*gu_settings.swapBuffersCallback)((void **)0x8a3f0f4,pvVar1);
  }
  if (gu_display_on != 0) {
    sceDisplaySetFrameBuf
              ((int)gu_draw_buffer.disp_buffer + (int)ge_edram_address,gu_draw_buffer.frame_width,
               gu_draw_buffer.pixel_size,gu_settings.swapBuffersBehaviour);
  }
  gu_current_frame = gu_current_frame ^ 1;
  return gu_draw_buffer.frame_buffer;
}



----------------------------------------

// Function: sceGuSync @ 08983370

int sceGuSync(int mode,int what)

{
  int iVar1;
  
  if (mode == 3) {
    iVar1 = sceGeDrawSync(ge_list_executed[0]);
    return iVar1;
  }
  iVar1 = ge_list_executed[1];
  if ((mode != 4) && (iVar1 = what, mode != 0)) {
    return 0;
  }
  iVar1 = sceGeDrawSync(iVar1);
  return iVar1;
}



----------------------------------------

// Function: sceGuTerm @ 089833b4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void sceGuTerm(void)

{
  sceKernelDeleteEventFlag(gu_settings.kernel_event_flag);
  sceGeUnsetCallback(gu_settings.ge_callback_id);
  return;
}



----------------------------------------

// Function: sceGuTexFilter @ 089833e4

void sceGuTexFilter(int min,int mag)

{
  sendCommandi(0xc6,mag << 8 | min);
  return;
}



----------------------------------------

// Function: sceGuTexFunc @ 089833f4

void sceGuTexFunc(int tfx,int tcc)

{
  uint uVar1;
  uint uVar2;
  
                    /* Unresolved local var: GuContext * context@[???] */
  uVar2 = tcc << 8 | tfx;
  uVar1 = gu_contexts[gu_curr_context].fragment_2x;
  gu_contexts[gu_curr_context].texture_function = uVar2;
  sendCommandi(0xc9,uVar2 | uVar1);
  return;
}



----------------------------------------

// Function: getExp @ 08983430

/* WARNING: Control flow encountered bad instruction data */

int getExp(int val)

{
                    /* Unresolved local var: uint i@[DW_OP_reg4(a0)] */
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: sceGuTexImage @ 08983444

void sceGuTexImage(int mipmap,int width,int height,int tbw,void *tbp)

{
  int iVar1;
  uint uVar2;
  uint in_t0;
  int cmd;
  
  sendCommandi(tbpcmd_tbl[mipmap],in_t0 & 0xffffff);
  sendCommandi(tbwcmd_tbl[mipmap],in_t0 >> 8 & 0xf0000 | tbw);
  cmd = tsizecmd_tbl[mipmap];
  iVar1 = getExp(height);
  uVar2 = getExp(width);
  sendCommandi(cmd,iVar1 << 8 | uVar2);
  sceGuTexFlush();
  return;
}



----------------------------------------

// Function: sceGuTexMode @ 08983508

void sceGuTexMode(int tpsm,int maxmips,int a2,int swizzle)

{
                    /* Unresolved local var: GuContext * context@[???] */
  gu_contexts[gu_curr_context].texture_mode = tpsm;
  sendCommandi(0xc2,maxmips << 0x10 | a2 << 8 | swizzle);
  sendCommandi(0xc3,tpsm);
  sceGuTexFlush();
  return;
}



----------------------------------------

// Function: sceGuTexScale @ 08983570

/* WARNING: Unknown calling convention */

void sceGuTexScale(float u,float v)

{
  float in_a1;
  
  sendCommandf(0x48,in_a1);
  sendCommandf(0x49,in_a1);
  return;
}



----------------------------------------

// Function: sceGuTexSync @ 089835a0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void sceGuTexSync(void)

{
  sendCommandi(0xcc,0);
  return;
}



----------------------------------------

// Function: sceGuViewport @ 089835ac

void sceGuViewport(int cx,int cy,int width,int height)

{
  sendCommandf(0x42,(float)cy);
  sendCommandf(0x43,(float)cy);
  sendCommandf(0x45,(float)cy);
  sendCommandf(0x46,(float)cy);
  return;
}



----------------------------------------

// Function: sendCommandi @ 08983624

void sendCommandi(int cmd,int argument)

{
  uint *puVar1;
  
  puVar1 = gu_list->current;
  gu_list->current = puVar1 + 1;
  *puVar1 = cmd << 0x18 | argument & 0xffffffU;
  return;
}



----------------------------------------

// Function: sendCommandf @ 08983654

void sendCommandf(int cmd,float argument)

{
  uint in_f12;
  
                    /* Unresolved local var: anon_union_4_2_947300a4 t@[???] */
  sendCommandi(cmd,in_f12 >> 8);
  return;
}



----------------------------------------

// Function: sendCommandiStall @ 08983660

void sendCommandiStall(int cmd,int argument)

{
  sendCommandi(cmd,argument);
  if ((gu_object_stack_depth == 0) && (gu_curr_context == 0)) {
    sceGeListUpdateStallAddr(ge_list_executed[0],gu_list->current);
    return;
  }
  return;
}



----------------------------------------

// Function: callbackFin @ 089836b4

void callbackFin(int id,void *arg)

{
                    /* Unresolved local var: GuSettings * settings@[???] */
  if (*(code **)((int)arg + 4) != (code *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089836c0. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (**(code **)((int)arg + 4))(id & 0xffff);
    return;
  }
  return;
}



----------------------------------------

// Function: callbackSig @ 089836d0

void callbackSig(int id,void *arg)

{
  uint uVar1;
  code *pcVar2;
  
                    /* Unresolved local var: GuSettings * settings@[???] */
  uVar1 = *(uint *)((int)arg + 0x28);
  pcVar2 = *(code **)arg;
  *(short *)((int)arg + (uVar1 & 0xf) * 2 + 8) = (short)id;
  *(uint *)((int)arg + 0x28) = uVar1 + 1;
  if (pcVar2 != (code *)0x0) {
    (*pcVar2)(id & 0xffff);
  }
  sceKernelSetEventFlag(*(undefined4 *)((int)arg + 0x2c),1);
  return;
}



----------------------------------------

// Function: resetValues @ 0898372c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void resetValues(void)

{
  int *piVar1;
  
                    /* Unresolved local var: uint i@[???] */
  gu_draw_buffer.height = 0x110;
  gu_init = 0;
  gu_states = 0;
  gu_current_frame = 0;
  gu_object_stack_depth = 0;
  gu_display_on = 0;
  gu_call_mode = 0;
  gu_draw_buffer.pixel_size = 1;
  gu_draw_buffer.width = 0x1e0;
  gu_draw_buffer.frame_width = 0;
  gu_draw_buffer.frame_buffer = (void *)0x0;
  gu_draw_buffer.disp_buffer = (void *)0x0;
  gu_draw_buffer.depth_buffer = (void *)0x0;
  gu_draw_buffer.depth_width = 0;
  piVar1 = &gu_contexts[0].scissor_enable;
                    /* Unresolved local var: GuContext * context@[???] */
  gu_contexts[0].scissor_enable = 0;
  while( true ) {
    piVar1[1] = 0;
    piVar1[2] = 0;
    piVar1[3] = 0;
    piVar1[4] = 0;
    piVar1[5] = 0;
    piVar1[6] = 1;
    piVar1[7] = 0;
    piVar1[8] = 0;
    piVar1[9] = 0;
    piVar1[10] = 0;
    piVar1[0xb] = 0;
    piVar1[0xc] = 0;
    piVar1[0xd] = 0;
    piVar1[0xe] = 0;
    piVar1[0xf] = 0;
    piVar1[0x10] = 0;
    piVar1[0x11] = 0;
    piVar1[0x12] = 0xffff;
    piVar1[0x13] = 0;
    piVar1 = piVar1 + 0x17;
    if (piVar1 == ge_list_executed) break;
    *piVar1 = 0;
  }
  gu_settings.fin = (GuCallback)0x0;
  gu_settings.sig = (GuCallback)0x0;
  return;
}



----------------------------------------

// Function: sceGuColorMaterial @ 08983818

void sceGuColorMaterial(int a0)

{
  sendCommandi(0x53,a0);
  return;
}



----------------------------------------

// Function: sceGuPatchDivide @ 08983824

void sceGuPatchDivide(uint a0,uint a1)

{
  sendCommandi(0x36,a1 << 8 | a0);
  return;
}



----------------------------------------

// Function: sceGuSetDither @ 08983834

void sceGuSetDither(ScePspIMatrix4 *matrix)

{
  sendCommandi(0xe2,(matrix->x).x & 0xfU | ((matrix->x).y & 0xfU) << 4 |
                    ((matrix->x).z & 0xfU) << 8 | ((matrix->x).w & 0xfU) << 0xc);
  sendCommandi(0xe3,(matrix->y).x & 0xfU | ((matrix->y).y & 0xfU) << 4 |
                    ((matrix->y).z & 0xfU) << 8 | ((matrix->y).w & 0xfU) << 0xc);
  sendCommandi(0xe4,(matrix->z).x & 0xfU | ((matrix->z).y & 0xfU) << 4 |
                    ((matrix->z).z & 0xfU) << 8 | ((matrix->z).w & 0xfU) << 0xc);
  sendCommandi(0xe5,(matrix->w).x & 0xfU | ((matrix->w).y & 0xfU) << 4 |
                    ((matrix->w).z & 0xfU) << 8 | ((matrix->w).w & 0xfU) << 0xc);
  return;
}



----------------------------------------

// Function: sceGuSpecular @ 08983950

/* WARNING: Unknown calling convention */

void sceGuSpecular(float power)

{
  sendCommandi(0x5b,(uint)power >> 8);
  return;
}



----------------------------------------

// Function: sceGuTexFlush @ 08983958

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void sceGuTexFlush(void)

{
  float in_a1;
  
  sendCommandf(0xcb,in_a1);
  return;
}



----------------------------------------

// Function: fprintf @ 08983964

int fprintf(FILE *pOut,char *zFormat,...)

{
  int iVar1;
  undefined4 in_a2;
  undefined4 in_a3;
  undefined4 local_18;
  undefined4 local_14;
  
                    /* Unresolved local var: va_list ap@[???]
                       Unresolved local var: int retc@[???] */
  local_18 = in_a2;
  local_14 = in_a3;
  iVar1 = vxprintf(__fout,pOut,zFormat,&local_18);
  return iVar1;
}



----------------------------------------

// Function: atexit @ 089839b4

int atexit(_func_void *fn)

{
  int iVar1;
  
  iVar1 = __register_exitproc(0,fn,(void *)0x0,(void *)0x0);
  return iVar1;
}



----------------------------------------

// Function: atof @ 089839c8

double atof(char *s)

{
  double dVar1;
  
  dVar1 = _strtod_r(_impure_ptr,s,(char **)0x0);
  return dVar1;
}



----------------------------------------

// Function: _atoi_r @ 089839d0

int _atoi_r(_reent *ptr,char *s)

{
  long lVar1;
  
  lVar1 = _strtol_r(ptr,s,(char **)0x0,10);
  return lVar1;
}



----------------------------------------

// Function: atoi @ 089839dc

int atoi(char *s)

{
  long lVar1;
  
  lVar1 = strtol(s,(char **)0x0,10);
  return lVar1;
}



----------------------------------------

// Function: bsearch @ 089839e8

void * bsearch(void *key,void *base,size_t nmemb,size_t size,_func_int_void_ptr_void_ptr *compar)

{
  int iVar1;
  code *in_t0;
  void *pvVar2;
  size_t sVar3;
  uint uVar4;
  
                    /* Unresolved local var: void * current@[???]
                       Unresolved local var: size_t lower@[???]
                       Unresolved local var: size_t upper@[???]
                       Unresolved local var: size_t index@[???]
                       Unresolved local var: int result@[???] */
  if ((nmemb != 0) && (size != 0)) {
    uVar4 = 0;
    do {
      sVar3 = uVar4 + nmemb >> 1;
      pvVar2 = (void *)(size * sVar3 + (int)base);
      iVar1 = (*in_t0)(key,pvVar2);
      if ((-1 < iVar1) && (uVar4 = sVar3 + 1, sVar3 = nmemb, iVar1 == 0)) {
        return pvVar2;
      }
      nmemb = sVar3;
    } while (uVar4 < sVar3);
  }
  return (void *)0x0;
}



----------------------------------------

// Function: calloc @ 08983ab0

void * calloc(size_t n,size_t size)

{
  void *pvVar1;
  
  pvVar1 = _calloc_r(_impure_ptr,n,size);
  return pvVar1;
}



----------------------------------------

// Function: _calloc_r @ 08983ac8

void * _calloc_r(_reent *reent_ptr,size_t n,size_t elem_size)

{
  undefined4 *m;
  undefined4 *puVar1;
  uint n_00;
  
                    /* Unresolved local var: mchunkptr p@[???]
                       Unresolved local var: size_t csz@[???]
                       Unresolved local var: size_t sz@[???]
                       Unresolved local var: void * mem@[???] */
  m = _malloc_r(reent_ptr,n * elem_size);
  if (m != (undefined4 *)0x0) {
                    /* Unresolved local var: size_t mzsz@[???] */
    n_00 = (m[-1] & 0xfffffffc) - 4;
    if (0x24 < n_00) {
      memset(m,0,n_00);
      return m;
    }
                    /* Unresolved local var: size_t * mz@[???] */
    puVar1 = m;
    if (0x13 < n_00) {
      *m = 0;
      m[1] = 0;
      puVar1 = m + 2;
      if (0x1b < n_00) {
        m[2] = 0;
        m[3] = 0;
        puVar1 = m + 4;
        if (n_00 == 0x24) {
          puVar1 = m + 6;
          m[4] = 0;
          m[5] = 0;
        }
      }
    }
    puVar1[2] = 0;
    *puVar1 = 0;
    puVar1[1] = 0;
  }
  return m;
}



----------------------------------------

// Function: __errno @ 08983b8c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int * __errno(void)

{
  return &_impure_ptr->_errno;
}



----------------------------------------

// Function: exit @ 08983b9c

/* DWARF original prototype: void exit(int code) */

void exit(int code)

{
  __call_exitprocs(code,(void *)0x0);
  if (_global_impure_ptr->__cleanup != (_func_void__reent_ptr *)0x0) {
    (*_global_impure_ptr->__cleanup)(_global_impure_ptr);
  }
                    /* WARNING: Subroutine does not return */
  _exit(code);
}



----------------------------------------

// Function: _fclose_r @ 08983bd8

int _fclose_r(_reent *rptr,FILE *fp)

{
  short sVar1;
  ushort uVar2;
  int iVar3;
  int iVar4;
  uchar *puVar5;
  
                    /* Unresolved local var: int r@[???] */
  if (fp != (FILE *)0x0) {
    __sfp_lock_acquire();
    if (rptr == (_reent *)0x0) {
      sVar1 = fp->_flags;
    }
    else if (rptr->__sdidinit == 0) {
      __sinit(rptr);
      sVar1 = fp->_flags;
    }
    else {
      sVar1 = fp->_flags;
    }
    if (sVar1 != 0) {
      iVar3 = fflush(fp);
      if (fp->_close == (_func_int_void_ptr *)0x0) {
        uVar2 = fp->_flags;
      }
      else {
        iVar4 = (*fp->_close)(fp->_cookie);
        if (iVar4 < 0) {
          iVar3 = -1;
        }
        uVar2 = fp->_flags;
      }
      if ((uVar2 & 0x80) == 0) {
        puVar5 = (fp->_ub)._base;
      }
      else {
        _free_r(rptr,(fp->_bf)._base);
        puVar5 = (fp->_ub)._base;
      }
      if (puVar5 != (uchar *)0x0) {
        if (puVar5 == fp->_ubuf) {
          (fp->_ub)._base = (uchar *)0x0;
        }
        else {
          _free_r(_impure_ptr,puVar5);
          (fp->_ub)._base = (uchar *)0x0;
        }
      }
      puVar5 = (fp->_lb)._base;
      if (puVar5 != (uchar *)0x0) {
        _free_r(_impure_ptr,puVar5);
        (fp->_lb)._base = (uchar *)0x0;
      }
      fp->_flags = 0;
      __sfp_lock_release();
      return iVar3;
    }
    __sfp_lock_release();
  }
  return 0;
}



----------------------------------------

// Function: fclose @ 08983d1c

int fclose(FILE *fp)

{
  int iVar1;
  
  iVar1 = _fclose_r(_impure_ptr,fp);
  return iVar1;
}



----------------------------------------

// Function: fflush @ 08983d30

int fflush(FILE *fp)

{
  _fpos_t _Var1;
  uchar *puVar2;
  int iVar3;
  _fpos_t _Var4;
  ushort uVar5;
  int iVar6;
  uchar *puVar7;
  _func__fpos_t_void_ptr__fpos_t_int *p_Var8;
  
                    /* Unresolved local var: uchar * p@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int t@[???] */
  if (fp == (FILE *)0x0) {
    iVar6 = _fwalk(_global_impure_ptr,fflush);
    return iVar6;
  }
  if (_impure_ptr == (_reent *)0x0) {
    uVar5 = fp->_flags;
  }
  else if (_impure_ptr->__sdidinit == 0) {
    __sinit(_impure_ptr);
    uVar5 = fp->_flags;
  }
  else {
    uVar5 = fp->_flags;
  }
  if ((uVar5 & 8) == 0) {
                    /* Unresolved local var: _func__fpos_t_void_ptr__fpos_t_int * seekfn@[???] */
    fp->_flags = uVar5 | 0x800;
    if (fp->_r < 1) {
      if (fp->_ur < 1) {
        return 0;
      }
      p_Var8 = fp->_seek;
    }
    else {
      p_Var8 = fp->_seek;
    }
    if (p_Var8 != (_func__fpos_t_void_ptr__fpos_t_int *)0x0) {
                    /* Unresolved local var: _fpos_t curoff@[???] */
      if ((uVar5 & 0x1000) == 0) {
        _Var4 = (*p_Var8)(fp->_cookie,0,1);
        if (_Var4 == -1) {
          return 0;
        }
        uVar5 = fp->_flags;
      }
      else {
        _Var4 = fp->_offset;
        uVar5 = fp->_flags;
      }
      if (((uVar5 & 4) != 0) && (_Var4 = _Var4 - fp->_r, (fp->_ub)._base != (uchar *)0x0)) {
        _Var4 = _Var4 - fp->_ur;
      }
      _Var1 = (*p_Var8)(fp->_cookie,_Var4,0);
      if (_Var1 != -1) {
        uVar5 = fp->_flags;
        puVar7 = (fp->_bf)._base;
        fp->_r = 0;
        fp->_flags = uVar5 & 0xf7ff;
        fp->_p = puVar7;
        if ((uVar5 & 0x1000) != 0) {
          fp->_offset = _Var4;
          return 0;
        }
      }
    }
  }
  else {
    puVar7 = (fp->_bf)._base;
    if (puVar7 != (uchar *)0x0) {
      puVar2 = fp->_p;
      fp->_p = puVar7;
      iVar6 = (int)puVar2 - (int)puVar7;
      if ((uVar5 & 3) == 0) {
        fp->_w = (fp->_bf)._size;
      }
      else {
        fp->_w = 0;
      }
      while (0 < iVar6) {
        iVar3 = (*fp->_write)(fp->_cookie,(char *)puVar7,iVar6);
        puVar7 = puVar7 + iVar3;
        iVar6 = iVar6 - iVar3;
        if (iVar3 < 1) {
          fp->_flags = fp->_flags | 0x40;
          return -1;
        }
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: fgetc @ 08983f30

int fgetc(FILE *fp)

{
  byte bVar1;
  int iVar2;
  
                    /* Unresolved local var: int result@[???] */
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  else {
    __sinit(_impure_ptr);
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  if (-1 < iVar2) {
    bVar1 = *fp->_p;
    fp->_p = fp->_p + 1;
    return (uint)bVar1;
  }
  iVar2 = __srget_r(_impure_ptr,fp);
  return iVar2;
}



----------------------------------------

// Function: _fgetc_r @ 08983fc0

int _fgetc_r(_reent *ptr,FILE *fp)

{
  byte bVar1;
  int iVar2;
  
                    /* Unresolved local var: int result@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  else {
    __sinit(ptr);
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  if (-1 < iVar2) {
    bVar1 = *fp->_p;
    fp->_p = fp->_p + 1;
    return (uint)bVar1;
  }
  iVar2 = __srget_r(ptr,fp);
  return iVar2;
}



----------------------------------------

// Function: _fgets_r @ 08984058

char * _fgets_r(_reent *ptr,char *buf,int n,FILE *fp)

{
  uint uVar1;
  int iVar2;
  void *pvVar3;
  uint length;
  size_t len0;
  uchar *src_void;
  uint uVar4;
  char *dst0;
  char *pcVar5;
  
                    /* Unresolved local var: size_t len@[???]
                       Unresolved local var: char * s@[???]
                       Unresolved local var: uchar * p@[???]
                       Unresolved local var: uchar * t@[???] */
  if (n < 2) {
    return (char *)0x0;
  }
  uVar4 = n - 1;
  dst0 = buf;
  if ((ptr != (_reent *)0x0) && (ptr->__sdidinit == 0)) {
    uVar4 = n - 1;
    __sinit(ptr);
  }
  while( true ) {
    uVar1 = fp->_r;
    if (uVar1 == 0) {
      iVar2 = __srefill_r(ptr,fp);
      if (iVar2 != 0) {
        if (dst0 != buf) {
          *dst0 = '\0';
          return buf;
        }
        return (char *)0x0;
      }
      uVar1 = fp->_r;
    }
    src_void = fp->_p;
    length = uVar4;
    if (uVar1 <= uVar4) {
      length = uVar1;
    }
    pvVar3 = memchr(src_void,10,length);
    if (pvVar3 != (void *)0x0) break;
    pcVar5 = dst0 + length;
    fp->_p = fp->_p + length;
    fp->_r = fp->_r - length;
    memcpy(dst0,src_void,length);
    uVar4 = uVar4 - length;
    dst0 = pcVar5;
    if (uVar4 == 0) {
      *pcVar5 = '\0';
      return buf;
    }
  }
  len0 = ((int)pvVar3 + 1) - (int)src_void;
  fp->_p = (uchar *)((int)pvVar3 + 1);
  fp->_r = fp->_r - len0;
  memcpy(dst0,src_void,len0);
  dst0[len0] = '\0';
  return buf;
}



----------------------------------------

// Function: fgets @ 08984208

char * fgets(char *buf,int n,FILE *fp)

{
  char *pcVar1;
  
  pcVar1 = _fgets_r(_impure_ptr,buf,n,fp);
  return pcVar1;
}



----------------------------------------

// Function: std @ 08984228

void std(FILE *ptr,int flags,int file,_reent *data)

{
  ptr->_close = __sclose;
  ptr->_read = __sread;
  ptr->_flags = (short)flags;
  ptr->_file = (short)file;
  ptr->_write = __swrite;
  ptr->_seek = __sseek;
  ptr->_p = (uchar *)0x0;
  ptr->_r = 0;
  ptr->_w = 0;
  (ptr->_bf)._base = (uchar *)0x0;
  (ptr->_bf)._size = 0;
  ptr->_lbfsize = 0;
  ptr->_cookie = ptr;
  return;
}



----------------------------------------

// Function: __sfp_lock_acquire @ 08984280

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __sfp_lock_acquire(void)

{
  return;
}



----------------------------------------

// Function: __sfp_lock_release @ 08984288

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __sfp_lock_release(void)

{
  return;
}



----------------------------------------

// Function: __sinit_lock_acquire @ 08984290

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __sinit_lock_acquire(void)

{
  return;
}



----------------------------------------

// Function: __sinit_lock_release @ 08984298

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __sinit_lock_release(void)

{
  return;
}



----------------------------------------

// Function: __sinit @ 089842a0

void __sinit(_reent *s)

{
  FILE *ptr;
  
  if (s->__sdidinit != 0) {
    return;
  }
  ptr = s->_stdin;
  s->__cleanup = _cleanup_r;
  s->__sdidinit = 1;
  (s->__sglue)._niobs = 3;
  (s->__sglue)._iobs = s->__sf;
  (s->__sglue)._next = (_glue *)0x0;
  std(ptr,4,0,s);
  std(s->_stdout,8,1,s);
  std(s->_stderr,10,2,s);
  return;
}



----------------------------------------

// Function: __fp_lock @ 08984338

int __fp_lock(FILE *ptr)

{
  return 0;
}



----------------------------------------

// Function: __fp_unlock @ 08984340

int __fp_unlock(FILE *ptr)

{
  return 0;
}



----------------------------------------

// Function: __fp_unlock_all @ 08984348

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __fp_unlock_all(void)

{
  _fwalk(_impure_ptr,__fp_unlock);
  return;
}



----------------------------------------

// Function: __fp_lock_all @ 08984360

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __fp_lock_all(void)

{
  _fwalk(_impure_ptr,__fp_lock);
  return;
}



----------------------------------------

// Function: _cleanup_r @ 08984378

void _cleanup_r(_reent *ptr)

{
  _fwalk(ptr,fclose);
  return;
}



----------------------------------------

// Function: _cleanup @ 08984388

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _cleanup(void)

{
  _cleanup_r(_global_impure_ptr);
  return;
}



----------------------------------------

// Function: __sfmoreglue @ 08984398

_glue * __sfmoreglue(_reent *d,int n)

{
  _glue *p_Var1;
  _glue *p_Var2;
  
                    /* Unresolved local var: _glue * g@[???]
                       Unresolved local var: FILE * p@[???] */
  p_Var1 = _malloc_r(d,n * 0x5c + 0xc);
  p_Var2 = (_glue *)0x0;
  if (p_Var1 != (_glue *)0x0) {
    p_Var1->_niobs = n;
    p_Var1->_next = (_glue *)0x0;
    p_Var1->_iobs = (__FILE *)(p_Var1 + 1);
    memset((__FILE *)(p_Var1 + 1),0,n * 0x5c);
    p_Var2 = p_Var1;
  }
  return p_Var2;
}



----------------------------------------

// Function: __sfp @ 08984408

FILE * __sfp(_reent *d)

{
  short sVar1;
  __FILE *p_Var2;
  _reent *p_Var3;
  _glue *p_Var4;
  int iVar5;
  int iVar6;
  _glue *p_Var7;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: _glue * g@[???] */
  p_Var3 = _global_impure_ptr;
  if (_global_impure_ptr->__sdidinit == 0) {
    __sinit(_global_impure_ptr);
    p_Var4 = &p_Var3->__sglue;
  }
  else {
    p_Var4 = &_global_impure_ptr->__sglue;
  }
  do {
    do {
      p_Var7 = p_Var4;
      iVar6 = p_Var7->_niobs + -1;
      if (-1 < iVar6) {
        sVar1 = p_Var7->_iobs->_flags;
        iVar5 = 0;
        p_Var2 = p_Var7->_iobs;
        while( true ) {
          if (sVar1 == 0) {
            p_Var2->_file = -1;
            p_Var2->_flags = 1;
            p_Var2->_p = (uchar *)0x0;
            p_Var2->_w = 0;
            p_Var2->_r = 0;
            (p_Var2->_bf)._base = (uchar *)0x0;
            (p_Var2->_bf)._size = 0;
            p_Var2->_lbfsize = 0;
            (p_Var2->_ub)._base = (uchar *)0x0;
            (p_Var2->_ub)._size = 0;
            (p_Var2->_lb)._base = (uchar *)0x0;
            (p_Var2->_lb)._size = 0;
            return p_Var2;
          }
          if (iVar5 == iVar6) break;
          sVar1 = p_Var2[1]._flags;
          iVar5 = iVar5 + 1;
          p_Var2 = p_Var2 + 1;
        }
      }
      p_Var4 = p_Var7->_next;
    } while (p_Var7->_next != (_glue *)0x0);
    p_Var4 = __sfmoreglue(d,4);
    p_Var7->_next = p_Var4;
  } while (p_Var4 != (_glue *)0x0);
  d->_errno = 0xc;
  return (FILE *)0x0;
}



----------------------------------------

// Function: _fopen_r @ 089844fc

FILE * _fopen_r(_reent *ptr,char *file,char *mode)

{
  uint uVar1;
  int iVar2;
  FILE *fp;
  int local_20 [2];
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int f@[???]
                       Unresolved local var: int flags@[???]
                       Unresolved local var: int oflags@[???] */
  uVar1 = __sflags(ptr,mode,local_20);
  fp = (FILE *)0x0;
  if ((uVar1 != 0) && (fp = __sfp(ptr), fp != (FILE *)0x0)) {
    iVar2 = _open_r(ptr,file,local_20[0],0x1b6);
    if (iVar2 < 0) {
      __sfp_lock_acquire();
      fp->_flags = 0;
      __sfp_lock_release();
      fp = (FILE *)0x0;
    }
    else {
      fp->_file = (short)iVar2;
      fp->_read = __sread;
      fp->_write = __swrite;
      fp->_flags = (short)uVar1;
      fp->_seek = __sseek;
      fp->_close = __sclose;
      fp->_cookie = fp;
      if ((uVar1 & 0x100) != 0) {
        _fseek_r(ptr,fp,0,2);
      }
    }
  }
  return fp;
}



----------------------------------------

// Function: fopen @ 08984600

FILE * fopen(char *file,char *mode)

{
  FILE *pFVar1;
  
  pFVar1 = _fopen_r(_impure_ptr,file,mode);
  return pFVar1;
}



----------------------------------------

// Function: fputc @ 08984618

int fputc(int ch,FILE *file)

{
  int iVar1;
  
                    /* Unresolved local var: int result@[???] */
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
    iVar1 = _putc_r(_impure_ptr,ch,file);
    return iVar1;
  }
  iVar1 = _putc_r(_impure_ptr,ch,file);
  return iVar1;
}



----------------------------------------

// Function: _fputc_r @ 08984698

int _fputc_r(_reent *ptr,int ch,FILE *file)

{
  int iVar1;
  
                    /* Unresolved local var: int result@[???] */
  if ((ptr != (_reent *)0x0) && (ptr->__sdidinit == 0)) {
    __sinit(ptr);
    iVar1 = _putc_r(ptr,ch,file);
    return iVar1;
  }
  iVar1 = _putc_r(ptr,ch,file);
  return iVar1;
}



----------------------------------------

// Function: _fread_r @ 08984718

size_t _fread_r(_reent *ptr,void *buf,size_t size,size_t count,FILE *fp)

{
  ushort uVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  uchar *puVar5;
  uchar *puVar6;
  FILE *in_t0;
  uint len0;
  int iVar7;
  uint len0_00;
  void *pvVar8;
  uchar *puVar9;
  
                    /* Unresolved local var: size_t resid@[???]
                       Unresolved local var: char * p@[???]
                       Unresolved local var: int r@[???]
                       Unresolved local var: size_t total@[???] */
  uVar2 = count * size;
  if (uVar2 == 0) {
    return 0;
  }
  if (ptr == (_reent *)0x0) {
    len0 = in_t0->_r;
LAB_0898477c:
    if ((int)len0 < 0) goto LAB_08984954;
  }
  else {
    if (ptr->__sdidinit != 0) {
      len0 = in_t0->_r;
      goto LAB_0898477c;
    }
    __sinit(ptr);
    len0 = in_t0->_r;
    if (-1 < (int)len0) {
      uVar1 = in_t0->_flags;
      goto LAB_08984788;
    }
LAB_08984954:
    len0 = 0;
    in_t0->_r = 0;
  }
  uVar1 = in_t0->_flags;
LAB_08984788:
  len0_00 = uVar2;
  if ((uVar1 & 2) == 0) {
    while( true ) {
      if (len0_00 <= len0) {
        memcpy(buf,in_t0->_p,len0_00);
        in_t0->_p = in_t0->_p + len0_00;
        in_t0->_r = in_t0->_r - len0_00;
        return count;
      }
      pvVar8 = (void *)((int)buf + len0);
      len0_00 = len0_00 - len0;
      memcpy(buf,in_t0->_p,len0);
      in_t0->_p = in_t0->_p + len0;
      iVar3 = __srefill_r(ptr,in_t0);
      if (iVar3 != 0) break;
      len0 = in_t0->_r;
      buf = pvVar8;
    }
    if (size == 0) {
      trap(7);
    }
LAB_089847f0:
    count = (uVar2 - len0_00) / size;
  }
  else {
                    /* Unresolved local var: int copy_size@[???] */
    if (uVar2 <= len0) {
      len0 = uVar2;
    }
    memcpy(buf,in_t0->_p,len0);
    puVar5 = (in_t0->_ub)._base;
    puVar6 = in_t0->_p + len0;
    puVar9 = (uchar *)((int)buf + len0);
    in_t0->_r = in_t0->_r - len0;
    in_t0->_p = puVar6;
    len0_00 = uVar2 - len0;
    if (puVar5 == (uchar *)0x0) goto LAB_08984898;
    if (len0_00 != 0) {
      if (puVar5 == in_t0->_ubuf) {
        (in_t0->_ub)._base = (uchar *)0x0;
      }
      else {
        _free_r(_impure_ptr,puVar5);
        puVar6 = in_t0->_p;
        (in_t0->_ub)._base = (uchar *)0x0;
      }
      do {
                    /* Unresolved local var: int rc@[???]
                       Unresolved local var: void * old_base@[???]
                       Unresolved local var: void * old_p@[???]
                       Unresolved local var: int old_size@[???] */
        puVar5 = (in_t0->_bf)._base;
        iVar7 = (in_t0->_bf)._size;
        in_t0->_p = puVar9;
        (in_t0->_bf)._base = puVar9;
        (in_t0->_bf)._size = len0_00;
        iVar3 = __srefill_r(ptr,in_t0);
        iVar4 = in_t0->_r;
        (in_t0->_bf)._base = puVar5;
        (in_t0->_bf)._size = iVar7;
        puVar9 = puVar9 + iVar4;
        in_t0->_p = puVar6;
        len0_00 = len0_00 - iVar4;
        in_t0->_r = 0;
        if (iVar3 != 0) {
          if (size == 0) {
            trap(7);
          }
          goto LAB_089847f0;
        }
LAB_08984898:
      } while (len0_00 != 0);
    }
  }
  return count;
}



----------------------------------------

// Function: fread @ 089849b4

size_t fread(void *buf,size_t size,size_t count,FILE *fp)

{
  size_t sVar1;
  FILE *in_stack_00000010;
  
  sVar1 = _fread_r(_impure_ptr,buf,size,count,in_stack_00000010);
  return sVar1;
}



----------------------------------------

// Function: _malloc_trim_r @ 089849dc

int _malloc_trim_r(_reent *reent_ptr,size_t pad)

{
  void *pvVar1;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: long top_size@[???]
                       Unresolved local var: long extra@[???]
                       Unresolved local var: char * current_brk@[???]
                       Unresolved local var: char * new_brk@[???]
                       Unresolved local var: ulong pagesz@[???] */
  __malloc_lock(reent_ptr);
  uVar3 = __malloc_av_[2]->size & 0xfffffffc;
  iVar2 = ((uVar3 - pad) + 0xfef >> 0xc) - 1;
  if (0xfff < iVar2 * 0x1000) {
    pvVar1 = _sbrk_r(reent_ptr,0);
    if (pvVar1 == (void *)((int)&__malloc_av_[2]->prev_size + uVar3)) {
      pvVar1 = _sbrk_r(reent_ptr,iVar2 * -0x1000);
      if (pvVar1 != (void *)0xffffffff) {
        __malloc_av_[2]->size = uVar3 + iVar2 * -0x1000 | 1;
        __malloc_current_mallinfo.arena = __malloc_current_mallinfo.arena + iVar2 * -0x1000;
        __malloc_unlock(reent_ptr);
        return 1;
      }
      pvVar1 = _sbrk_r(reent_ptr,0);
      if (0xf < (int)pvVar1 - (int)__malloc_av_[2]) {
        __malloc_current_mallinfo.arena = (int)pvVar1 - (int)__malloc_sbrk_base;
        __malloc_av_[2]->size = (int)pvVar1 - (int)__malloc_av_[2] | 1;
      }
    }
  }
  __malloc_unlock(reent_ptr);
  return 0;
}



----------------------------------------

// Function: _free_r @ 08984b0c

/* WARNING: Removing unreachable block (ram,0x08984dac) */
/* WARNING: Removing unreachable block (ram,0x08984ca0) */

void _free_r(_reent *reent_ptr,void *mem)

{
  bool bVar1;
  malloc_chunk *pmVar2;
  int iVar3;
  mbinptr pmVar4;
  uint uVar5;
  malloc_chunk *pmVar6;
  uint uVar7;
  uint uVar8;
  malloc_chunk *pmVar9;
  
                    /* Unresolved local var: mchunkptr p@[???]
                       Unresolved local var: size_t hd@[???]
                       Unresolved local var: size_t sz@[???]
                       Unresolved local var: int idx@[???]
                       Unresolved local var: mchunkptr next@[???]
                       Unresolved local var: size_t nextsz@[???]
                       Unresolved local var: size_t prevsz@[???]
                       Unresolved local var: mchunkptr bck@[???]
                       Unresolved local var: mchunkptr fwd@[???]
                       Unresolved local var: int islr@[???] */
  if (mem == (void *)0x0) {
    return;
  }
  __malloc_lock(reent_ptr);
  pmVar9 = (malloc_chunk *)((int)mem + -8);
  uVar5 = *(uint *)((int)mem + -4);
  uVar7 = uVar5 & 0xfffffffe;
  pmVar4 = (mbinptr)((int)&pmVar9->prev_size + uVar7);
  uVar8 = pmVar4->size & 0xfffffffc;
  if (pmVar4 == __malloc_av_[2]) {
    uVar7 = uVar7 + uVar8;
    if ((uVar5 & 1) == 0) {
      pmVar9 = (malloc_chunk *)((int)pmVar9 - *(int *)((int)mem + -8));
      pmVar2 = pmVar9->bk;
      pmVar6 = pmVar9->fd;
      uVar7 = uVar7 + *(int *)((int)mem + -8);
      pmVar2->fd = pmVar6;
      pmVar6->bk = pmVar2;
    }
    bVar1 = __malloc_trim_threshold <= uVar7;
    __malloc_av_[2] = pmVar9;
    pmVar9->size = uVar7 | 1;
    if (bVar1) {
      _malloc_trim_r(reent_ptr,__malloc_top_pad);
    }
  }
  else {
    pmVar4->size = uVar8;
    if ((uVar5 & 1) == 0) {
      pmVar9 = (malloc_chunk *)((int)pmVar9 - *(int *)((int)mem + -8));
      pmVar6 = pmVar9->fd;
      uVar7 = uVar7 + *(int *)((int)mem + -8);
      if (pmVar6 == (malloc_chunk *)(__malloc_av_ + 2)) {
        bVar1 = true;
      }
      else {
        pmVar2 = pmVar9->bk;
        bVar1 = false;
        pmVar2->fd = pmVar6;
        pmVar6->bk = pmVar2;
      }
    }
    else {
      bVar1 = false;
    }
    if ((*(uint *)((int)&pmVar4->size + uVar8) & 1) == 0) {
      uVar7 = uVar7 + uVar8;
      if (bVar1) {
        pmVar6 = pmVar4->fd;
      }
      else {
        pmVar6 = pmVar4->fd;
        if (pmVar6 == (malloc_chunk *)(__malloc_av_ + 2)) {
          __malloc_av_[4] = pmVar9;
          __malloc_av_[5] = pmVar9;
          *(uint *)((int)&pmVar9->prev_size + uVar7) = uVar7;
          pmVar9->size = uVar7 | 1;
          pmVar9->fd = (malloc_chunk *)(__malloc_av_ + 2);
          pmVar9->bk = (malloc_chunk *)(__malloc_av_ + 2);
          goto LAB_08984c34;
        }
      }
      pmVar2 = pmVar4->bk;
      pmVar2->fd = pmVar6;
      pmVar6->bk = pmVar2;
    }
    pmVar9->size = uVar7 | 1;
    *(uint *)((int)&pmVar9->prev_size + uVar7) = uVar7;
    if (!bVar1) {
      uVar5 = uVar7 >> 3;
      if (uVar7 < 0x200) {
        pmVar4 = __malloc_av_[uVar5 * 2 + 2];
        pmVar9->bk = (malloc_chunk *)(__malloc_av_ + uVar5 * 2);
        pmVar9->fd = pmVar4;
        __malloc_av_[uVar5 * 2 + 2] = pmVar9;
        pmVar4->bk = pmVar9;
        __malloc_av_[1] = (mbinptr)((uint)__malloc_av_[1] | 1 << (uVar5 / 4 & 0x1f));
        __malloc_unlock(reent_ptr);
        return;
      }
      uVar5 = uVar7 >> 9;
      if (uVar5 == 0) {
        uVar5 = uVar7 >> 3;
        iVar3 = uVar5 << 3;
      }
      else if (uVar5 < 5) {
        uVar5 = (uVar7 >> 6) + 0x38;
        iVar3 = uVar5 * 8;
      }
      else if (uVar5 < 0x15) {
        uVar5 = uVar5 + 0x5b;
        iVar3 = uVar5 * 8;
      }
      else if (uVar5 < 0x55) {
        uVar5 = (uVar7 >> 0xc) + 0x6e;
        iVar3 = uVar5 * 8;
      }
      else if (uVar5 < 0x155) {
        uVar5 = (uVar7 >> 0xf) + 0x77;
        iVar3 = uVar5 * 8;
      }
      else if (uVar5 < 0x555) {
        uVar5 = (uVar7 >> 0x12) + 0x7c;
        iVar3 = uVar5 * 8;
      }
      else {
        uVar5 = 0x7e;
        iVar3 = 0x3f0;
      }
      pmVar2 = (malloc_chunk *)((int)__malloc_av_ + iVar3);
      pmVar6 = *(malloc_chunk **)((int)__malloc_av_ + iVar3 + 8);
      if (pmVar2 == pmVar6) {
        __malloc_av_[1] = (mbinptr)((uint)__malloc_av_[1] | 1 << (uVar5 / 4 & 0x1f));
      }
      else {
        uVar5 = pmVar6->size;
        while (uVar7 < (uVar5 & 0xfffffffc)) {
          pmVar6 = pmVar6->fd;
          if (pmVar2 == pmVar6) {
            pmVar2 = pmVar6->bk;
            goto LAB_08984c20;
          }
          uVar5 = pmVar6->size;
        }
        pmVar2 = pmVar6->bk;
      }
LAB_08984c20:
      pmVar9->bk = pmVar2;
      pmVar9->fd = pmVar6;
      pmVar6->bk = pmVar9;
      pmVar2->fd = pmVar9;
    }
  }
LAB_08984c34:
  __malloc_unlock(reent_ptr);
  return;
}



----------------------------------------

// Function: _fseek_r @ 08984e20

int _fseek_r(_reent *ptr,FILE *fp,long offset,int whence)

{
  bool bVar1;
  ushort uVar2;
  int iVar3;
  int iVar4;
  _fpos_t _Var5;
  uchar *puVar6;
  uchar *puVar7;
  uchar *puVar8;
  int iVar9;
  uchar *puVar10;
  uint uVar11;
  _func__fpos_t_void_ptr__fpos_t_int *p_Var12;
  stat sStack_68;
  
                    /* Unresolved local var: _func__fpos_t_void_ptr__fpos_t_int * seekfn@[???]
                       Unresolved local var: _fpos_t target@[???]
                       Unresolved local var: _fpos_t curoff@[???]
                       Unresolved local var: size_t n@[???]
                       Unresolved local var: stat st@[???]
                       Unresolved local var: int havepos@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    if ((fp->_flags & 0x108U) == 0x108) goto LAB_089850cc;
    p_Var12 = fp->_seek;
  }
  else {
    __sinit(ptr);
    if ((fp->_flags & 0x108U) == 0x108) {
LAB_089850cc:
      fflush(fp);
      p_Var12 = fp->_seek;
    }
    else {
      p_Var12 = fp->_seek;
    }
  }
  if (p_Var12 == (_func__fpos_t_void_ptr__fpos_t_int *)0x0) {
    ptr->_errno = 0x1d;
    return -1;
  }
  if (whence == 1) {
    fflush(fp);
    uVar2 = fp->_flags;
    if ((uVar2 & 0x1000) == 0) {
      puVar10 = (uchar *)(*p_Var12)(fp->_cookie,0,1);
      if (puVar10 == (uchar *)0xffffffff) {
        return -1;
      }
      uVar2 = fp->_flags;
    }
    else {
      puVar10 = (uchar *)fp->_offset;
    }
    if ((uVar2 & 4) == 0) {
      puVar7 = (fp->_bf)._base;
      if (((uVar2 & 8) != 0) && (fp->_p != (uchar *)0x0)) {
        puVar10 = fp->_p + ((int)puVar10 - (int)puVar7);
      }
    }
    else {
      puVar10 = puVar10 + -fp->_r;
      if ((fp->_ub)._base == (uchar *)0x0) {
        puVar7 = (fp->_bf)._base;
      }
      else {
        puVar7 = (fp->_bf)._base;
        puVar10 = puVar10 + -fp->_ur;
      }
    }
    offset = (long)(puVar10 + offset);
    whence = 0;
    bVar1 = true;
  }
  else {
    if (whence == 2) {
      puVar7 = (fp->_bf)._base;
    }
    else {
      if (whence != 0) {
        ptr->_errno = 0x16;
        return -1;
      }
      puVar7 = (fp->_bf)._base;
    }
    puVar10 = (uchar *)0x0;
    bVar1 = false;
  }
  if (puVar7 == (uchar *)0x0) {
    __smakebuf(fp);
    uVar2 = fp->_flags;
  }
  else {
    uVar2 = fp->_flags;
  }
  if ((uVar2 & 0x81a) != 0) goto LAB_08984f20;
  if ((uVar2 & 0x400) == 0) {
    if ((p_Var12 == __sseek) && (-1 < fp->_file)) {
      iVar3 = _fstat_r(ptr,(int)fp->_file,&sStack_68);
      if (iVar3 == 0) {
        uVar2 = fp->_flags;
        if ((sStack_68.st_mode & 0xf000) == 0x8000) {
          fp->_blksize = 0x400;
          fp->_flags = uVar2 | 0x400;
          goto LAB_08984fa0;
        }
      }
      else {
        uVar2 = fp->_flags;
      }
    }
    else {
      uVar2 = fp->_flags;
    }
    fp->_flags = uVar2 | 0x800;
    goto LAB_08984f20;
  }
LAB_08984fa0:
  if (whence == 0) {
    puVar7 = (uchar *)offset;
    if (!bVar1) {
      uVar2 = fp->_flags;
      goto LAB_08984fb4;
    }
LAB_089850dc:
    puVar6 = (fp->_ub)._base;
    uVar2 = fp->_flags;
    if (puVar6 == (uchar *)0x0) {
      iVar3 = fp->_r;
      goto LAB_08985210;
    }
    iVar3 = fp->_r;
    iVar9 = fp->_ur;
LAB_08984fdc:
    puVar8 = (fp->_bf)._base;
    iVar4 = (int)fp->_up - (int)puVar8;
    iVar9 = iVar4 + iVar9;
    puVar10 = puVar10 + (iVar3 - iVar4);
  }
  else {
    iVar3 = _fstat_r(ptr,(int)fp->_file,&sStack_68);
    if (iVar3 != 0) goto LAB_08984f20;
    puVar7 = (uchar *)(offset + sStack_68.st_size);
    if (bVar1) goto LAB_089850dc;
    uVar2 = fp->_flags;
LAB_08984fb4:
    if ((uVar2 & 0x1000) == 0) {
      _Var5 = (*p_Var12)(fp->_cookie,0,1);
      if (_Var5 == -1) goto LAB_08984f20;
      uVar2 = fp->_flags;
    }
    else {
      _Var5 = fp->_offset;
    }
    iVar3 = fp->_r;
    puVar6 = (fp->_ub)._base;
    puVar10 = (uchar *)(_Var5 - iVar3);
    if (puVar6 != (uchar *)0x0) {
      iVar9 = fp->_ur;
      puVar10 = puVar10 + -iVar9;
      goto LAB_08984fdc;
    }
LAB_08985210:
    puVar8 = (fp->_bf)._base;
    iVar4 = (int)fp->_p - (int)puVar8;
    iVar9 = iVar4 + iVar3;
    puVar10 = puVar10 + -iVar4;
  }
  if ((uVar2 & 0x2000) == 0) {
    if ((int)puVar7 < (int)puVar10) {
      iVar3 = fp->_blksize;
    }
    else {
      if (puVar7 < puVar10 + iVar9) {
                    /* Unresolved local var: int o@[???] */
        fp->_p = puVar8 + ((int)puVar7 - (int)puVar10);
        fp->_r = iVar9 - ((int)puVar7 - (int)puVar10);
        if (puVar6 != (uchar *)0x0) {
          if (puVar6 == fp->_ubuf) {
            (fp->_ub)._base = (uchar *)0x0;
          }
          else {
            _free_r(_impure_ptr,puVar6);
            (fp->_ub)._base = (uchar *)0x0;
          }
        }
        fp->_flags = fp->_flags & 0xffdf;
        return 0;
      }
      iVar3 = fp->_blksize;
    }
  }
  else {
    iVar3 = fp->_blksize;
  }
  _Var5 = (*p_Var12)(fp->_cookie,(uint)puVar7 & -iVar3,0);
  if (_Var5 != -1) {
    puVar10 = (fp->_bf)._base;
    puVar6 = (fp->_ub)._base;
    fp->_r = 0;
    fp->_p = puVar10;
    if (puVar6 != (uchar *)0x0) {
      if (puVar6 == fp->_ubuf) {
        (fp->_ub)._base = (uchar *)0x0;
      }
      else {
        _free_r(_impure_ptr,puVar6);
        (fp->_ub)._base = (uchar *)0x0;
      }
    }
    uVar11 = (int)puVar7 - ((uint)puVar7 & -iVar3);
    fp->_flags = fp->_flags & 0xffdf;
    if (uVar11 == 0) {
      return 0;
    }
    iVar3 = __srefill_r(ptr,fp);
    if ((iVar3 == 0) && (uVar11 <= (uint)fp->_r)) {
      fp->_r = fp->_r - uVar11;
      fp->_p = fp->_p + uVar11;
      return 0;
    }
  }
LAB_08984f20:
  iVar3 = fflush(fp);
  if ((iVar3 == 0) && (_Var5 = (*p_Var12)(fp->_cookie,offset,whence), _Var5 != -1)) {
    puVar10 = (fp->_ub)._base;
    if (puVar10 != (uchar *)0x0) {
      if (puVar10 == fp->_ubuf) {
        (fp->_ub)._base = (uchar *)0x0;
      }
      else {
        _free_r(_impure_ptr,puVar10);
        (fp->_ub)._base = (uchar *)0x0;
      }
    }
    puVar10 = (fp->_bf)._base;
    fp->_flags = fp->_flags & 0xf7df;
    fp->_p = puVar10;
    fp->_r = 0;
    return 0;
  }
  return -1;
}



----------------------------------------

// Function: fseek @ 089852e0

int fseek(FILE *fp,long offset,int whence)

{
  int iVar1;
  
  iVar1 = _fseek_r(_impure_ptr,fp,offset,whence);
  return iVar1;
}



----------------------------------------

// Function: _fstat_r @ 08985300

int _fstat_r(_reent *ptr,int fd,stat *pstat)

{
  int iVar1;
  
                    /* Unresolved local var: int ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _fstat(fd,pstat);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: _ftell_r @ 0898536c

long _ftell_r(_reent *ptr,FILE *fp)

{
  ushort uVar1;
  _func__fpos_t_void_ptr__fpos_t_int *p_Var2;
  _fpos_t _Var3;
  
                    /* Unresolved local var: _fpos_t pos@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    p_Var2 = fp->_seek;
  }
  else {
    __sinit(ptr);
    p_Var2 = fp->_seek;
  }
  if (p_Var2 == (_func__fpos_t_void_ptr__fpos_t_int *)0x0) {
    _Var3 = -1;
    ptr->_errno = 0x1d;
  }
  else {
    fflush(fp);
    uVar1 = fp->_flags;
    if ((uVar1 & 0x1000) == 0) {
      _Var3 = (*fp->_seek)(fp->_cookie,0,1);
      if (_Var3 == -1) {
        return -1;
      }
      uVar1 = fp->_flags;
    }
    else {
      _Var3 = fp->_offset;
    }
    if ((uVar1 & 4) == 0) {
      if (((uVar1 & 8) != 0) && (fp->_p != (uchar *)0x0)) {
        return (long)(fp->_p + (_Var3 - (int)(fp->_bf)._base));
      }
    }
    else {
      _Var3 = _Var3 - fp->_r;
      if ((fp->_ub)._base != (uchar *)0x0) {
        _Var3 = _Var3 - fp->_ur;
      }
    }
  }
  return _Var3;
}



----------------------------------------

// Function: ftell @ 0898546c

long ftell(FILE *fp)

{
  long lVar1;
  
  lVar1 = _ftell_r(_impure_ptr,fp);
  return lVar1;
}



----------------------------------------

// Function: _fwalk_reent @ 08985480

int _fwalk_reent(_reent *ptr,_func_int__reent_ptr_FILE_ptr *reent_function)

{
  int iVar1;
  uint uVar2;
  FILE *pFVar3;
  int iVar4;
  _glue *p_Var5;
  uint uVar6;
  
                    /* Unresolved local var: int ret@[???] */
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int ret@[???]
                       Unresolved local var: _glue * g@[???] */
  p_Var5 = &ptr->__sglue;
  __sfp_lock_acquire();
  uVar6 = 0;
  if (p_Var5 != (_glue *)0x0) {
    iVar1 = (ptr->__sglue)._niobs;
    while( true ) {
      pFVar3 = p_Var5->_iobs;
      if (-1 < iVar1 + -1) {
        iVar4 = 0;
        while( true ) {
          if ((pFVar3->_flags != 0) && (pFVar3->_file != -1)) {
            uVar2 = (*reent_function)(ptr,pFVar3);
            uVar6 = uVar6 | uVar2;
          }
          pFVar3 = pFVar3 + 1;
          if (iVar1 + -1 == iVar4) break;
          iVar4 = iVar4 + 1;
        }
      }
      p_Var5 = p_Var5->_next;
      if (p_Var5 == (_glue *)0x0) break;
      iVar1 = p_Var5->_niobs;
    }
    __sfp_lock_release();
    return uVar6;
  }
  __sfp_lock_release();
  return 0;
}



----------------------------------------

// Function: _fwalk @ 08985588

int _fwalk(_reent *ptr,_func_int_FILE_ptr *function)

{
  int iVar1;
  uint uVar2;
  FILE *pFVar3;
  int iVar4;
  _glue *p_Var5;
  uint uVar6;
  
                    /* Unresolved local var: int ret@[???] */
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int ret@[???]
                       Unresolved local var: _glue * g@[???] */
  p_Var5 = &ptr->__sglue;
  __sfp_lock_acquire();
  uVar6 = 0;
  if (p_Var5 != (_glue *)0x0) {
    iVar1 = (ptr->__sglue)._niobs;
    while( true ) {
      pFVar3 = p_Var5->_iobs;
      if (-1 < iVar1 + -1) {
        iVar4 = 0;
        while( true ) {
          if ((pFVar3->_flags != 0) && (pFVar3->_file != -1)) {
            uVar2 = (*function)(pFVar3);
            uVar6 = uVar6 | uVar2;
          }
          pFVar3 = pFVar3 + 1;
          if (iVar1 + -1 == iVar4) break;
          iVar4 = iVar4 + 1;
        }
      }
      p_Var5 = p_Var5->_next;
      if (p_Var5 == (_glue *)0x0) break;
      iVar1 = p_Var5->_niobs;
    }
    __sfp_lock_release();
    return uVar6;
  }
  __sfp_lock_release();
  return 0;
}



----------------------------------------

// Function: _fwrite_r @ 08985680

size_t _fwrite_r(_reent *ptr,void *buf,size_t size,size_t count,FILE *fp)

{
  size_t sVar1;
  __siov *p_Var2;
  int iVar3;
  FILE *in_t0;
  __siov local_30;
  __suio local_28;
  
                    /* Unresolved local var: size_t n@[???]
                       Unresolved local var: __suio uio@[???]
                       Unresolved local var: __siov iov@[???] */
  sVar1 = count * size;
  local_28.uio_iov = &local_30;
  local_28.uio_iovcnt = 1;
  local_30.iov_base = buf;
  local_30.iov_len = sVar1;
  p_Var2 = &local_30;
  local_28.uio_resid = sVar1;
  if ((ptr != (_reent *)0x0) && (p_Var2 = &local_30, ptr->__sdidinit == 0)) {
    __sinit(ptr);
    p_Var2 = local_28.uio_iov;
  }
  local_28.uio_iov = p_Var2;
  iVar3 = __sfvwrite_r(ptr,in_t0,&local_28);
  if ((iVar3 != 0) && (count = (sVar1 - local_28.uio_resid) / size, size == 0)) {
    trap(7);
  }
  return count;
}



----------------------------------------

// Function: fwrite @ 0898573c

size_t fwrite(void *buf,size_t size,size_t count,FILE *fp)

{
  size_t sVar1;
  FILE *in_stack_00000010;
  
  sVar1 = _fwrite_r(_impure_ptr,buf,size,count,in_stack_00000010);
  return sVar1;
}



----------------------------------------

// Function: getenv @ 08985764

char * getenv(char *name)

{
  char *pcVar1;
  int aiStack_10 [2];
  
                    /* Unresolved local var: int offset@[???] */
  pcVar1 = _findenv_r(_impure_ptr,name,aiStack_10);
  return pcVar1;
}



----------------------------------------

// Function: _findenv @ 0898578c

char * _findenv(char *name,int *offset)

{
  char *pcVar1;
  
  pcVar1 = _findenv_r(_impure_ptr,name,offset);
  return pcVar1;
}



----------------------------------------

// Function: _findenv_r @ 089857a4

char * _findenv_r(_reent *reent_ptr,char *name,int *offset)

{
  char **ppcVar1;
  int iVar2;
  char *pcVar3;
  size_t n;
  
                    /* Unresolved local var: int len@[???]
                       Unresolved local var: char * * p@[???]
                       Unresolved local var: char * c@[???] */
  __env_lock(reent_ptr);
  if (environ != (char **)0x0) {
    ppcVar1 = environ;
    if ((*name == '\0') || (*name == '=')) {
      n = 0;
LAB_08985820:
      pcVar3 = *environ;
    }
    else {
      n = 0;
      pcVar3 = name;
      do {
        pcVar3 = pcVar3 + 1;
        n = n + 1;
        if (*pcVar3 == '\0') goto LAB_08985820;
      } while (*pcVar3 != '=');
      pcVar3 = *environ;
    }
    while (pcVar3 != (char *)0x0) {
      iVar2 = strncmp(pcVar3,name,n);
      if ((iVar2 == 0) && (pcVar3 = *ppcVar1, pcVar3[n] == '=')) {
        *offset = (int)ppcVar1 - (int)environ >> 2;
        __env_unlock(reent_ptr);
        return pcVar3 + n + 1;
      }
      pcVar3 = ppcVar1[1];
      ppcVar1 = ppcVar1 + 1;
    }
  }
  __env_unlock(reent_ptr);
  return (char *)0x0;
}



----------------------------------------

// Function: _getenv_r @ 089858e4

char * _getenv_r(_reent *reent_ptr,char *name)

{
  char *pcVar1;
  int aiStack_10 [2];
  
                    /* Unresolved local var: int offset@[???] */
  pcVar1 = _findenv_r(reent_ptr,name,aiStack_10);
  return pcVar1;
}



----------------------------------------

// Function: __smakebuf @ 08985900

void __smakebuf(FILE *fp)

{
  bool bVar1;
  ushort uVar2;
  uchar *puVar3;
  int iVar4;
  size_t bytes;
  stat sStack_50;
  
                    /* Unresolved local var: size_t size@[???]
                       Unresolved local var: size_t couldbetty@[???]
                       Unresolved local var: void * p@[???]
                       Unresolved local var: stat st@[???] */
  if ((fp->_flags & 2U) != 0) {
    (fp->_bf)._size = 1;
    (fp->_bf)._base = fp->_nbuf;
    fp->_p = fp->_nbuf;
    return;
  }
  if (fp->_file < 0) {
    uVar2 = fp->_flags;
  }
  else {
    iVar4 = _fstat_r(_impure_ptr,(int)fp->_file,&sStack_50);
    if (-1 < iVar4) {
      bVar1 = (sStack_50.st_mode & 0xf000) == 0x2000;
      if ((sStack_50.st_mode & 0xf000) == 0x8000) {
        uVar2 = fp->_flags;
        if (fp->_seek == __sseek) {
          bytes = 0x400;
          fp->_flags = uVar2 | 0x400;
          fp->_blksize = 0x400;
          goto LAB_089859bc;
        }
      }
      else {
        uVar2 = fp->_flags;
      }
      bytes = 0x400;
      fp->_flags = uVar2 | 0x800;
      goto LAB_089859bc;
    }
    uVar2 = fp->_flags;
  }
  bytes = 0x40;
  if ((uVar2 & 0x80) == 0) {
    bytes = 0x400;
  }
  bVar1 = false;
  fp->_flags = uVar2 | 0x800;
LAB_089859bc:
  puVar3 = _malloc_r(_impure_ptr,bytes);
  if (puVar3 == (uchar *)0x0) {
    uVar2 = fp->_flags;
    (fp->_bf)._size = 1;
    fp->_flags = uVar2 | 2;
    (fp->_bf)._base = fp->_nbuf;
    fp->_p = fp->_nbuf;
  }
  else {
    uVar2 = fp->_flags;
    _impure_ptr->__cleanup = _cleanup_r;
    fp->_flags = uVar2 | 0x80;
    (fp->_bf)._base = puVar3;
    (fp->_bf)._size = bytes;
    fp->_p = puVar3;
    if ((bVar1) && (iVar4 = isatty((int)fp->_file), iVar4 != 0)) {
      fp->_flags = fp->_flags | 1;
      return;
    }
  }
  return;
}



----------------------------------------

// Function: memalign @ 08985a88

void * memalign(size_t align,size_t nbytes)

{
  void *pvVar1;
  
  pvVar1 = _memalign_r(_impure_ptr,align,nbytes);
  return pvVar1;
}



----------------------------------------

// Function: _memalign_r @ 08985aa0

void * _memalign_r(_reent *reent_ptr,size_t alignment,size_t bytes)

{
  bool bVar1;
  void *pvVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  
                    /* Unresolved local var: size_t nb@[???]
                       Unresolved local var: char * m@[???]
                       Unresolved local var: mchunkptr p@[???]
                       Unresolved local var: char * brk@[???]
                       Unresolved local var: mchunkptr newp@[???]
                       Unresolved local var: size_t newsize@[???]
                       Unresolved local var: size_t leadsize@[???]
                       Unresolved local var: mchunkptr remainder@[???]
                       Unresolved local var: long remainder_size@[???] */
  if (alignment < 0x11) {
    pvVar2 = _malloc_r(reent_ptr,bytes);
    return pvVar2;
  }
  if (bytes + 0x13 < 0x1f) {
    uVar7 = 0x10;
    bVar1 = 0x10 < bytes;
  }
  else {
    uVar7 = bytes + 0x13 & 0xfffffff0;
    if ((int)uVar7 < 0) goto LAB_08985aec;
    bVar1 = uVar7 < bytes;
  }
  if (!bVar1) {
    pvVar2 = _malloc_r(reent_ptr,alignment + 0x10 + uVar7);
    if (pvVar2 != (void *)0x0) {
      __malloc_lock(reent_ptr);
      if (alignment == 0) {
        trap(7);
      }
      iVar6 = (int)pvVar2 + -8;
      if ((uint)pvVar2 % alignment != 0) {
        iVar5 = ((int)pvVar2 + (alignment - 1) & -alignment) - 8;
        uVar3 = iVar5 - iVar6;
        if ((int)uVar3 < 0x10) {
          iVar5 = iVar5 + alignment;
          uVar3 = iVar5 - iVar6;
        }
        uVar4 = (*(uint *)((int)pvVar2 + -4) & 0xfffffffc) - uVar3;
        *(uint *)(iVar5 + 4) = uVar4 | 1;
        iVar6 = iVar5 + uVar4;
        *(uint *)(iVar6 + 4) = *(uint *)(iVar6 + 4) | 1;
        *(uint *)((int)pvVar2 + -4) = uVar3 | *(uint *)((int)pvVar2 + -4) & 1;
        _free_r(reent_ptr,pvVar2);
        iVar6 = iVar5;
      }
      uVar3 = (*(uint *)(iVar6 + 4) & 0xfffffffc) - uVar7;
      if (0xf < (int)uVar3) {
        *(uint *)(uVar7 + iVar6 + 4) = uVar3 | 1;
        *(uint *)(iVar6 + 4) = *(uint *)(iVar6 + 4) & 1 | uVar7;
        _free_r(reent_ptr,(void *)(uVar7 + iVar6 + 8));
      }
      __malloc_unlock(reent_ptr);
      return (void *)(iVar6 + 8);
    }
    return (void *)0x0;
  }
LAB_08985aec:
  reent_ptr->_errno = 0xc;
  return (void *)0x0;
}



----------------------------------------

// Function: free @ 08985c58

void free(void *aptr)

{
  _free_r(_impure_ptr,aptr);
  return;
}



----------------------------------------

// Function: malloc @ 08985c6c

void * malloc(size_t nbytes)

{
  void *pvVar1;
  
  pvVar1 = _malloc_r(_impure_ptr,nbytes);
  return pvVar1;
}



----------------------------------------

// Function: _malloc_r @ 08985c80

/* WARNING: Removing unreachable block (ram,0x0898642c) */
/* WARNING: Removing unreachable block (ram,0x08985e90) */
/* WARNING: Removing unreachable block (ram,0x08985ee0) */

void * _malloc_r(_reent *reent_ptr,size_t bytes)

{
  size_t *psVar1;
  mbinptr pmVar2;
  int iVar3;
  uint uVar4;
  void *pvVar5;
  mbinptr pmVar6;
  uint uVar7;
  int iVar8;
  size_t sVar9;
  mbinptr pmVar10;
  uint uVar11;
  mbinptr pmVar12;
  mbinptr pmVar13;
  int iVar14;
  mbinptr pmVar15;
  malloc_chunk *pmVar16;
  uint uVar17;
  int iVar18;
  malloc_chunk *pmVar19;
  mbinptr pmVar20;
  uint uVar21;
  
                    /* Unresolved local var: mchunkptr victim@[???]
                       Unresolved local var: size_t victim_size@[???]
                       Unresolved local var: int idx@[???]
                       Unresolved local var: mbinptr bin@[???]
                       Unresolved local var: mchunkptr remainder@[???]
                       Unresolved local var: long remainder_size@[???]
                       Unresolved local var: int remainder_index@[???]
                       Unresolved local var: ulong block@[???]
                       Unresolved local var: int startidx@[???]
                       Unresolved local var: mchunkptr fwd@[???]
                       Unresolved local var: mchunkptr bck@[???]
                       Unresolved local var: mbinptr q@[???]
                       Unresolved local var: size_t nb@[???] */
  if (bytes + 0x13 < 0x1f) {
    uVar21 = 0x10;
    if (0x10 < bytes) {
LAB_08985cc8:
      reent_ptr->_errno = 0xc;
      return (void *)0x0;
    }
  }
  else {
    uVar21 = bytes + 0x13 & 0xfffffff0;
    if (((int)uVar21 < 0) || (uVar21 < bytes)) goto LAB_08985cc8;
  }
  __malloc_lock(reent_ptr);
  pmVar15 = __malloc_av_[4];
  if (uVar21 < 0x1f8) {
    iVar3 = *(int *)((int)__malloc_av_ + uVar21 + 0xc);
    if ((int)__malloc_av_ + uVar21 != iVar3) {
      iVar18 = *(int *)(iVar3 + 0xc);
      iVar8 = iVar3 + (*(uint *)(iVar3 + 4) & 0xfffffffc);
      iVar14 = *(int *)(iVar3 + 8);
      *(uint *)(iVar8 + 4) = *(uint *)(iVar8 + 4) | 1;
      *(int *)(iVar18 + 8) = iVar14;
      *(int *)(iVar14 + 0xc) = iVar18;
      __malloc_unlock(reent_ptr);
      return (void *)(iVar3 + 8);
    }
    uVar4 = (uVar21 >> 3) + 2;
  }
  else {
    uVar7 = uVar21 >> 9;
    if (uVar7 == 0) {
      uVar7 = uVar21 >> 3;
      iVar3 = uVar7 << 3;
    }
    else if (uVar7 < 5) {
      uVar7 = (uVar21 >> 6) + 0x38;
      iVar3 = uVar7 * 8;
    }
    else if (uVar7 < 0x15) {
      uVar7 = uVar7 + 0x5b;
      iVar3 = uVar7 * 8;
    }
    else if (uVar7 < 0x55) {
      uVar7 = (uVar21 >> 0xc) + 0x6e;
      iVar3 = uVar7 * 8;
    }
    else if (uVar7 < 0x155) {
      uVar7 = (uVar21 >> 0xf) + 0x77;
      iVar3 = uVar7 * 8;
    }
    else if (uVar7 < 0x555) {
      uVar7 = (uVar21 >> 0x12) + 0x7c;
      iVar3 = uVar7 * 8;
    }
    else {
      uVar7 = 0x7e;
      iVar3 = 0x3f0;
    }
    pmVar20 = *(mbinptr *)((int)__malloc_av_ + iVar3 + 0xc);
    if ((malloc_chunk *)((int)__malloc_av_ + iVar3) == pmVar20) {
      uVar4 = uVar7 + 1;
    }
    else {
      do {
        uVar11 = pmVar20->size & 0xfffffffc;
        iVar8 = uVar11 - uVar21;
        uVar4 = uVar7;
        if (0xf < iVar8) break;
        if (-1 < iVar8) {
          iVar3 = (int)&pmVar20->prev_size + uVar11;
LAB_08985fd8:
          pmVar16 = pmVar20->fd;
          pmVar19 = pmVar20->bk;
          *(uint *)(iVar3 + 4) = *(uint *)(iVar3 + 4) | 1;
          pmVar19->fd = pmVar16;
          pmVar16->bk = pmVar19;
          __malloc_unlock(reent_ptr);
          return &pmVar20->fd;
        }
        pmVar20 = pmVar20->bk;
        uVar4 = uVar7 + 1;
      } while ((malloc_chunk *)((int)__malloc_av_ + iVar3) != pmVar20);
    }
  }
  if (__malloc_av_[4] != (mbinptr)(__malloc_av_ + 2)) {
    uVar7 = __malloc_av_[4]->size;
    uVar11 = uVar7 & 0xfffffffc;
    uVar17 = uVar11 - uVar21;
    pmVar20 = (mbinptr)((int)&__malloc_av_[4]->prev_size + uVar21);
    if (0xf < (int)uVar17) {
      __malloc_av_[4]->size = uVar21 | 1;
      *(uint *)((int)pmVar20 + uVar17) = uVar17;
      __malloc_av_[4] = pmVar20;
      __malloc_av_[5] = pmVar20;
      pmVar20->size = uVar17 | 1;
      pmVar20->fd = (malloc_chunk *)(__malloc_av_ + 2);
      pmVar20->bk = (malloc_chunk *)(__malloc_av_ + 2);
      __malloc_unlock(reent_ptr);
      return &pmVar15->fd;
    }
    __malloc_av_[5] = (mbinptr)(__malloc_av_ + 2);
    __malloc_av_[4] = (mbinptr)(__malloc_av_ + 2);
    if (-1 < (int)uVar17) {
      *(uint *)((int)&pmVar15->size + uVar11) = *(uint *)((int)&pmVar15->size + uVar11) | 1;
      __malloc_unlock(reent_ptr);
      return &pmVar15->fd;
    }
    uVar17 = uVar7 >> 9;
    if (uVar11 < 0x200) {
      uVar7 = uVar7 >> 3;
      pmVar20 = __malloc_av_[uVar7 * 2 + 2];
      pmVar15->bk = (malloc_chunk *)(__malloc_av_ + uVar7 * 2);
      pmVar15->fd = pmVar20;
      __malloc_av_[uVar7 * 2 + 2] = pmVar15;
      pmVar20->bk = pmVar15;
      __malloc_av_[1] = (mbinptr)((uint)__malloc_av_[1] | 1 << (uVar7 / 4 & 0x1f));
    }
    else {
      if (uVar17 == 0) {
        uVar7 = uVar7 >> 3;
        iVar3 = uVar7 << 3;
      }
      else if (uVar17 < 5) {
        uVar7 = (uVar7 >> 6) + 0x38;
        iVar3 = uVar7 * 8;
      }
      else if (uVar17 < 0x15) {
        uVar7 = uVar17 + 0x5b;
        iVar3 = uVar7 * 8;
      }
      else if (uVar17 < 0x55) {
        uVar7 = (uVar7 >> 0xc) + 0x6e;
        iVar3 = uVar7 * 8;
      }
      else if (uVar17 < 0x155) {
        uVar7 = (uVar7 >> 0xf) + 0x77;
        iVar3 = uVar7 * 8;
      }
      else if (uVar17 < 0x555) {
        uVar7 = (uVar7 >> 0x12) + 0x7c;
        iVar3 = uVar7 * 8;
      }
      else {
        uVar7 = 0x7e;
        iVar3 = 0x3f0;
      }
      pmVar19 = (malloc_chunk *)((int)__malloc_av_ + iVar3);
      pmVar16 = *(malloc_chunk **)((int)__malloc_av_ + iVar3 + 8);
      if (pmVar19 == pmVar16) {
        __malloc_av_[1] = (mbinptr)((uint)__malloc_av_[1] | 1 << (uVar7 / 4 & 0x1f));
      }
      else {
        uVar7 = pmVar16->size;
        while (uVar11 < (uVar7 & 0xfffffffc)) {
          pmVar16 = pmVar16->fd;
          if (pmVar19 == pmVar16) {
            pmVar19 = pmVar16->bk;
            goto LAB_0898604c;
          }
          uVar7 = pmVar16->size;
        }
        pmVar19 = pmVar16->bk;
      }
LAB_0898604c:
      pmVar15->bk = pmVar19;
      pmVar15->fd = pmVar16;
      pmVar16->bk = pmVar15;
      pmVar19->fd = pmVar15;
    }
  }
  pmVar2 = __malloc_av_[2];
  pmVar15 = (mbinptr)(1 << (uVar4 / 4 & 0x1f));
  if (pmVar15 <= __malloc_av_[1]) {
    pmVar6 = __malloc_av_[1];
    if (((uint)pmVar15 & (uint)__malloc_av_[1]) == 0) {
      uVar4 = uVar4 & 0xfffffffc;
      do {
        pmVar15 = (mbinptr)((int)pmVar15 << 1);
        uVar4 = uVar4 + 4;
      } while (((uint)__malloc_av_[1] & (uint)pmVar15) == 0);
    }
    do {
      pmVar10 = (mbinptr)(__malloc_av_ + uVar4 * 2);
      pmVar20 = __malloc_av_[uVar4 * 2 + 3];
      pmVar12 = pmVar10;
      uVar7 = uVar4;
      while( true ) {
        if (pmVar12 != pmVar20) {
          uVar11 = pmVar20->size;
          while( true ) {
            uVar17 = (uVar11 & 0xfffffffc) - uVar21;
            pmVar13 = (mbinptr)((int)&pmVar20->prev_size + uVar21);
            if (0xf < (int)uVar17) {
              pmVar19 = pmVar20->bk;
              pmVar16 = pmVar20->fd;
              pmVar19->fd = pmVar16;
              pmVar16->bk = pmVar19;
              *(uint *)((int)pmVar13 + uVar17) = uVar17;
              pmVar20->size = uVar21 | 1;
              __malloc_av_[4] = pmVar13;
              pmVar13->size = uVar17 | 1;
              __malloc_av_[5] = pmVar13;
              pmVar13->fd = (malloc_chunk *)(__malloc_av_ + 2);
              pmVar13->bk = (malloc_chunk *)(__malloc_av_ + 2);
              __malloc_unlock(reent_ptr);
              return &pmVar20->fd;
            }
            if (-1 < (int)uVar17) {
              iVar3 = (int)&pmVar20->prev_size + (uVar11 & 0xfffffffc);
              goto LAB_08985fd8;
            }
            pmVar20 = pmVar20->bk;
            if (pmVar12 == pmVar20) break;
            uVar11 = pmVar20->size;
          }
        }
        pmVar13 = (mbinptr)&pmVar12->fd;
        if ((int)uVar7 < 0x3f) {
          pmVar13 = pmVar12 + 1;
          uVar7 = uVar7 + 1;
        }
        uVar7 = uVar7 + 1;
        if ((uVar7 & 3) == 0) break;
        pmVar20 = pmVar13->bk;
        pmVar12 = pmVar13;
      }
      do {
        uVar11 = uVar4 & 3;
        pmVar20 = pmVar10 + -1;
        uVar4 = uVar4 - 1;
        if (uVar11 == 0) {
          pmVar6 = (mbinptr)((uint)pmVar6 & ~(uint)pmVar15);
          __malloc_av_[1] = pmVar6;
          break;
        }
        psVar1 = &pmVar10->prev_size;
        pmVar10 = (mbinptr)&pmVar20->fd;
      } while ((mbinptr)*psVar1 == (mbinptr)&pmVar20->fd);
      pmVar15 = (mbinptr)((int)pmVar15 << 1);
      if ((pmVar6 < pmVar15) || (uVar4 = uVar7, pmVar15 == (mbinptr)0x0)) break;
      for (; ((uint)pmVar15 & (uint)pmVar6) == 0; pmVar15 = (mbinptr)((int)pmVar15 << 1)) {
        uVar4 = uVar4 + 4;
      }
    } while( true );
  }
  uVar7 = __malloc_av_[2]->size & 0xfffffffc;
  uVar4 = uVar7 - uVar21;
  if ((uVar21 <= uVar7) && (pmVar15 = __malloc_av_[2], 0xf < (int)uVar4)) goto LAB_089860d0;
                    /* Unresolved local var: char * brk@[???]
                       Unresolved local var: size_t front_misalign@[???]
                       Unresolved local var: size_t correction@[???]
                       Unresolved local var: int correction_failed@[???]
                       Unresolved local var: char * new_brk@[???]
                       Unresolved local var: size_t top_size@[???]
                       Unresolved local var: mchunkptr old_top@[???]
                       Unresolved local var: size_t old_top_size@[???]
                       Unresolved local var: char * old_end@[???]
                       Unresolved local var: size_t sbrk_size@[???]
                       Unresolved local var: ulong pagesz@[???] */
  uVar4 = uVar21 + __malloc_top_pad + 0x10;
  if (__malloc_sbrk_base != (char *)0xffffffff) {
    uVar4 = uVar4 + 0xfff & 0xfffff000;
  }
  pmVar20 = _sbrk_r(reent_ptr,uVar4);
  pmVar15 = __malloc_av_[2];
  if (pmVar20 == (mbinptr)0xffffffff) {
LAB_08986158:
    uVar4 = pmVar15->size;
  }
  else {
    pmVar6 = (mbinptr)((int)&pmVar2->prev_size + uVar7);
    if (pmVar20 < pmVar6) {
      if (pmVar2 != (mbinptr)__malloc_av_) goto LAB_08986158;
LAB_089861a4:
      __malloc_current_mallinfo.arena = uVar4 + __malloc_current_mallinfo.arena;
      pmVar15 = pmVar20;
      if (__malloc_sbrk_base != (char *)0xffffffff) {
        __malloc_current_mallinfo.arena =
             (int)pmVar20 + (__malloc_current_mallinfo.arena - (int)pmVar6);
        pmVar15 = (mbinptr)__malloc_sbrk_base;
      }
      __malloc_sbrk_base = (char *)pmVar15;
      uVar11 = (uint)&pmVar20->fd & 0xf;
      if (uVar11 == 0) {
        iVar3 = 0;
      }
      else {
        iVar3 = 0x10 - uVar11;
        pmVar20 = (mbinptr)((int)pmVar20 + iVar3);
      }
      iVar3 = iVar3 + (0x1000 - ((int)&pmVar20->prev_size + uVar4 & 0xfff));
      pvVar5 = _sbrk_r(reent_ptr,iVar3);
      if (pvVar5 == (void *)0xffffffff) {
        iVar3 = 0;
        sVar9 = 1;
      }
      else {
        sVar9 = (int)pvVar5 + (iVar3 - (int)pmVar20) | 1;
      }
      __malloc_current_mallinfo.arena = iVar3 + __malloc_current_mallinfo.arena;
      __malloc_av_[2] = pmVar20;
      pmVar20->size = sVar9;
      pmVar15 = __malloc_av_[2];
      if (pmVar2 != (mbinptr)__malloc_av_) {
        if (uVar7 < 0x10) {
          pmVar20->size = 1;
          goto LAB_08986158;
        }
        uVar4 = uVar7 - 0xc & 0xfffffff0;
        *(undefined4 *)((int)&pmVar2->fd + uVar4) = 5;
        *(undefined4 *)((int)&pmVar2->size + uVar4) = 5;
        pmVar2->size = uVar4 | pmVar2->size & 1;
        pmVar15 = __malloc_av_[2];
        if (0xf < uVar4) {
          _free_r(reent_ptr,&pmVar2->fd);
          pmVar15 = __malloc_av_[2];
        }
      }
    }
    else {
      if ((pmVar6 != pmVar20) || (((uint)pmVar20 & 0xfff) != 0)) goto LAB_089861a4;
      __malloc_current_mallinfo.arena = uVar4 + __malloc_current_mallinfo.arena;
      __malloc_av_[2]->size = uVar4 + uVar7 | 1;
    }
    if (__malloc_max_sbrked_mem < (uint)__malloc_current_mallinfo.arena) {
      __malloc_max_sbrked_mem = __malloc_current_mallinfo.arena;
    }
    if (__malloc_max_total_mem < (uint)__malloc_current_mallinfo.arena) {
      uVar4 = pmVar15->size;
      __malloc_max_total_mem = __malloc_current_mallinfo.arena;
    }
    else {
      uVar4 = pmVar15->size;
    }
  }
  if (((uVar4 & 0xfffffffc) < uVar21) || (uVar4 = (uVar4 & 0xfffffffc) - uVar21, (int)uVar4 < 0x10))
  {
    __malloc_unlock(reent_ptr);
    return (void *)0x0;
  }
LAB_089860d0:
  __malloc_av_[2] = (mbinptr)((int)&pmVar15->prev_size + uVar21);
  pmVar15->size = uVar21 | 1;
  __malloc_av_[2]->size = uVar4 | 1;
  __malloc_unlock(reent_ptr);
  return &pmVar15->fd;
}



----------------------------------------

// Function: memchr @ 089864e4

void * memchr(void *src_void,int c,size_t length)

{
  byte bVar1;
  int iVar2;
  uint *puVar3;
  uint uVar4;
  uint uVar5;
  
                    /* Unresolved local var: uchar * src@[???]
                       Unresolved local var: ulong * asrc@[???]
                       Unresolved local var: ulong buffer@[???]
                       Unresolved local var: ulong mask@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???] */
  uVar4 = c & 0xff;
  if ((3 < length) && (uVar5 = 0, ((uint)src_void & 3) == 0)) {
    iVar2 = 0;
    do {
      iVar2 = iVar2 + 1;
      uVar5 = uVar5 * 0x100 + uVar4;
    } while (iVar2 != 4);
    do {
      length = length - 4;
      if (((~(*(uint *)src_void ^ uVar5) & (*(uint *)src_void ^ uVar5) + 0xfefefeff & 0x80808080) !=
           0) && ((((puVar3 = src_void, uVar4 == (byte)*(uint *)src_void ||
                    (puVar3 = (uint *)((int)src_void + 1), uVar4 == *(byte *)((int)src_void + 1)))
                   || (puVar3 = (uint *)((int)src_void + 2), uVar4 == *(byte *)((int)src_void + 2)))
                  || (puVar3 = (uint *)((int)src_void + 3), uVar4 == *(byte *)((int)src_void + 3))))
         ) {
        return puVar3;
      }
      src_void = (void *)((int)src_void + 4);
    } while (3 < length);
  }
  if (length != 0) {
    bVar1 = (byte)*(uint *)src_void;
    iVar2 = 0;
    while( true ) {
      if (uVar4 == bVar1) {
        return src_void;
      }
      src_void = (void *)((int)src_void + 1);
      if (length - 1 == iVar2) break;
      bVar1 = *(byte *)src_void;
      iVar2 = iVar2 + 1;
    }
  }
  return (void *)0x0;
}



----------------------------------------

// Function: memcmp @ 089865d8

int memcmp(void *m1,void *m2,size_t n)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: uchar * s1@[???]
                       Unresolved local var: uchar * s2@[???]
                       Unresolved local var: ulong * a1@[???]
                       Unresolved local var: ulong * a2@[???] */
  if ((3 < n) && ((((uint)m1 | (uint)m2) & 3) == 0)) {
    iVar2 = *(int *)m1;
    while (iVar2 == *(int *)m2) {
      n = n - 4;
      m1 = (void *)((int)m1 + 4);
      m2 = (void *)((int)m2 + 4);
      if (n < 4) break;
      iVar2 = *(int *)m1;
    }
  }
  if (n == 0) {
    return 0;
  }
  uVar3 = (uint)*(byte *)m1;
  uVar1 = (uint)*(byte *)m2;
  iVar2 = 0;
  if (uVar3 == uVar1) {
    do {
      m1 = (void *)((int)m1 + 1);
      m2 = (void *)((int)m2 + 1);
      if (n - 1 == iVar2) {
        return 0;
      }
      uVar3 = (uint)*(byte *)m1;
      uVar1 = (uint)*(byte *)m2;
      iVar2 = iVar2 + 1;
    } while (uVar3 == uVar1);
  }
  return uVar3 - uVar1;
}



----------------------------------------

// Function: memcpy @ 08986668

/* WARNING: Removing unreachable block (ram,0x08986718) */

void * memcpy(void *dst0,void *src0,size_t len0)

{
  undefined1 uVar1;
  undefined4 uVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  int iVar5;
  undefined4 uVar6;
  undefined1 *puVar7;
  uint uVar8;
  uint uVar9;
  int iVar10;
  
                    /* Unresolved local var: char * dst@[???]
                       Unresolved local var: char * src@[???]
                       Unresolved local var: long * aligned_dst@[???]
                       Unresolved local var: long * aligned_src@[???]
                       Unresolved local var: int len@[???]
                       Unresolved local var: size_t iter@[???] */
  if ((((uint)src0 | (uint)dst0) & 3) == 0) {
    puVar3 = dst0;
    for (uVar9 = len0 >> 4; uVar9 != 0; uVar9 = uVar9 - 1) {
                    /* Unresolved local var: long tmp0@[???]
                       Unresolved local var: long tmp1@[???]
                       Unresolved local var: long tmp2@[???]
                       Unresolved local var: long tmp3@[???] */
      uVar4 = *(undefined4 *)((int)src0 + 8);
      uVar6 = *(undefined4 *)((int)src0 + 0xc);
      uVar2 = *(undefined4 *)src0;
      puVar3[1] = *(undefined4 *)((int)src0 + 4);
      *puVar3 = uVar2;
      puVar3[2] = uVar4;
      puVar3[3] = uVar6;
      src0 = (void *)((int)src0 + 0x10);
      puVar3 = puVar3 + 4;
    }
    uVar8 = len0 & 3;
    for (uVar9 = (len0 & 0xf) >> 2; uVar9 != 0; uVar9 = uVar9 - 1) {
      uVar2 = *(undefined4 *)src0;
      src0 = (void *)((int)src0 + 4);
      *puVar3 = uVar2;
      puVar3 = puVar3 + 1;
    }
    for (; uVar8 != 0; uVar8 = uVar8 - 1) {
      uVar1 = *(undefined1 *)src0;
      src0 = (void *)((int)src0 + 1);
      *(undefined1 *)puVar3 = uVar1;
      puVar3 = (undefined4 *)((int)puVar3 + 1);
    }
  }
  else {
                    /* Unresolved local var: int tmp@[???]
                       Unresolved local var: int * int_src@[???]
                       Unresolved local var: int * int_dst@[???] */
    iVar10 = (int)len0 % 4;
    puVar3 = dst0;
    if ((int)len0 / 4 != 0) {
      iVar5 = 0;
      do {
        iVar5 = iVar5 + 1;
        uVar2 = *(undefined4 *)src0;
        src0 = (void *)((int)src0 + 4);
        *puVar3 = uVar2;
        puVar3 = puVar3 + 1;
      } while ((int)len0 / 4 != iVar5);
    }
    if (0 < iVar10) {
      do {
        puVar7 = (undefined1 *)((int)src0 + 1);
        *(undefined1 *)puVar3 = *(undefined1 *)src0;
        if (iVar10 == 1) {
          return dst0;
        }
        iVar10 = iVar10 + -2;
        src0 = (void *)((int)src0 + 2);
        *(undefined1 *)((int)puVar3 + 1) = *puVar7;
        puVar3 = (undefined4 *)((int)puVar3 + 2);
      } while (iVar10 != 0);
    }
  }
  return dst0;
}



----------------------------------------

// Function: memmove @ 08986794

void * memmove(void *dst_void,void *src_void,size_t length)

{
  undefined4 *puVar1;
  undefined1 *puVar2;
  undefined4 *puVar3;
  undefined1 *puVar4;
  undefined1 *puVar5;
  
                    /* Unresolved local var: char * dst@[???]
                       Unresolved local var: char * src@[DW_OP_reg5(a1)]
                       Unresolved local var: long * aligned_dst@[???]
                       Unresolved local var: long * aligned_src@[???]
                       Unresolved local var: int len@[???] */
  if ((src_void < dst_void) && (puVar5 = (undefined1 *)((int)src_void + length), dst_void < puVar5))
  {
    if (length != 0) {
      puVar2 = (undefined1 *)((int)dst_void + length);
      puVar4 = puVar5 + (-1 - (length - 1));
      do {
        puVar5 = puVar5 + -1;
        puVar2 = puVar2 + -1;
        *puVar2 = *puVar5;
      } while (puVar5 != puVar4);
    }
  }
  else {
    puVar3 = dst_void;
    if ((0xf < length) && ((((uint)src_void | (uint)dst_void) & 3) == 0)) {
      do {
        length = length - 0x10;
        *puVar3 = *(undefined4 *)src_void;
        puVar3[1] = *(undefined4 *)((int)src_void + 4);
        puVar3[2] = *(undefined4 *)((int)src_void + 8);
        puVar1 = (undefined4 *)((int)src_void + 0xc);
        src_void = (void *)((int)src_void + 0x10);
        puVar3[3] = *puVar1;
        puVar3 = puVar3 + 4;
      } while (0xf < length);
      for (; 3 < length; length = length - 4) {
        *puVar3 = *(undefined4 *)src_void;
        src_void = (void *)((int)src_void + 4);
        puVar3 = puVar3 + 1;
      }
    }
    if (length != 0) {
      puVar1 = (undefined4 *)(length + (int)puVar3);
      do {
        *(undefined1 *)puVar3 = *(undefined1 *)src_void;
        puVar3 = (undefined4 *)((int)puVar3 + 1);
        src_void = (void *)((int)src_void + 1);
      } while (puVar3 != puVar1);
      return dst_void;
    }
  }
  return dst_void;
}



----------------------------------------

// Function: memset @ 089868a8

void * memset(void *m,int c,size_t n)

{
  uint uVar1;
  uint *puVar2;
  size_t sVar3;
  uint uVar4;
  
                    /* Unresolved local var: char * s@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: ulong buffer@[???]
                       Unresolved local var: ulong * aligned_addr@[DW_OP_reg7(a3)]
                       Unresolved local var: ushort * short_addr@[???]
                       Unresolved local var: size_t iter@[???] */
  puVar2 = m;
  if (0xf < n) {
                    /* Unresolved local var: int unaligned@[???] */
    uVar4 = (uint)m & 3;
    sVar3 = n;
    if ((uVar4 != 0) && (uVar4 < 4)) {
      do {
        *(char *)puVar2 = (char)c;
        puVar2 = (uint *)((int)puVar2 + 1);
        n = n - 1;
        sVar3 = n;
      } while ((uint *)((int)m + (5 - (uVar4 + 1))) != puVar2);
    }
    c = c & 0xff;
    if (c == 0) {
      uVar4 = 0;
    }
    else {
      uVar4 = c | c << 8;
      uVar4 = uVar4 | uVar4 << 0x10;
    }
    n = sVar3 & 7;
    for (uVar1 = sVar3 >> 3; uVar1 != 0; uVar1 = uVar1 - 1) {
      *puVar2 = uVar4;
      puVar2[1] = uVar4;
      puVar2 = puVar2 + 2;
    }
    if (3 < n) {
      *puVar2 = uVar4;
      n = n - 4;
      puVar2 = puVar2 + 1;
    }
  }
  if (n != 0) {
    do {
      n = n - 1;
      *(char *)puVar2 = (char)c;
      puVar2 = (uint *)((int)puVar2 + 1);
    } while (n != 0);
  }
  return m;
}



----------------------------------------

// Function: __malloc_lock @ 0898696c

void __malloc_lock(_reent *ptr)

{
  return;
}



----------------------------------------

// Function: __malloc_unlock @ 08986974

void __malloc_unlock(_reent *ptr)

{
  return;
}



----------------------------------------

// Function: _open_r @ 0898697c

int _open_r(_reent *ptr,char *file,int flags,int mode)

{
  int iVar1;
  
                    /* Unresolved local var: int ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _open(file,flags,mode);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: putc @ 089869ec

int putc(int c,FILE *fp)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: int result@[???] */
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    iVar2 = fp->_w + -1;
    fp->_w = iVar2;
  }
  else {
    __sinit(_impure_ptr);
    iVar2 = fp->_w + -1;
    fp->_w = iVar2;
  }
  if (iVar2 < 0) {
    if (fp->_lbfsize <= iVar2) {
      *fp->_p = (uchar)c;
      uVar3 = (uint)*fp->_p;
      if (uVar3 != 10) {
        fp->_p = fp->_p + 1;
        return uVar3;
      }
      c = 10;
    }
    iVar2 = __swbuf_r(_impure_ptr,c,fp);
    return iVar2;
  }
  *fp->_p = (uchar)c;
  bVar1 = *fp->_p;
  fp->_p = fp->_p + 1;
  return (uint)bVar1;
}



----------------------------------------

// Function: _putc_r @ 08986af4

int _putc_r(_reent *ptr,int c,FILE *fp)

{
  byte bVar1;
  int iVar2;
  uint uVar3;
  
                    /* Unresolved local var: int result@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    iVar2 = fp->_w + -1;
    fp->_w = iVar2;
  }
  else {
    __sinit(ptr);
    iVar2 = fp->_w + -1;
    fp->_w = iVar2;
  }
  if (iVar2 < 0) {
    if (fp->_lbfsize <= iVar2) {
      *fp->_p = (uchar)c;
      uVar3 = (uint)*fp->_p;
      if (uVar3 != 10) {
        fp->_p = fp->_p + 1;
        return uVar3;
      }
      c = 10;
    }
    iVar2 = __swbuf_r(ptr,c,fp);
    return iVar2;
  }
  *fp->_p = (uchar)c;
  bVar1 = *fp->_p;
  fp->_p = fp->_p + 1;
  return (uint)bVar1;
}



----------------------------------------

// Function: _puts_r @ 08986c00

int _puts_r(_reent *ptr,char *s)

{
  int iVar1;
  int iVar2;
  __suio local_30;
  __siov local_24;
  char *local_1c;
  undefined4 local_18;
  
                    /* Unresolved local var: size_t c@[???]
                       Unresolved local var: __suio uio@[???]
                       Unresolved local var: __siov[2] iov@[???] */
  local_24.iov_len = strlen(s);
  local_1c = "\n";
  local_18 = 1;
  local_30.uio_iov = &local_24;
  local_30.uio_resid = local_24.iov_len + 1;
  local_30.uio_iovcnt = 2;
  local_24.iov_base = s;
  iVar1 = __sfvwrite_r(ptr,ptr->_stdout,&local_30);
  iVar2 = -1;
  if (iVar1 == 0) {
    iVar2 = 10;
  }
  return iVar2;
}



----------------------------------------

// Function: puts @ 08986c88

int puts(char *s)

{
  int iVar1;
  
  iVar1 = _puts_r(_impure_ptr,s);
  return iVar1;
}



----------------------------------------

// Function: qsort @ 08986c9c

void qsort(void *a,size_t n,size_t es,_func_int_varargs *cmp)

{
  undefined1 uVar1;
  bool bVar2;
  byte bVar3;
  bool bVar4;
  int iVar5;
  undefined1 *puVar6;
  int iVar7;
  undefined4 uVar8;
  undefined4 *puVar9;
  undefined4 *puVar10;
  undefined4 *puVar11;
  uint uVar12;
  size_t sVar13;
  undefined4 *puVar14;
  undefined4 *puVar15;
  uint uVar16;
  undefined4 *puVar17;
  undefined1 *puVar18;
  undefined4 *puVar19;
  uint local_44;
  int local_38;
  
                    /* Unresolved local var: char * pa@[???]
                       Unresolved local var: char * pb@[???]
                       Unresolved local var: char * pc@[???]
                       Unresolved local var: char * pd@[???]
                       Unresolved local var: char * pl@[???]
                       Unresolved local var: char * pm@[???]
                       Unresolved local var: char * pn@[???]
                       Unresolved local var: int d@[???]
                       Unresolved local var: int r@[???]
                       Unresolved local var: int swaptype@[???]
                       Unresolved local var: int swap_cnt@[???] */
  local_44 = n;
  if (((uint)a & 3) != 0) goto LAB_08986ea8;
LAB_08986ce4:
  if ((es & 3) != 0) goto LAB_08986ea8;
  bVar3 = es != 4;
  if (6 < local_44) {
    do {
      puVar17 = (undefined4 *)((local_44 >> 1) * es + (int)a);
      if (local_44 == 7) {
        local_38 = 6;
      }
      else {
        local_38 = local_44 - 1;
        puVar19 = (undefined4 *)((int)a + es * local_38);
        puVar9 = puVar19;
        puVar10 = a;
        if (local_44 < 0x29) {
LAB_08986d44:
          puVar19 = puVar9;
LAB_08986d48:
          iVar5 = (*cmp)(puVar10,puVar17);
        }
        else {
          iVar5 = es * (local_44 >> 3);
          puVar10 = (undefined4 *)((int)a + iVar5);
          puVar9 = (undefined4 *)((int)a + iVar5 * 2);
          iVar7 = (*cmp)(a,puVar10);
          if (iVar7 < 0) {
            iVar7 = (*cmp)(puVar10,puVar9);
            if ((-1 < iVar7) && (iVar7 = (*cmp)(a,puVar9), puVar10 = a, iVar7 < 0)) {
              puVar10 = puVar9;
            }
          }
          else {
            iVar7 = (*cmp)(puVar10,puVar9);
            if ((iVar7 < 1) && (iVar7 = (*cmp)(a,puVar9), puVar10 = puVar9, iVar7 < 0)) {
              puVar10 = a;
            }
          }
          puVar11 = (undefined4 *)((int)puVar17 - iVar5);
          puVar9 = (undefined4 *)((int)puVar17 + iVar5);
          iVar7 = (*cmp)(puVar11,puVar17);
          if (iVar7 < 0) {
            iVar7 = (*cmp)(puVar17,puVar9);
            if ((-1 < iVar7) && (iVar7 = (*cmp)(puVar11,puVar9), puVar17 = puVar11, iVar7 < 0)) {
              puVar17 = puVar9;
            }
          }
          else {
            iVar7 = (*cmp)(puVar17,puVar9);
            if ((iVar7 < 1) && (iVar7 = (*cmp)(puVar11,puVar9), puVar17 = puVar9, iVar7 < 0)) {
              puVar17 = puVar11;
            }
          }
          puVar11 = (undefined4 *)((int)puVar19 - iVar5);
          puVar9 = (undefined4 *)((int)puVar19 + iVar5 * -2);
          iVar5 = (*cmp)(puVar9,puVar11);
          if (iVar5 < 0) {
            iVar5 = (*cmp)(puVar11,puVar19);
            if (iVar5 < 0) goto LAB_089871ec;
            iVar5 = (*cmp)(puVar9,puVar19);
            if (iVar5 < 0) goto LAB_08986d48;
            goto LAB_08986d44;
          }
          iVar5 = (*cmp)(puVar11,puVar19);
          if (iVar5 < 1) {
            iVar5 = (*cmp)(puVar9,puVar19);
            if (iVar5 < 0) goto LAB_08986d44;
            goto LAB_08986d48;
          }
LAB_089871ec:
          iVar5 = (*cmp)(puVar10,puVar17);
          puVar19 = puVar11;
        }
        if (iVar5 < 0) {
          iVar5 = (*cmp)(puVar17,puVar19);
          if ((-1 < iVar5) && (iVar5 = (*cmp)(puVar10,puVar19), puVar17 = puVar10, iVar5 < 0)) {
            puVar17 = puVar19;
          }
        }
        else {
          iVar5 = (*cmp)(puVar17,puVar19);
          if ((iVar5 < 1) && (iVar5 = (*cmp)(puVar10,puVar19), puVar17 = puVar19, iVar5 < 0)) {
            puVar17 = puVar10;
          }
        }
      }
      if (bVar3 == 0) {
                    /* Unresolved local var: long t@[???] */
        uVar8 = *(undefined4 *)a;
        *(undefined4 *)a = *puVar17;
        *puVar17 = uVar8;
      }
      else {
        puVar19 = a;
        sVar13 = es;
        if (bVar3 < 2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
          uVar12 = es >> 2;
          do {
                    /* Unresolved local var: long t@[???] */
            uVar8 = *puVar19;
            uVar12 = uVar12 - 1;
            *puVar19 = *puVar17;
            *puVar17 = uVar8;
            puVar19 = puVar19 + 1;
            puVar17 = puVar17 + 1;
          } while (0 < (int)uVar12);
        }
        else {
          do {
                    /* Unresolved local var: char t@[???] */
            uVar1 = *(undefined1 *)puVar19;
            sVar13 = sVar13 - 1;
            *(undefined1 *)puVar19 = *(undefined1 *)puVar17;
            *(undefined1 *)puVar17 = uVar1;
            puVar17 = (undefined4 *)((int)puVar17 + 1);
            puVar19 = (undefined4 *)((int)puVar19 + 1);
          } while (0 < (int)sVar13);
        }
      }
      puVar9 = (undefined4 *)((int)a + es);
      bVar2 = bVar3 < 2;
      bVar4 = false;
      puVar17 = (undefined4 *)((int)a + es * local_38);
      puVar10 = puVar9;
      puVar11 = puVar9;
      puVar19 = puVar17;
      while (puVar11 <= puVar17) {
        iVar5 = (*cmp)(puVar11,a);
        if (iVar5 < 1) {
          if (iVar5 == 0) {
            if (bVar3 == 0) {
                    /* Unresolved local var: long t@[???] */
              uVar8 = *puVar10;
              *puVar10 = *puVar11;
              *puVar11 = uVar8;
            }
            else {
              puVar15 = puVar11;
              puVar14 = puVar10;
              sVar13 = es;
              if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
                uVar12 = es >> 2;
                do {
                    /* Unresolved local var: long t@[???] */
                  uVar8 = *puVar14;
                  uVar12 = uVar12 - 1;
                  *puVar14 = *puVar15;
                  *puVar15 = uVar8;
                  puVar14 = puVar14 + 1;
                  puVar15 = puVar15 + 1;
                } while (0 < (int)uVar12);
              }
              else {
                do {
                    /* Unresolved local var: char t@[???] */
                  uVar1 = *(undefined1 *)puVar14;
                  sVar13 = sVar13 - 1;
                  *(undefined1 *)puVar14 = *(undefined1 *)puVar15;
                  *(undefined1 *)puVar15 = uVar1;
                  puVar15 = (undefined4 *)((int)puVar15 + 1);
                  puVar14 = (undefined4 *)((int)puVar14 + 1);
                } while (0 < (int)sVar13);
              }
            }
            puVar10 = (undefined4 *)((int)puVar10 + es);
            bVar4 = true;
            puVar11 = (undefined4 *)((int)puVar11 + es);
          }
          else {
            puVar11 = (undefined4 *)((int)puVar11 + es);
          }
        }
        else {
          iVar7 = (*cmp)(puVar17,a);
          iVar5 = (int)puVar17 - es;
          while (-1 < iVar7) {
            if (iVar7 == 0) {
              if (bVar3 == 0) {
                    /* Unresolved local var: long t@[???] */
                uVar8 = *puVar17;
                *puVar17 = *puVar19;
                *puVar19 = uVar8;
                puVar19 = (undefined4 *)((int)puVar19 - es);
              }
              else {
                puVar15 = puVar19;
                puVar14 = puVar17;
                sVar13 = es;
                if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
                  uVar12 = es >> 2;
                  do {
                    /* Unresolved local var: long t@[???] */
                    uVar8 = *puVar14;
                    uVar12 = uVar12 - 1;
                    *puVar14 = *puVar15;
                    *puVar15 = uVar8;
                    puVar14 = puVar14 + 1;
                    puVar15 = puVar15 + 1;
                  } while (0 < (int)uVar12);
                  puVar19 = (undefined4 *)((int)puVar19 - es);
                }
                else {
                  do {
                    /* Unresolved local var: char t@[???] */
                    uVar1 = *(undefined1 *)puVar14;
                    sVar13 = sVar13 - 1;
                    *(undefined1 *)puVar14 = *(undefined1 *)puVar15;
                    *(undefined1 *)puVar15 = uVar1;
                    puVar15 = (undefined4 *)((int)puVar15 + 1);
                    puVar14 = (undefined4 *)((int)puVar14 + 1);
                  } while (0 < (int)sVar13);
                  puVar19 = (undefined4 *)((int)puVar19 - es);
                }
              }
              bVar4 = true;
            }
            iVar5 = iVar5 + -es;
            puVar17 = (undefined4 *)((int)puVar17 + -es);
            if ((undefined4 *)(es + iVar5) < puVar11) goto LAB_08986dd0;
            iVar7 = (*cmp)(puVar17,a);
          }
          if (bVar3 == 0) {
                    /* Unresolved local var: long t@[???] */
            uVar8 = *puVar11;
            *puVar11 = *puVar17;
            *puVar17 = uVar8;
          }
          else {
            puVar15 = puVar11;
            sVar13 = es;
            puVar14 = puVar17;
            if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
              uVar12 = es >> 2;
              puVar15 = puVar17;
              puVar14 = puVar11;
              do {
                    /* Unresolved local var: long t@[???] */
                uVar8 = *puVar14;
                uVar12 = uVar12 - 1;
                *puVar14 = *puVar15;
                *puVar15 = uVar8;
                puVar14 = puVar14 + 1;
                puVar15 = puVar15 + 1;
              } while (0 < (int)uVar12);
            }
            else {
              do {
                    /* Unresolved local var: char t@[???] */
                uVar1 = *(undefined1 *)puVar15;
                sVar13 = sVar13 - 1;
                *(undefined1 *)puVar15 = *(undefined1 *)puVar14;
                *(undefined1 *)puVar14 = uVar1;
                puVar15 = (undefined4 *)((int)puVar15 + 1);
                puVar14 = (undefined4 *)((int)puVar14 + 1);
              } while (0 < (int)sVar13);
            }
          }
          puVar11 = (undefined4 *)((int)puVar11 + es);
          puVar17 = (undefined4 *)((int)puVar17 - es);
          bVar4 = true;
        }
      }
LAB_08986dd0:
      if (!bVar4) {
        puVar17 = (undefined4 *)((int)a + local_44 * es);
        if (puVar17 <= puVar9) {
          return;
        }
        puVar19 = (undefined4 *)((int)puVar9 + es);
        goto LAB_089874ac;
      }
      uVar12 = (int)puVar11 - (int)puVar10;
      iVar5 = local_44 * es;
      puVar6 = (undefined1 *)((int)puVar10 + (uVar12 - (int)a));
      if (0 < (int)puVar6) {
        puVar10 = (undefined4 *)((int)puVar11 - (int)puVar6);
        if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
          uVar16 = (uint)puVar6 >> 2;
          puVar9 = a;
          do {
                    /* Unresolved local var: long t@[???] */
            uVar8 = *puVar9;
            uVar16 = uVar16 - 1;
            *puVar9 = *puVar10;
            *puVar10 = uVar8;
            puVar9 = puVar9 + 1;
            puVar10 = puVar10 + 1;
          } while (0 < (int)uVar16);
        }
        else {
          puVar9 = a;
          do {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: char * pi@[???]
                       Unresolved local var: char * pj@[???]
                       Unresolved local var: char t@[???] */
            uVar1 = *(undefined1 *)puVar9;
            *(undefined1 *)puVar9 = *(undefined1 *)puVar10;
            puVar9 = (undefined4 *)((int)puVar9 + 1);
            *(undefined1 *)puVar10 = uVar1;
            puVar10 = (undefined4 *)((int)puVar10 + 1);
          } while (puVar9 != (undefined4 *)(puVar6 + (int)a));
        }
      }
      puVar18 = (undefined1 *)((int)puVar19 - (int)puVar17);
      puVar6 = (undefined1 *)((int)a + ((iVar5 - (int)puVar19) - es));
      if (puVar18 < puVar6) {
        puVar6 = puVar18;
      }
      if (0 < (int)puVar6) {
        puVar17 = (undefined4 *)((int)a + (iVar5 - (int)puVar6));
        if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
          uVar16 = (uint)puVar6 >> 2;
          do {
                    /* Unresolved local var: long t@[???] */
            uVar8 = *puVar11;
            uVar16 = uVar16 - 1;
            *puVar11 = *puVar17;
            *puVar17 = uVar8;
            puVar11 = puVar11 + 1;
            puVar17 = puVar17 + 1;
          } while (0 < (int)uVar16);
        }
        else {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: char * pi@[???]
                       Unresolved local var: char * pj@[???] */
          puVar19 = (undefined4 *)((int)puVar11 + (int)puVar6);
          do {
                    /* Unresolved local var: char t@[???] */
            uVar1 = *(undefined1 *)puVar11;
            *(undefined1 *)puVar11 = *(undefined1 *)puVar17;
            puVar11 = (undefined4 *)((int)puVar11 + 1);
            *(undefined1 *)puVar17 = uVar1;
            puVar17 = (undefined4 *)((int)puVar17 + 1);
          } while (puVar11 != puVar19);
        }
      }
      if (es < uVar12) {
        if (es == 0) {
          trap(7);
        }
        qsort(a,uVar12 / es,es,cmp);
      }
      a = (void *)((int)a + (iVar5 - (int)puVar18));
      if (puVar18 <= es) {
        return;
      }
      local_44 = (uint)puVar18 / es;
      if (es == 0) {
        trap(7);
      }
      if (((uint)a & 3) == 0) goto LAB_08986ce4;
LAB_08986ea8:
      bVar3 = 2;
      if (local_44 < 7) break;
    } while( true );
  }
  puVar17 = (undefined4 *)((int)a + es);
  puVar19 = (undefined4 *)(local_44 * es + (int)a);
  if (puVar17 < puVar19) {
    puVar10 = (undefined4 *)(es + (int)puVar17);
    do {
      if (a < puVar17) {
        iVar5 = -es;
        puVar9 = (undefined4 *)((int)puVar17 - es);
        do {
          while( true ) {
            puVar11 = (undefined4 *)((int)puVar17 + iVar5);
            iVar7 = (*cmp)(puVar11,puVar17);
            if (iVar7 < 1) goto LAB_08986f8c;
            if (bVar3 != 0) break;
                    /* Unresolved local var: long t@[???] */
            uVar8 = *(undefined4 *)(es + (int)puVar11);
            *(undefined4 *)(es + (int)puVar11) = *puVar9;
            *puVar9 = uVar8;
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: char * pi@[???]
                       Unresolved local var: char * pj@[???] */
LAB_08986f08:
            puVar9 = (undefined4 *)((int)puVar9 + iVar5);
            puVar17 = puVar11;
            if ((undefined4 *)(es + (int)puVar9) <= a) goto LAB_08986f8c;
          }
          puVar15 = puVar11;
          sVar13 = es;
          if (bVar3 < 2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
            uVar12 = es >> 2;
            puVar15 = (undefined4 *)(es + (int)puVar11);
            puVar17 = puVar9;
            do {
                    /* Unresolved local var: long t@[???] */
              uVar8 = *puVar15;
              uVar12 = uVar12 - 1;
              *puVar15 = *puVar17;
              *puVar17 = uVar8;
              puVar15 = puVar15 + 1;
              puVar17 = puVar17 + 1;
            } while (0 < (int)uVar12);
            goto LAB_08986f08;
          }
          do {
                    /* Unresolved local var: char t@[???] */
            uVar1 = *(undefined1 *)puVar17;
            sVar13 = sVar13 - 1;
            *(undefined1 *)puVar17 = *(undefined1 *)puVar15;
            *(undefined1 *)puVar15 = uVar1;
            puVar17 = (undefined4 *)((int)puVar17 + 1);
            puVar15 = (undefined4 *)((int)puVar15 + 1);
          } while (0 < (int)sVar13);
          puVar9 = (undefined4 *)((int)puVar9 + iVar5);
          puVar17 = puVar11;
        } while (a < (undefined4 *)(es + (int)puVar9));
      }
LAB_08986f8c:
      puVar9 = (undefined4 *)((int)puVar10 + es);
      puVar17 = puVar10;
      puVar10 = puVar9;
    } while ((undefined4 *)((int)puVar9 - es) < puVar19);
  }
  return;
LAB_089874ac:
  if (a < puVar9) {
    iVar5 = -es;
    puVar10 = (undefined4 *)((int)puVar9 - es);
    do {
      while( true ) {
        puVar11 = (undefined4 *)(iVar5 + (int)puVar9);
        iVar7 = (*cmp)(puVar11,puVar9);
        if (iVar7 < 1) goto LAB_08987558;
        if (bVar3 != 0) break;
                    /* Unresolved local var: long t@[???] */
        uVar8 = *(undefined4 *)(es + (int)puVar11);
        *(undefined4 *)(es + (int)puVar11) = *puVar10;
        *puVar10 = uVar8;
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: char * pi@[???]
                       Unresolved local var: char * pj@[???] */
LAB_089874d8:
        puVar10 = (undefined4 *)((int)puVar10 + iVar5);
        puVar9 = puVar11;
        if ((undefined4 *)((int)puVar10 + es) <= a) goto LAB_08987558;
      }
      puVar15 = puVar11;
      sVar13 = es;
      if (bVar2) {
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: long * pi@[???]
                       Unresolved local var: long * pj@[???] */
        uVar12 = es >> 2;
        puVar15 = (undefined4 *)(es + (int)puVar11);
        puVar9 = puVar10;
        do {
                    /* Unresolved local var: long t@[???] */
          uVar8 = *puVar15;
          uVar12 = uVar12 - 1;
          *puVar15 = *puVar9;
          *puVar9 = uVar8;
          puVar15 = puVar15 + 1;
          puVar9 = puVar9 + 1;
        } while (0 < (int)uVar12);
        goto LAB_089874d8;
      }
      do {
                    /* Unresolved local var: char t@[???] */
        uVar1 = *(undefined1 *)puVar9;
        sVar13 = sVar13 - 1;
        *(undefined1 *)puVar9 = *(undefined1 *)puVar15;
        *(undefined1 *)puVar15 = uVar1;
        puVar9 = (undefined4 *)((int)puVar9 + 1);
        puVar15 = (undefined4 *)((int)puVar15 + 1);
      } while (0 < (int)sVar13);
      puVar10 = (undefined4 *)((int)puVar10 + iVar5);
      puVar9 = puVar11;
    } while (a < (undefined4 *)((int)puVar10 + es));
  }
LAB_08987558:
  puVar10 = (undefined4 *)((int)puVar19 + es);
  puVar9 = puVar19;
  puVar19 = puVar10;
  if (puVar17 <= (undefined4 *)((int)puVar10 - es)) {
    return;
  }
  goto LAB_089874ac;
}



----------------------------------------

// Function: srand @ 08987694

void srand(uint seed)

{
  _reent *p_Var1;
  
  p_Var1 = _impure_ptr;
  (_impure_ptr->_new)._unused._nextf[0x14] = (uchar *)seed;
  (p_Var1->_new)._unused._nextf[0x15] = (uchar *)0x0;
  return;
}



----------------------------------------

// Function: rand @ 089876a8

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int rand(void)

{
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}



----------------------------------------

// Function: realloc @ 08987720

void * realloc(void *ap,size_t nbytes)

{
  void *pvVar1;
  
  pvVar1 = _realloc_r(_impure_ptr,ap,nbytes);
  return pvVar1;
}



----------------------------------------

// Function: _realloc_r @ 08987738

void * _realloc_r(_reent *reent_ptr,void *oldmem,size_t bytes)

{
  bool bVar1;
  malloc_chunk *pmVar2;
  undefined4 *dst_void;
  void *pvVar3;
  malloc_chunk *pmVar4;
  int iVar5;
  int iVar6;
  undefined4 *puVar7;
  mbinptr pmVar8;
  uint uVar9;
  undefined4 *puVar10;
  int *piVar11;
  int *piVar12;
  int *piVar13;
  uint uVar14;
  int iVar15;
  uint uVar16;
  int *piVar17;
  
                    /* Unresolved local var: size_t nb@[???]
                       Unresolved local var: mchunkptr oldp@[???]
                       Unresolved local var: size_t oldsize@[???]
                       Unresolved local var: mchunkptr newp@[???]
                       Unresolved local var: size_t newsize@[???]
                       Unresolved local var: void * newmem@[???]
                       Unresolved local var: mchunkptr next@[???]
                       Unresolved local var: size_t nextsize@[???]
                       Unresolved local var: mchunkptr prev@[???]
                       Unresolved local var: size_t prevsize@[???]
                       Unresolved local var: mchunkptr remainder@[???]
                       Unresolved local var: size_t remainder_size@[???]
                       Unresolved local var: mchunkptr bck@[???]
                       Unresolved local var: mchunkptr fwd@[???] */
  if (oldmem == (void *)0x0) {
    pvVar3 = _malloc_r(reent_ptr,bytes);
    return pvVar3;
  }
  piVar13 = (int *)((int)oldmem + -8);
  __malloc_lock(reent_ptr);
  if (bytes + 0x13 < 0x1f) {
    uVar16 = 0x10;
    bVar1 = 0x10 < bytes;
  }
  else {
    uVar16 = bytes + 0x13 & 0xfffffff0;
    bVar1 = uVar16 < bytes;
    if ((int)uVar16 < 0) goto LAB_08987840;
  }
  if (bVar1) {
LAB_08987840:
    reent_ptr->_errno = 0xc;
    return (void *)0x0;
  }
  uVar14 = *(uint *)((int)oldmem + -4) & 0xfffffffc;
  pmVar8 = (mbinptr)((int)piVar13 + uVar14);
  if ((int)uVar16 <= (int)uVar14) goto LAB_089877c0;
  if (pmVar8 == __malloc_av_[2]) {
    uVar9 = pmVar8->size & 0xfffffffc;
    if ((int)(uVar16 + 0x10) <= (int)(uVar14 + uVar9)) {
      __malloc_av_[2] = (mbinptr)((int)piVar13 + uVar16);
      __malloc_av_[2]->size = (uVar14 + uVar9) - uVar16 | 1;
      *(uint *)((int)oldmem + -4) = uVar16 | *(uint *)((int)oldmem + -4) & 1;
      __malloc_unlock(reent_ptr);
      return oldmem;
    }
  }
  else if ((*(uint *)((int)&pmVar8->size + (pmVar8->size & 0xfffffffe)) & 1) == 0) {
    uVar9 = pmVar8->size & 0xfffffffc;
    if ((int)uVar16 <= (int)(uVar14 + uVar9)) {
      pmVar4 = pmVar8->fd;
      pmVar2 = pmVar8->bk;
      pmVar2->fd = pmVar4;
      pmVar4->bk = pmVar2;
      uVar14 = uVar14 + uVar9;
      goto LAB_089877c0;
    }
  }
  else {
    pmVar8 = (mbinptr)0x0;
    uVar9 = 0;
  }
  if ((*(uint *)((int)oldmem + -4) & 1) != 0) {
LAB_08987a34:
    dst_void = _malloc_r(reent_ptr,bytes);
    if (dst_void != (undefined4 *)0x0) {
      uVar9 = uVar14 - 4;
      if (dst_void + -2 == (undefined4 *)((int)piVar13 + (*(uint *)((int)oldmem + -4) & 0xfffffffe))
         ) {
        uVar14 = uVar14 + (dst_void[-1] & 0xfffffffc);
        goto LAB_089877c0;
      }
                    /* Unresolved local var: size_t mcsz@[???] */
      if (uVar9 < 0x25) {
                    /* Unresolved local var: size_t * mcsrc@[???]
                       Unresolved local var: size_t * mcdst@[???] */
        puVar7 = oldmem;
        puVar10 = dst_void;
        if (0x13 < uVar9) {
          puVar10 = dst_void + 2;
          *dst_void = *(undefined4 *)oldmem;
          puVar7 = (undefined4 *)((int)oldmem + 8);
          dst_void[1] = *(undefined4 *)((int)oldmem + 4);
          if (0x1b < uVar9) {
            puVar10 = dst_void + 4;
            puVar7 = (undefined4 *)((int)oldmem + 0x10);
            dst_void[2] = *(undefined4 *)((int)oldmem + 8);
            dst_void[3] = *(undefined4 *)((int)oldmem + 0xc);
            if (uVar9 == 0x24) {
              puVar10 = dst_void + 6;
              puVar7 = (undefined4 *)((int)oldmem + 0x18);
              dst_void[4] = *(undefined4 *)((int)oldmem + 0x10);
              dst_void[5] = *(undefined4 *)((int)oldmem + 0x14);
            }
          }
        }
        *puVar10 = *puVar7;
        puVar10[1] = puVar7[1];
        puVar10[2] = puVar7[2];
      }
      else {
        memmove(dst_void,oldmem,uVar9);
      }
      _free_r(reent_ptr,oldmem);
    }
    __malloc_unlock(reent_ptr);
    return dst_void;
  }
  piVar17 = (int *)((int)piVar13 - *piVar13);
  piVar11 = oldmem;
  if (pmVar8 == (mbinptr)0x0) {
LAB_089879a8:
    uVar9 = uVar14 + (piVar17[1] & 0xfffffffcU);
    if ((int)uVar9 < (int)uVar16) goto LAB_08987a34;
    iVar15 = piVar17[3];
    iVar6 = piVar17[2];
    uVar14 = uVar14 - 4;
    *(int *)(iVar15 + 8) = iVar6;
    *(int *)(iVar6 + 0xc) = iVar15;
    piVar13 = piVar17 + 2;
    if (0x24 < uVar14) {
      memmove(piVar13,oldmem,uVar14);
      oldmem = piVar13;
      uVar14 = uVar9;
      piVar13 = piVar17;
      goto LAB_089877c0;
    }
    if (0x13 < uVar14) {
      piVar13 = piVar17 + 4;
      piVar17[2] = *(int *)oldmem;
      piVar11 = (int *)((int)oldmem + 8);
      piVar17[3] = *(int *)((int)oldmem + 4);
      if (0x1b < uVar14) {
        piVar13 = piVar17 + 6;
        piVar11 = (int *)((int)oldmem + 0x10);
        piVar17[4] = *(int *)((int)oldmem + 8);
        piVar17[5] = *(int *)((int)oldmem + 0xc);
        if (uVar14 == 0x24) {
          piVar11 = (int *)((int)oldmem + 0x18);
          piVar13 = piVar17 + 8;
          piVar17[6] = *(int *)((int)oldmem + 0x10);
          piVar17[7] = *(int *)((int)oldmem + 0x14);
          iVar15 = *piVar11;
          goto LAB_0898798c;
        }
      }
    }
    iVar15 = *piVar11;
  }
  else {
    iVar15 = uVar14 + (piVar17[1] & 0xfffffffcU);
    if (pmVar8 == __malloc_av_[2]) {
      iVar15 = uVar9 + iVar15;
      if ((int)(uVar16 + 0x10) <= iVar15) {
        iVar6 = piVar17[3];
        iVar5 = piVar17[2];
                    /* Unresolved local var: size_t mcsz@[???] */
        uVar14 = uVar14 - 4;
        *(int *)(iVar6 + 8) = iVar5;
        *(int *)(iVar5 + 0xc) = iVar6;
        piVar13 = piVar17 + 2;
        if (uVar14 < 0x25) {
                    /* Unresolved local var: size_t * mcsrc@[???]
                       Unresolved local var: size_t * mcdst@[???] */
          piVar12 = piVar13;
          if (0x13 < uVar14) {
            piVar12 = piVar17 + 4;
            piVar17[2] = *(int *)oldmem;
            piVar11 = (int *)((int)oldmem + 8);
            piVar17[3] = *(int *)((int)oldmem + 4);
            if (0x1b < uVar14) {
              piVar12 = piVar17 + 6;
              piVar11 = (int *)((int)oldmem + 0x10);
              piVar17[4] = *(int *)((int)oldmem + 8);
              piVar17[5] = *(int *)((int)oldmem + 0xc);
              if (uVar14 == 0x24) {
                piVar11 = (int *)((int)oldmem + 0x18);
                piVar12 = piVar17 + 8;
                piVar17[6] = *(int *)((int)oldmem + 0x10);
                piVar17[7] = *(int *)((int)oldmem + 0x14);
              }
            }
          }
          *piVar12 = *piVar11;
          piVar12[1] = piVar11[1];
          piVar12[2] = piVar11[2];
        }
        else {
          memmove(piVar13,oldmem,uVar14);
        }
        __malloc_av_[2] = (mbinptr)((int)piVar17 + uVar16);
        __malloc_av_[2]->size = iVar15 - uVar16 | 1;
        piVar17[1] = uVar16 | piVar17[1] & 1U;
        __malloc_unlock(reent_ptr);
        return piVar13;
      }
      goto LAB_089879a8;
    }
    uVar9 = uVar9 + iVar15;
    if ((int)uVar9 < (int)uVar16) goto LAB_089879a8;
    pmVar4 = pmVar8->fd;
    pmVar2 = pmVar8->bk;
                    /* Unresolved local var: size_t mcsz@[???] */
    uVar14 = uVar14 - 4;
    pmVar4->bk = pmVar2;
    pmVar2->fd = pmVar4;
    iVar6 = piVar17[3];
    iVar15 = piVar17[2];
    piVar13 = piVar17 + 2;
    *(int *)(iVar6 + 8) = iVar15;
    *(int *)(iVar15 + 0xc) = iVar6;
    if (0x24 < uVar14) {
      memmove(piVar13,oldmem,uVar14);
      oldmem = piVar13;
      uVar14 = uVar9;
      piVar13 = piVar17;
      goto LAB_089877c0;
    }
                    /* Unresolved local var: size_t * mcsrc@[???]
                       Unresolved local var: size_t * mcdst@[???] */
    if (0x13 < uVar14) {
      piVar13 = piVar17 + 4;
      piVar17[2] = *(int *)oldmem;
      piVar11 = (int *)((int)oldmem + 8);
      piVar17[3] = *(int *)((int)oldmem + 4);
      if (0x1b < uVar14) {
        piVar13 = piVar17 + 6;
        piVar11 = (int *)((int)oldmem + 0x10);
        piVar17[4] = *(int *)((int)oldmem + 8);
        piVar17[5] = *(int *)((int)oldmem + 0xc);
        if (uVar14 == 0x24) {
          piVar11 = (int *)((int)oldmem + 0x18);
          piVar13 = piVar17 + 8;
          piVar17[6] = *(int *)((int)oldmem + 0x10);
          piVar17[7] = *(int *)((int)oldmem + 0x14);
        }
      }
    }
    iVar15 = *piVar11;
  }
LAB_0898798c:
                    /* Unresolved local var: size_t mcsz@[???]
                       Unresolved local var: size_t * mcsrc@[???]
                       Unresolved local var: size_t * mcdst@[???] */
  *piVar13 = iVar15;
  piVar13[1] = piVar11[1];
  piVar13[2] = piVar11[2];
  oldmem = piVar17 + 2;
  uVar14 = uVar9;
  piVar13 = piVar17;
LAB_089877c0:
  uVar9 = uVar14 - uVar16;
  if (uVar9 < 0x10) {
    piVar13[1] = uVar14 | piVar13[1] & 1U;
    *(uint *)((int)piVar13 + uVar14 + 4) = *(uint *)((int)piVar13 + uVar14 + 4) | 1;
  }
  else {
    piVar13[1] = piVar13[1] & 1U | uVar16;
    *(uint *)((int)piVar13 + uVar16 + 4) = uVar9 | 1;
    *(uint *)((int)piVar13 + uVar9 + uVar16 + 4) = *(uint *)((int)piVar13 + uVar9 + uVar16 + 4) | 1;
    _free_r(reent_ptr,(void *)((int)piVar13 + uVar16 + 8));
  }
  __malloc_unlock(reent_ptr);
  return oldmem;
}



----------------------------------------

// Function: _wrapup_reent @ 08987d94

void _wrapup_reent(_reent *ptr)

{
  _func_void *p_Var1;
  _func_void **pp_Var2;
  int iVar3;
  int iVar4;
  _atexit *p_Var5;
  _func_void__reent_ptr *UNRECOVERED_JUMPTABLE;
  
                    /* Unresolved local var: _atexit * p@[???]
                       Unresolved local var: int n@[???] */
  if (ptr == (_reent *)0x0) {
    p_Var5 = _impure_ptr->_atexit;
    ptr = _impure_ptr;
  }
  else {
    p_Var5 = ptr->_atexit;
  }
  if (p_Var5 == (_atexit *)0x0) {
    UNRECOVERED_JUMPTABLE = ptr->__cleanup;
  }
  else {
    iVar4 = p_Var5->_ind;
    while( true ) {
      if (-1 < iVar4 + -1) {
        pp_Var2 = p_Var5->_fns + iVar4 + -1;
        iVar3 = 0;
        p_Var1 = *pp_Var2;
        while( true ) {
          iVar3 = iVar3 + 1;
          pp_Var2 = pp_Var2 + -1;
          (*p_Var1)();
          if (iVar3 == iVar4) break;
          p_Var1 = *pp_Var2;
        }
      }
      p_Var5 = p_Var5->_next;
      if (p_Var5 == (_atexit *)0x0) break;
      iVar4 = p_Var5->_ind;
    }
    UNRECOVERED_JUMPTABLE = ptr->__cleanup;
  }
  if (UNRECOVERED_JUMPTABLE != (_func_void__reent_ptr *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x08987e28. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*UNRECOVERED_JUMPTABLE)(ptr);
    return;
  }
  return;
}



----------------------------------------

// Function: cleanup_glue @ 08987e60

void cleanup_glue(_reent *ptr,_glue *glue)

{
  if (glue->_next != (_glue *)0x0) {
    cleanup_glue(ptr,glue->_next);
  }
  _free_r(ptr,glue);
  return;
}



----------------------------------------

// Function: _reclaim_reent @ 08987ea8

void _reclaim_reent(_reent *ptr)

{
  int iVar1;
  _Bigint **pp_Var2;
  _Bigint **mem;
  _Bigint *p_Var3;
  _atexit *mem_00;
  char *mem_01;
  _glue *glue;
  _Bigint *p_Var4;
  _atexit *p_Var5;
  
  if (_impure_ptr != ptr) {
    pp_Var2 = ptr->_freelist;
    if (pp_Var2 == (_Bigint **)0x0) {
      p_Var3 = ptr->_result;
    }
    else {
      iVar1 = 0;
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: _Bigint * thisone@[???]
                       Unresolved local var: _Bigint * nextone@[???] */
      mem = pp_Var2;
      do {
        p_Var3 = *pp_Var2;
        if (*pp_Var2 != (_Bigint *)0x0) {
          do {
            p_Var4 = p_Var3->_next;
            _free_r(ptr,p_Var3);
            p_Var3 = p_Var4;
          } while (p_Var4 != (_Bigint *)0x0);
          mem = ptr->_freelist;
        }
        iVar1 = iVar1 + 4;
        pp_Var2 = (_Bigint **)(iVar1 + (int)mem);
      } while (iVar1 != 0x3c);
      _free_r(ptr,mem);
      p_Var3 = ptr->_result;
    }
    if (p_Var3 == (_Bigint *)0x0) {
      mem_00 = ptr->_atexit;
    }
    else {
      _free_r(ptr,p_Var3);
      mem_00 = ptr->_atexit;
    }
    if (mem_00 == (_atexit *)0x0) {
      mem_01 = ptr->_cvtbuf;
    }
    else if (mem_00 == &ptr->_atexit0) {
      mem_01 = ptr->_cvtbuf;
    }
    else {
      do {
                    /* Unresolved local var: _atexit * p@[???]
                       Unresolved local var: _atexit * q@[???] */
        p_Var5 = mem_00->_next;
        _free_r(ptr,mem_00);
        mem_00 = p_Var5;
      } while (&ptr->_atexit0 != p_Var5);
      mem_01 = ptr->_cvtbuf;
    }
    if (mem_01 == (char *)0x0) {
      iVar1 = ptr->__sdidinit;
    }
    else {
      _free_r(ptr,mem_01);
      iVar1 = ptr->__sdidinit;
    }
    if (iVar1 != 0) {
      (*ptr->__cleanup)(ptr);
      glue = (ptr->__sglue)._next;
      if (glue != (_glue *)0x0) {
        cleanup_glue(ptr,glue);
        return;
      }
    }
  }
  return;
}



----------------------------------------

// Function: lflush @ 08987fd0

int lflush(FILE *fp)

{
  int iVar1;
  
  if ((fp->_flags & 9U) != 9) {
    return 0;
  }
  iVar1 = fflush(fp);
  return iVar1;
}



----------------------------------------

// Function: __srefill_r @ 08987ff4

int __srefill_r(_reent *ptr,FILE *fp)

{
  ushort uVar1;
  int iVar2;
  uchar *puVar3;
  
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    uVar1 = fp->_flags;
  }
  else {
    __sinit(_impure_ptr);
    uVar1 = fp->_flags;
  }
  fp->_r = 0;
  if ((uVar1 & 0x20) != 0) {
    return -1;
  }
  if ((uVar1 & 4) == 0) {
    if ((uVar1 & 0x10) == 0) {
      ptr->_errno = 9;
      fp->_flags = uVar1 | 0x40;
      return -1;
    }
    if ((uVar1 & 8) != 0) {
      iVar2 = fflush(fp);
      if (iVar2 != 0) {
        return -1;
      }
      fp->_w = 0;
      fp->_lbfsize = 0;
      fp->_flags = fp->_flags & 0xfff7;
    }
    fp->_flags = fp->_flags | 4;
  }
  else {
    puVar3 = (fp->_ub)._base;
    if (puVar3 != (uchar *)0x0) {
      if (puVar3 == fp->_ubuf) {
        iVar2 = fp->_ur;
      }
      else {
        _free_r(_impure_ptr,puVar3);
        iVar2 = fp->_ur;
      }
      (fp->_ub)._base = (uchar *)0x0;
      fp->_r = iVar2;
      if (iVar2 != 0) {
        fp->_p = fp->_up;
        return 0;
      }
    }
  }
  if ((fp->_bf)._base == (uchar *)0x0) {
    __smakebuf(fp);
    uVar1 = fp->_flags;
  }
  else {
    uVar1 = fp->_flags;
  }
  if ((uVar1 & 3) == 0) {
    puVar3 = (fp->_bf)._base;
  }
  else {
    _fwalk(_global_impure_ptr,lflush);
    puVar3 = (fp->_bf)._base;
  }
  iVar2 = (fp->_bf)._size;
  fp->_p = puVar3;
  iVar2 = (*fp->_read)(fp->_cookie,(char *)puVar3,iVar2);
  fp->_r = iVar2;
  uVar1 = fp->_flags & 0xdfff;
  fp->_flags = uVar1;
  if (iVar2 < 1) {
    if (iVar2 == 0) {
      iVar2 = -1;
      fp->_flags = uVar1 | 0x20;
    }
    else {
      iVar2 = -1;
      fp->_flags = uVar1 | 0x40;
      fp->_r = 0;
    }
  }
  else {
    iVar2 = 0;
  }
  return iVar2;
}



----------------------------------------

// Function: __srget_r @ 089881e4

int __srget_r(_reent *ptr,FILE *fp)

{
  int iVar1;
  uint uVar2;
  
  iVar1 = __srefill_r(ptr,fp);
  uVar2 = 0xffffffff;
  if (iVar1 == 0) {
    fp->_r = fp->_r + -1;
    uVar2 = (uint)*fp->_p;
    fp->_p = fp->_p + 1;
  }
  return uVar2;
}



----------------------------------------

// Function: __srget @ 08988230

int __srget(FILE *fp)

{
  int iVar1;
  
  iVar1 = __srget_r(_impure_ptr,fp);
  return iVar1;
}



----------------------------------------

// Function: _sbrk_r @ 08988244

void * _sbrk_r(_reent *ptr,ptrdiff_t incr)

{
  void *pvVar1;
  
                    /* Unresolved local var: char * ret@[???] */
  errno = 0;
  pvVar1 = _sbrk(incr);
  if ((pvVar1 == (void *)0xffffffff) && (errno != 0)) {
    ptr->_errno = errno;
    return (void *)0xffffffff;
  }
  return pvVar1;
}



----------------------------------------

// Function: _init_signal_r @ 089882ac

int _init_signal_r(_reent *ptr)

{
  int iVar1;
  _func_void_int **pp_Var2;
  undefined4 *puVar3;
  
                    /* Unresolved local var: int i@[???] */
  if (ptr->_sig_func == (_func_void_int **)0x0) {
    pp_Var2 = _malloc_r(ptr,0x80);
    ptr->_sig_func = pp_Var2;
    if (pp_Var2 == (_func_void_int **)0x0) {
      iVar1 = -1;
    }
    else {
      iVar1 = 0;
      do {
        puVar3 = (undefined4 *)((int)pp_Var2 + iVar1);
        iVar1 = iVar1 + 4;
        *puVar3 = 0;
      } while (iVar1 != 0x80);
      iVar1 = 0;
    }
  }
  else {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: _init_signal @ 08988314

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int _init_signal(void)

{
  int iVar1;
  
  iVar1 = _init_signal_r(_impure_ptr);
  return iVar1;
}



----------------------------------------

// Function: __sigtramp_r @ 08988324

int __sigtramp_r(_reent *ptr,int sig)

{
  int iVar1;
  _func_void_int **pp_Var2;
  _func_void_int *p_Var3;
  
                    /* Unresolved local var: _sig_func_ptr func@[???] */
  if (0x1f < (uint)sig) {
    return -1;
  }
  pp_Var2 = ptr->_sig_func;
  if (pp_Var2 == (_func_void_int **)0x0) {
    iVar1 = _init_signal_r(ptr);
    if (iVar1 != 0) {
      return -1;
    }
    pp_Var2 = ptr->_sig_func;
  }
  p_Var3 = pp_Var2[sig];
  iVar1 = 1;
  if ((p_Var3 != (_func_void_int *)0x0) && (iVar1 = 2, p_Var3 != (_func_void_int *)0xffffffff)) {
    if (p_Var3 == (_func_void_int *)0x1) {
      return 3;
    }
    pp_Var2[sig] = (_func_void_int *)0x0;
    (*p_Var3)(sig);
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: __sigtramp @ 089883e4

int __sigtramp(int sig)

{
  int iVar1;
  
  iVar1 = __sigtramp_r(_impure_ptr,sig);
  return iVar1;
}



----------------------------------------

// Function: _raise_r @ 089883f8

int _raise_r(_reent *ptr,int sig)

{
  _func_void_int **pp_Var1;
  _func_void_int *p_Var2;
  int iVar3;
  
                    /* Unresolved local var: _sig_func_ptr func@[???] */
  if ((uint)sig < 0x20) {
    pp_Var1 = ptr->_sig_func;
    if (pp_Var1 == (_func_void_int **)0x0) {
      iVar3 = _init_signal_r(ptr);
      if (iVar3 != 0) {
        return -1;
      }
      pp_Var1 = ptr->_sig_func;
    }
    p_Var2 = pp_Var1[sig];
    if (p_Var2 == (_func_void_int *)0x0) {
      iVar3 = _getpid_r(ptr);
      iVar3 = _kill_r(ptr,iVar3,sig);
      return iVar3;
    }
    if (p_Var2 != (_func_void_int *)0x1) {
      if (p_Var2 == (_func_void_int *)0xffffffff) {
        ptr->_errno = 0x16;
        return 1;
      }
      pp_Var1[sig] = (_func_void_int *)0x0;
      (*p_Var2)(sig);
    }
    iVar3 = 0;
  }
  else {
    iVar3 = -1;
    ptr->_errno = 0x16;
  }
  return iVar3;
}



----------------------------------------

// Function: raise @ 089884e0

int raise(int sig)

{
  int iVar1;
  
  iVar1 = _raise_r(_impure_ptr,sig);
  return iVar1;
}



----------------------------------------

// Function: _signal_r @ 089884f4

_sig_func_ptr _signal_r(_reent *ptr,int sig,_sig_func_ptr func)

{
  int iVar1;
  _sig_func_ptr p_Var2;
  _func_void_int **pp_Var3;
  
                    /* Unresolved local var: _sig_func_ptr old_func@[???] */
  if (0x1f < (uint)sig) {
    ptr->_errno = 0x16;
    return (_sig_func_ptr)0xffffffff;
  }
  pp_Var3 = ptr->_sig_func;
  if (pp_Var3 == (_func_void_int **)0x0) {
    iVar1 = _init_signal_r(ptr);
    if (iVar1 != 0) {
      return (_sig_func_ptr)0xffffffff;
    }
    pp_Var3 = ptr->_sig_func;
  }
  p_Var2 = pp_Var3[sig];
  pp_Var3[sig] = func;
  return p_Var2;
}



----------------------------------------

// Function: signal @ 08988594

_sig_func_ptr signal(int sig,_sig_func_ptr func)

{
  _sig_func_ptr p_Var1;
  
  p_Var1 = _signal_r(_impure_ptr,sig,func);
  return p_Var1;
}



----------------------------------------

// Function: _getpid_r @ 089885ac

int _getpid_r(_reent *ptr)

{
  int *piVar1;
  
                    /* Unresolved local var: int ret@[???] */
  piVar1 = __errno();
  *piVar1 = 0x58;
  return -1;
}



----------------------------------------

// Function: _kill_r @ 089885b4

int _kill_r(_reent *ptr,int pid,int sig)

{
  int iVar1;
  
                    /* Unresolved local var: int ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _kill(pid,sig);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: sprintf @ 08988620

int sprintf(char *str,char *fmt,...)

{
  int iVar1;
  undefined4 in_a2;
  undefined4 in_a3;
  FILE local_7c;
  undefined4 local_18;
  undefined4 local_14;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: va_list ap@[???]
                       Unresolved local var: FILE f@[???] */
  local_7c._flags = 0x208;
  local_7c._bf._size = 0x7fffffff;
  local_7c._w = 0x7fffffff;
  local_7c._file = -1;
  local_7c._p = (uchar *)str;
  local_7c._bf._base = (uchar *)str;
  local_18 = in_a2;
  local_14 = in_a3;
  iVar1 = _vfprintf_r(_impure_ptr,&local_7c,fmt,&local_18);
  *local_7c._p = '\0';
  return iVar1;
}



----------------------------------------

// Function: _sprintf_r @ 089886a0

int _sprintf_r(_reent *ptr,char *str,char *fmt,...)

{
  int iVar1;
  undefined4 in_a3;
  FILE local_7c;
  undefined4 local_14 [5];
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: va_list ap@[???]
                       Unresolved local var: FILE f@[???] */
  local_7c._flags = 0x208;
  local_7c._bf._size = 0x7fffffff;
  local_7c._w = 0x7fffffff;
  local_7c._file = -1;
  local_7c._p = (uchar *)str;
  local_7c._bf._base = (uchar *)str;
  local_14[0] = in_a3;
  iVar1 = _vfprintf_r(ptr,&local_7c,fmt,local_14);
  *local_7c._p = '\0';
  return iVar1;
}



----------------------------------------

// Function: __sclose @ 08988710

int __sclose(void *cookie)

{
  int iVar1;
  
                    /* Unresolved local var: FILE * fp@[???] */
  iVar1 = _close_r(_impure_ptr,(int)*(short *)((int)cookie + 0xe));
  return iVar1;
}



----------------------------------------

// Function: __sseek @ 08988724

_fpos_t __sseek(void *cookie,_fpos_t offset,int whence)

{
  _off_t _Var1;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: _off_t ret@[DW_OP_reg3(v1)] */
  _Var1 = _lseek_r(_impure_ptr,(int)*(short *)((int)cookie + 0xe),offset,whence);
  if (_Var1 != -1) {
    *(_off_t *)((int)cookie + 0x50) = _Var1;
    *(ushort *)((int)cookie + 0xc) = *(ushort *)((int)cookie + 0xc) | 0x1000;
    return _Var1;
  }
  *(ushort *)((int)cookie + 0xc) = *(ushort *)((int)cookie + 0xc) & 0xefff;
  return -1;
}



----------------------------------------

// Function: __swrite @ 0898879c

int __swrite(void *cookie,char *buf,int n)

{
  _reent *ptr;
  _ssize_t _Var1;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int w@[???] */
  if ((*(ushort *)((int)cookie + 0xc) & 0x100) != 0) {
    _lseek_r(_impure_ptr,(int)*(short *)((int)cookie + 0xe),0,2);
  }
  ptr = _impure_ptr;
  *(ushort *)((int)cookie + 0xc) = *(ushort *)((int)cookie + 0xc) & 0xefff;
  _Var1 = _write_r(ptr,(int)*(short *)((int)cookie + 0xe),buf,n);
  return _Var1;
}



----------------------------------------

// Function: __sread @ 08988818

int __sread(void *cookie,char *buf,int n)

{
  _ssize_t _Var1;
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int ret@[???] */
  _Var1 = _read_r(_impure_ptr,(int)*(short *)((int)cookie + 0xe),buf,n);
  if (-1 < _Var1) {
    *(int *)((int)cookie + 0x50) = *(int *)((int)cookie + 0x50) + _Var1;
    return _Var1;
  }
  *(ushort *)((int)cookie + 0xc) = *(ushort *)((int)cookie + 0xc) & 0xefff;
  return _Var1;
}



----------------------------------------

// Function: strcasecmp @ 0898888c

int strcasecmp(char *s1,char *s2)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  
  iVar1 = (int)*s1;
  if (iVar1 == 0) {
    uVar2 = (uint)(byte)*s1;
  }
  else {
    do {
      if ((__ctype_ptr[iVar1] & 1U) != 0) {
        iVar1 = iVar1 + 0x20;
      }
                    /* Unresolved local var: int __x@[???] */
      iVar4 = (int)*s2;
      if ((__ctype_ptr[iVar4] & 1U) != 0) {
        iVar4 = iVar4 + 0x20;
      }
      if (iVar1 != iVar4) {
        uVar2 = (uint)(byte)*s1;
        goto LAB_089888ec;
      }
      s1 = s1 + 1;
      iVar1 = (int)*s1;
      s2 = s2 + 1;
    } while (iVar1 != 0);
                    /* Unresolved local var: int __x@[???] */
    uVar2 = (uint)(byte)*s1;
  }
LAB_089888ec:
  if ((__ctype_ptr[uVar2] & 1U) != 0) {
    uVar2 = uVar2 + 0x20;
  }
                    /* Unresolved local var: int __x@[???] */
  uVar3 = (uint)(byte)*s2;
  if ((__ctype_ptr[uVar3] & 1U) != 0) {
    uVar3 = uVar3 + 0x20;
  }
  return uVar2 - uVar3;
}



----------------------------------------

// Function: strcat @ 08988930

char * strcat(char *s1,char *s2)

{
  uint uVar1;
  uint *dst0;
  
                    /* Unresolved local var: char * s@[???] */
  dst0 = (uint *)s1;
  if (((uint)s1 & 3) == 0) {
                    /* Unresolved local var: ulong * aligned_s1@[???] */
    uVar1 = ~*(uint *)s1 & *(uint *)s1 + 0xfefefeff & 0x80808080;
    while (uVar1 == 0) {
      dst0 = dst0 + 1;
      uVar1 = ~*dst0 & *dst0 + 0xfefefeff & 0x80808080;
    }
    if ((char)*dst0 == '\0') goto LAB_089889b8;
    dst0 = (uint *)((int)dst0 + 1);
  }
  for (; (char)*dst0 != '\0'; dst0 = (uint *)((int)dst0 + 1)) {
  }
LAB_089889b8:
  strcpy((char *)dst0,s2);
  return s1;
}



----------------------------------------

// Function: strchr @ 089889d4

char * strchr(char *s1,int i)

{
  byte bVar1;
  uint uVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  
                    /* Unresolved local var: uchar * s@[DW_OP_reg4(a0)]
                       Unresolved local var: uchar c@[DW_OP_reg7(a3)]
                       Unresolved local var: ulong mask@[DW_OP_reg10(t2)]
                       Unresolved local var: ulong j@[???]
                       Unresolved local var: ulong * aligned_addr@[DW_OP_reg6(a2)] */
  uVar5 = i & 0xff;
  if (((uint)s1 & 3) != 0) goto LAB_08988aa4;
  uVar6 = 0;
  iVar3 = 0;
  do {
    iVar3 = iVar3 + 1;
    uVar6 = uVar5 | uVar6 << 8;
  } while (iVar3 != 4);
  uVar4 = *(uint *)s1;
  if ((uVar4 + 0xfefefeff & 0x80808080 & ~uVar4) == 0) {
    uVar4 = ~(uVar4 ^ uVar6) & (uVar4 ^ uVar6) + 0xfefefeff & 0x80808080;
    do {
      if (uVar4 != 0) break;
      s1 = (char *)((int)s1 + 4);
      uVar2 = *(uint *)s1;
      uVar4 = ~(uVar2 ^ uVar6) & (uVar2 ^ uVar6) + 0xfefefeff & 0x80808080;
    } while ((~uVar2 & uVar2 + 0xfefefeff & 0x80808080) == 0);
  }
  bVar1 = (byte)*(uint *)s1;
  while (bVar1 != 0) {
    if (uVar5 == bVar1) {
      return (char *)(uint *)s1;
    }
    s1 = (char *)((int)s1 + 1);
LAB_08988aa4:
    bVar1 = (byte)*(uint *)s1;
  }
  if (uVar5 == 0) {
    return (char *)(uint *)s1;
  }
  return (char *)0x0;
}



----------------------------------------

// Function: strcmp @ 08988ac8

int strcmp(char *s1,char *s2)

{
  byte *pbVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  
                    /* Unresolved local var: uchar * us1@[DW_OP_reg4(a0)]
                       Unresolved local var: uchar * us2@[DW_OP_reg5(a1)]
                       Unresolved local var: int c1a@[???]
                       Unresolved local var: int c1b@[???]
                       Unresolved local var: int c2a@[???]
                       Unresolved local var: int c2b@[???] */
  uVar2 = (uint)(byte)*s1;
  if ((((uint)s1 | (uint)s2) & 1) == 0) {
    while( true ) {
      uVar3 = (uint)(byte)*s2;
      if ((uVar2 == 0) || (uVar4 = (uint)(byte)s1[1], uVar2 != uVar3)) break;
      pbVar1 = (byte *)(s2 + 1);
      s2 = s2 + 2;
      if ((uVar4 == 0) || (uVar2 = (uint)(byte)s1[2], s1 = s1 + 2, uVar4 != *pbVar1)) {
        return uVar4 - *pbVar1;
      }
    }
  }
  else {
    while( true ) {
      uVar3 = (uint)(byte)*s2;
      s1 = s1 + 1;
      s2 = s2 + 1;
      if ((uVar2 == 0) || (uVar2 != uVar3)) break;
      uVar2 = (uint)(byte)*s1;
    }
  }
  return uVar2 - uVar3;
}



----------------------------------------

// Function: strcpy @ 08988b34

char * strcpy(char *dst0,char *src0)

{
  uint *puVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: char * dst@[???]
                       Unresolved local var: char * src@[???]
                       Unresolved local var: long * aligned_dst@[???]
                       Unresolved local var: long * aligned_src@[???] */
  puVar1 = (uint *)dst0;
  if ((((uint)src0 | (uint)dst0) & 3) == 0) {
    uVar3 = *(uint *)src0;
    uVar2 = uVar3 + 0xfefefeff & ~uVar3;
    while ((uVar2 & 0x80808080) == 0) {
      *puVar1 = uVar3;
      src0 = (char *)((int)src0 + 4);
      uVar3 = *(uint *)src0;
      puVar1 = puVar1 + 1;
      uVar2 = uVar3 + 0xfefefeff & ~uVar3;
    }
  }
  do {
    uVar3 = *(uint *)src0;
    src0 = (char *)((int)src0 + 1);
    *(char *)puVar1 = (char)uVar3;
    puVar1 = (uint *)((int)puVar1 + 1);
  } while ((char)uVar3 != '\0');
  return dst0;
}



----------------------------------------

// Function: strdup @ 08988bc0

char * strdup(char *str)

{
  char *pcVar1;
  
  pcVar1 = _strdup_r(_impure_ptr,str);
  return pcVar1;
}



----------------------------------------

// Function: _strdup_r @ 08988bd4

char * _strdup_r(_reent *reent_ptr,char *str)

{
  size_t sVar1;
  char *dst0;
  
                    /* Unresolved local var: size_t len@[???]
                       Unresolved local var: char * copy@[???] */
  sVar1 = strlen(str);
  dst0 = _malloc_r(reent_ptr,sVar1 + 1);
  if (dst0 != (char *)0x0) {
    memcpy(dst0,str,sVar1 + 1);
  }
  return dst0;
}



----------------------------------------

// Function: strerror @ 08988c40

char * strerror(int errnum)

{
  char *pcVar1;
  char *pcVar2;
  
                    /* Unresolved local var: char * error@[???] */
  switch(errnum) {
  default:
    pcVar1 = _user_strerror(errnum);
    pcVar2 = "";
    if (pcVar1 != (char *)0x0) {
      pcVar2 = pcVar1;
    }
    break;
  case 1:
    pcVar2 = "Not owner";
    break;
  case 2:
    pcVar2 = "No such file or directory";
    break;
  case 3:
    pcVar2 = "No such process";
    break;
  case 4:
    pcVar2 = "Interrupted system call";
    break;
  case 5:
    pcVar2 = "I/O error";
    break;
  case 6:
    pcVar2 = "No such device or address";
    break;
  case 7:
    pcVar2 = "Arg list too long";
    break;
  case 8:
    pcVar2 = "Exec format error";
    break;
  case 9:
    pcVar2 = "Bad file number";
    break;
  case 10:
    pcVar2 = "No children";
    break;
  case 0xb:
    pcVar2 = "No more processes";
    break;
  case 0xc:
    pcVar2 = "Not enough space";
    break;
  case 0xd:
    pcVar2 = "Permission denied";
    break;
  case 0xe:
    pcVar2 = "Bad address";
    break;
  case 0xf:
    pcVar2 = "Block device required";
    break;
  case 0x10:
    pcVar2 = "Device or resource busy";
    break;
  case 0x11:
    pcVar2 = "File exists";
    break;
  case 0x12:
    pcVar2 = "Cross-device link";
    break;
  case 0x13:
    pcVar2 = "No such device";
    break;
  case 0x14:
    pcVar2 = "Not a directory";
    break;
  case 0x15:
    pcVar2 = "Is a directory";
    break;
  case 0x16:
    pcVar2 = "Invalid argument";
    break;
  case 0x17:
    pcVar2 = "Too many open files in system";
    break;
  case 0x18:
    pcVar2 = "Too many open files";
    break;
  case 0x19:
    pcVar2 = "Not a character device";
    break;
  case 0x1a:
    pcVar2 = "Text file busy";
    break;
  case 0x1b:
    pcVar2 = "File too large";
    break;
  case 0x1c:
    pcVar2 = "No space left on device";
    break;
  case 0x1d:
    pcVar2 = "Illegal seek";
    break;
  case 0x1e:
    pcVar2 = "Read-only file system";
    break;
  case 0x1f:
    pcVar2 = "Too many links";
    break;
  case 0x20:
    pcVar2 = "Broken pipe";
    break;
  case 0x21:
    pcVar2 = "Math argument";
    break;
  case 0x22:
    pcVar2 = "Result too large";
    break;
  case 0x23:
    pcVar2 = "No message of desired type";
    break;
  case 0x24:
    pcVar2 = "Identifier removed";
    break;
  case 0x2d:
    pcVar2 = "Deadlock";
    break;
  case 0x2e:
    pcVar2 = "No lock";
    break;
  case 0x3c:
    pcVar2 = "Not a stream";
    break;
  case 0x3e:
    pcVar2 = "Stream ioctl timeout";
    break;
  case 0x3f:
    pcVar2 = "No stream resources";
    break;
  case 0x40:
    pcVar2 = "Machine is not on the network";
    break;
  case 0x41:
    pcVar2 = "No package";
    break;
  case 0x42:
    pcVar2 = "Resource is remote";
    break;
  case 0x43:
    pcVar2 = "Virtual circuit is gone";
    break;
  case 0x44:
    pcVar2 = "Advertise error";
    break;
  case 0x45:
    pcVar2 = "Srmount error";
    break;
  case 0x46:
    pcVar2 = "Communication error";
    break;
  case 0x47:
    pcVar2 = "Protocol error";
    break;
  case 0x4a:
    pcVar2 = "Multihop attempted";
    break;
  case 0x4d:
    pcVar2 = "Bad message";
    break;
  case 0x53:
    pcVar2 = "Cannot access a needed shared library";
    break;
  case 0x54:
    pcVar2 = "Accessing a corrupted shared library";
    break;
  case 0x55:
    pcVar2 = ".lib section in a.out corrupted";
    break;
  case 0x56:
    pcVar2 = "Attempting to link in more shared libraries than system limit";
    break;
  case 0x57:
    pcVar2 = "Cannot exec a shared library directly";
    break;
  case 0x58:
    pcVar2 = "Function not implemented";
    break;
  case 0x59:
    pcVar2 = "No more files";
    break;
  case 0x5a:
    pcVar2 = "Directory not empty";
    break;
  case 0x5b:
    pcVar2 = "File or path name too long";
    break;
  case 0x5c:
    pcVar2 = "Too many symbolic links";
    break;
  case 0x5f:
    pcVar2 = "Operation not supported on socket";
    break;
  case 0x69:
    pcVar2 = "No buffer space available";
    break;
  case 0x6a:
    pcVar2 = "Address family not supported by protocol family";
    break;
  case 0x6b:
    pcVar2 = "Protocol wrong type for socket";
    break;
  case 0x6c:
    pcVar2 = "Socket operation on non-socket";
    break;
  case 0x6d:
    pcVar2 = "Protocol not available";
    break;
  case 0x6e:
    pcVar2 = "Can\'t send after socket shutdown";
    break;
  case 0x6f:
    pcVar2 = "Connection refused";
    break;
  case 0x70:
    pcVar2 = "Address already in use";
    break;
  case 0x71:
    pcVar2 = "Software caused connection abort";
    break;
  case 0x72:
    pcVar2 = "Network is unreachable";
    break;
  case 0x73:
    pcVar2 = "Network interface is not configured";
    break;
  case 0x74:
    pcVar2 = "Connection timed out";
    break;
  case 0x75:
    pcVar2 = "Host is down";
    break;
  case 0x76:
    pcVar2 = "Host is unreachable";
    break;
  case 0x77:
    pcVar2 = "Connection already in progress";
    break;
  case 0x78:
    pcVar2 = "Socket already connected";
    break;
  case 0x79:
    pcVar2 = "Destination address required";
    break;
  case 0x7a:
    pcVar2 = "Message too long";
    break;
  case 0x7b:
    pcVar2 = "Unknown protocol";
    break;
  case 0x7c:
    pcVar2 = "Socket type not supported";
    break;
  case 0x7f:
    pcVar2 = "Socket is already connected";
    break;
  case 0x80:
    pcVar2 = "Socket is not connected";
    break;
  case 0x86:
    pcVar2 = "Not supported";
  }
  return pcVar2;
}



----------------------------------------

// Function: strlen @ 089891e4

size_t strlen(char *__s)

{
  char cVar1;
  char *pcVar2;
  
  pcVar2 = __s + 1;
  do {
    cVar1 = *__s;
    __s = __s + 1;
  } while (cVar1 != '\0');
  return (int)__s - (int)pcVar2;
}



----------------------------------------

// Function: strncmp @ 089891fc

int strncmp(char *s1,char *s2,size_t n)

{
  uint uVar1;
  uint uVar2;
  uint *puVar3;
  int iVar4;
  byte bVar5;
  int iVar6;
  
                    /* Unresolved local var: ulong * a1@[???]
                       Unresolved local var: ulong * a2@[???] */
  if (n == 0) {
    return 0;
  }
  if ((((((uint)s1 | (uint)s2) & 3) == 0) && (3 < n)) && (uVar1 = *(uint *)s1, uVar1 == *(uint *)s2)
     ) {
    n = n - 4;
    if (n == 0) {
      return 0;
    }
    uVar1 = ~uVar1 & uVar1 + 0xfefefeff & 0x80808080;
    while( true ) {
      if (uVar1 != 0) {
        return 0;
      }
      s1 = (char *)((int)s1 + 4);
      s2 = (char *)((int)s2 + 4);
      if (n < 4) break;
      uVar2 = *(uint *)s1;
      uVar1 = ~uVar2 & uVar2 + 0xfefefeff & 0x80808080;
      if (uVar2 != *(uint *)s2) break;
      n = n - 4;
      if (n == 0) {
        return 0;
      }
    }
  }
  iVar6 = n - 1;
  puVar3 = (uint *)s1;
  if (n != 0) {
    uVar1 = *(uint *)s2;
    if ((byte)uVar1 != (byte)*(uint *)s1) {
      bVar5 = (byte)*(uint *)s1;
      goto LAB_08989318;
    }
    if (iVar6 == 0) {
      return 0;
    }
    s2 = (char *)((int)s2 + 1);
    if ((byte)uVar1 == 0) {
      return 0;
    }
    iVar4 = 0;
    puVar3 = (uint *)((int)s1 + 1);
    bVar5 = *s2;
    while( true ) {
      iVar4 = iVar4 + 1;
      if (bVar5 != (byte)*puVar3) break;
      s2 = (char *)((int)s2 + 1);
      if (puVar3 == (uint *)((int)s1 + iVar6)) {
        return 0;
      }
      puVar3 = (uint *)((int)puVar3 + 1);
      if (bVar5 == 0) {
        return 0;
      }
      if (iVar4 == iVar6) break;
      bVar5 = *s2;
    }
  }
  bVar5 = (byte)*puVar3;
LAB_08989318:
  return (uint)bVar5 - (uint)(byte)*(uint *)s2;
}



----------------------------------------

// Function: strncpy @ 0898932c

char * strncpy(char *dst0,char *src0,size_t count)

{
  char cVar1;
  char cVar2;
  char cVar3;
  char cVar4;
  char *pcVar5;
  int iVar6;
  int iVar7;
  char *pcVar8;
  uint uVar9;
  char *pcVar10;
  size_t sVar11;
  
                    /* Unresolved local var: uchar * dst@[???]
                       Unresolved local var: uchar * dst_end@[???]
                       Unresolved local var: uchar * end@[???]
                       Unresolved local var: uchar * src@[DW_OP_reg5(a1)]
                       Unresolved local var: int ch0@[???]
                       Unresolved local var: int ch1@[???]
                       Unresolved local var: int ch2@[???]
                       Unresolved local var: int ch3@[???]
                       Unresolved local var: int ch@[???]
                       Unresolved local var: int odd_bytes@[???]
                       Unresolved local var: size_t long_count@[???] */
  pcVar5 = dst0;
  sVar11 = count;
  if (3 < count) {
    sVar11 = count & 3;
    iVar6 = count - sVar11;
    do {
      cVar1 = *src0;
      cVar2 = src0[1];
      cVar3 = src0[2];
      cVar4 = src0[3];
      iVar7 = iVar6 + -4;
      src0 = src0 + 4;
      *pcVar5 = cVar1;
      if (cVar1 == '\0') {
        iVar7 = iVar6 + -3;
        pcVar5 = pcVar5 + -1;
LAB_089893ec:
        iVar7 = iVar7 + 1;
        pcVar5 = pcVar5 + -1;
LAB_089893f4:
        iVar7 = iVar7 + 1;
        pcVar5 = pcVar5 + -1;
LAB_089893fc:
        uVar9 = iVar7 + sVar11;
        pcVar5 = pcVar5 + 4;
        if (uVar9 == 0) {
          return dst0;
        }
        if (((uint)pcVar5 & 3) != 0) {
          *pcVar5 = '\0';
          while( true ) {
            uVar9 = uVar9 - 1;
            pcVar5 = pcVar5 + 1;
            if (uVar9 == 0) {
              return dst0;
            }
            if (((uint)pcVar5 & 3) == 0) break;
            *pcVar5 = '\0';
          }
        }
        for (; 0xf < uVar9; uVar9 = uVar9 - 0x10) {
          pcVar5[0] = '\0';
          pcVar5[1] = '\0';
          pcVar5[2] = '\0';
          pcVar5[3] = '\0';
          pcVar5[4] = '\0';
          pcVar5[5] = '\0';
          pcVar5[6] = '\0';
          pcVar5[7] = '\0';
          pcVar5[8] = '\0';
          pcVar5[9] = '\0';
          pcVar5[10] = '\0';
          pcVar5[0xb] = '\0';
          pcVar5[0xc] = '\0';
          pcVar5[0xd] = '\0';
          pcVar5[0xe] = '\0';
          pcVar5[0xf] = '\0';
          pcVar5 = pcVar5 + 0x10;
        }
        if (7 < uVar9) {
          pcVar5[0] = '\0';
          pcVar5[1] = '\0';
          pcVar5[2] = '\0';
          pcVar5[3] = '\0';
          pcVar5[4] = '\0';
          pcVar5[5] = '\0';
          pcVar5[6] = '\0';
          pcVar5[7] = '\0';
          uVar9 = uVar9 - 8;
          pcVar5 = pcVar5 + 8;
        }
        if (3 < uVar9) {
          uVar9 = uVar9 - 4;
          pcVar5[0] = '\0';
          pcVar5[1] = '\0';
          pcVar5[2] = '\0';
          pcVar5[3] = '\0';
          pcVar5 = pcVar5 + 4;
        }
        if (1 < uVar9) {
          pcVar5[0] = '\0';
          pcVar5[1] = '\0';
          uVar9 = uVar9 - 2;
          pcVar5 = pcVar5 + 2;
        }
        if (uVar9 == 0) {
          return dst0;
        }
        *pcVar5 = '\0';
        return dst0;
      }
      pcVar5[1] = cVar2;
      if (cVar2 == '\0') goto LAB_089893ec;
      pcVar5[2] = cVar3;
      if (cVar3 == '\0') goto LAB_089893f4;
      pcVar5[3] = cVar4;
      if (cVar4 == '\0') goto LAB_089893fc;
      pcVar5 = pcVar5 + 4;
      iVar6 = iVar7;
    } while (iVar7 != 0);
  }
  pcVar8 = pcVar5 + sVar11;
  pcVar10 = pcVar5 + 1;
  if (pcVar5 != pcVar8) {
    cVar1 = *src0;
    *pcVar5 = cVar1;
    if (cVar1 != '\0') {
      iVar6 = 0;
      iVar7 = (int)pcVar8 - (int)pcVar10;
      do {
        if (iVar7 == iVar6) {
          return dst0;
        }
        cVar1 = src0[iVar6 + 1];
        iVar6 = iVar6 + 1;
        *pcVar10 = cVar1;
        pcVar10 = pcVar10 + 1;
      } while (cVar1 != '\0');
    }
    if (pcVar8 != pcVar10) {
      *pcVar10 = '\0';
      while (pcVar10 = pcVar10 + 1, pcVar10 != pcVar8) {
        *pcVar10 = '\0';
      }
    }
  }
  return dst0;
}



----------------------------------------

// Function: strrchr @ 089894c8

char * strrchr(char *s,int i)

{
  char *pcVar1;
  char *pcVar2;
  
                    /* Unresolved local var: char * last@[???] */
  if (i != 0) {
    pcVar2 = (char *)0x0;
    while (pcVar1 = strchr(s,i), pcVar1 != (char *)0x0) {
      s = pcVar1 + 1;
      pcVar2 = pcVar1;
    }
    return pcVar2;
  }
  pcVar2 = strchr(s,0);
  return pcVar2;
}



----------------------------------------

// Function: strstr @ 08989530

char * strstr(char *searchee,char *lookfor)

{
  char *pcVar1;
  char *pcVar2;
  int iVar3;
  
  if (*searchee == '\0') {
    if (*lookfor == '\0') {
      return searchee;
    }
  }
  else {
    do {
      iVar3 = 0;
      do {
                    /* Unresolved local var: size_t i@[???] */
        pcVar1 = lookfor + iVar3;
        pcVar2 = searchee + iVar3;
        iVar3 = iVar3 + 1;
        if (*pcVar1 == '\0') {
          return searchee;
        }
      } while (*pcVar2 == *pcVar1);
      searchee = searchee + 1;
    } while (*searchee != '\0');
  }
  return (char *)0x0;
}



----------------------------------------

// Function: match @ 08989588

int match(char **sp,char *t)

{
  char cVar1;
  int iVar2;
  char *pcVar3;
  
                    /* Unresolved local var: int c@[DW_OP_reg3(v1)]
                       Unresolved local var: int d@[???]
                       Unresolved local var: char * s@[DW_OP_reg7(a3)] */
  pcVar3 = *sp;
  cVar1 = *t;
  while( true ) {
    t = t + 1;
    if (cVar1 == 0) {
      *sp = pcVar3 + 1;
      return 1;
    }
    pcVar3 = pcVar3 + 1;
    iVar2 = (int)*pcVar3;
    if ((0x40 < iVar2) && (iVar2 < 0x5b)) {
      iVar2 = iVar2 + 0x20;
    }
    if (iVar2 != cVar1) break;
    cVar1 = *t;
  }
  return 0;
}



----------------------------------------

// Function: _strtod_r @ 089895d4

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

double _strtod_r(_reent *ptr,char *s00,char **se)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  char *pcVar4;
  int iVar5;
  uint extraout_v0;
  uint extraout_v0_00;
  uint extraout_v0_01;
  uint uVar6;
  uint extraout_v0_02;
  _Bigint *b;
  _Bigint *b_00;
  int iVar7;
  _Bigint *p_Var8;
  SItype SVar9;
  USItype arg_a;
  uint extraout_v0_03;
  undefined4 extraout_v0_04;
  uint extraout_v0_05;
  undefined4 extraout_v0_06;
  undefined4 extraout_v0_07;
  undefined4 extraout_v0_08;
  uint extraout_v0_09;
  int extraout_v0_10;
  uint extraout_v0_11;
  uint extraout_v0_12;
  char cVar10;
  uint extraout_v1;
  uint extraout_v1_00;
  uint extraout_v1_01;
  uint extraout_v1_02;
  uint extraout_v1_03;
  undefined4 extraout_v1_04;
  uint extraout_v1_05;
  undefined4 extraout_v1_06;
  undefined4 extraout_v1_07;
  undefined4 extraout_v1_08;
  uint extraout_v1_09;
  int extraout_v1_10;
  uint extraout_v1_11;
  uint extraout_v1_12;
  int iVar11;
  char *pcVar12;
  char *pcVar13;
  int iVar14;
  int iVar15;
  uint uVar16;
  int iVar17;
  int iVar18;
  int iVar19;
  char *pcVar20;
  double in_f0_1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  int local_88;
  int local_84;
  char *local_80;
  _Bigint *local_7c;
  _Bigint **in_stack_ffffff88;
  int *in_stack_ffffff8c;
  uint local_68;
  uint local_64;
  __ULong local_58 [2];
  undefined4 local_50;
  undefined4 local_4c;
  int local_48;
  _Bigint *local_44;
  int local_40;
  int local_3c;
  int local_38;
  char **local_34;
  int *local_30;
  
                    /* Unresolved local var: int scale@[???]
                       Unresolved local var: int bb2@[???]
                       Unresolved local var: int bb5@[???]
                       Unresolved local var: int bbe@[???]
                       Unresolved local var: int bd2@[???]
                       Unresolved local var: int bd5@[???]
                       Unresolved local var: int bbbits@[???]
                       Unresolved local var: int bs2@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int decpt@[???]
                       Unresolved local var: int dsign@[???]
                       Unresolved local var: int e@[???]
                       Unresolved local var: int e1@[???]
                       Unresolved local var: int esign@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int nd@[???]
                       Unresolved local var: int nd0@[???]
                       Unresolved local var: int nf@[???]
                       Unresolved local var: int nz@[???]
                       Unresolved local var: int nz0@[???]
                       Unresolved local var: int sign@[???]
                       Unresolved local var: char * s@[???]
                       Unresolved local var: char * s0@[???]
                       Unresolved local var: char * s1@[???]
                       Unresolved local var: double aadj@[???]
                       Unresolved local var: double aadj1@[???]
                       Unresolved local var: double adj@[???]
                       Unresolved local var: double rv@[???]
                       Unresolved local var: double rv0@[???]
                       Unresolved local var: Long L@[???]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: __ULong z@[???]
                       Unresolved local var: _Bigint * bb@[???]
                       Unresolved local var: _Bigint * bb1@[???]
                       Unresolved local var: _Bigint * bd@[???]
                       Unresolved local var: _Bigint * bd0@[???]
                       Unresolved local var: _Bigint * bs@[???]
                       Unresolved local var: _Bigint * delta@[???] */
  local_80 = s00;
LAB_0898961c:
  pcVar13 = s00;
  local_34 = se;
  switch(*local_80) {
  case '\0':
    goto switchD_08989644_caseD_0;
  default:
    local_40 = 0;
    cVar10 = *local_80;
    goto LAB_08989654;
  case '\t':
  case '\n':
  case '\v':
  case '\f':
  case '\r':
  case ' ':
    goto switchD_08989644_caseD_9;
  case '+':
    local_40 = 0;
    break;
  case '-':
    local_40 = 1;
  }
  if (local_80[1] == '\0') {
    local_40 = 0;
    local_80 = s00;
    goto LAB_08989744;
  }
  cVar10 = local_80[1];
  local_80 = local_80 + 1;
LAB_08989654:
  bVar1 = false;
  if (cVar10 != '0') goto LAB_08989660;
                    /* Unresolved local var: Long exp@[???]
                       Unresolved local var: __ULong[2] bits@[???] */
  if ((local_80[1] != 'X') && (pcVar13 = local_80, local_80[1] != 'x')) goto LAB_08989b04;
  uVar16 = __gethex(ptr,&local_80,&_strtod_r::fpi,(Long *)&stack0xffffff88,in_stack_ffffff88,
                    (int)in_stack_ffffff8c);
  uVar16 = uVar16 & 7;
  if (uVar16 == 0) goto LAB_08989744;
  if (uVar16 == 6) goto LAB_089897b4;
  if (local_7c != (_Bigint *)0x0) {
    __copybits(local_58,_strtod_r::fpi.nbits,local_7c);
    _Bfree(ptr,local_7c);
  }
  switch(uVar16) {
  case 0:
  case 6:
    break;
  case 1:
  case 5:
    break;
  case 2:
    break;
  case 3:
    break;
  case 4:
  }
  goto LAB_08989744;
switchD_08989644_caseD_9:
  local_80 = local_80 + 1;
  goto LAB_0898961c;
LAB_08989b04:
  do {
    local_80 = pcVar13 + 1;
    pcVar20 = pcVar13 + 1;
    pcVar13 = local_80;
  } while (*pcVar20 == '0');
  if (*pcVar20 == '\0') goto LAB_08989744;
  bVar1 = true;
LAB_08989660:
  pcVar20 = local_80;
  iVar11 = (int)*local_80;
  if ((iVar11 < 0x30) || (0x39 < iVar11)) {
    local_3c = 0;
    iVar18 = 0;
    iVar19 = 0;
    pcVar13 = local_80;
  }
  else {
    iVar18 = 0;
    iVar19 = 0;
    iVar17 = 0;
    do {
      if (iVar17 < 9) {
        iVar18 = iVar18 * 10 + iVar11 + -0x30;
LAB_089896a0:
        cVar10 = local_80[1];
      }
      else {
        if (0xf < iVar17) goto LAB_089896a0;
        cVar10 = local_80[1];
        iVar19 = iVar19 * 10 + iVar11 + -0x30;
      }
      iVar11 = (int)cVar10;
      local_3c = iVar17 + 1;
      pcVar13 = local_80 + 1;
      if (iVar11 < 0x30) break;
      local_80 = local_80 + 1;
      local_3c = iVar17 + 1;
      iVar17 = local_3c;
      pcVar13 = local_80;
    } while (iVar11 < 0x3a);
  }
  local_80 = pcVar13;
  iVar17 = local_3c;
  if (iVar11 == 0x2e) {
    iVar11 = (int)local_80[1];
    if (local_3c == 0) {
      iVar14 = 0;
      local_80 = local_80 + 1;
      while (iVar11 == 0x30) {
        iVar14 = iVar14 + 1;
        iVar11 = (int)local_80[1];
        local_80 = local_80 + 1;
      }
      iVar17 = 0;
      if (iVar11 - 0x31U < 9) {
        uVar16 = iVar11 - 0x30;
        iVar7 = 1;
        pcVar20 = local_80;
        goto LAB_08989dac;
      }
      bVar3 = true;
      iVar15 = 0;
    }
    else {
      iVar15 = 0;
      iVar14 = 0;
      local_80 = local_80 + 1;
      while (uVar16 = iVar11 - 0x30, uVar16 < 10) {
        iVar7 = iVar14 + 1;
        iVar14 = iVar15;
LAB_08989dac:
        iVar15 = iVar14;
        if (uVar16 != 0) {
          iVar15 = iVar14 + iVar7;
          if (1 < iVar7) {
            iVar5 = 1;
            iVar11 = iVar17;
            iVar14 = iVar18;
            do {
              iVar17 = iVar11 + 1;
              iVar18 = iVar14 * 10;
              if ((8 < iVar11) && (iVar18 = iVar14, iVar17 < 0x11)) {
                iVar19 = iVar19 * 10;
              }
              iVar5 = iVar5 + 1;
              iVar11 = iVar17;
              iVar14 = iVar18;
            } while (iVar5 != iVar7);
          }
          bVar3 = iVar17 < 9;
          iVar17 = iVar17 + 1;
          if (bVar3) {
            iVar18 = iVar18 * 10 + uVar16;
          }
          else if (iVar17 < 0x11) {
            iVar19 = iVar19 * 10 + uVar16;
          }
          iVar7 = 0;
        }
        iVar11 = (int)local_80[1];
        iVar14 = iVar7;
        local_80 = local_80 + 1;
      }
      bVar3 = true;
    }
  }
  else {
    bVar3 = false;
    iVar15 = 0;
    iVar14 = 0;
  }
  pcVar13 = local_80;
  if ((iVar11 != 0x65) && (local_48 = 0, iVar11 != 0x45)) goto LAB_08989730;
  if ((iVar17 == 0) && ((iVar14 == 0 && (!bVar1)))) goto LAB_089897b4;
  pcVar12 = local_80 + 1;
  iVar11 = (int)local_80[1];
  if (iVar11 == 0x2b) {
    bVar2 = false;
LAB_08989cb0:
    pcVar12 = local_80 + 2;
    iVar11 = (int)local_80[2];
  }
  else {
    if (iVar11 == 0x2d) {
      bVar2 = true;
      goto LAB_08989cb0;
    }
    bVar2 = false;
  }
  s00 = pcVar13;
  if (iVar11 - 0x30U < 10) {
    while (iVar11 == 0x30) {
      iVar11 = (int)pcVar12[1];
      pcVar12 = pcVar12 + 1;
    }
    local_48 = 0;
    local_80 = pcVar12;
    if (8 < iVar11 - 0x31U) goto LAB_08989730;
    iVar7 = iVar11 + -0x30;
    local_80 = pcVar12 + 1;
    iVar11 = (int)pcVar12[1];
    if (iVar11 < 0x30) {
LAB_089898b0:
      iVar5 = (int)local_80 - (int)pcVar12;
    }
    else {
      iVar5 = (int)local_80 - (int)pcVar12;
      pcVar4 = local_80;
      while (local_80 = pcVar4, iVar11 < 0x3a) {
        local_80 = pcVar4 + 1;
        iVar7 = iVar11 + iVar7 * 10;
        iVar11 = (int)pcVar4[1];
        iVar7 = iVar7 + -0x30;
        if (iVar11 < 0x30) goto LAB_089898b0;
        iVar5 = (int)local_80 - (int)pcVar12;
        pcVar4 = local_80;
      }
    }
    local_48 = 19999;
    if (iVar5 < 9) {
      local_48 = iVar7 + 19999;
    }
    if (!bVar2) goto LAB_08989730;
    if (iVar17 == 0) goto LAB_08989738;
    local_48 = -iVar15 - local_48;
  }
  else {
    local_48 = 0;
LAB_08989730:
    pcVar13 = s00;
    if (iVar17 == 0) {
LAB_08989738:
      if ((iVar14 != 0) || (bVar1)) goto LAB_08989744;
      s00 = pcVar13;
      if (!bVar3) {
        if (iVar11 == 0x4e) {
LAB_0898aa30:
          iVar11 = match(&local_80,"an");
          if (iVar11 != 0) {
            if (*local_80 == '(') {
              __hexnan(&local_80,&_strtod_r::fpinan,local_58);
            }
            goto LAB_08989744;
          }
        }
        else if (iVar11 < 0x4f) {
          if (iVar11 == 0x49) {
LAB_08989c18:
            iVar11 = match(&local_80,"nf");
            if (iVar11 != 0) {
              local_80 = local_80 + -1;
              iVar11 = match(&local_80,"inity");
              if (iVar11 == 0) {
                local_80 = local_80 + 1;
              }
              goto LAB_08989744;
            }
          }
        }
        else {
                    /* Unresolved local var: __ULong[2] bits@[???] */
          if (iVar11 == 0x69) goto LAB_08989c18;
          if (iVar11 == 0x6e) goto LAB_0898aa30;
switchD_08989644_caseD_0:
          s00 = pcVar13;
        }
      }
LAB_089897b4:
      local_40 = 0;
      local_80 = s00;
      goto LAB_08989744;
    }
    local_48 = local_48 - iVar15;
  }
  if (local_3c == 0) {
    local_3c = iVar17;
  }
  in_f0_1 = __floatsidf(iVar18);
  local_68 = extraout_v0;
  local_64 = extraout_v1;
  if (iVar18 < 0) {
    in_f0_1 = __adddf3(in_f12_13,in_f14_15);
    local_68 = extraout_v0_09;
    local_64 = extraout_v1_09;
  }
  if (9 < iVar17 + 0x10) {
    __muldf3(in_f12_13,in_f14_15);
    __floatsidf(iVar19);
    if (iVar19 < 0) {
      __adddf3(in_f12_13,in_f14_15);
    }
    in_f0_1 = __adddf3(in_f12_13,in_f14_15);
    local_68 = extraout_v0_00;
    local_64 = extraout_v1_00;
  }
  if (iVar17 < 0x10) {
    if (local_48 == 0) goto LAB_08989744;
    if (local_48 < 1) {
      if (-0x17 < local_48) {
        in_f0_1 = __divdf3(in_f12_13,in_f14_15);
        goto LAB_08989744;
      }
    }
    else {
      if (local_48 < 0x17) {
        in_f0_1 = __muldf3(in_f12_13,in_f14_15);
        goto LAB_08989744;
      }
      if (local_48 <= 0x25 - iVar17) {
        __muldf3(in_f12_13,in_f14_15);
        in_f0_1 = __muldf3(in_f12_13,in_f14_15);
        goto LAB_08989744;
      }
    }
  }
  uVar16 = local_48 + (iVar17 - (iVar17 + 0x10));
  if ((int)uVar16 < 1) {
    if (uVar16 == 0) goto LAB_08989e0c;
    uVar6 = (int)-uVar16 >> 4;
    if ((-uVar16 & 0xf) != 0) {
      in_f0_1 = __divdf3(in_f12_13,in_f14_15);
      local_68 = extraout_v0_11;
      local_64 = extraout_v1_11;
    }
    if (uVar6 == 0) goto LAB_08989e0c;
    if (0x1f < (int)uVar6) {
LAB_0898a990:
      ptr->_errno = 0x22;
      goto LAB_08989744;
    }
    local_38 = 0x6a;
    if ((uVar6 & 0x10) == 0) {
      local_38 = 0;
    }
    while (0 < (int)uVar6) {
      uVar16 = uVar6 & 1;
      uVar6 = (int)uVar6 >> 1;
      if (uVar16 != 0) {
        in_f0_1 = __muldf3(in_f12_13,in_f14_15);
        local_68 = extraout_v0_12;
        local_64 = extraout_v1_12;
      }
    }
    if (local_38 != 0) {
      uVar16 = 0x6b - ((local_64 & 0x7fffffff) >> 0x14);
      if (0 < (int)uVar16) {
        if ((int)uVar16 < 0x20) {
          local_68 = local_68 & -1 << (uVar16 & 0x1f);
        }
        else {
          local_68 = 0;
          if ((int)uVar16 < 0x35) {
            local_64 = local_64 & -1 << (uVar16 & 0x1f);
          }
          else {
            local_64 = 0x3700000;
          }
        }
      }
    }
    SVar9 = __nedf2(in_f12_13,in_f14_15);
    if (SVar9 == 0) goto LAB_0898a990;
  }
  else {
    if ((uVar16 & 0xf) != 0) {
      in_f0_1 = __muldf3(in_f12_13,in_f14_15);
      local_68 = extraout_v0_01;
      local_64 = extraout_v1_01;
    }
    if ((uVar16 & 0xfffffff0) != 0) {
      if ((int)(uVar16 & 0xfffffff0) < 0x135) {
        uVar16 = (int)uVar16 >> 4;
        while (1 < (int)uVar16) {
          uVar6 = uVar16 & 1;
          uVar16 = (int)uVar16 >> 1;
          if (uVar6 != 0) {
            __muldf3(in_f12_13,in_f14_15);
          }
        }
        in_f0_1 = __muldf3(in_f12_13,in_f14_15);
        if ((extraout_v1_02 & 0x7ff00000) < 0x7ca00001) {
          if ((extraout_v1_02 & 0x7ff00000) < 0x7c900001) {
            local_64 = extraout_v1_02 + 0x3500000;
            local_68 = extraout_v0_02;
          }
          else {
            local_64 = 0x7fefffff;
            local_68 = 0xffffffff;
          }
          goto LAB_08989e0c;
        }
      }
      ptr->_errno = 0x22;
      goto LAB_08989744;
    }
LAB_08989e0c:
    local_38 = 0;
  }
  local_44 = __s2b(ptr,pcVar20,local_3c,iVar17,(__ULong)in_stack_ffffff88);
  local_30 = &local_44->_sign;
LAB_08989e34:
  uVar16 = local_64;
  b = _Balloc(ptr,local_44->_k);
  memcpy(&b->_sign,local_30,local_44->_wds * 4 + 8);
  local_7c = __d2b(ptr,(double)CONCAT44(local_64,local_68),(int *)in_stack_ffffff88,
                   in_stack_ffffff8c);
  b_00 = __i2b(ptr,1);
  if (local_48 < 0) {
    iVar19 = 0;
    iVar11 = -local_48;
  }
  else {
    iVar11 = 0;
    iVar19 = local_48;
  }
  if (local_88 < 0) {
    iVar18 = iVar19 - local_88;
    iVar17 = iVar11;
  }
  else {
    iVar17 = iVar11 + local_88;
    iVar18 = iVar19;
  }
  if ((local_88 - local_38) + local_84 + -1 < -0x3fe) {
    iVar7 = (local_88 - local_38) + 0x433;
    iVar14 = iVar17 + iVar7;
    iVar18 = local_38 + iVar18 + iVar7;
    iVar7 = iVar18 + iVar17 + iVar14;
  }
  else {
    iVar14 = iVar17 + (0x36 - local_84);
    iVar18 = local_38 + iVar18 + (0x36 - local_84);
    iVar7 = iVar18 + iVar17 + iVar14;
  }
  if (0 < iVar7) {
    iVar17 = iVar17 - iVar7;
    iVar14 = iVar14 - iVar7;
    iVar18 = iVar18 - iVar7;
  }
  if (0 < iVar11) {
    b_00 = __pow5mult(ptr,b_00,iVar11);
    p_Var8 = __multiply(ptr,b_00,local_7c);
    _Bfree(ptr,local_7c);
    local_7c = p_Var8;
  }
  if (0 < iVar14) {
    local_7c = __lshift(ptr,local_7c,iVar14);
  }
  if (iVar19 != 0) {
    b = __pow5mult(ptr,b,iVar19);
  }
  if (0 < iVar18) {
    b = __lshift(ptr,b,iVar18);
  }
  if (0 < iVar17) {
    b_00 = __lshift(ptr,b_00,iVar17);
  }
  p_Var8 = __mdiff(ptr,local_7c,b);
  iVar19 = p_Var8->_sign;
  p_Var8->_sign = 0;
  iVar11 = __mcmp(p_Var8,b_00);
  if (iVar11 < 0) {
    if (((((iVar19 != 0) || (local_68 != 0)) || ((local_64 & 0xfffff) != 0)) ||
        ((local_64 & 0x7ff00000) < 0x6b00001)) || ((p_Var8->_x[0] == 0 && (p_Var8->_wds < 2))))
    goto LAB_0898a7dc;
    p_Var8 = __lshift(ptr,p_Var8,1);
    iVar11 = __mcmp(p_Var8,b_00);
    if (iVar11 < 1) goto LAB_0898a7dc;
LAB_0898a6e4:
    if ((local_38 == 0) || (0x6b00000 < (local_64 & 0x7ff00000))) goto LAB_0898a7dc;
    if ((local_64 & 0x7ff00000) < 0x3700001) goto LAB_0898a4a8;
  }
  else {
    if (iVar11 != 0) {
      in_f0_1 = __ratio(p_Var8,b_00);
      SVar9 = __ledf2(in_f12_13,in_f14_15);
      if (SVar9 < 1) {
        if (iVar19 == 0) {
          if (local_68 == 0) {
            if ((local_64 & 0xfffff) == 0) {
              SVar9 = __ltdf2(in_f12_13,in_f14_15);
              if (SVar9 < 0) {
                local_50 = DAT_089e1190;
                local_4c = DAT_089e1194;
              }
              else {
                __muldf3(in_f12_13,in_f14_15);
                local_50 = extraout_v0_06;
                local_4c = extraout_v1_06;
              }
              goto LAB_0898a1e8;
            }
          }
          else if ((local_68 == 1) && (local_64 == 0)) goto LAB_0898a4a8;
        }
        local_4c = DAT_089dbcc4;
        local_50 = DAT_089dbcc0;
        if ((local_64 & 0x7ff00000) != 0x7fe00000) goto LAB_0898a040;
LAB_0898a200:
        __ulp(in_f12_13);
        __muldf3(in_f12_13,in_f14_15);
        in_f0_1 = __adddf3(in_f12_13,in_f14_15);
        if ((extraout_v1_05 & 0x7ff00000) < 0x7ca00000) {
          local_64 = extraout_v1_05 + 0x3500000;
          local_68 = extraout_v0_05;
          goto LAB_0898a110;
        }
        if ((local_64 == 0x7fefffff) && (local_68 == 0xffffffff)) {
          ptr->_errno = 0x22;
          goto LAB_0898a404;
        }
        local_68 = 0xffffffff;
        local_64 = 0x7fefffff;
      }
      else {
        __muldf3(in_f12_13,in_f14_15);
        local_50 = extraout_v0_04;
        local_4c = extraout_v1_04;
LAB_0898a1e8:
        if ((local_64 & 0x7ff00000) == 0x7fe00000) goto LAB_0898a200;
LAB_0898a040:
        if (((local_38 != 0) && ((local_64 & 0x7ff00000) < 0x6a00001)) &&
           (SVar9 = __ledf2(in_f12_13,in_f14_15), SVar9 < 1)) {
          arg_a = __fixunsdfsi(in_f12_13);
          if (arg_a == 0) {
            local_50 = DAT_089dbcc0;
            local_4c = DAT_089dbcc4;
          }
          else {
            __floatsidf(arg_a);
            local_50 = extraout_v0_07;
            local_4c = extraout_v1_07;
            if ((int)arg_a < 0) {
              __adddf3(in_f12_13,in_f14_15);
              local_50 = extraout_v0_08;
              local_4c = extraout_v1_08;
            }
          }
        }
        __ulp(in_f12_13);
        __muldf3(in_f12_13,in_f14_15);
        in_f0_1 = __adddf3(in_f12_13,in_f14_15);
        local_68 = extraout_v0_03;
        local_64 = extraout_v1_03;
LAB_0898a110:
        if ((local_38 == 0) && ((uVar16 & 0x7ff00000) == (local_64 & 0x7ff00000))) {
          SVar9 = __fixdfsi(in_f12_13);
          __floatsidf(SVar9);
          in_f0_1 = __subdf3(in_f12_13,in_f14_15);
          if ((iVar19 == 0) && ((local_68 == 0 && ((local_64 & 0xfffff) == 0)))) {
            SVar9 = __ltdf2(in_f12_13,in_f14_15);
            if (SVar9 < 0) goto LAB_0898a404;
          }
          else {
            SVar9 = __ltdf2(in_f12_13,in_f14_15);
            if ((SVar9 < 0) || (SVar9 = __gtdf2(in_f12_13,in_f14_15), 0 < SVar9)) goto LAB_0898a404;
          }
        }
      }
      _Bfree(ptr,local_7c);
      _Bfree(ptr,b);
      _Bfree(ptr,b_00);
      _Bfree(ptr,p_Var8);
      goto LAB_08989e34;
    }
    if (iVar19 == 0) {
      if (((local_64 & 0xfffff) == 0) && (local_68 == 0)) goto LAB_0898a6e4;
    }
    else if ((local_64 & 0xfffff) == 0xfffff) {
      uVar16 = 0xffffffff;
      if (local_38 != 0) {
        uVar16 = 0xffffffff;
        if ((local_64 & 0x7ff00000) < 0x6a00001) {
          uVar16 = -1 << (0x6b - ((local_64 & 0x7ff00000) >> 0x14) & 0x1f);
        }
      }
      if (uVar16 == local_68) goto LAB_0898a7dc;
    }
    if ((local_68 & 1) != 0) {
      if (iVar19 != 0) {
        __ulp(in_f12_13);
        in_f0_1 = __adddf3(in_f12_13,in_f14_15);
        goto LAB_0898a7dc;
      }
      __ulp(in_f12_13);
      in_f0_1 = __subdf3(in_f12_13,in_f14_15);
      SVar9 = __nedf2(in_f12_13,in_f14_15);
      if (SVar9 == 0) {
LAB_0898a4a8:
        ptr->_errno = 0x22;
        goto LAB_0898a404;
      }
    }
LAB_0898a7dc:
    if (local_38 == 0) goto LAB_0898a404;
  }
  in_f0_1 = __muldf3(in_f12_13,in_f14_15);
  if ((extraout_v1_10 == 0) && (extraout_v0_10 == 0)) {
    ptr->_errno = 0x22;
  }
LAB_0898a404:
  _Bfree(ptr,local_7c);
  _Bfree(ptr,b);
  _Bfree(ptr,b_00);
  _Bfree(ptr,local_44);
  _Bfree(ptr,p_Var8);
LAB_08989744:
  if (local_34 != (char **)0x0) {
    *local_34 = local_80;
  }
  if (local_40 == 0) {
    return in_f0_1;
  }
  return in_f0_1;
}



----------------------------------------

// Function: strtof @ 0898ab6c

float strtof(char *s00,char **se)

{
  int iVar1;
  SFtype SVar2;
  float fVar3;
  DFtype in_f12_13;
  
                    /* Unresolved local var: double retval@[???] */
  _strtod_r(_impure_ptr,s00,se);
                    /* Unresolved local var: double __x@[???] */
  iVar1 = __isnand(in_f12_13);
  if (iVar1 == 0) {
    SVar2 = __truncdfsf2(in_f12_13);
    return SVar2;
  }
  fVar3 = nanf((char *)0x0);
  return fVar3;
}



----------------------------------------

// Function: strtod @ 0898abe4

double strtod(char *s00,char **se)

{
  double dVar1;
  
  dVar1 = _strtod_r(_impure_ptr,s00,se);
  return dVar1;
}



----------------------------------------

// Function: strtok @ 0898abfc

char * strtok(char *s,char *delim)

{
  char *pcVar1;
  
  pcVar1 = __strtok_r(s,delim,&(_impure_ptr->_new)._reent._strtok_last,1);
  return pcVar1;
}



----------------------------------------

// Function: __strtok_r @ 0898ac10

char * __strtok_r(char *s,char *delim,char **lasts,int skip_leading_delim)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  char cVar4;
  char cVar5;
  
                    /* Unresolved local var: char * spanp@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: int sc@[???]
                       Unresolved local var: char * tok@[???] */
  if (s == (char *)0x0) {
    s = *lasts;
    if (s == (char *)0x0) {
      return (char *)0x0;
    }
    cVar5 = *s;
  }
  else {
    cVar5 = *s;
  }
  while( true ) {
    pcVar2 = s + 1;
    cVar4 = *delim;
    pcVar1 = delim;
    while( true ) {
      pcVar1 = pcVar1 + 1;
      if (cVar4 == '\0') {
        if (cVar5 == '\0') {
          *lasts = (char *)0x0;
          return (char *)0x0;
        }
        cVar5 = *pcVar2;
        do {
          pcVar3 = pcVar2 + 1;
          pcVar1 = delim;
          do {
            cVar4 = *pcVar1;
            pcVar1 = pcVar1 + 1;
            if (cVar5 == cVar4) {
              if (cVar4 != '\0') {
                *pcVar2 = '\0';
                *lasts = pcVar3;
                return s;
              }
              *lasts = (char *)0x0;
              return s;
            }
          } while (cVar4 != '\0');
          cVar5 = *pcVar3;
          pcVar2 = pcVar3;
        } while( true );
      }
      if (cVar5 == cVar4) break;
      cVar4 = *pcVar1;
    }
    if (skip_leading_delim == 0) break;
    cVar5 = *pcVar2;
    s = pcVar2;
  }
  *lasts = pcVar2;
  *s = '\0';
  return s;
}



----------------------------------------

// Function: strtok_r @ 0898acb8

/* WARNING: Removing unreachable block (ram,0x0898ac44) */

char * strtok_r(char *s,char *delim,char **lasts)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  char cVar4;
  char cVar5;
  
  if (s == (char *)0x0) {
    s = *lasts;
    if (s == (char *)0x0) {
      return (char *)0x0;
    }
    cVar5 = *s;
  }
  else {
    cVar5 = *s;
  }
  do {
    pcVar2 = s + 1;
    cVar4 = *delim;
    pcVar1 = delim;
    while( true ) {
      pcVar1 = pcVar1 + 1;
      if (cVar4 == '\0') {
        if (cVar5 == '\0') {
          *lasts = (char *)0x0;
          return (char *)0x0;
        }
        cVar5 = *pcVar2;
        do {
          pcVar3 = pcVar2 + 1;
          pcVar1 = delim;
          do {
            cVar4 = *pcVar1;
            pcVar1 = pcVar1 + 1;
            if (cVar5 == cVar4) {
              if (cVar4 == '\0') {
                *lasts = (char *)0x0;
                return s;
              }
              *pcVar2 = '\0';
              *lasts = pcVar3;
              return s;
            }
          } while (cVar4 != '\0');
          cVar5 = *pcVar3;
          pcVar2 = pcVar3;
        } while( true );
      }
      if (cVar5 == cVar4) break;
      cVar4 = *pcVar1;
    }
    cVar5 = *pcVar2;
    s = pcVar2;
  } while( true );
}



----------------------------------------

// Function: _strtol_r @ 0898acc0

long _strtol_r(_reent *rptr,char *nptr,char **endptr,int base)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  char *pcVar7;
  char *pcVar8;
  uint uVar9;
  int iVar10;
  
                    /* Unresolved local var: char * s@[DW_OP_reg9(t1)]
                       Unresolved local var: ulong acc@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: ulong cutoff@[???]
                       Unresolved local var: int neg@[???]
                       Unresolved local var: int any@[???]
                       Unresolved local var: int cutlim@[???] */
  pcVar8 = nptr;
  do {
    pcVar7 = pcVar8;
    iVar6 = (int)*pcVar7;
    pcVar8 = pcVar7 + 1;
  } while ((__ctype_ptr[iVar6] & 8U) != 0);
  if (iVar6 == 0x2d) {
    iVar6 = (int)*pcVar8;
    bVar3 = true;
    pcVar8 = pcVar7 + 2;
  }
  else if (iVar6 == 0x2b) {
    iVar6 = (int)*pcVar8;
    bVar3 = false;
    pcVar8 = pcVar7 + 2;
  }
  else {
    bVar3 = false;
  }
  if ((base == 0) || (base == 0x10)) {
    if ((iVar6 == 0x30) && ((*pcVar8 == 'x' || (*pcVar8 == 'X')))) {
      iVar6 = (int)pcVar8[1];
      pcVar8 = pcVar8 + 2;
      base = 0x10;
      goto LAB_0898ad18;
    }
    if (base != 0) goto LAB_0898ad18;
    if (iVar6 == 0x30) {
      base = 8;
      goto LAB_0898ad18;
    }
    base = 10;
    if (bVar3) {
      uVar4 = 0x80000000;
      goto LAB_0898ad28;
    }
  }
  else {
LAB_0898ad18:
    uVar4 = 0x80000000;
    if (bVar3) goto LAB_0898ad28;
  }
  uVar4 = 0x7fffffff;
LAB_0898ad28:
  if (base == 0) {
    trap(7);
  }
  bVar2 = __ctype_ptr[iVar6];
  iVar10 = 0;
  uVar9 = 0;
  if ((bVar2 & 4) == 0) goto LAB_0898ada8;
LAB_0898ad58:
  iVar6 = iVar6 + -0x30;
  do {
    if (base <= iVar6) goto LAB_0898add0;
    if (iVar10 < 0) {
LAB_0898ae38:
      cVar1 = *pcVar8;
LAB_0898ae3c:
      iVar10 = -1;
    }
    else {
      if (uVar4 / (uint)base < uVar9) {
        cVar1 = *pcVar8;
        goto LAB_0898ae3c;
      }
      if ((uVar9 == uVar4 / (uint)base) && ((int)(uVar4 % (uint)base) < iVar6)) goto LAB_0898ae38;
      cVar1 = *pcVar8;
      iVar10 = 1;
      uVar9 = uVar9 * base + iVar6;
    }
    iVar6 = (int)cVar1;
    pcVar8 = pcVar8 + 1;
    bVar2 = __ctype_ptr[iVar6];
    if ((bVar2 & 4) != 0) goto LAB_0898ad58;
LAB_0898ada8:
    if ((bVar2 & 3) == 0) {
LAB_0898add0:
      if (iVar10 < 0) {
        if (bVar3) {
          uVar9 = 0x80000000;
          rptr->_errno = 0x22;
        }
        else {
          uVar9 = 0x7fffffff;
          rptr->_errno = 0x22;
        }
      }
      else if (bVar3) {
        uVar9 = -uVar9;
      }
      if (endptr != (char **)0x0) {
        if (iVar10 != 0) {
          nptr = pcVar8 + -1;
        }
        *endptr = nptr;
      }
      return uVar9;
    }
    iVar5 = 0x37;
    if ((bVar2 & 1) == 0) {
      iVar5 = 0x57;
    }
    iVar6 = iVar6 - iVar5;
  } while( true );
}



----------------------------------------

// Function: strtol @ 0898aebc

long strtol(char *s,char **ptr,int base)

{
  long lVar1;
  
  lVar1 = _strtol_r(_impure_ptr,s,ptr,base);
  return lVar1;
}



----------------------------------------

// Function: gettimeofday @ 0898aedc

int gettimeofday(timeval *ptimeval,timezone *ptimezone)

{
  int iVar1;
  undefined4 uStack_28;
  undefined1 auStack_24 [4];
  int iStack_20;
  undefined1 auStack_1c [4];
  int iStack_18;
  
  do {
    iVar1 = sceKernelLibcGettimeofday(auStack_24,ptimezone);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
    iVar1 = sceKernelLibcTime(&uStack_28);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
    iVar1 = sceKernelLibcGettimeofday(auStack_1c,ptimezone);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
  } while (iStack_18 < iStack_20);
  *(int *)(ptimeval + 4) = iStack_18;
  *(undefined4 *)ptimeval = uStack_28;
  return 0;
}



----------------------------------------

// Function: _user_strerror @ 0898aee4

char * _user_strerror(int errnum)

{
  return (char *)0x0;
}



----------------------------------------

// Function: __sprint_r @ 0898aeec

int __sprint_r(_reent *ptr,FILE *fp,__suio *uio)

{
  int iVar1;
  
                    /* Unresolved local var: int err@[???] */
  if (uio->uio_resid == 0) {
    uio->uio_iovcnt = 0;
    return 0;
  }
  iVar1 = __sfvwrite_r(ptr,fp,uio);
  uio->uio_iovcnt = 0;
  uio->uio_resid = 0;
  return iVar1;
}



----------------------------------------

// Function: _vfprintf_r @ 0898af48

/* WARNING: Removing unreachable block (ram,0x0898cbb4) */
/* WARNING: Removing unreachable block (ram,0x0898c2c0) */
/* WARNING: Type propagation algorithm not settling */

int _vfprintf_r(_reent *data,FILE *fp,char *fmt0,va_list ap)

{
  bool bVar1;
  void **ppvVar2;
  ushort uVar3;
  lconv *plVar4;
  int iVar5;
  int iVar6;
  SItype SVar7;
  undefined4 *puVar8;
  void *pvVar9;
  size_t sVar10;
  uint uVar11;
  int *piVar12;
  size_t sVar13;
  char cVar14;
  undefined1 *puVar15;
  mbstate_t *pmVar16;
  __siov *p_Var17;
  __siov *p_Var18;
  int iVar19;
  __siov *p_Var20;
  char *pcVar21;
  size_t sVar22;
  uint uVar23;
  size_t sVar24;
  uint uVar25;
  uint *puVar26;
  mbstate_t *pmVar27;
  int *piVar28;
  undefined1 uVar29;
  double in_f12_13;
  FLO_type_conflict in_f14_15;
  UDItype UVar30;
  UDItype u;
  char local_6d0;
  char local_6cf;
  undefined1 local_6ce;
  size_t local_6cc;
  mbstate_t *in_stack_fffff938;
  int in_stack_fffff93c;
  int *in_stack_fffff940;
  undefined2 uVar31;
  int *in_stack_fffff944;
  char **in_stack_fffff948;
  mbstate_t mStack_6b4;
  mbstate_t mStack_6ac;
  __suio local_6a4 [4];
  char local_672 [2];
  __siov local_670 [8];
  FILE local_630;
  mbstate_t local_5d4 [43];
  char local_47a [2];
  mbstate_t amStack_478 [128];
  uint *local_78;
  uint local_74;
  uint local_70;
  undefined4 local_68;
  uint local_64;
  mbstate_t *local_60;
  char *local_5c;
  size_t local_58;
  size_t local_54;
  size_t local_50;
  size_t local_4c;
  int local_48;
  char *local_44;
  uint local_40;
  int local_3c;
  mbstate_t *local_38;
  uint local_34;
  __siov *local_30;
  
                    /* Unresolved local var: char * fmt@[???]
                       Unresolved local var: int ch@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int m@[???]
                       Unresolved local var: char * cp@[???]
                       Unresolved local var: __siov * iovp@[???]
                       Unresolved local var: int flags@[???]
                       Unresolved local var: char * fmt_anchor@[???]
                       Unresolved local var: int N@[???]
                       Unresolved local var: int arg_index@[???]
                       Unresolved local var: int ret@[???]
                       Unresolved local var: int width@[???]
                       Unresolved local var: int prec@[???]
                       Unresolved local var: char sign@[???]
                       Unresolved local var: char * decimal_point@[???]
                       Unresolved local var: char softsign@[???]
                       Unresolved local var: anon_union_8_2_94730066 _double_@[???]
                       Unresolved local var: int expt@[???]
                       Unresolved local var: int expsize@[???]
                       Unresolved local var: int ndig@[???]
                       Unresolved local var: char[7] expstr@[???]
                       Unresolved local var: ulonglong _uquad@[???]
                       Unresolved local var: anon_enum_8 base@[???]
                       Unresolved local var: int dprec@[???]
                       Unresolved local var: int realsz@[???]
                       Unresolved local var: int size@[???]
                       Unresolved local var: char * xdigs@[???]
                       Unresolved local var: __suio uio@[???]
                       Unresolved local var: __siov[8] iov@[???]
                       Unresolved local var: char[348] buf@[???]
                       Unresolved local var: char[2] ox@[???]
                       Unresolved local var: char * malloc_buf@[???] */
  plVar4 = localeconv();
  local_44 = plVar4->decimal_point;
  if ((data == (_reent *)0x0) || (data->__sdidinit != 0)) {
    uVar3 = fp->_flags;
  }
  else {
    __sinit(data);
    uVar3 = fp->_flags;
  }
  if (((uVar3 & 8) == 0) || ((fp->_bf)._base == (uchar *)0x0)) {
    iVar5 = __swsetup(fp);
    if (iVar5 != 0) {
      return -1;
    }
    local_630._flags = fp->_flags;
  }
  else {
    local_630._flags = fp->_flags;
  }
  p_Var17 = local_670;
  if (((local_630._flags & 0x1aU) == 10) && (-1 < fp->_file)) {
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: FILE fake@[???]
                       Unresolved local var: uchar[1024] buf@[???] */
    local_630._file = fp->_file;
    local_630._cookie = fp->_cookie;
    local_630._write = fp->_write;
    local_630._p = (uchar *)(local_47a + 2);
    local_630._flags = local_630._flags & 0xfffd;
    local_630._bf._size = 0x400;
    local_630._w = 0x400;
    local_630._lbfsize = 0;
    local_630._bf._base = local_630._p;
    local_3c = _vfprintf_r(data,&local_630,fmt0,ap);
    if ((-1 < local_3c) && (iVar5 = fflush(&local_630), iVar5 != 0)) {
      local_3c = -1;
    }
    if ((local_630._flags & 0x40U) != 0) {
      fp->_flags = fp->_flags | 0x40;
    }
  }
  else {
    local_68 = 0;
    local_64 = 0;
    local_3c = 0;
    local_4c = 0;
    local_5c = (char *)0x0;
    local_60 = (mbstate_t *)0x0;
    local_50 = 0;
    local_6a4[0].uio_resid = 0;
    local_6a4[0].uio_iovcnt = 0;
    local_6a4[0].uio_iov = p_Var17;
    local_30 = p_Var17;
LAB_0898b0d0:
    cVar14 = *fmt0;
    if (cVar14 != '\0') {
      pcVar21 = fmt0;
      if (cVar14 != '%') {
        do {
          pcVar21 = pcVar21 + 1;
          sVar24 = (int)pcVar21 - (int)fmt0;
          if (*pcVar21 == '\0') break;
        } while (*pcVar21 != '%');
        if (sVar24 == 0) {
          cVar14 = *pcVar21;
        }
        else {
          p_Var17->iov_len = sVar24;
          p_Var17->iov_base = fmt0;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b65c;
          }
          cVar14 = *pcVar21;
          local_3c = local_3c + sVar24;
        }
      }
      fmt0 = pcVar21 + 1;
      if (cVar14 != '\0') {
        local_6d0 = '\0';
        iVar5 = (int)*fmt0;
        local_74 = 0;
        local_40 = 0;
        local_70 = 0xffffffff;
        puVar26 = ap;
LAB_0898b16c:
        fmt0 = fmt0 + 1;
LAB_0898b174:
        uVar29 = (undefined1)iVar5;
        switch(iVar5) {
        case 0x20:
          goto switchD_0898b194_caseD_20;
        default:
          if (iVar5 == 0) goto LAB_0898baac;
          local_58 = 1;
          local_5d4[0].__count._0_1_ = uVar29;
          local_78 = puVar26;
          local_38 = local_5d4;
LAB_0898b1bc:
          local_6d0 = '\0';
          local_54 = 0;
          sVar10 = local_58;
          piVar12 = in_stack_fffff940;
          goto LAB_0898b1c4;
        case 0x23:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 1;
          goto LAB_0898b16c;
        case 0x27:
        case 0x74:
        case 0x7a:
          iVar5 = (int)*fmt0;
          goto LAB_0898b16c;
        case 0x2a:
          local_40 = *puVar26;
          if ((int)local_40 < 0) {
            local_40 = -local_40;
            puVar26 = puVar26 + 1;
            goto switchD_0898b194_caseD_2d;
          }
          goto LAB_0898c164;
        case 0x2b:
          local_6d0 = '+';
          iVar5 = (int)*fmt0;
          goto LAB_0898b16c;
        case 0x2d:
switchD_0898b194_caseD_2d:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 4;
          goto LAB_0898b16c;
        case 0x2e:
          iVar5 = (int)*fmt0;
          fmt0 = fmt0 + 1;
          if (iVar5 == 0x2a) {
            local_70 = *puVar26;
            if ((int)local_70 < 0) {
              iVar5 = (int)*fmt0;
              local_70 = 0xffffffff;
              puVar26 = puVar26 + 1;
            }
            else {
LAB_0898c164:
              puVar26 = puVar26 + 1;
              iVar5 = (int)*fmt0;
            }
            goto LAB_0898b16c;
          }
          if (iVar5 - 0x30U < 10) {
            iVar6 = 0;
            do {
              iVar19 = iVar6 * 10 + iVar5;
              iVar5 = (int)*fmt0;
              iVar6 = iVar19 + -0x30;
              fmt0 = fmt0 + 1;
            } while (iVar5 - 0x30U < 10);
            local_70 = iVar19 - 0x31;
          }
          else {
            local_70 = 0;
          }
          goto LAB_0898b174;
        case 0x30:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 0x80;
          goto LAB_0898b16c;
        case 0x31:
        case 0x32:
        case 0x33:
        case 0x34:
        case 0x35:
        case 0x36:
        case 0x37:
        case 0x38:
        case 0x39:
          goto switchD_0898b194_caseD_31;
        case 0x43:
        case 99:
          if ((iVar5 == 0x43) || ((local_74 & 0x10) != 0)) {
            memset(&mStack_6b4,0,8);
            local_58 = _wcrtomb_r(data,(char *)local_5d4,*puVar26,&mStack_6b4);
            if (local_58 == 0xffffffff) goto LAB_0898cdc8;
          }
          else {
            local_58 = 1;
            local_5d4[0].__count._0_1_ = (undefined1)*puVar26;
          }
          local_78 = puVar26 + 1;
          local_38 = local_5d4;
          goto LAB_0898b1bc;
        case 0x44:
          local_74 = local_74 | 0x10;
        case 100:
        case 0x69:
          if ((local_74 & 0x20) == 0) {
            if ((local_74 & 0x10) == 0) {
              if ((local_74 & 0x40) == 0) {
                if ((local_74 & 0x200) == 0) {
                  uVar11 = *puVar26;
                  goto LAB_0898c658;
                }
                uVar11 = (uint)(char)(byte)*puVar26;
                local_78 = puVar26 + 1;
                uVar25 = (int)uVar11 >> 0x1f;
              }
              else {
                uVar11 = (uint)(short)(ushort)*puVar26;
                local_78 = puVar26 + 1;
                uVar25 = (int)uVar11 >> 0x1f;
              }
            }
            else {
              uVar11 = *puVar26;
LAB_0898c658:
              local_78 = puVar26 + 1;
              uVar25 = (int)uVar11 >> 0x1f;
            }
          }
          else {
            local_78 = (uint *)((uint)((int)puVar26 + 7) & 0xfffffff8);
            uVar11 = *local_78;
            uVar25 = local_78[1];
            local_78 = local_78 + 2;
          }
          uVar23 = -uVar11;
          if ((int)uVar25 < 0) {
            uVar25 = -(uint)(uVar23 != 0) - uVar25;
            iVar6 = 1;
            local_6d0 = '-';
          }
          else {
            iVar6 = 1;
            uVar23 = uVar11;
          }
LAB_0898bc2c:
          if (-1 < (int)local_70) {
            local_74 = local_74 & 0xffffff7f;
          }
          if ((uVar23 == 0 && uVar25 == 0) && (local_70 == 0)) {
            if (iVar6 == 0) {
              if ((local_74 & 1) == 0) {
                pmVar27 = (mbstate_t *)(local_47a + 2);
              }
              else {
                local_47a[1] = 0x30;
                pmVar27 = (mbstate_t *)((int)local_47a + 1);
              }
            }
            else {
              pmVar27 = (mbstate_t *)(local_47a + 2);
            }
            break;
          }
          if (iVar6 != 1) {
            if (iVar6 == 0) {
              pmVar27 = (mbstate_t *)(local_47a + 2);
              do {
                local_38 = pmVar27;
                uVar11 = uVar25 << 0x1d | uVar23 >> 3;
                uVar25 = uVar25 >> 3;
                pmVar27 = (mbstate_t *)((int)&local_38[-1].__value + 3);
                iVar6 = (uVar23 & 7) + 0x30;
                *(char *)&pmVar27->__count = (char)iVar6;
                uVar23 = uVar11;
              } while (uVar11 != 0 || uVar25 != 0);
              if (((local_74 & 1) != 0) &&
                 (pmVar16 = (mbstate_t *)((int)&local_38[-1].__value + 2), iVar6 != 0x30)) {
                *(char *)&pmVar16->__count = '0';
                pmVar27 = pmVar16;
              }
              break;
            }
            pmVar27 = (mbstate_t *)(local_47a + 2);
            if (iVar6 == 2) goto LAB_0898c5f8;
            sVar10 = strlen("bug in vfprintf: bad base");
            local_54 = local_70;
            local_38 = (mbstate_t *)0x89ece70;
            piVar12 = in_stack_fffff940;
            local_58 = local_70 + sVar10;
            goto LAB_0898bc88;
          }
          pmVar27 = (mbstate_t *)(local_47a + 2);
          u = CONCAT44(uVar25,uVar23);
          if (uVar25 != 0) goto LAB_0898c284;
          if (uVar23 < 10) {
            local_38 = (mbstate_t *)((int)local_47a + 1);
          }
          else {
            pmVar27 = (mbstate_t *)(local_47a + 2);
            u = CONCAT44(uVar25,uVar23);
LAB_0898c284:
            do {
              do {
                pcVar21 = (char *)pmVar27;
                UVar30 = __umoddi3(u,10);
                pmVar27 = (mbstate_t *)(pcVar21 + -1);
                *(char *)pmVar27 = (char)UVar30 + '0';
                u = __udivdi3(u,10);
                uVar23 = (uint)u;
              } while ((int)(u >> 0x20) != 0);
            } while (9 < uVar23);
            local_38 = (mbstate_t *)(pcVar21 + -2);
          }
          *(char *)&local_38->__count = (char)uVar23 + '0';
          pmVar27 = local_38;
          break;
        case 0x45:
        case 0x46:
        case 0x47:
        case 0x65:
        case 0x66:
        case 0x67:
          if (local_70 == 0xffffffff) {
            local_70 = 6;
          }
          else if (((iVar5 == 0x67) || (iVar5 == 0x47)) && (local_70 == 0)) {
            local_70 = 1;
          }
          puVar8 = (undefined4 *)((uint)((int)puVar26 + 7) & 0xfffffff8);
          local_68 = *puVar8;
          local_64 = puVar8[1];
          local_78 = puVar8 + 2;
                    /* Unresolved local var: double __x@[???] */
          iVar6 = __isinfd(in_f12_13);
          if (iVar6 == 0) {
                    /* Unresolved local var: double __x@[???] */
            iVar6 = __isnand(in_f12_13);
            if (iVar6 == 0) {
                    /* Unresolved local var: int mode@[???]
                       Unresolved local var: int dsgn@[???]
                       Unresolved local var: char * digits@[???]
                       Unresolved local var: char * bp@[???]
                       Unresolved local var: char * rve@[???]
                       Unresolved local var: double_union tmp@[???] */
              local_74 = local_74 | 0x100;
              sVar13 = local_70;
              if ((iVar5 != 0x66) && ((iVar5 == 0x65 || (iVar5 == 0x45)))) {
                sVar13 = local_70 + 1;
              }
              if ((int)local_64 < 0) {
                uVar23 = local_64 ^ 0x80000000;
                local_48 = 0x2d;
              }
              else {
                local_48 = 0;
                uVar23 = local_64;
              }
              local_38 = (mbstate_t *)
                         _dtoa_r(data,(double)CONCAT44(uVar23,local_68),(int)in_stack_fffff938,
                                 in_stack_fffff93c,in_stack_fffff940,in_stack_fffff944,
                                 in_stack_fffff948);
              if (((iVar5 != 0x67) && (iVar5 != 0x47)) ||
                 (piVar12 = in_stack_fffff940, (local_74 & 1) != 0)) {
                piVar28 = (int *)((int)&local_38->__count + sVar13);
                if (iVar5 == 0x66) {
                  if (((char)local_38->__count == '0') &&
                     (SVar7 = __nedf2(in_f12_13,in_f14_15), SVar7 != 0)) {
                    local_6cc = 1 - sVar13;
                    piVar28 = (int *)((int)piVar28 + local_6cc);
                  }
                  else {
                    piVar28 = (int *)((int)piVar28 + local_6cc);
                  }
                }
                SVar7 = __eqdf2(in_f12_13,in_f14_15);
                piVar12 = piVar28;
                if ((SVar7 != 0) && (piVar12 = in_stack_fffff940, in_stack_fffff940 < piVar28)) {
                  do {
                    *(char *)in_stack_fffff940 = '0';
                    in_stack_fffff940 = (int *)((int)in_stack_fffff940 + 1);
                    piVar12 = in_stack_fffff940;
                  } while (in_stack_fffff940 != piVar28);
                }
              }
              local_50 = (int)piVar12 - (int)local_38;
              sVar10 = local_6cc;
              if ((iVar5 == 0x67) || (iVar5 == 0x47)) {
                if (((int)local_6cc < -3) || ((int)local_70 < (int)local_6cc)) {
                  if (iVar5 == 0x67) {
                    iVar5 = 0x65;
                    uVar29 = 0x65;
                  }
                  else {
                    iVar5 = 0x45;
                    uVar29 = 0x45;
                  }
                  goto LAB_0898cb7c;
                }
                iVar5 = 0x67;
LAB_0898ccfc:
                if ((int)local_6cc < (int)local_50) {
                  if ((int)local_6cc < 1) {
                    iVar6 = 2 - local_6cc;
                  }
                  else {
                    iVar6 = 1;
                  }
                  local_58 = iVar6 + local_50;
                  sVar10 = local_58;
                }
                else {
                  local_58 = local_6cc;
                  if ((local_74 & 1) != 0) {
                    local_58 = local_6cc + 1;
                    sVar10 = local_58;
                  }
                }
              }
              else if (iVar5 < 0x66) {
LAB_0898cb7c:
                local_6cc = local_6cc + -1;
                    /* Unresolved local var: char * p@[???]
                       Unresolved local var: char * t@[???]
                       Unresolved local var: char[40] expbuf@[???] */
                if ((int)local_6cc < 0) {
                  sVar13 = -local_6cc;
                  uVar31 = CONCAT11(0x2d,uVar29);
                }
                else {
                  uVar31 = CONCAT11(0x2b,uVar29);
                  sVar13 = local_6cc;
                }
                in_stack_fffff944 = (int *)CONCAT22((short)((uint)in_stack_fffff944 >> 0x10),uVar31)
                ;
                if ((int)sVar13 < 10) {
                  puVar15 = &stack0xfffff948;
                  in_stack_fffff944 = (int *)CONCAT13((char)sVar13 + '0',CONCAT12(0x30,uVar31));
                }
                else {
                  p_Var18 = local_670;
                  do {
                    p_Var20 = p_Var18;
                    sVar10 = (int)sVar13 / 10;
                    p_Var18 = (__siov *)((int)&p_Var20[-1].iov_len + 3);
                    *(char *)&p_Var18->iov_base = (char)((int)sVar13 % 10) + '0';
                    sVar13 = sVar10;
                  } while (9 < (int)sVar10);
                  p_Var18 = (__siov *)((int)&p_Var20[-1].iov_len + 2);
                  *(char *)((int)&p_Var20[-1].iov_len + 2) = (char)sVar10 + '0';
                  if (p_Var18 < local_30) {
                    puVar15 = &stack0xfffff946;
                    do {
                      ppvVar2 = &p_Var18->iov_base;
                      p_Var18 = (__siov *)((int)&p_Var18->iov_base + 1);
                      bVar1 = p_Var18 < local_30;
                      *puVar15 = *(undefined1 *)ppvVar2;
                      puVar15 = puVar15 + 1;
                    } while (bVar1);
                  }
                  else {
                    puVar15 = &stack0xfffff946;
                  }
                }
                local_4c = (int)puVar15 - (int)&stack0xfffff944;
                sVar10 = local_50 + local_4c;
                if ((int)local_50 < 2) {
                  local_58 = sVar10 + (local_74 & 1);
                  if ((local_74 & 1) != 0) {
                    local_58 = sVar10 + 1;
                    sVar10 = local_58;
                  }
                }
                else {
                  local_58 = sVar10 + 1;
                  sVar10 = local_58;
                }
              }
              else {
                if (iVar5 != 0x66) goto LAB_0898ccfc;
                if ((int)local_6cc < 1) {
                  if ((local_70 == 0) && ((local_74 & 1) == 0)) {
                    local_58 = 1;
                    sVar10 = 1;
                  }
                  else {
                    local_58 = local_70 + 2;
                    sVar10 = local_58;
                  }
                }
                else if ((local_70 == 0) && ((local_74 & 1) == 0)) {
                  local_58 = local_6cc;
                }
                else {
                  local_58 = local_70 + local_6cc + 1;
                  sVar10 = local_58;
                }
              }
              if (local_48 == 0) {
                local_54 = 0;
                local_58 = sVar10;
                goto LAB_0898bc88;
              }
              local_54 = 0;
              local_6d0 = '-';
              goto LAB_0898bc94;
            }
            sVar10 = 3;
            piVar12 = in_stack_fffff940;
            if (iVar5 - 0x45U < 3) {
              local_38 = (mbstate_t *)&DAT_089ece68;
              local_54 = 0;
              local_58 = 3;
            }
            else {
              local_38 = (mbstate_t *)&DAT_089ece6c;
              local_54 = 0;
              local_58 = 3;
            }
          }
          else {
            SVar7 = __ltdf2(in_f12_13,in_f14_15);
            if (SVar7 < 0) {
              local_6d0 = '-';
            }
            sVar10 = 3;
            piVar12 = in_stack_fffff940;
            if (iVar5 - 0x45U < 3) {
              local_38 = (mbstate_t *)&DAT_089ece64;
              local_54 = 0;
              local_58 = 3;
            }
            else {
              local_38 = (mbstate_t *)&DAT_089ece8c;
              local_54 = 0;
              local_58 = 3;
            }
          }
          goto LAB_0898bc88;
        case 0x4c:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 8;
          goto LAB_0898b16c;
        case 0x4f:
          local_74 = local_74 | 0x10;
        case 0x6f:
          if ((local_74 & 0x20) == 0) {
            if ((local_74 & 0x10) == 0) {
              if ((local_74 & 0x40) == 0) {
                if ((local_74 & 0x200) == 0) {
                  uVar23 = *puVar26;
                  goto LAB_0898c67c;
                }
                uVar23 = (uint)(byte)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
                iVar6 = 0;
              }
              else {
                uVar23 = (uint)(ushort)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
                iVar6 = 0;
              }
            }
            else {
              uVar23 = *puVar26;
LAB_0898c67c:
              uVar25 = 0;
              local_78 = puVar26 + 1;
              iVar6 = 0;
            }
          }
          else {
            local_78 = (uint *)((uint)((int)puVar26 + 7) & 0xfffffff8);
            uVar23 = *local_78;
            uVar25 = local_78[1];
            iVar6 = 0;
            local_78 = local_78 + 2;
          }
LAB_0898bc28:
          local_6d0 = '\0';
          goto LAB_0898bc2c;
        case 0x53:
        case 0x73:
          local_6d0 = '\0';
          pmVar27 = (mbstate_t *)*puVar26;
          local_78 = puVar26 + 1;
          if (pmVar27 != (mbstate_t *)0x0) {
            local_38 = pmVar27;
            if ((iVar5 == 0x53) || ((local_74 & 0x10) != 0)) {
              memset(&mStack_6ac,0,8);
              if ((int)local_70 < 0) {
                sVar10 = _wcsrtombs_r(data,(char *)0x0,(wchar_t **)&stack0xfffff938,0,pmVar27);
                in_stack_fffff938 = local_38;
                if (sVar10 != 0xffffffff) goto LAB_0898c7e8;
                goto LAB_0898cdc8;
              }
              iVar6 = 0;
              sVar13 = 0;
              goto LAB_0898c7a4;
            }
            if ((int)local_70 < 0) {
              sVar10 = strlen((char *)pmVar27);
            }
            else {
                    /* Unresolved local var: char * p@[???] */
              pvVar9 = memchr(pmVar27,0,local_70);
              piVar12 = in_stack_fffff940;
              if (pvVar9 == (void *)0x0) {
                local_54 = 0;
                local_58 = local_70;
                sVar10 = local_70;
                goto LAB_0898bc88;
              }
              sVar10 = (int)pvVar9 - (int)local_38;
              if ((int)local_70 < (int)sVar10) {
                local_54 = 0;
                local_58 = local_70;
                sVar10 = local_70;
                goto LAB_0898bc88;
              }
            }
            local_54 = 0;
            piVar12 = in_stack_fffff940;
            local_58 = sVar10;
            goto LAB_0898bc88;
          }
          local_38 = (mbstate_t *)0x89ece90;
          local_58 = 6;
          goto LAB_0898b1bc;
        case 0x55:
          local_74 = local_74 | 0x10;
        case 0x75:
          if ((local_74 & 0x20) == 0) {
            if ((local_74 & 0x10) == 0) {
              if ((local_74 & 0x40) == 0) {
                if ((local_74 & 0x200) == 0) {
                  uVar23 = *puVar26;
                  goto LAB_0898c644;
                }
                uVar23 = (uint)(byte)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
                iVar6 = 1;
              }
              else {
                uVar23 = (uint)(ushort)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
                iVar6 = 1;
              }
            }
            else {
              uVar23 = *puVar26;
LAB_0898c644:
              uVar25 = 0;
              local_78 = puVar26 + 1;
              iVar6 = 1;
            }
          }
          else {
            local_78 = (uint *)((uint)((int)puVar26 + 7) & 0xfffffff8);
            uVar23 = *local_78;
            uVar25 = local_78[1];
            local_78 = local_78 + 2;
            iVar6 = 1;
          }
          goto LAB_0898bc28;
        case 0x58:
          local_5c = "0123456789ABCDEF";
          goto LAB_0898bf74;
        case 0x68:
          iVar5 = (int)*fmt0;
          if (iVar5 == 0x68) {
            fmt0 = fmt0 + 1;
            iVar5 = (int)*fmt0;
            local_74 = local_74 | 0x200;
          }
          else {
            local_74 = local_74 | 0x40;
          }
          goto LAB_0898b16c;
        case 0x6a:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 0x20;
          goto LAB_0898b16c;
        case 0x6c:
          iVar5 = (int)*fmt0;
          if (iVar5 == 0x6c) {
            fmt0 = fmt0 + 1;
            iVar5 = (int)*fmt0;
            local_74 = local_74 | 0x20;
          }
          else {
            local_74 = local_74 | 0x10;
          }
          goto LAB_0898b16c;
        case 0x6e:
          if ((local_74 & 0x20) == 0) {
            if ((local_74 & 0x10) == 0) {
              if ((local_74 & 0x40) == 0) {
                if ((local_74 & 0x200) == 0) {
                  ap = puVar26 + 1;
                  *(int *)*puVar26 = local_3c;
                  local_78 = ap;
                }
                else {
                  ap = puVar26 + 1;
                  *(char *)*puVar26 = (char)local_3c;
                  local_78 = ap;
                }
              }
              else {
                ap = puVar26 + 1;
                *(short *)*puVar26 = (short)local_3c;
                local_78 = ap;
              }
            }
            else {
              ap = puVar26 + 1;
              *(int *)*puVar26 = local_3c;
              local_78 = ap;
            }
          }
          else {
            piVar12 = (int *)*puVar26;
            ap = puVar26 + 1;
            piVar12[1] = local_3c >> 0x1f;
            *piVar12 = local_3c;
            local_78 = ap;
          }
          goto LAB_0898b0d0;
        case 0x70:
          uVar23 = *puVar26;
          local_74 = local_74 | 2;
          local_78 = puVar26 + 1;
          uVar25 = 0;
          iVar5 = 0x78;
          iVar6 = 2;
          local_5c = "0123456789abcdef";
          goto LAB_0898bc28;
        case 0x71:
          iVar5 = (int)*fmt0;
          local_74 = local_74 | 0x20;
          goto LAB_0898b16c;
        case 0x78:
          local_5c = "0123456789abcdef";
LAB_0898bf74:
          if ((local_74 & 0x20) == 0) {
            if ((local_74 & 0x10) == 0) {
              if ((local_74 & 0x40) == 0) {
                if ((local_74 & 0x200) == 0) {
                  uVar23 = *puVar26;
                  goto LAB_0898c66c;
                }
                uVar23 = (uint)(byte)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
              }
              else {
                uVar23 = (uint)(ushort)*puVar26;
                uVar25 = 0;
                local_78 = puVar26 + 1;
              }
            }
            else {
              uVar23 = *puVar26;
LAB_0898c66c:
              uVar25 = 0;
              local_78 = puVar26 + 1;
            }
          }
          else {
            local_78 = (uint *)((uint)((int)puVar26 + 7) & 0xfffffff8);
            uVar23 = *local_78;
            uVar25 = local_78[1];
            local_78 = local_78 + 2;
          }
          if ((local_74 & 1) == 0) {
            iVar6 = 2;
          }
          else if (uVar23 == 0 && uVar25 == 0) {
            iVar6 = 2;
          }
          else {
            local_74 = local_74 | 2;
            iVar6 = 2;
          }
          goto LAB_0898bc28;
        }
        goto LAB_0898bc70;
      }
    }
LAB_0898baac:
    if ((local_6a4[0].uio_resid == 0) || (iVar5 = __sprint_r(data,fp,local_6a4), iVar5 == 0)) {
LAB_0898b65c:
      uVar3 = fp->_flags;
    }
    else {
      uVar3 = fp->_flags;
    }
LAB_0898b660:
    if ((uVar3 & 0x40) != 0) {
      return -1;
    }
  }
  return local_3c;
LAB_0898c7a4:
  iVar19 = *(int *)((int)&pmVar27->__count + iVar6);
  sVar10 = sVar13;
  in_stack_fffff938 = pmVar27;
  if (iVar19 == 0) goto LAB_0898c7e8;
  sVar24 = _wcrtomb_r(data,(char *)local_5d4,iVar19,&mStack_6ac);
  sVar13 = sVar13 + sVar24;
  if (sVar24 == 0xffffffff) goto LAB_0898cdc8;
  in_stack_fffff938 = pmVar27;
  if (((int)local_70 < (int)sVar13) || (iVar6 = iVar6 + 4, sVar10 = local_70, local_70 == sVar13))
  goto LAB_0898c7e8;
  goto LAB_0898c7a4;
LAB_0898c7e8:
  if (sVar10 == 0) {
    local_54 = 0;
    local_58 = 0;
    piVar12 = in_stack_fffff940;
  }
  else {
    local_60 = _malloc_r(data,sVar10 + 1);
    if (local_60 == (mbstate_t *)0x0) {
LAB_0898cdc8:
      fp->_flags = fp->_flags | 0x40;
      goto LAB_0898b65c;
    }
    memset(&mStack_6ac,0,8);
    sVar24 = _wcsrtombs_r(data,(char *)local_60,(wchar_t **)&stack0xfffff938,sVar10,
                          in_stack_fffff938);
    if (sVar10 != sVar24) {
      fp->_flags = fp->_flags | 0x40;
      goto LAB_0898b650;
    }
    local_54 = 0;
    *(char *)((int)&local_60->__count + sVar10) = '\0';
    piVar12 = in_stack_fffff940;
    local_58 = sVar10;
    local_38 = local_60;
  }
  goto LAB_0898bc88;
LAB_0898c5f8:
  do {
    local_38 = pmVar27;
    uVar11 = uVar25 << 0x1c | uVar23 >> 4;
    uVar25 = uVar25 >> 4;
    pmVar27 = (mbstate_t *)((int)&local_38[-1].__value + 3);
    *(char *)&pmVar27->__count = local_5c[uVar23 & 0xf];
    uVar23 = uVar11;
  } while (uVar11 != 0 || uVar25 != 0);
LAB_0898bc70:
  local_38 = pmVar27;
  sVar10 = (int)local_47a + (2U - (int)local_38);
  local_54 = local_70;
  piVar12 = in_stack_fffff940;
  local_58 = local_70 + sVar10;
LAB_0898bc88:
  if (local_6d0 == '\0') {
LAB_0898b1c4:
    if ((local_74 & 2) != 0) {
      local_58 = local_58 + 2;
    }
  }
  else {
LAB_0898bc94:
    local_58 = local_58 + 1;
  }
  local_34 = local_74 & 0x84;
  if (local_34 == 0) {
    sVar24 = local_40 - local_58;
    if ((int)sVar24 < 1) goto LAB_0898b2a4;
    if ((int)sVar24 < 0x11) {
      p_Var17->iov_len = sVar24;
    }
    else {
      do {
        while( true ) {
          sVar22 = sVar24;
          p_Var17->iov_len = 0x10;
          p_Var17->iov_base = "                ";
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
          if (local_6a4[0].uio_iovcnt < 8) break;
          iVar6 = __sprint_r(data,fp,local_6a4);
          if (iVar6 != 0) goto LAB_0898b648;
          p_Var17 = local_670;
          sVar24 = sVar22 - 0x10;
          if ((int)(sVar22 - 0x10) < 0x11) goto LAB_0898b274;
        }
        p_Var17 = p_Var17 + 1;
        sVar24 = sVar22 - 0x10;
      } while (0x10 < (int)(sVar22 - 0x10));
LAB_0898b274:
      sVar24 = sVar22 - 0x10;
      p_Var17->iov_len = sVar24;
    }
    p_Var17->iov_base = "                ";
    local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
    local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
    if (local_6a4[0].uio_iovcnt < 8) {
      p_Var17 = p_Var17 + 1;
      goto LAB_0898b2a4;
    }
    iVar6 = __sprint_r(data,fp,local_6a4);
    p_Var17 = local_670;
    if (iVar6 == 0) goto LAB_0898b2a4;
    goto LAB_0898b648;
  }
LAB_0898b2a4:
  in_stack_fffff940 = piVar12;
  if (local_6d0 == '\0') {
    if ((local_74 & 2) != 0) {
      local_6cf = '0';
      local_6ce = (undefined1)iVar5;
      p_Var17->iov_len = 2;
      local_6a4[0].uio_resid = local_6a4[0].uio_resid + 2;
      p_Var17->iov_base = &local_6cf;
      goto joined_r0x0898b2d4;
    }
  }
  else {
    p_Var17->iov_len = 1;
    local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
    p_Var17->iov_base = &local_6d0;
joined_r0x0898b2d4:
    if (local_6a4[0].uio_iovcnt + 1 < 8) {
      local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
      p_Var17 = p_Var17 + 1;
    }
    else {
      local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
      iVar6 = __sprint_r(data,fp,local_6a4);
      if (iVar6 != 0) goto LAB_0898b648;
      p_Var17 = local_670;
      in_stack_fffff940 = piVar12;
    }
  }
  if (local_34 == 0x80) {
    sVar24 = local_40 - local_58;
    if (0 < (int)sVar24) {
      if ((int)sVar24 < 0x11) {
        p_Var17->iov_len = sVar24;
      }
      else {
        do {
          while( true ) {
            sVar22 = sVar24;
            p_Var17->iov_len = 0x10;
            p_Var17->iov_base = "0000000000000000";
            local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
            local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
            if (local_6a4[0].uio_iovcnt < 8) break;
            iVar6 = __sprint_r(data,fp,local_6a4);
            if (iVar6 != 0) goto LAB_0898b648;
            p_Var17 = local_670;
            sVar24 = sVar22 - 0x10;
            if ((int)(sVar22 - 0x10) < 0x11) goto LAB_0898b5f4;
          }
          p_Var17 = p_Var17 + 1;
          sVar24 = sVar22 - 0x10;
        } while (0x10 < (int)(sVar22 - 0x10));
LAB_0898b5f4:
        sVar24 = sVar22 - 0x10;
        p_Var17->iov_len = sVar24;
      }
      p_Var17->iov_base = "0000000000000000";
      local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
      local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
      if (local_6a4[0].uio_iovcnt < 8) {
        p_Var17 = p_Var17 + 1;
      }
      else {
        iVar6 = __sprint_r(data,fp,local_6a4);
        p_Var17 = local_670;
        if (iVar6 != 0) goto LAB_0898b648;
      }
    }
  }
  sVar24 = local_54 - sVar10;
  if (0 < (int)sVar24) {
    if ((int)sVar24 < 0x11) {
      p_Var17->iov_len = sVar24;
    }
    else {
      do {
        while( true ) {
          sVar22 = sVar24;
          p_Var17->iov_len = 0x10;
          p_Var17->iov_base = "0000000000000000";
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
          if (local_6a4[0].uio_iovcnt < 8) break;
          iVar6 = __sprint_r(data,fp,local_6a4);
          if (iVar6 != 0) goto LAB_0898b648;
          p_Var17 = local_670;
          sVar24 = sVar22 - 0x10;
          if ((int)(sVar22 - 0x10) < 0x11) goto LAB_0898b374;
        }
        p_Var17 = p_Var17 + 1;
        sVar24 = sVar22 - 0x10;
      } while (0x10 < (int)(sVar22 - 0x10));
LAB_0898b374:
      sVar24 = sVar22 - 0x10;
      p_Var17->iov_len = sVar24;
    }
    p_Var17->iov_base = "0000000000000000";
    local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
    local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
    if (local_6a4[0].uio_iovcnt < 8) {
      p_Var17 = p_Var17 + 1;
    }
    else {
      iVar6 = __sprint_r(data,fp,local_6a4);
      p_Var17 = local_670;
      if (iVar6 != 0) goto LAB_0898b648;
    }
  }
  if ((local_74 & 0x100) == 0) {
    p_Var17->iov_len = sVar10;
    local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
    local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar10;
    p_Var17->iov_base = local_38;
    if (local_6a4[0].uio_iovcnt < 8) {
      p_Var17 = p_Var17 + 1;
      goto LAB_0898b3e4;
    }
LAB_0898b9ac:
    iVar5 = __sprint_r(data,fp,local_6a4);
    p_Var17 = local_670;
    if (iVar5 == 0) goto LAB_0898b3e4;
  }
  else {
    if (iVar5 < 0x66) {
      if ((1 < (int)local_50) || ((local_74 & 1) != 0)) {
        local_6cf = (char)local_38->__count;
        local_6ce = 0x2e;
        p_Var17->iov_len = 2;
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        local_6a4[0].uio_resid = local_6a4[0].uio_resid + 2;
        p_Var17->iov_base = &local_6cf;
        if (local_6a4[0].uio_iovcnt < 8) {
          p_Var17 = p_Var17 + 1;
        }
        else {
          iVar5 = __sprint_r(data,fp,local_6a4);
          p_Var17 = local_670;
          if (iVar5 != 0) goto LAB_0898b648;
        }
        SVar7 = __nedf2(in_f12_13,in_f14_15);
        sVar24 = local_50;
        if (SVar7 == 0) {
          sVar24 = local_50 - 1;
          if ((int)sVar24 < 1) goto LAB_0898b768;
          if ((int)sVar24 < 0x11) {
            p_Var17->iov_len = sVar24;
          }
          else {
            p_Var17->iov_len = 0x10;
            while( true ) {
              p_Var17->iov_base = "0000000000000000";
              local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
              local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
              if (local_6a4[0].uio_iovcnt < 8) {
                p_Var17 = p_Var17 + 1;
              }
              else {
                iVar5 = __sprint_r(data,fp,local_6a4);
                p_Var17 = local_670;
                if (iVar5 != 0) goto LAB_0898b648;
              }
              sVar24 = sVar24 - 0x10;
              if ((int)sVar24 < 0x11) break;
              p_Var17->iov_len = 0x10;
            }
            p_Var17->iov_len = sVar24;
          }
          p_Var17->iov_base = "0000000000000000";
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
        }
        else {
          p_Var17->iov_len = local_50 - 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + (sVar24 - 1);
          p_Var17->iov_base = (char *)((int)&local_38->__count + 1);
        }
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        if (local_6a4[0].uio_iovcnt < 8) {
          p_Var17 = p_Var17 + 1;
          goto LAB_0898b768;
        }
LAB_0898bd5c:
        iVar5 = __sprint_r(data,fp,local_6a4);
        p_Var17 = local_670;
        if (iVar5 == 0) goto LAB_0898b768;
        goto LAB_0898b648;
      }
      p_Var17->iov_len = 1;
      local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
      p_Var17->iov_base = local_38;
      local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
      if (7 < local_6a4[0].uio_iovcnt) goto LAB_0898bd5c;
      p_Var17 = p_Var17 + 1;
LAB_0898b768:
      sVar24 = local_4c;
      p_Var17->iov_base = &stack0xfffff944;
      p_Var17->iov_len = sVar24;
      local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
      local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
      if (7 < local_6a4[0].uio_iovcnt) goto LAB_0898b9ac;
      p_Var17 = p_Var17 + 1;
    }
    else {
      SVar7 = __eqdf2(in_f12_13,in_f14_15);
      sVar24 = local_50;
      if (SVar7 == 0) {
        p_Var17->iov_len = 1;
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
        p_Var17->iov_base = "0";
        if (local_6a4[0].uio_iovcnt < 8) {
          p_Var17 = p_Var17 + 1;
        }
        else {
          iVar5 = __sprint_r(data,fp,local_6a4);
          p_Var17 = local_670;
          if (iVar5 != 0) goto LAB_0898b648;
        }
        if (((int)local_6cc < (int)local_50) || ((local_74 & 1) != 0)) {
          p_Var17->iov_len = 1;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
          p_Var17->iov_base = local_44;
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b648;
          }
          sVar24 = local_50 - 1;
          if (0 < (int)sVar24) {
            if ((int)sVar24 < 0x11) {
              p_Var17->iov_len = sVar24;
            }
            else {
              p_Var17->iov_len = 0x10;
              while( true ) {
                p_Var17->iov_base = "0000000000000000";
                local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
                local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
                if (local_6a4[0].uio_iovcnt < 8) {
                  p_Var17 = p_Var17 + 1;
                }
                else {
                  iVar5 = __sprint_r(data,fp,local_6a4);
                  p_Var17 = local_670;
                  if (iVar5 != 0) goto LAB_0898b648;
                }
                sVar24 = sVar24 - 0x10;
                if ((int)sVar24 < 0x11) break;
                p_Var17->iov_len = 0x10;
              }
              p_Var17->iov_len = sVar24;
            }
            p_Var17->iov_base = "0000000000000000";
            local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
            local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
            if (7 < local_6a4[0].uio_iovcnt) goto LAB_0898b9ac;
            p_Var17 = p_Var17 + 1;
          }
        }
      }
      else if ((int)local_6cc < 1) {
        p_Var17->iov_len = 1;
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
        p_Var17->iov_base = "0";
        if (local_6a4[0].uio_iovcnt < 8) {
          p_Var17 = p_Var17 + 1;
        }
        else {
          iVar5 = __sprint_r(data,fp,local_6a4);
          p_Var17 = local_670;
          if (iVar5 != 0) goto LAB_0898b648;
        }
        pcVar21 = local_44;
        if ((local_6cc != 0) || (local_50 != 0)) {
          p_Var17->iov_len = 1;
          p_Var17->iov_base = pcVar21;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b648;
          }
          sVar24 = -local_6cc;
          if (0 < (int)sVar24) {
            if ((int)sVar24 < 0x11) {
              p_Var17->iov_len = sVar24;
            }
            else {
              p_Var17->iov_len = 0x10;
              while( true ) {
                p_Var17->iov_base = "0000000000000000";
                local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
                local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
                if (local_6a4[0].uio_iovcnt < 8) {
                  p_Var17 = p_Var17 + 1;
                }
                else {
                  iVar5 = __sprint_r(data,fp,local_6a4);
                  p_Var17 = local_670;
                  if (iVar5 != 0) goto LAB_0898b648;
                }
                sVar24 = sVar24 - 0x10;
                if ((int)sVar24 < 0x11) break;
                p_Var17->iov_len = 0x10;
              }
              p_Var17->iov_len = sVar24;
            }
            p_Var17->iov_base = "0000000000000000";
            local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
            local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
            if (local_6a4[0].uio_iovcnt < 8) {
              p_Var17 = p_Var17 + 1;
            }
            else {
              iVar5 = __sprint_r(data,fp,local_6a4);
              p_Var17 = local_670;
              if (iVar5 != 0) goto LAB_0898b648;
            }
          }
          pmVar27 = local_38;
          sVar24 = local_50;
          p_Var17->iov_len = local_50;
          p_Var17->iov_base = pmVar27;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
          if (7 < local_6a4[0].uio_iovcnt) goto LAB_0898b9ac;
          p_Var17 = p_Var17 + 1;
        }
      }
      else {
        if ((int)local_6cc < (int)local_50) {
          p_Var17->iov_len = local_6cc;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + local_6cc;
          p_Var17->iov_base = local_38;
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b648;
          }
          sVar13 = local_6cc;
          p_Var17->iov_len = 1;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
          p_Var17->iov_base = ".";
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b648;
          }
          p_Var17->iov_base = (char *)((int)&local_38->__count + sVar13);
          sVar24 = local_50 - local_6cc;
          p_Var17->iov_len = sVar24;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
        }
        else {
          p_Var17->iov_len = local_50;
          local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
          p_Var17->iov_base = local_38;
          if (local_6a4[0].uio_iovcnt < 8) {
            p_Var17 = p_Var17 + 1;
          }
          else {
            iVar5 = __sprint_r(data,fp,local_6a4);
            p_Var17 = local_670;
            if (iVar5 != 0) goto LAB_0898b648;
          }
          sVar24 = local_6cc - local_50;
          if (0 < (int)sVar24) {
            if ((int)sVar24 < 0x11) {
              p_Var17->iov_len = sVar24;
            }
            else {
              p_Var17->iov_len = 0x10;
              while( true ) {
                p_Var17->iov_base = "0000000000000000";
                local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
                local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
                if (local_6a4[0].uio_iovcnt < 8) {
                  p_Var17 = p_Var17 + 1;
                }
                else {
                  iVar5 = __sprint_r(data,fp,local_6a4);
                  p_Var17 = local_670;
                  if (iVar5 != 0) goto LAB_0898b648;
                }
                sVar24 = sVar24 - 0x10;
                if ((int)sVar24 < 0x11) break;
                p_Var17->iov_len = 0x10;
              }
              p_Var17->iov_len = sVar24;
            }
            p_Var17->iov_base = "0000000000000000";
            local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
            local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
            if (local_6a4[0].uio_iovcnt < 8) {
              p_Var17 = p_Var17 + 1;
            }
            else {
              iVar5 = __sprint_r(data,fp,local_6a4);
              p_Var17 = local_670;
              if (iVar5 != 0) goto LAB_0898b648;
            }
          }
          if ((local_74 & 1) == 0) goto LAB_0898b3e4;
          p_Var17->iov_len = 1;
          local_6a4[0].uio_resid = local_6a4[0].uio_resid + 1;
          p_Var17->iov_base = ".";
        }
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        if (7 < local_6a4[0].uio_iovcnt) goto LAB_0898b9ac;
        p_Var17 = p_Var17 + 1;
      }
    }
LAB_0898b3e4:
    if ((local_74 & 4) != 0) {
      sVar24 = local_40 - local_58;
      if (0 < (int)sVar24) {
        if ((int)sVar24 < 0x11) {
          p_Var17->iov_len = sVar24;
        }
        else {
          do {
            while( true ) {
              sVar22 = sVar24;
              p_Var17->iov_len = 0x10;
              p_Var17->iov_base = "                ";
              local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
              local_6a4[0].uio_resid = local_6a4[0].uio_resid + 0x10;
              if (local_6a4[0].uio_iovcnt < 8) break;
              iVar5 = __sprint_r(data,fp,local_6a4);
              if (iVar5 != 0) goto LAB_0898b648;
              p_Var17 = local_670;
              sVar24 = sVar22 - 0x10;
              if ((int)(sVar22 - 0x10) < 0x11) goto LAB_0898b478;
            }
            p_Var17 = p_Var17 + 1;
            sVar24 = sVar22 - 0x10;
          } while (0x10 < (int)(sVar22 - 0x10));
LAB_0898b478:
          sVar24 = sVar22 - 0x10;
          p_Var17->iov_len = sVar24;
        }
        p_Var17->iov_base = "                ";
        local_6a4[0].uio_iovcnt = local_6a4[0].uio_iovcnt + 1;
        local_6a4[0].uio_resid = local_6a4[0].uio_resid + sVar24;
        if ((7 < local_6a4[0].uio_iovcnt) && (iVar5 = __sprint_r(data,fp,local_6a4), iVar5 != 0))
        goto LAB_0898b648;
      }
    }
    local_3c = local_3c + local_58 + local_40;
    if ((local_6a4[0].uio_resid == 0) || (iVar5 = __sprint_r(data,fp,local_6a4), iVar5 == 0)) {
      local_6a4[0].uio_iovcnt = 0;
      if (local_60 == (mbstate_t *)0x0) {
        p_Var17 = local_670;
        ap = local_78;
      }
      else {
        _free_r(data,local_60);
        p_Var17 = local_670;
        local_60 = (mbstate_t *)0x0;
        ap = local_78;
      }
      goto LAB_0898b0d0;
    }
  }
LAB_0898b648:
  if (local_60 == (mbstate_t *)0x0) {
    uVar3 = fp->_flags;
    goto LAB_0898b660;
  }
LAB_0898b650:
  _free_r(data,local_60);
  goto LAB_0898b65c;
switchD_0898b194_caseD_31:
  local_40 = 0;
  do {
    iVar6 = iVar5 + local_40 * 10;
    iVar5 = (int)*fmt0;
    local_40 = iVar6 - 0x30;
    fmt0 = fmt0 + 1;
  } while (iVar5 - 0x30U < 10);
  goto LAB_0898b174;
switchD_0898b194_caseD_20:
  if (local_6d0 == '\0') {
    local_6d0 = ' ';
    iVar5 = (int)*fmt0;
  }
  else {
    iVar5 = (int)*fmt0;
  }
  goto LAB_0898b16c;
}



----------------------------------------

// Function: vfprintf @ 0898cfd8

int vfprintf(FILE *fp,char *fmt0,va_list ap)

{
  int iVar1;
  
                    /* Unresolved local var: int result@[???] */
  iVar1 = _vfprintf_r(_impure_ptr,fp,fmt0,ap);
  return iVar1;
}



----------------------------------------

// Function: _vsprintf_r @ 0898cff8

int _vsprintf_r(_reent *ptr,char *str,char *fmt,va_list ap)

{
  int iVar1;
  FILE local_68;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: FILE f@[???] */
  local_68._flags = 0x208;
  local_68._bf._size = 0x7fffffff;
  local_68._w = 0x7fffffff;
  local_68._file = -1;
  local_68._p = (uchar *)str;
  local_68._bf._base = (uchar *)str;
  iVar1 = _vfprintf_r(ptr,&local_68,fmt,ap);
  *local_68._p = '\0';
  return iVar1;
}



----------------------------------------

// Function: vsprintf @ 0898d048

int vsprintf(char *str,char *fmt,va_list ap)

{
  int iVar1;
  FILE local_68;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: FILE f@[???] */
  local_68._flags = 0x208;
  local_68._bf._size = 0x7fffffff;
  local_68._w = 0x7fffffff;
  local_68._file = -1;
  local_68._p = (uchar *)str;
  local_68._bf._base = (uchar *)str;
  iVar1 = _vfprintf_r(_impure_ptr,&local_68,fmt,ap);
  *local_68._p = '\0';
  return iVar1;
}



----------------------------------------

// Function: __swbuf_r @ 0898d0a8

int __swbuf_r(_reent *ptr,int c,FILE *fp)

{
  ushort uVar1;
  int iVar2;
  uchar *puVar3;
  uchar *puVar4;
  int iVar5;
  uint uVar6;
  
                    /* Unresolved local var: int n@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    uVar1 = fp->_flags;
  }
  else {
    __sinit(ptr);
    uVar1 = fp->_flags;
  }
  fp->_w = fp->_lbfsize;
  if (((uVar1 & 8) == 0) || (puVar3 = (fp->_bf)._base, puVar3 == (uchar *)0x0)) {
    iVar5 = __swsetup(fp);
    if (iVar5 != 0) {
      fp->_flags = fp->_flags | 0x40;
      ptr->_errno = 9;
      return -1;
    }
    puVar3 = (fp->_bf)._base;
  }
  puVar4 = fp->_p;
  iVar5 = ((int)puVar4 - (int)puVar3) + 1;
  if ((fp->_bf)._size <= (int)puVar4 - (int)puVar3) {
    iVar2 = fflush(fp);
    iVar5 = 1;
    if (iVar2 != 0) {
      return -1;
    }
    puVar4 = fp->_p;
  }
  uVar6 = c & 0xff;
  fp->_w = fp->_w + -1;
  *puVar4 = (uchar)c;
  iVar2 = (fp->_bf)._size;
  fp->_p = puVar4 + 1;
  if (iVar2 != iVar5) {
    if ((fp->_flags & 1U) == 0) {
      return uVar6;
    }
    if (uVar6 != 10) {
      return uVar6;
    }
  }
  iVar5 = fflush(fp);
  if (iVar5 != 0) {
    return -1;
  }
  return uVar6;
}



----------------------------------------

// Function: __swbuf @ 0898d1d8

int __swbuf(int c,FILE *fp)

{
  int iVar1;
  
  iVar1 = __swbuf_r(_impure_ptr,c,fp);
  return iVar1;
}



----------------------------------------

// Function: _wcrtomb_r @ 0898d1f0

size_t _wcrtomb_r(_reent *ptr,char *s,wchar_t wc,mbstate_t *ps)

{
  size_t sVar1;
  char acStack_20 [16];
  
                    /* Unresolved local var: int retval@[???]
                       Unresolved local var: char[10] buf@[???] */
  if (s == (char *)0x0) {
    sVar1 = _wctomb_r(ptr,acStack_20,0,ps);
  }
  else {
    sVar1 = _wctomb_r(ptr,s,wc,ps);
  }
  if (sVar1 == 0xffffffff) {
    ps->__count = 0;
    ptr->_errno = 0x8a;
    sVar1 = 0xffffffff;
  }
  return sVar1;
}



----------------------------------------

// Function: wcrtomb @ 0898d264

size_t wcrtomb(char *s,wchar_t wc,mbstate_t *ps)

{
  size_t sVar1;
  
  sVar1 = _wcrtomb_r(_impure_ptr,s,wc,ps);
  return sVar1;
}



----------------------------------------

// Function: _wcsrtombs_r @ 0898d284

size_t _wcsrtombs_r(_reent *r,char *dst,wchar_t **src,size_t len,mbstate_t *ps)

{
  size_t sVar1;
  wchar_t *pwVar2;
  char *pcVar3;
  size_t sVar4;
  wchar_t wc;
  mbstate_t *in_t0;
  char *pcVar5;
  uint uVar6;
  anon_union_dwarf_77a aVar7;
  int iVar8;
  int *piVar9;
  char local_40 [16];
  _reent *local_30;
  
                    /* Unresolved local var: char * ptr@[???]
                       Unresolved local var: char[10] buff@[???]
                       Unresolved local var: wchar_t * pwcs@[???]
                       Unresolved local var: size_t n@[???]
                       Unresolved local var: int i@[???] */
  if (dst == (char *)0x0) {
    piVar9 = *src;
    len = 0xffffffff;
  }
  else {
    piVar9 = *src;
    if (len == 0) {
      return 0;
    }
  }
  uVar6 = 0;
                    /* Unresolved local var: int count@[???]
                       Unresolved local var: wint_t wch@[???]
                       Unresolved local var: int bytes@[???] */
  wc = *piVar9;
  pcVar5 = dst;
  local_30 = r;
  while( true ) {
    iVar8 = in_t0->__count;
    aVar7 = in_t0->__value;
    sVar1 = _wcrtomb_r(local_30,local_40,wc,in_t0);
    if (sVar1 == 0xffffffff) {
      local_30->_errno = 0x8a;
      in_t0->__count = 0;
      return 0xffffffff;
    }
    if (len - sVar1 < uVar6) break;
    if (len <= sVar1) {
      in_t0->__value = aVar7;
      goto LAB_0898d370;
    }
    uVar6 = uVar6 + sVar1;
    if (dst != (char *)0x0) {
      if ((int)sVar1 < 1) {
        pwVar2 = *src;
      }
      else {
        sVar4 = 0;
        do {
          pcVar3 = local_40 + sVar4;
          sVar4 = sVar4 + 1;
          *pcVar5 = *pcVar3;
          pcVar5 = pcVar5 + 1;
        } while (sVar1 != sVar4);
        pwVar2 = *src;
      }
      *src = pwVar2 + 1;
    }
    if (*piVar9 == 0) {
      if (dst != (char *)0x0) {
        *src = (wchar_t *)0x0;
      }
      in_t0->__count = 0;
      return uVar6 - 1;
    }
    piVar9 = piVar9 + 1;
    if (len <= uVar6) {
      return uVar6;
    }
    wc = *piVar9;
  }
  in_t0->__value = aVar7;
LAB_0898d370:
  in_t0->__count = iVar8;
  return uVar6;
}



----------------------------------------

// Function: wcsrtombs @ 0898d3e8

size_t wcsrtombs(char *dst,wchar_t **src,size_t len,mbstate_t *ps)

{
  size_t sVar1;
  mbstate_t *in_stack_00000010;
  
  sVar1 = _wcsrtombs_r(_impure_ptr,dst,src,len,in_stack_00000010);
  return sVar1;
}



----------------------------------------

// Function: _wctomb_r @ 0898d410

int _wctomb_r(_reent *r,char *s,wchar_t wchar,mbstate_t *state)

{
  uint uVar1;
  size_t sVar2;
  int iVar3;
  byte bVar4;
  byte bVar5;
  
  sVar2 = strlen(__lc_ctype);
  bVar5 = (byte)wchar;
  if (1 < sVar2) {
    iVar3 = strcmp(__lc_ctype,"C-UTF-8");
    bVar4 = (byte)((uint)wchar >> 8);
    if (iVar3 == 0) {
      if (s == (char *)0x0) {
        return 0;
      }
      if (0x7f < wchar) {
        if (wchar - 0x80U < 0x780) {
          s[1] = bVar5 & 0x3f | 0x80;
          *s = (byte)((uint)(wchar << 0x15) >> 0x1b) | 0xc0;
          return 2;
        }
        if (wchar - 0x800U < 0xf800) {
          if (0x7ff < wchar - 0xd800U) {
            s[2] = bVar5 & 0x3f | 0x80;
            *s = bVar4 >> 4 | 0xe0;
            s[1] = (byte)((uint)(wchar << 0x14) >> 0x1a) | 0x80;
            return 3;
          }
        }
        else {
          if (wchar - 0x10000U < 0x1f0000) {
            s[3] = bVar5 & 0x3f | 0x80;
            *s = (byte)((uint)(wchar << 0xb) >> 0x1d) | 0xf0;
            s[1] = (byte)((int)(wchar & 0x3f000U) >> 0xc) | 0x80;
            s[2] = (byte)((uint)(wchar << 0x14) >> 0x1a) | 0x80;
            return 4;
          }
          bVar4 = (byte)((uint)wchar >> 0x10);
          if (wchar - 0x200000U < 0x3e00000) {
            s[4] = bVar5 & 0x3f | 0x80;
            *s = (byte)((uint)(wchar << 6) >> 0x1e) | 0xf8;
            s[1] = bVar4 >> 2 | 0x80;
            s[2] = (byte)((int)(wchar & 0x3f000U) >> 0xc) | 0x80;
            s[3] = (byte)((uint)(wchar << 0x14) >> 0x1a) | 0x80;
            return 5;
          }
          if (0x3ffffff < wchar) {
            s[5] = bVar5 & 0x3f | 0x80;
            *s = (byte)((uint)(wchar << 1) >> 0x1f) | 0xfc;
            s[1] = (byte)((uint)(wchar << 2) >> 0x1a) | 0x80;
            s[2] = bVar4 >> 2 | 0x80;
            s[3] = (byte)((int)(wchar & 0x3f000U) >> 0xc) | 0x80;
            s[4] = (byte)((uint)(wchar << 0x14) >> 0x1a) | 0x80;
            return 6;
          }
        }
        return -1;
      }
      goto LAB_0898d4cc;
    }
    iVar3 = strcmp(__lc_ctype,"C-SJIS");
    if (iVar3 == 0) {
                    /* Unresolved local var: uchar char2@[???]
                       Unresolved local var: uchar char1@[???] */
      uVar1 = (wchar & 0xffffU) >> 8;
      if (s == (char *)0x0) {
        return 0;
      }
      if (uVar1 != 0) {
        if ((0x1e < (uVar1 + 0x7f & 0xff)) && (0xf < (uVar1 + 0x20 & 0xff))) {
          return -1;
        }
        if ((0x3e < ((wchar & 0xffU) - 0x40 & 0xff)) && (0x7c < (wchar & 0xffU ^ 0x80))) {
          return -1;
        }
        s[1] = bVar5;
        *s = bVar4;
        return 2;
      }
      goto LAB_0898d4cc;
    }
    iVar3 = strcmp(__lc_ctype,"C-EUCJP");
    if (iVar3 == 0) {
                    /* Unresolved local var: uchar char2@[???]
                       Unresolved local var: uchar char1@[???] */
      uVar1 = (wchar & 0xffffU) >> 8;
      if (s == (char *)0x0) {
        return 0;
      }
      if (uVar1 != 0) {
        if (0x5d < (uVar1 + 0x5f & 0xff)) {
          return -1;
        }
        if (((wchar & 0xffU) + 0x5f & 0xff) < 0x5e) {
          s[1] = bVar5;
          *s = bVar4;
          return 2;
        }
        return -1;
      }
      goto LAB_0898d4cc;
    }
    iVar3 = strcmp(__lc_ctype,"C-JIS");
    if (iVar3 == 0) {
                    /* Unresolved local var: int cnt@[???]
                       Unresolved local var: uchar char2@[???]
                       Unresolved local var: uchar char1@[???] */
      uVar1 = (wchar & 0xffffU) >> 8;
      if (s == (char *)0x0) {
        return 1;
      }
      if (uVar1 == 0) {
        if (state->__count == 0) {
          *s = bVar5;
          return 1;
        }
        state->__count = 0;
        *s = '\x1b';
        s[2] = 'B';
        s[1] = '(';
        s[3] = bVar5;
        return 4;
      }
      if (0x5d < (uVar1 - 0x21 & 0xff)) {
        return -1;
      }
      if (((wchar & 0xffU) - 0x21 & 0xff) < 0x5e) {
        if (state->__count == 0) {
          state->__count = 1;
          *s = '\x1b';
          s[1] = '$';
          s[2] = 'B';
          iVar3 = 5;
          s = s + 3;
        }
        else {
          iVar3 = 2;
        }
        s[1] = bVar5;
        *s = bVar4;
        return iVar3;
      }
      return -1;
    }
  }
  if (s == (char *)0x0) {
    return 0;
  }
LAB_0898d4cc:
  *s = bVar5;
  return 1;
}



----------------------------------------

// Function: _write_r @ 0898d888

_ssize_t _write_r(_reent *ptr,int fd,void *buf,size_t cnt)

{
  int iVar1;
  
                    /* Unresolved local var: _ssize_t ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _write(fd,buf,cnt);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: __swsetup @ 0898d8f8

int __swsetup(FILE *fp)

{
  int iVar1;
  uchar *puVar2;
  ushort uVar3;
  
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    uVar3 = fp->_flags;
  }
  else {
    __sinit(_impure_ptr);
    uVar3 = fp->_flags;
  }
  if ((uVar3 & 8) == 0) {
    if ((uVar3 & 0x10) == 0) {
      return -1;
    }
    if ((uVar3 & 4) == 0) {
      puVar2 = (fp->_bf)._base;
    }
    else {
      puVar2 = (fp->_ub)._base;
      if (puVar2 != (uchar *)0x0) {
        if (puVar2 == fp->_ubuf) {
          (fp->_ub)._base = (uchar *)0x0;
        }
        else {
          _free_r(_impure_ptr,puVar2);
          (fp->_ub)._base = (uchar *)0x0;
        }
      }
      puVar2 = (fp->_bf)._base;
      fp->_r = 0;
      fp->_flags = fp->_flags & 0xffdb;
      fp->_p = puVar2;
    }
    uVar3 = fp->_flags | 8;
    fp->_flags = uVar3;
  }
  else {
    puVar2 = (fp->_bf)._base;
  }
  if ((puVar2 == (uchar *)0x0) && ((uVar3 & 0x280) != 0x200)) {
    __smakebuf(fp);
    uVar3 = fp->_flags;
  }
  if ((uVar3 & 1) != 0) {
    iVar1 = (fp->_bf)._size;
    fp->_w = 0;
    fp->_lbfsize = -iVar1;
    return 0;
  }
  if ((uVar3 & 2) == 0) {
    fp->_w = (fp->_bf)._size;
  }
  else {
    fp->_w = 0;
  }
  return 0;
}



----------------------------------------

// Function: getdigit @ 0898da3c

int getdigit(longdouble *val,int *cnt)

{
  int iVar1;
  SItype arg_a;
  undefined4 extraout_v0;
  undefined4 extraout_v1;
  int iVar2;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: int digit@[???]
                       Unresolved local var: longdouble d@[???] */
  iVar1 = *cnt;
  iVar2 = 0x30;
  *cnt = iVar1 + 1;
  if (iVar1 < 0x14) {
    arg_a = __fixdfsi(in_f12_13);
    iVar2 = arg_a + 0x30;
    __floatsidf(arg_a);
    __subdf3(in_f12_13,in_f14_15);
    __muldf3(in_f12_13,in_f14_15);
    *(undefined4 *)val = extraout_v0;
    *(undefined4 *)((int)val + 4) = extraout_v1;
  }
  return iVar2;
}



----------------------------------------

// Function: vxprintf @ 0898dae8

/* WARNING: Removing unreachable block (ram,0x0898eafc) */
/* WARNING: Removing unreachable block (ram,0x0898eb2c) */
/* WARNING: Type propagation algorithm not settling */

int vxprintf(_func_void_char_ptr_int_void_ptr *func,void *arg,char *format,va_list ap)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  byte bVar4;
  int iVar5;
  undefined4 *puVar6;
  SItype SVar7;
  undefined4 extraout_v0;
  undefined4 extraout_v0_00;
  undefined4 extraout_v0_01;
  undefined4 extraout_v0_02;
  undefined4 extraout_v0_03;
  undefined4 extraout_v0_04;
  undefined4 extraout_v0_05;
  undefined4 extraout_v0_06;
  undefined4 extraout_v1;
  uint extraout_v1_00;
  uint extraout_v1_01;
  uint extraout_v1_02;
  uint extraout_v1_03;
  byte *pbVar8;
  uint extraout_v1_04;
  uint extraout_v1_05;
  uint extraout_v1_06;
  int iVar9;
  info *piVar10;
  uint uVar11;
  int iVar12;
  byte *pbVar13;
  byte *pbVar14;
  byte *pbVar15;
  UDItype *pUVar16;
  e_type eVar17;
  byte *pbVar18;
  undefined4 uVar19;
  char *pcVar20;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  UDItype UVar21;
  UDItype UVar22;
  int local_f8 [2];
  undefined8 local_f0;
  undefined4 local_e8;
  uint local_e4;
  byte local_e0 [98];
  byte local_7e;
  undefined1 local_7d;
  byte abStack_7c [4];
  byte *local_78;
  int local_74;
  byte *local_70;
  undefined4 local_68;
  undefined4 local_64;
  int local_60;
  byte *local_5c;
  e_type local_58;
  int local_54;
  info *local_50;
  int local_4c;
  int local_48;
  int local_44;
  int local_40;
  int local_3c;
  uint local_38;
  int local_34;
  void *local_30;
  UDItype *local_2c;
  
                    /* Unresolved local var: char * fmt@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: char * bufpt@[???]
                       Unresolved local var: int precision@[???]
                       Unresolved local var: int length@[???]
                       Unresolved local var: int idx@[???]
                       Unresolved local var: int count@[???]
                       Unresolved local var: int width@[???]
                       Unresolved local var: int flag_leftjustify@[???]
                       Unresolved local var: int flag_plussign@[???]
                       Unresolved local var: int flag_blanksign@[???]
                       Unresolved local var: int flag_alternateform@[???]
                       Unresolved local var: int flag_zeropad@[???]
                       Unresolved local var: int flag_long@[???]
                       Unresolved local var: int flag_center@[???]
                       Unresolved local var: ulonglong longvalue@[???]
                       Unresolved local var: longdouble realvalue@[???]
                       Unresolved local var: info * infop@[???]
                       Unresolved local var: char[100] buf@[???]
                       Unresolved local var: char prefix@[???]
                       Unresolved local var: int errorflag@[???]
                       Unresolved local var: e_type xtype@[???]
                       Unresolved local var: char * zMem@[???]
                       Unresolved local var: int exp@[???]
                       Unresolved local var: longdouble rounder@[???]
                       Unresolved local var: int flag_dp@[???]
                       Unresolved local var: int flag_rtz@[???]
                       Unresolved local var: int flag_exp@[???]
                       Unresolved local var: int nsd@[???] */
  bVar4 = *format;
  if (bVar4 == 0) {
    return 0;
  }
  pbVar15 = (byte *)0x0;
  pbVar18 = (byte *)0x0;
  local_34 = 0;
  local_5c = (byte *)0x0;
  local_30 = arg;
  local_2c = ap;
LAB_0898db3c:
  if (bVar4 == 0x25) {
    bVar4 = format[1];
    pbVar13 = (byte *)format;
    format = (char *)pbVar15;
  }
  else {
                    /* Unresolved local var: int amt@[???] */
    pbVar13 = (byte *)(format + 1);
    if (format[1] == 0x25) {
      iVar9 = 1;
    }
    else {
      iVar9 = 1;
      if (format[1] == 0) {
LAB_0898deac:
        (*func)(format,iVar9,local_30);
        return local_34 + iVar9;
      }
      pbVar13 = (byte *)(format + 2);
      while( true ) {
        iVar9 = iVar9 + 1;
        if (*pbVar13 == 0x25) break;
        if (*pbVar13 == 0) goto LAB_0898deac;
        pbVar13 = pbVar13 + 1;
      }
    }
    (*func)(format,iVar9,local_30);
    local_34 = local_34 + iVar9;
    bVar4 = pbVar13[1];
  }
  iVar9 = (int)(char)bVar4;
  pbVar13 = pbVar13 + 1;
  if (iVar9 == 0) {
    (*func)("%",1,local_30);
    return -1;
  }
  local_38 = 0;
  local_3c = 0;
  local_40 = 0;
  local_44 = 0;
  local_48 = 0;
  local_4c = 0;
  do {
    switch(iVar9) {
    case 0x20:
      local_40 = 1;
      break;
    default:
      if (iVar9 != 0) goto LAB_0898dc08;
      break;
    case 0x23:
      local_44 = 1;
      break;
    case 0x2b:
      local_3c = 1;
      break;
    case 0x2d:
      local_38 = 1;
      break;
    case 0x30:
      local_48 = 1;
      break;
    case 0x3d:
      local_4c = 1;
    }
    pbVar13 = pbVar13 + 1;
    iVar9 = (int)(char)*pbVar13;
  } while (iVar9 != 0);
LAB_0898dc08:
  if (local_4c != 0) {
    local_38 = 0;
  }
  if (iVar9 == 0x2a) {
    uVar11 = (uint)*local_2c;
    if ((int)uVar11 < 0) {
      uVar11 = -uVar11;
      local_38 = 1;
    }
    pbVar13 = pbVar13 + 1;
    iVar9 = (int)(char)*pbVar13;
    local_78 = (byte *)(uVar11 + 0x5a);
    pUVar16 = (UDItype *)((int)local_2c + 4);
    if (iVar9 != 0x2e) goto LAB_0898dc64;
LAB_0898df2c:
    pbVar14 = pbVar13 + 1;
    iVar9 = (int)(char)*pbVar14;
    if (iVar9 == 0x2a) {
      pbVar14 = pbVar13 + 2;
      iVar9 = (int)(char)*pbVar14;
      pUVar16 = (UDItype *)((int)pUVar16 + 4);
      local_70 = (byte *)0x3c;
    }
    else {
      local_70 = (byte *)0x0;
      while (iVar12 = isdigit(iVar9), iVar12 != 0) {
        pbVar14 = pbVar14 + 1;
        local_70 = (byte *)(iVar9 + (int)local_70 * 10 + -0x30);
        iVar9 = (int)(char)*pbVar14;
      }
      local_70 = (byte *)((int)local_70 + 0x3c);
    }
    uVar11 = 0;
    if (iVar9 != 0x6c) goto LAB_0898dc7c;
  }
  else {
    iVar12 = 0;
    while (iVar5 = isdigit(iVar9), iVar5 != 0) {
      pbVar13 = pbVar13 + 1;
      iVar12 = iVar9 + iVar12 * 10;
      iVar9 = (int)(char)*pbVar13;
      iVar12 = iVar12 + -0x30;
    }
    local_78 = (byte *)(iVar12 + 0x5a);
    pUVar16 = local_2c;
    if (iVar9 == 0x2e) goto LAB_0898df2c;
LAB_0898dc64:
    local_70 = (byte *)0xffffffff;
    pbVar14 = pbVar13;
    if (iVar9 != 0x6c) {
      uVar11 = 0;
      goto LAB_0898dc7c;
    }
  }
  iVar9 = (int)(char)pbVar14[1];
  if (iVar9 == 0x6c) {
    iVar9 = (int)(char)pbVar14[2];
    uVar11 = 2;
    pbVar14 = pbVar14 + 2;
  }
  else {
    uVar11 = 1;
    pbVar14 = pbVar14 + 1;
  }
LAB_0898dc7c:
  piVar10 = fmtinfo;
  iVar12 = 0;
LAB_0898dca4:
  pbVar15 = (byte *)format;
  if (iVar9 != piVar10->fmttype) goto code_r0x0898dca8;
  local_50 = fmtinfo + iVar12;
  if (local_50 == (info *)0x0) goto switchD_0898dffc_caseD_8;
  local_58 = fmtinfo[iVar12].type;
  eVar17 = local_58;
  switch(local_58) {
  case RADIX:
  case ORDINAL:
    if (uVar11 < 2) {
      if (uVar11 == 0) {
        iVar9 = fmtinfo[iVar12].flag_signed;
        if (iVar9 == 0) {
                    /* Unresolved local var: uint t@[???] */
          local_2c = (UDItype *)((int)pUVar16 + 4);
          local_f0 = (UDItype)(uint)*pUVar16;
        }
        else {
          uVar11 = (uint)*pUVar16;
LAB_0898ee88:
                    /* Unresolved local var: int t@[???] */
          local_2c = (UDItype *)((int)pUVar16 + 4);
          local_f0 = (UDItype)(int)uVar11;
        }
      }
      else {
        iVar9 = fmtinfo[iVar12].flag_signed;
        if (iVar9 != 0) {
          uVar11 = (uint)*pUVar16;
          goto LAB_0898ee88;
        }
                    /* Unresolved local var: ulong t@[???] */
        local_2c = (UDItype *)((int)pUVar16 + 4);
        local_f0 = (UDItype)(uint)*pUVar16;
      }
    }
    else {
                    /* Unresolved local var: ulonglong t@[???] */
      iVar9 = fmtinfo[iVar12].flag_signed;
      local_2c = (UDItype *)((uint)((int)pUVar16 + 7) & 0xfffffff8);
      local_f0 = *local_2c;
      local_2c = local_2c + 1;
    }
    if ((int)local_f0 == 0 && local_f0._4_4_ == 0) {
      iVar12 = fmtinfo[iVar12].base;
      if (iVar12 == 8) {
        local_44 = 0;
      }
    }
    else {
      iVar12 = fmtinfo[iVar12].base;
    }
    if (iVar9 == 0) {
      local_54 = 0;
    }
    else if ((longlong)local_f0 < 0) {
      local_54 = 0x2d;
      local_f0 = CONCAT44(-(uint)(-(int)local_f0 != 0) - local_f0._4_4_,-(int)local_f0);
    }
    else if (local_3c == 0) {
      if (local_40 == 0) {
        local_54 = 0;
      }
      else {
        local_54 = 0x20;
      }
    }
    else {
      local_54 = 0x2b;
    }
    UVar21 = local_f0;
    if (local_48 != 0) {
      local_70 = local_70 + ((int)local_78 - (uint)(local_54 != 0));
    }
    if (local_58 == ORDINAL) {
                    /* Unresolved local var: long a@[???]
                       Unresolved local var: long b@[???] */
      UVar22 = __umoddi3(local_f0,10);
      iVar9 = (int)UVar22;
      if (((iVar9 == 0) || (3 < iVar9)) || (UVar22 = __umoddi3(UVar21,100), (int)UVar22 - 0xbU < 3))
      {
        pbVar15 = &local_7e;
        local_7e = 0x74;
        local_7d = 0x68;
      }
      else if (iVar9 == 1) {
        pbVar15 = &local_7e;
        local_7e = 0x73;
        local_7d = 0x74;
      }
      else if (iVar9 == 2) {
        pbVar15 = &local_7e;
        local_7e = 0x6e;
        local_7d = 100;
      }
      else {
        pbVar15 = &local_7e;
        if (iVar9 == 3) {
          local_7e = 0x72;
          local_7d = 100;
        }
      }
    }
    else {
      pbVar15 = abStack_7c;
    }
                    /* Unresolved local var: char * cset@[???]
                       Unresolved local var: int base@[???] */
    pcVar20 = local_50->charset;
    do {
      UVar21 = __umoddi3(UVar21,(longlong)iVar12);
      pbVar15 = pbVar15 + -1;
      *pbVar15 = pcVar20[(int)UVar21];
      UVar21 = __udivdi3(local_f0,(longlong)iVar12);
      local_f0 = UVar21;
    } while (UVar21 != 0);
    if (local_50->fmttype == 0x70) {
      local_70 = (byte *)0x8;
      local_44 = 1;
    }
    iVar9 = (int)local_70 - (int)(abStack_7c + -(int)pbVar15);
    if (0 < iVar9) {
      do {
        pbVar15 = pbVar15 + -1;
        iVar9 = iVar9 + -1;
        *pbVar15 = 0x30;
      } while (iVar9 != 0);
    }
    if (local_54 != 0) {
      pbVar15 = pbVar15 + -1;
      *pbVar15 = (byte)local_54;
    }
    pbVar18 = local_e0 + -(int)pbVar15;
    local_f0 = 0;
    eVar17 = local_58;
    if (local_44 != 0) {
      pbVar13 = (byte *)local_50->prefix;
      if (pbVar13 == (byte *)0x0) {
        pbVar18 = abStack_7c + -(int)pbVar15;
        goto joined_r0x0898dce4;
      }
                    /* Unresolved local var: char * pre@[???]
                       Unresolved local var: char x@[???] */
      bVar4 = *pbVar13;
      pbVar18 = local_e0 + -(int)pbVar15;
      if (*pbVar15 != bVar4) {
        while (pbVar13 = pbVar13 + 1, bVar4 != 0) {
          pbVar15 = pbVar15 + -1;
          *pbVar15 = bVar4;
          bVar4 = *pbVar13;
        }
        pbVar18 = local_e0 + -(int)pbVar15;
      }
    }
    pbVar18 = pbVar18 + 100;
    goto joined_r0x0898dce4;
  case FLOAT:
  case EXP:
  case GENERIC:
    goto switchD_0898dffc_caseD_1;
  case SIZE:
    local_2c = (UDItype *)((int)pUVar16 + 4);
    local_78 = (byte *)0x0;
    **(int **)pUVar16 = local_34;
    pbVar18 = (byte *)0x0;
    goto joined_r0x0898dce4;
  case STRING:
  case MEM_STRING:
    pbVar13 = *(byte **)pUVar16;
    local_2c = (UDItype *)((int)pUVar16 + 4);
    pbVar15 = (byte *)"(null)";
    if (pbVar13 != (byte *)0x0) {
      pbVar15 = pbVar13;
    }
    pbVar18 = (byte *)strlen((char *)pbVar15);
    eVar17 = local_58;
    local_5c = pbVar13;
    if ((-1 < (int)local_70) && ((int)local_70 < (int)pbVar18)) {
      pbVar18 = local_70;
    }
    goto joined_r0x0898dce4;
  case PERCENT:
    local_e0[0] = 0x25;
    pbVar15 = local_e0;
    local_2c = pUVar16;
    pbVar18 = (byte *)0x1;
    goto joined_r0x0898dce4;
  case CHAR:
  case CHARLIT:
    if (local_58 == CHAR) {
      bVar4 = (byte)*pUVar16;
      local_2c = (UDItype *)((int)pUVar16 + 4);
    }
    else {
      pbVar14 = pbVar14 + 1;
      bVar4 = *pbVar14;
      local_2c = pUVar16;
    }
    local_e0[0] = bVar4;
    if ((int)local_70 < 0) {
      pbVar15 = local_e0;
      pbVar18 = (byte *)0x1;
    }
    else if ((int)local_70 < 2) {
      pbVar15 = local_e0;
      pbVar18 = local_70;
    }
    else {
      pbVar15 = local_e0;
      pbVar8 = (byte *)0x1;
      pbVar13 = local_e0 + 1;
      do {
        *pbVar13 = bVar4;
        pbVar8 = pbVar8 + 1;
        pbVar13 = pbVar15 + (int)pbVar8;
        eVar17 = local_58;
        pbVar18 = local_70;
      } while (local_70 != pbVar8);
    }
    goto joined_r0x0898dce4;
  case ERROR:
    goto switchD_0898dffc_caseD_8;
  case SEEIT:
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: char * arg@[???] */
    pbVar13 = *(byte **)pUVar16;
    pbVar18 = (byte *)0x0;
    local_2c = (UDItype *)((int)pUVar16 + 4);
    pbVar15 = local_e0;
    goto LAB_0898e6c4;
  default:
    local_2c = pUVar16;
    goto joined_r0x0898dce4;
  }
code_r0x0898dca8:
  iVar12 = iVar12 + 1;
  piVar10 = piVar10 + 1;
  if (iVar12 == 0x16) goto switchD_0898dffc_caseD_8;
  goto LAB_0898dca4;
  while( true ) {
    if ((int)(char)bVar4 - 0x20U < 0x5f) {
      *pbVar15 = bVar4;
    }
    else {
      *pbVar15 = 0x5e;
      pbVar15 = pbVar15 + 1;
      pbVar18 = pbVar18 + 1;
      *pbVar15 = (bVar4 & 0x1f) + 0x40;
    }
    pbVar18 = pbVar18 + 1;
    pbVar15 = pbVar15 + 1;
    if (0x62 < (int)pbVar18) break;
LAB_0898e6c4:
    bVar4 = *pbVar13;
    pbVar13 = pbVar13 + 1;
    if ((char)bVar4 == 0) break;
  }
  eVar17 = local_58;
  if (((int)local_70 < 0) || ((int)pbVar18 <= (int)local_70)) {
    pbVar15 = local_e0;
  }
  else {
    pbVar15 = local_e0;
    pbVar18 = local_70;
  }
joined_r0x0898dce4:
  local_58 = eVar17;
  if (local_38 == 0) {
    uVar11 = (int)local_78 - (int)pbVar18;
LAB_0898dcf8:
                    /* Unresolved local var: int nspace@[???] */
    if ((int)uVar11 < 1) {
      local_38 = 0;
    }
    else {
      if (local_4c != 0) {
        uVar11 = (int)uVar11 >> 1;
        local_78 = local_78 + -uVar11;
      }
      local_38 = (uint)(local_4c != 0);
      local_34 = local_34 + uVar11;
      for (; 0x33 < uVar11; uVar11 = uVar11 - 0x34) {
        (*func)(vxprintf::spaces,0x34,local_30);
      }
      if (0 < (int)uVar11) {
        (*func)(vxprintf::spaces,uVar11,local_30);
      }
    }
  }
LAB_0898dd64:
  if (0 < (int)pbVar18) {
    (*func)((char *)pbVar15,(int)pbVar18,local_30);
    local_34 = local_34 + (int)pbVar18;
  }
  if ((eVar17 == MEM_STRING) && (local_5c != (byte *)0x0)) {
    free(local_5c);
  }
  if (local_38 == 0) {
    bVar4 = pbVar14[1];
    goto LAB_0898de00;
  }
                    /* Unresolved local var: int nspace@[???] */
  uVar11 = (int)local_78 - (int)pbVar18;
  if (0 < (int)uVar11) {
    local_34 = local_34 + uVar11;
    if (0x33 < uVar11) {
      do {
        uVar11 = uVar11 - 0x34;
        (*func)(vxprintf::spaces,0x34,local_30);
      } while (0x33 < uVar11);
      if ((int)uVar11 < 1) goto LAB_0898ddfc;
    }
    (*func)(vxprintf::spaces,uVar11,local_30);
  }
LAB_0898ddfc:
  bVar4 = pbVar14[1];
LAB_0898de00:
  format = (char *)(pbVar14 + 1);
  if (bVar4 == 0) {
    return local_34;
  }
  goto LAB_0898db3c;
switchD_0898dffc_caseD_8:
  local_e0[0] = 0x25;
  local_e0[1] = (byte)iVar9;
  if (iVar9 == 0) {
    (*func)("%",1,local_30);
    pbVar14 = pbVar14 + -1;
    local_34 = local_34 + 1;
    local_58 = ERROR;
    eVar17 = local_58;
    local_2c = pUVar16;
  }
  else {
    (*func)("%",2,local_30);
    local_34 = local_34 + 2;
    local_58 = ERROR;
    eVar17 = local_58;
    local_2c = pUVar16;
  }
  goto joined_r0x0898dce4;
switchD_0898dffc_caseD_1:
  puVar6 = (undefined4 *)((uint)((int)pUVar16 + 7) & 0xfffffff8);
  uVar19 = *puVar6;
  uVar11 = puVar6[1];
  local_2c = (UDItype *)(puVar6 + 2);
  if ((int)local_70 < 0) {
    local_70 = (byte *)0x6;
  }
  else {
    local_70 = local_70 + 0x5a;
  }
  local_e8 = uVar19;
  local_e4 = uVar11;
  SVar7 = __ltdf2(in_f12_13,in_f14_15);
  if (SVar7 < 0) {
    local_e4 = uVar11 ^ 0x80000000;
    local_74 = 0x2d;
    local_e8 = uVar19;
  }
  else if (local_3c == 0) {
    local_74 = 0x20;
    if (local_40 == 0) {
      local_74 = 0;
    }
  }
  else {
    local_74 = 0x2b;
  }
  pbVar15 = local_70;
  if (((local_58 == GENERIC) && (pbVar15 = local_70 + -1, local_70 == (byte *)0x0)) ||
     ((local_70 = pbVar15, pbVar15 = (byte *)0x13, (int)local_70 < 0x14 &&
      (pbVar15 = local_70, local_70 == (byte *)0x0)))) {
    local_68 = DAT_089e1190;
    local_64 = DAT_089e1194;
  }
  else {
    local_68 = DAT_089e1190;
    local_64 = DAT_089e1194;
    do {
      __muldf3(in_f12_13,in_f14_15);
      pbVar15 = pbVar15 + -1;
      local_68 = extraout_v0;
      local_64 = extraout_v1;
    } while (pbVar15 != (byte *)0x0);
  }
  if (local_58 == FLOAT) {
    __adddf3(in_f12_13,in_f14_15);
    local_e8 = extraout_v0_06;
    local_e4 = extraout_v1_06;
  }
  SVar7 = __gtdf2(in_f12_13,in_f14_15);
  if (SVar7 < 1) {
    local_60 = 0;
  }
  else {
                    /* Unresolved local var: int k@[???] */
    SVar7 = __gedf2(in_f12_13,in_f14_15);
    if (SVar7 < 0) {
      iVar9 = 0;
      local_60 = 0;
      uVar19 = local_e8;
      uVar11 = local_e4;
    }
    else {
      iVar9 = 1;
      do {
        __muldf3(in_f12_13,in_f14_15);
        local_60 = iVar9 << 3;
        SVar7 = __gedf2(in_f12_13,in_f14_15);
        uVar19 = extraout_v0_00;
        uVar11 = extraout_v1_00;
        if (SVar7 < 0) break;
        iVar9 = iVar9 + 1;
        uVar19 = extraout_v0_00;
        uVar11 = extraout_v1_00;
      } while (iVar9 != 0x65);
    }
    local_e4 = uVar11;
    local_e8 = uVar19;
    SVar7 = __gedf2(in_f12_13,in_f14_15);
    bVar2 = iVar9 < 100;
    uVar19 = local_e8;
    uVar11 = local_e4;
    iVar12 = local_60;
    if ((-1 < SVar7) && (iVar9 = iVar9 + 1, bVar2)) {
      iVar5 = local_60 - iVar9;
      do {
        __muldf3(in_f12_13,in_f14_15);
        iVar12 = iVar12 + 1;
        SVar7 = __gedf2(in_f12_13,in_f14_15);
        uVar19 = extraout_v0_01;
        uVar11 = extraout_v1_01;
        if (SVar7 < 0) break;
        iVar9 = iVar9 + 1;
        uVar19 = extraout_v0_01;
        uVar11 = extraout_v1_01;
      } while (iVar12 != iVar5 + 0x65);
    }
    local_60 = iVar12;
    local_e4 = uVar11;
    local_e8 = uVar19;
    SVar7 = __ltdf2(in_f12_13,in_f14_15);
    iVar12 = iVar9;
    uVar19 = local_e8;
    uVar11 = local_e4;
    if ((SVar7 < 0) && (iVar12 = iVar9 + 1, iVar9 < 100)) {
      iVar9 = iVar9 - iVar12;
      do {
        __muldf3(in_f12_13,in_f14_15);
        local_60 = local_60 + -8;
        SVar7 = __ltdf2(in_f12_13,in_f14_15);
        uVar19 = extraout_v0_02;
        uVar11 = extraout_v1_02;
        if (-1 < SVar7) break;
        iVar12 = iVar12 + 1;
        uVar19 = extraout_v0_02;
        uVar11 = extraout_v1_02;
      } while (iVar12 != iVar9 + 0x66);
    }
    local_e4 = uVar11;
    local_e8 = uVar19;
    SVar7 = __ltdf2(in_f12_13,in_f14_15);
    bVar2 = iVar12 < 100;
    if ((SVar7 < 0) && (iVar12 = iVar12 + 1, bVar2)) {
      iVar5 = local_60 + iVar12;
      iVar9 = local_60;
      do {
        __muldf3(in_f12_13,in_f14_15);
        iVar9 = iVar9 + -1;
        SVar7 = __ltdf2(in_f12_13,in_f14_15);
        if (-1 < SVar7) {
          local_60 = iVar9;
          local_e8 = extraout_v0_03;
          local_e4 = extraout_v1_03;
          goto LAB_0898e46c;
        }
        iVar12 = iVar12 + 1;
      } while (iVar5 + -0x65 != iVar9);
      local_60 = iVar9;
      local_e8 = extraout_v0_03;
      local_e4 = extraout_v1_03;
    }
LAB_0898e46c:
    if (99 < iVar12) {
      pbVar15 = &DAT_089ed060;
      eVar17 = local_58;
      pbVar18 = (byte *)0x3;
      goto joined_r0x0898dce4;
    }
  }
  if (local_58 == FLOAT) {
    bVar2 = false;
LAB_0898ec78:
    local_f8[0] = 0;
    eVar17 = FLOAT;
    if (0x45 < (int)(local_70 + local_60)) goto LAB_0898e85c;
    bVar1 = (int)local_70 < 1;
    bVar3 = local_44 == 0;
    if (local_74 == 0) {
      pbVar18 = local_e0;
      pbVar15 = local_e0 + 1;
    }
    else {
      pbVar18 = local_e0 + 1;
      local_e0[0] = (byte)local_74;
      pbVar15 = local_e0 + 2;
    }
    if (local_60 < 0) {
      *pbVar18 = 0x30;
    }
    else {
      pbVar15 = pbVar18;
      do {
        iVar9 = getdigit((longdouble *)&local_e8,local_f8);
        iVar12 = local_60 + -1;
        local_60 = iVar12;
        *pbVar15 = (byte)iVar9;
        pbVar15 = pbVar15 + 1;
      } while (iVar12 != -1);
    }
    if (!bVar1 || !bVar3) {
      *pbVar15 = 0x2e;
      pbVar15 = pbVar15 + 1;
    }
    pbVar18 = local_70;
    if (local_60 + 1 < 0) {
      pbVar13 = local_70 + local_60 + 1;
      if ((int)local_70 < 1) goto LAB_0898ed64;
      do {
        pbVar18 = pbVar18 + -1;
        *pbVar15 = 0x30;
        pbVar15 = pbVar15 + 1;
        if (pbVar18 == pbVar13) goto LAB_0898ed38;
      } while (pbVar18 != (byte *)0x0);
      *pbVar15 = 0;
    }
    else {
LAB_0898ed38:
      if ((int)pbVar18 < 1) {
        *pbVar15 = 0;
      }
      else {
        pbVar18 = pbVar15 + (int)pbVar18;
        do {
          iVar9 = getdigit((longdouble *)&local_e8,local_f8);
          *pbVar15 = (byte)iVar9;
          pbVar15 = pbVar15 + 1;
        } while (pbVar15 != pbVar18);
LAB_0898ed64:
        *pbVar15 = 0;
      }
    }
    pbVar18 = pbVar15 + -1;
    if (bVar2) {
      if (bVar1 && bVar3) goto LAB_0898edb8;
      if (pbVar18 < local_e0) goto LAB_0898edb4;
      bVar4 = pbVar15[-1];
      if (bVar4 == 0x30) {
        *pbVar18 = 0;
        while( true ) {
          pbVar18 = pbVar18 + -1;
          if (pbVar18 < local_e0) goto LAB_0898edb4;
          bVar4 = *pbVar18;
          if (bVar4 != 0x30) break;
          *pbVar18 = 0;
        }
      }
      if (bVar4 != 0x2e) {
        pbVar15 = pbVar18 + 1;
        goto LAB_0898edb8;
      }
      *pbVar18 = 0;
      eVar17 = FLOAT;
    }
    else {
LAB_0898edb4:
      pbVar15 = pbVar18 + 1;
LAB_0898edb8:
      pbVar18 = pbVar15;
      eVar17 = FLOAT;
    }
  }
  else {
    __adddf3(in_f12_13,in_f14_15);
    local_e8 = extraout_v0_04;
    local_e4 = extraout_v1_04;
    SVar7 = __gedf2(in_f12_13,in_f14_15);
    if (-1 < SVar7) {
      local_60 = local_60 + 1;
      __muldf3(in_f12_13,in_f14_15);
      local_e8 = extraout_v0_05;
      local_e4 = extraout_v1_05;
    }
    if (local_58 == GENERIC) {
      bVar2 = local_44 == 0;
      if ((-5 < local_60) && (local_60 <= (int)local_70)) {
        local_70 = local_70 + -local_60;
        goto LAB_0898ec78;
      }
      eVar17 = EXP;
    }
    else {
      bVar2 = false;
      eVar17 = local_58;
    }
LAB_0898e85c:
    local_f8[0] = 0;
    bVar1 = 0 < (int)local_70;
    bVar3 = local_44 != 0;
    if (local_74 == 0) {
      pbVar18 = local_e0;
      pbVar15 = local_e0 + 1;
    }
    else {
      pbVar18 = local_e0 + 1;
      pbVar15 = local_e0 + 2;
      local_e0[0] = (byte)local_74;
    }
    iVar9 = getdigit((longdouble *)&local_e8,local_f8);
    *pbVar18 = (byte)iVar9;
    if (bVar1 || bVar3) {
      *pbVar15 = 0x2e;
      pbVar15 = pbVar15 + 1;
    }
    if (0 < (int)local_70) {
      pbVar18 = pbVar15 + (int)local_70;
      do {
        iVar9 = getdigit((longdouble *)&local_e8,local_f8);
        *pbVar15 = (byte)iVar9;
        pbVar15 = pbVar15 + 1;
      } while (pbVar15 != pbVar18);
    }
    pbVar13 = pbVar15 + -1;
    if (((bVar2) && (bVar1 || bVar3)) && (local_e0 <= pbVar13)) {
      bVar4 = pbVar15[-1];
      if (bVar4 == 0x30) {
        *pbVar13 = 0;
        while( true ) {
          pbVar13 = pbVar13 + -1;
          if (pbVar13 < local_e0) goto LAB_0898e924;
          bVar4 = *pbVar13;
          if (bVar4 != 0x30) break;
          *pbVar13 = 0;
        }
      }
      if (bVar4 == 0x2e) {
        *pbVar13 = 0;
        pbVar13 = pbVar13 + -1;
      }
    }
LAB_0898e924:
    pbVar18 = pbVar13 + 1;
    if (local_60 == 0) {
      if (local_58 != EXP) goto LAB_0898e93c;
      pbVar13[1] = *local_50->charset;
LAB_0898ead4:
      pbVar13[2] = 0x2b;
    }
    else {
      pbVar13[1] = *local_50->charset;
      if (-1 < local_60) goto LAB_0898ead4;
      local_60 = -local_60;
      pbVar13[2] = 0x2d;
    }
    pbVar15 = pbVar13 + 3;
    if (99 < local_60) {
      *pbVar15 = (char)(local_60 / 100) + 0x30;
      local_60 = local_60 % 100;
      pbVar15 = pbVar13 + 4;
    }
    pbVar18 = pbVar15 + 2;
    iVar9 = local_60 / 10;
    pbVar15[1] = (char)(local_60 % 10) + 0x30;
    *pbVar15 = (char)iVar9 + 0x30;
  }
LAB_0898e93c:
  pbVar15 = local_e0;
  pbVar18 = pbVar18 + -(int)pbVar15;
  if (local_48 == 0) goto joined_r0x0898dce4;
  if (local_38 == 0) {
    if ((int)pbVar18 < (int)local_78) {
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int nPad@[???] */
      iVar9 = (int)local_78 - (int)pbVar18;
      if (iVar9 <= (int)local_78) {
        pbVar8 = pbVar15 + ((int)local_78 - iVar9);
        pbVar13 = pbVar15 + (int)local_78;
        pbVar18 = local_78;
        do {
          pbVar18 = pbVar18 + -1;
          *pbVar13 = *pbVar8;
          pbVar8 = pbVar8 + -1;
          pbVar13 = pbVar13 + -1;
        } while (iVar9 <= (int)pbVar18);
      }
      if (iVar9 != 0) {
        pbVar18 = pbVar15 + (local_74 != 0);
        iVar12 = 0;
        do {
          iVar12 = iVar12 + 1;
          *pbVar18 = 0x30;
          pbVar18 = pbVar18 + 1;
        } while (iVar9 != iVar12);
      }
      uVar11 = 0;
      pbVar18 = local_78;
    }
    else {
      uVar11 = (int)local_78 - (int)pbVar18;
    }
    goto LAB_0898dcf8;
  }
  goto LAB_0898dd64;
}



----------------------------------------

// Function: __fout @ 0898ef5c

void __fout(char *zNewText,int nNewChar,void *arg)

{
  fwrite(zNewText,1,nNewChar,arg);
  return;
}



----------------------------------------

// Function: __psp_libc_init @ 0898ef6c

void __psp_libc_init(int argc,char **argv)

{
  __psp_init_cwd(*argv);
  __psp_fdman_init();
  return;
}



----------------------------------------

// Function: _exit @ 0898ef8c

/* WARNING: Removing unreachable block (ram,0x0898efc8) */
/* WARNING: Removing unreachable block (ram,0x0898efd0) */
/* WARNING: Removing unreachable block (ram,0x0898efd8) */
/* DWARF original prototype: void _exit(int status) */

void _exit(int status)

{
  __psp_free_heap();
  sceKernelSelfStopUnloadModule(1,0,0);
  do {
                    /* WARNING: Do nothing block with infinite loop */
  } while( true );
}



----------------------------------------

// Function: _fstat @ 0898efe8

int _fstat(int fd,stat *sbuf)

{
  int *piVar1;
  int iVar2;
  off_t oVar3;
  int iVar4;
  __psp_descriptormap_type *p_Var5;
  __psp_descriptormap_type **pp_Var6;
  undefined8 uVar7;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: SceOff oldpos@[???] */
  if ((uint)fd < 0x400) {
    pp_Var6 = __psp_descriptormap + fd;
    p_Var5 = *pp_Var6;
    if (p_Var5 != (__psp_descriptormap_type *)0x0) {
      if (p_Var5->type == '\0') {
        if (p_Var5->filename != (char *)0x0) {
          iVar2 = stat(p_Var5->filename,(stat *)sbuf);
          uVar7 = sceIoLseek((*pp_Var6)->sce_descriptor);
          iVar4 = (int)((ulonglong)uVar7 >> 0x20);
          if ((int)uVar7 == -1) {
            if (iVar4 == -1) {
              return iVar2;
            }
            p_Var5 = *pp_Var6;
          }
          else {
            p_Var5 = *pp_Var6;
          }
          oVar3 = sceIoLseek(p_Var5->sce_descriptor);
          p_Var5 = *pp_Var6;
          sbuf->st_size = oVar3;
          sceIoLseek(p_Var5->sce_descriptor,p_Var5,(int)uVar7,iVar4);
          return iVar2;
        }
      }
      else if (p_Var5->type == '\x03') {
        memset(sbuf,0,0x3c);
        sbuf->st_mode = 0x2000;
        return 0;
      }
      piVar1 = __errno();
      *piVar1 = 9;
      return -1;
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: _getpid @ 0898f18c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

pid_t _getpid(void)

{
  int *piVar1;
  
  piVar1 = __errno();
  *piVar1 = 0x58;
  return -1;
}



----------------------------------------

// Function: _gettimeofday @ 0898f1b4

int _gettimeofday(timeval *tp,timezone *tzp)

{
  int iVar1;
  time_t local_28;
  undefined1 auStack_24 [4];
  int local_20;
  undefined1 auStack_1c [4];
  int local_18;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: time_t t@[???]
                       Unresolved local var: timeval tv1@[???]
                       Unresolved local var: timeval tv2@[???] */
  do {
    iVar1 = sceKernelLibcGettimeofday(auStack_24,tzp);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
    iVar1 = sceKernelLibcTime(&local_28);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
    iVar1 = sceKernelLibcGettimeofday(auStack_1c,tzp);
    iVar1 = __psp_set_errno(iVar1);
    if (iVar1 < 0) {
      return iVar1;
    }
  } while (local_18 < local_20);
  tp->tv_usec = local_18;
  tp->tv_sec = local_28;
  return 0;
}



----------------------------------------

// Function: _kill @ 0898f26c

int _kill(int unused,int unused2)

{
  int *piVar1;
  
  piVar1 = __errno();
  *piVar1 = 0x58;
  return -1;
}



----------------------------------------

// Function: _open @ 0898f294

/* WARNING: Type propagation algorithm not settling */

int _open(char *name,int flags,int mode)

{
  int iVar1;
  char *pcVar2;
  u32 code;
  int *piVar3;
  uint uVar4;
  __psp_descriptormap_type *p_Var5;
  __psp_descriptormap_type *p_Var6;
  char acStack_420 [1032];
  
                    /* Unresolved local var: int scefd@[???]
                       Unresolved local var: int fd@[???]
                       Unresolved local var: int sce_flags@[???]
                       Unresolved local var: char[1025] dest@[???] */
  iVar1 = __psp_path_absolute(name,acStack_420,0x400);
  if (iVar1 < 0) {
    piVar3 = __errno();
    *piVar3 = 0x5b;
    return -1;
  }
  uVar4 = (flags & 3U) + 1;
  if ((flags & 8U) != 0) {
    uVar4 = uVar4 | 0x100;
  }
  if ((flags & 0x200U) != 0) {
    uVar4 = uVar4 | 0x200;
  }
  if ((flags & 0x400U) != 0) {
    uVar4 = uVar4 | 0x400;
  }
  if ((flags & 0x800U) != 0) {
    uVar4 = uVar4 | 0x800;
  }
  if ((flags & 0x4000U) == 0) {
    code = sceIoOpen(acStack_420,uVar4,mode);
  }
  else {
    code = sceIoOpen(acStack_420,uVar4 | 4,mode);
  }
  if ((int)code < 0) {
    iVar1 = __psp_set_errno(code);
    return iVar1;
  }
  iVar1 = __psp_fdman_get_new_descriptor();
  if (iVar1 == -1) {
    sceIoClose(code);
    piVar3 = __errno();
    *piVar3 = 0xc;
  }
  else {
    p_Var5 = __psp_descriptormap[iVar1];
    p_Var5->type = '\0';
    p_Var6 = __psp_descriptormap[iVar1];
    p_Var5->sce_descriptor = code;
    p_Var6->flags = flags;
    pcVar2 = strdup(acStack_420);
    p_Var6->filename = pcVar2;
  }
  return iVar1;
}



----------------------------------------

// Function: __psp_free_heap @ 0898f430

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int __psp_free_heap(void)

{
  int iVar1;
  
  if (0 < __psp_heap_blockid) {
    iVar1 = sceKernelFreePartitionMemory(__psp_heap_blockid);
    return iVar1;
  }
  return __psp_heap_blockid;
}



----------------------------------------

// Function: _sbrk @ 0898f450

/* WARNING: Removing unreachable block (ram,0x0898f58c) */
/* WARNING: Removing unreachable block (ram,0x0898f4e0) */

void * _sbrk(ptrdiff_t incr)

{
  bool bVar1;
  void *pvVar2;
  int iVar3;
  void *pvVar4;
  
                    /* Unresolved local var: void * heap_addr@[???]
                       Unresolved local var: void * next_heap_ptr@[???] */
  if (_sbrk::heap_bottom == (void *)0x0) {
    iVar3 = sceKernelMaxFreeMemSize();
    iVar3 = iVar3 + -0x400;
                    /* Unresolved local var: SceSize heap_size@[???] */
    if ((iVar3 != 0) &&
       (__psp_heap_blockid = sceKernelAllocPartitionMemory(2,"block",0,iVar3),
       0 < __psp_heap_blockid)) {
      _sbrk::heap_ptr = (void *)sceKernelGetBlockHeadAddr(__psp_heap_blockid);
      _sbrk::heap_top = (void *)((int)_sbrk::heap_ptr + iVar3);
      _sbrk::heap_bottom = _sbrk::heap_ptr;
    }
    pvVar4 = (void *)((int)_sbrk::heap_ptr + incr);
    if (_sbrk::heap_bottom == (void *)0x0) {
      return (void *)0xffffffff;
    }
    bVar1 = pvVar4 < _sbrk::heap_bottom;
  }
  else {
    pvVar4 = (void *)(incr + (int)_sbrk::heap_ptr);
    bVar1 = pvVar4 < _sbrk::heap_bottom;
  }
  pvVar2 = _sbrk::heap_ptr;
  if ((!bVar1) && (pvVar4 < _sbrk::heap_top)) {
    _sbrk::heap_ptr = pvVar4;
    return pvVar2;
  }
  return (void *)0xffffffff;
}



----------------------------------------

// Function: _write @ 0898f594

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x00000000) */

int _write(int fd,void *buf,size_t size)

{
  u8 uVar1;
  int *piVar2;
  int iVar3;
  __psp_descriptormap_type *p_Var4;
  
  if (((uint)fd < 0x400) &&
     (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) {
    uVar1 = p_Var4->type;
    if (uVar1 == '\x01') {
      if ((p_Var4->flags & 0x4000) == 0) {
        iVar3 = __psp_pipe_write(fd,buf,size);
        return iVar3;
      }
      iVar3 = __psp_pipe_nonblocking_write(fd,buf,size);
      return iVar3;
    }
    if ((uVar1 == '\0') || ((uVar1 != '\x02' && (uVar1 == '\x03')))) {
      iVar3 = sceIoWrite(p_Var4->sce_descriptor);
      iVar3 = __psp_set_errno(iVar3);
      return iVar3;
    }
  }
  piVar2 = __errno();
  *piVar2 = 9;
  return -1;
}



----------------------------------------

// Function: __psp_fdman_release_descriptor @ 0898f658

void __psp_fdman_release_descriptor(int fd)

{
  u32 uVar1;
  __psp_descriptormap_type *p_Var2;
  int *piVar3;
  __psp_descriptormap_type *p_Var4;
  __psp_descriptormap_type **pp_Var5;
  
  pp_Var5 = __psp_descriptormap + fd;
  if (((uint)fd < 0x400) && (p_Var4 = *pp_Var5, p_Var4 != (__psp_descriptormap_type *)0x0)) {
    uVar1 = p_Var4->ref_count - 1;
    p_Var4->ref_count = uVar1;
    if (uVar1 == 0) {
      if (p_Var4->filename != (char *)0x0) {
        free(p_Var4->filename);
        p_Var4 = *pp_Var5;
      }
      p_Var4->type = '\0';
      p_Var2 = *pp_Var5;
      p_Var4->filename = (char *)0x0;
      p_Var4->sce_descriptor = 0;
      p_Var2->flags = 0;
    }
    __psp_descriptormap[fd] = (__psp_descriptormap_type *)0x0;
    return;
  }
  piVar3 = __errno();
  *piVar3 = 9;
  return;
}



----------------------------------------

// Function: __psp_fdman_get_dup_descriptor @ 0898f718

int __psp_fdman_get_dup_descriptor(int fd)

{
  undefined4 uVar1;
  __psp_descriptormap_type *p_Var2;
  u32 uVar3;
  int *piVar4;
  int iVar5;
  __psp_descriptormap_type **pp_Var6;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int inten@[???] */
  if (((uint)fd < 0x400) &&
     (pp_Var6 = __psp_descriptormap, __psp_descriptormap[fd] != (__psp_descriptormap_type *)0x0)) {
    iVar5 = 0;
    uVar1 = pspDisableInterrupts();
    do {
      p_Var2 = *pp_Var6;
      pp_Var6 = pp_Var6 + 1;
      if (p_Var2 == (__psp_descriptormap_type *)0x0) {
        uVar3 = __psp_descriptor_data_pool[fd].ref_count;
        __psp_descriptormap[iVar5] = __psp_descriptor_data_pool + fd;
        __psp_descriptor_data_pool[fd].ref_count = uVar3 + 1;
        pspEnableInterrupts(uVar1);
        return iVar5;
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 != 0x400);
    pspEnableInterrupts(uVar1);
    piVar4 = __errno();
    *piVar4 = 0xc;
    return -1;
  }
  piVar4 = __errno();
  *piVar4 = 9;
  return -1;
}



----------------------------------------

// Function: __psp_fdman_get_new_descriptor @ 0898f834

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int __psp_fdman_get_new_descriptor(void)

{
  undefined4 uVar1;
  __psp_descriptormap_type *p_Var2;
  int *piVar3;
  __psp_descriptormap_type **pp_Var4;
  u32 uVar5;
  __psp_descriptormap_type **pp_Var6;
  int iVar7;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int inten@[???] */
  iVar7 = 0;
  uVar1 = pspDisableInterrupts();
  pp_Var4 = __psp_descriptormap;
  pp_Var6 = pp_Var4;
  do {
    p_Var2 = *pp_Var4;
    pp_Var4 = pp_Var4 + 1;
    if (p_Var2 == (__psp_descriptormap_type *)0x0) {
      uVar5 = __psp_descriptor_data_pool[iVar7].ref_count;
      *pp_Var6 = __psp_descriptor_data_pool + iVar7;
      __psp_descriptor_data_pool[iVar7].ref_count = uVar5 + 1;
      pspEnableInterrupts(uVar1);
      return iVar7;
    }
    iVar7 = iVar7 + 1;
    pp_Var6 = pp_Var6 + 1;
  } while (iVar7 != 0x400);
  pspEnableInterrupts(uVar1);
  piVar3 = __errno();
  *piVar3 = 0xc;
  return -1;
}



----------------------------------------

// Function: __psp_fdman_init @ 0898f8e4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __psp_fdman_init(void)

{
  u32 uVar1;
  
                    /* Unresolved local var: int scefd@[???] */
  memset(__psp_descriptor_data_pool,0,0x5000);
  memset(__psp_descriptormap,0,0x1000);
  uVar1 = sceKernelStdin();
  if (-1 < (int)uVar1) {
    __psp_descriptormap[0] = __psp_descriptor_data_pool;
    __psp_descriptor_data_pool[0].type = '\x03';
    __psp_descriptor_data_pool[0].sce_descriptor = uVar1;
  }
  uVar1 = sceKernelStdout();
  if (-1 < (int)uVar1) {
    __psp_descriptormap[1] = __psp_descriptor_data_pool + 1;
    __psp_descriptor_data_pool[1].type = '\x03';
    __psp_descriptor_data_pool[1].sce_descriptor = uVar1;
  }
  uVar1 = sceKernelStderr();
  if (-1 < (int)uVar1) {
    __psp_descriptormap[2] = __psp_descriptor_data_pool + 2;
    __psp_descriptor_data_pool[2].type = '\x03';
    __psp_descriptor_data_pool[2].sce_descriptor = uVar1;
  }
  return;
}



----------------------------------------

// Function: pspDisableInterrupts @ 0898f9bc

void pspDisableInterrupts(void)

{
  undefined4 in_v0;
  
  special2(0,in_v0,0,0x24);
  special2(0,0,0,0x26);
  return;
}



----------------------------------------

// Function: pspEnableInterrupts @ 0898fa20

void pspEnableInterrupts(undefined4 param_1)

{
  special2(0,param_1,0,0x26);
  return;
}



----------------------------------------

// Function: isatty @ 0898fa80

int isatty(int fd)

{
  int *piVar1;
  
  if (((uint)fd < 0x400) && (__psp_descriptormap[fd] != (__psp_descriptormap_type *)0x0)) {
    return (uint)(__psp_descriptormap[fd]->type == '\x03');
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return 0;
}



----------------------------------------

// Function: __register_exitproc @ 0898fae8

int __register_exitproc(int type,_func_void *fn,void *arg,void *d)

{
  _reent *p_Var1;
  void **ppvVar2;
  _atexit *p_Var3;
  uint uVar4;
  uint uVar5;
  _atexit *p_Var6;
  uint uVar7;
  
                    /* Unresolved local var: _on_exit_args * args@[???]
                       Unresolved local var: _atexit * p@[???] */
  p_Var1 = _global_impure_ptr;
  p_Var6 = _global_impure_ptr->_atexit;
  if (p_Var6 == (_atexit *)0x0) {
    p_Var6 = &_global_impure_ptr->_atexit0;
    _global_impure_ptr->_atexit = p_Var6;
  }
  uVar7 = p_Var6->_ind;
  if (0x1f < (int)uVar7) {
    p_Var6 = malloc(400);
    if (p_Var6 == (_atexit *)0x0) {
      return -1;
    }
    p_Var3 = p_Var1->_atexit;
    p_Var6->_ind = 0;
    p_Var6->_next = p_Var3;
    (p_Var6->_on_exit_args)._fntypes = 0;
    p_Var1->_atexit = p_Var6;
    (p_Var6->_on_exit_args)._is_cxa = 0;
    uVar7 = 0;
  }
  if (type != 0) {
    uVar5 = (p_Var6->_on_exit_args)._fntypes;
    ppvVar2 = (p_Var6->_on_exit_args)._fnargs + uVar7;
    uVar4 = 1 << (uVar7 & 0x1f);
    ppvVar2[0x20] = d;
    *ppvVar2 = arg;
    (p_Var6->_on_exit_args)._fntypes = uVar5 | uVar4;
    if (type == 2) {
      (p_Var6->_on_exit_args)._is_cxa = (p_Var6->_on_exit_args)._is_cxa | uVar4;
    }
  }
  p_Var6->_fns[uVar7] = fn;
  p_Var6->_ind = uVar7 + 1;
  return 0;
}



----------------------------------------

// Function: __call_exitprocs @ 0898fc00

void __call_exitprocs(int code,void *d)

{
  uint uVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  _func_void *p_Var5;
  _func_void **pp_Var6;
  _func_void **pp_Var7;
  _atexit *p_Var8;
  _atexit *aptr;
  _atexit *p_Var9;
  
                    /* Unresolved local var: _atexit * p@[???]
                       Unresolved local var: _atexit * * lastp@[???]
                       Unresolved local var: _on_exit_args * args@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: _func_void * fn@[???] */
  p_Var8 = _global_impure_ptr->_atexit;
  if (p_Var8 != (_atexit *)0x0) {
    iVar4 = p_Var8->_ind;
    p_Var9 = (_atexit *)&_global_impure_ptr->_atexit;
    while( true ) {
      while( true ) {
        aptr = p_Var8;
        uVar1 = iVar4 - 1;
        if (-1 < (int)uVar1) {
          iVar3 = iVar4 - uVar1;
          pp_Var7 = aptr->_fns + iVar4 + -1;
          pp_Var6 = aptr->_fns + iVar4 + 0x1f;
          do {
            if ((d == (void *)0x0) || (d == ((_on_exit_args *)(pp_Var6 + 0x20))->_fnargs[0])) {
              p_Var5 = *pp_Var7;
              if (iVar4 - 1U == uVar1) {
                aptr->_ind = uVar1;
              }
              else {
                *pp_Var7 = (_func_void *)0x0;
              }
              if (p_Var5 == (_func_void *)0x0) {
                iVar4 = aptr->_ind;
              }
              else {
                uVar2 = 1 << (uVar1 & 0x1f);
                if ((uVar2 & (aptr->_on_exit_args)._fntypes) == 0) {
                  (*p_Var5)();
                  iVar4 = aptr->_ind;
                }
                else if ((uVar2 & (aptr->_on_exit_args)._is_cxa) == 0) {
                  (*p_Var5)(code,*pp_Var6);
                  iVar4 = aptr->_ind;
                }
                else {
                  (*p_Var5)(*pp_Var6);
                  iVar4 = aptr->_ind;
                }
              }
            }
            uVar1 = uVar1 - 1;
            pp_Var6 = pp_Var6 + -1;
            pp_Var7 = pp_Var7 + -1;
          } while (uVar1 != iVar3 - 2U);
        }
        p_Var8 = aptr->_next;
        if ((iVar4 == 0) && (p_Var8 != (_atexit *)0x0)) break;
        if (p_Var8 == (_atexit *)0x0) {
          return;
        }
        iVar4 = p_Var8->_ind;
        p_Var9 = aptr;
      }
      p_Var9->_next = p_Var8;
      free(aptr);
      p_Var8 = p_Var9->_next;
      if (p_Var8 == (_atexit *)0x0) break;
      iVar4 = p_Var8->_ind;
    }
  }
  return;
}



----------------------------------------

// Function: _close_r @ 0898fd80

int _close_r(_reent *ptr,int fd)

{
  int iVar1;
  
                    /* Unresolved local var: int ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _close(fd);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: quorem @ 0898fde8

int quorem(_Bigint *b,_Bigint *S)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  __ULong *p_Var7;
  __ULong *p_Var8;
  __ULong *p_Var9;
  uint uVar10;
  __ULong *p_Var11;
  int iVar12;
  __ULong *p_Var13;
  __ULong *p_Var14;
  uint uVar15;
  
                    /* Unresolved local var: int n@[???]
                       Unresolved local var: long borrow@[???]
                       Unresolved local var: long y@[???]
                       Unresolved local var: __ULong carry@[???]
                       Unresolved local var: __ULong q@[???]
                       Unresolved local var: __ULong ys@[???]
                       Unresolved local var: __ULong * bx@[???]
                       Unresolved local var: __ULong * bxe@[???]
                       Unresolved local var: __ULong * sx@[???]
                       Unresolved local var: __ULong * sxe@[???]
                       Unresolved local var: long z@[???]
                       Unresolved local var: __ULong si@[???]
                       Unresolved local var: __ULong zs@[???] */
  if (b->_wds < S->_wds) {
    return 0;
  }
  iVar12 = S->_wds + -1;
  p_Var11 = S->_x;
  p_Var14 = p_Var11 + iVar12;
  p_Var13 = b->_x;
  p_Var7 = p_Var13 + iVar12;
  uVar10 = *p_Var7;
  uVar15 = uVar10 / (*p_Var14 + 1);
  if (*p_Var14 + 1 == 0) {
    trap(7);
  }
  if (uVar15 != 0) {
    iVar1 = 0;
    uVar6 = 0;
    p_Var8 = p_Var13;
    p_Var9 = p_Var11;
    do {
      uVar4 = *p_Var9;
      uVar5 = *p_Var8;
      p_Var9 = p_Var9 + 1;
      uVar6 = uVar6 + uVar15 * (uVar4 & 0xffff);
      iVar1 = ((uVar5 & 0xffff) - (uVar6 & 0xffff)) + iVar1;
      *(short *)p_Var8 = (short)iVar1;
      uVar6 = uVar15 * (uVar4 >> 0x10) + (uVar6 >> 0x10);
      iVar1 = ((uVar5 >> 0x10) - (uVar6 & 0xffff)) + (iVar1 >> 0x10);
      *(short *)((int)p_Var8 + 2) = (short)iVar1;
      uVar6 = uVar6 >> 0x10;
      p_Var8 = p_Var8 + 1;
      iVar1 = iVar1 >> 0x10;
    } while (p_Var9 <= p_Var14);
    if (uVar10 == 0) {
      if (p_Var13 < p_Var7 + -1) {
        piVar2 = (int *)(p_Var7 + -2);
        if (p_Var7[-1] == 0) {
          do {
            iVar12 = iVar12 + -1;
            if (piVar2 <= p_Var13) break;
            iVar1 = *piVar2;
            piVar2 = piVar2 + -1;
          } while (iVar1 == 0);
          b->_wds = iVar12;
        }
        else {
          b->_wds = iVar12;
        }
      }
      else {
        b->_wds = iVar12;
      }
    }
  }
  iVar1 = __mcmp(b,S);
  if (-1 < iVar1) {
    uVar15 = uVar15 + 1;
    iVar1 = 0;
    p_Var7 = p_Var13;
    do {
      uVar10 = *p_Var11;
      p_Var11 = p_Var11 + 1;
      iVar1 = ((*p_Var7 & 0xffff) - (uVar10 & 0xffff)) + iVar1;
      iVar3 = ((*p_Var7 >> 0x10) - (uVar10 >> 0x10)) + (iVar1 >> 0x10);
      *(short *)((int)p_Var7 + 2) = (short)iVar3;
      *(short *)p_Var7 = (short)iVar1;
      p_Var7 = p_Var7 + 1;
      iVar1 = iVar3 >> 0x10;
    } while (p_Var11 <= p_Var14);
    p_Var7 = p_Var13 + iVar12;
    if (*p_Var7 == 0) {
      if (p_Var13 < p_Var7 + -1) {
        if (p_Var7[-1] == 0) {
          for (piVar2 = (int *)(p_Var7 + -2); iVar12 = iVar12 + -1, p_Var13 < piVar2;
              piVar2 = piVar2 + -1) {
            if (*piVar2 != 0) {
              b->_wds = iVar12;
              return uVar15;
            }
          }
          b->_wds = iVar12;
        }
        else {
          b->_wds = iVar12;
        }
      }
      else {
        b->_wds = iVar12;
      }
    }
  }
  return uVar15;
}



----------------------------------------

// Function: _dtoa_r @ 0899005c

char * _dtoa_r(_reent *ptr,double _d,int mode,int ndigits,int *decpt,int *sign,char **rve)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  __ULong *p_Var5;
  SItype SVar6;
  uint uVar7;
  int iVar8;
  _Bigint *p_Var9;
  _Bigint *b;
  int iVar10;
  uint uVar11;
  int iVar12;
  uint in_t0;
  uint in_t1;
  int *in_t2;
  undefined4 *in_t3;
  _Bigint *p_Var13;
  uint uVar14;
  _Bigint *b_00;
  uint uVar15;
  int iVar16;
  _Bigint *p_Var17;
  char *pcVar18;
  _Bigint *p_Var19;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  undefined4 *local_res0;
  int local_88;
  int local_84;
  uint local_80;
  uint local_7c;
  int *in_stack_ffffff88;
  int *in_stack_ffffff8c;
  _Bigint *local_70;
  uint local_68;
  uint local_5c;
  uint local_58;
  uint local_54;
  int local_50;
  int local_4c;
  uint local_38;
  uint local_34;
  
                    /* Unresolved local var: int bbits@[???]
                       Unresolved local var: int b2@[???]
                       Unresolved local var: int b5@[???]
                       Unresolved local var: int be@[???]
                       Unresolved local var: int dig@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int ieps@[???]
                       Unresolved local var: int ilim@[???]
                       Unresolved local var: int ilim0@[???]
                       Unresolved local var: int ilim1@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int j1@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int k0@[???]
                       Unresolved local var: int k_check@[???]
                       Unresolved local var: int leftright@[???]
                       Unresolved local var: int m2@[???]
                       Unresolved local var: int m5@[???]
                       Unresolved local var: int s2@[???]
                       Unresolved local var: int s5@[???]
                       Unresolved local var: int spec_case@[???]
                       Unresolved local var: int try_quick@[???]
                       Unresolved local var: double_union d@[???]
                       Unresolved local var: double_union d2@[???]
                       Unresolved local var: double_union eps@[???]
                       Unresolved local var: long L@[???]
                       Unresolved local var: int denorm@[???]
                       Unresolved local var: __ULong x@[???]
                       Unresolved local var: _Bigint * b@[???]
                       Unresolved local var: _Bigint * b1@[???]
                       Unresolved local var: _Bigint * delta@[???]
                       Unresolved local var: _Bigint * mlo@[???]
                       Unresolved local var: _Bigint * mhi@[???]
                       Unresolved local var: _Bigint * S@[???]
                       Unresolved local var: double ds@[???]
                       Unresolved local var: char * s@[???]
                       Unresolved local var: char * s0@[???] */
  uVar14 = (uint)((ulonglong)_d >> 0x20);
  uVar11 = SUB84(_d,0);
  p_Var13 = ptr->_result;
  if (p_Var13 != (_Bigint *)0x0) {
    p_Var13->_k = ptr->_result_k;
    p_Var13->_maxwds = 1 << (ptr->_result_k & 0x1fU);
    _Bfree(ptr,p_Var13);
    ptr->_result = (_Bigint *)0x0;
  }
  if ((longlong)_d < 0) {
    uVar14 = uVar14 & 0x7fffffff;
    *in_t3 = 1;
  }
  else {
    *in_t3 = 0;
  }
  if ((uVar14 & 0x7ff00000) == 0x7ff00000) {
    *in_t2 = 9999;
    if ((uVar11 == 0) && ((uVar14 & 0xfffff) == 0)) {
      pcVar18 = "Infinity";
    }
    else {
      pcVar18 = "NaN";
    }
    if (local_res0 == (undefined4 *)0x0) {
      return pcVar18;
    }
    if (pcVar18[3] == '\0') {
      *local_res0 = pcVar18 + 3;
    }
    else {
      *local_res0 = pcVar18 + 8;
    }
    return pcVar18;
  }
  SVar6 = __nedf2(in_f12_13,in_f14_15);
  if (SVar6 == 0) {
    *in_t2 = 1;
    if (local_res0 != (undefined4 *)0x0) {
      *local_res0 = "";
      return "0";
    }
    return "0";
  }
  local_70 = __d2b(ptr,(double)CONCAT44(uVar14,uVar11),in_stack_ffffff88,in_stack_ffffff8c);
  uVar15 = (uVar14 & 0x7fffffff) >> 0x14;
  if (uVar15 == 0) {
    uVar15 = local_88 + 0x432 + local_84;
    if ((int)uVar15 < 0x21) {
      uVar7 = uVar11 << (-uVar15 & 0x1f);
    }
    else {
      uVar7 = uVar14 << (-uVar15 & 0x1f) | uVar11 >> (uVar15 & 0x1f);
    }
    __floatsidf(uVar7);
    if ((int)uVar7 < 0) {
      __adddf3(in_f12_13,in_f14_15);
    }
    uVar15 = uVar15 - 0x433;
    bVar2 = true;
  }
  else {
    uVar15 = uVar15 - 0x3ff;
    bVar2 = false;
  }
  __subdf3(in_f12_13,in_f14_15);
  __muldf3(in_f12_13,in_f14_15);
  __adddf3(in_f12_13,in_f14_15);
  __floatsidf(uVar15);
  __muldf3(in_f12_13,in_f14_15);
  __adddf3(in_f12_13,in_f14_15);
  local_5c = __fixdfsi(in_f12_13);
  SVar6 = __ltdf2(in_f12_13,in_f14_15);
  if (SVar6 < 0) {
    __floatsidf(local_5c);
    SVar6 = __nedf2(in_f12_13,in_f14_15);
    if (SVar6 != 0) {
      local_5c = local_5c - 1;
    }
  }
  if (local_5c < 0x17) {
    SVar6 = __ltdf2(in_f12_13,in_f14_15);
    if (SVar6 < 0) {
      local_5c = local_5c - 1;
      bVar3 = false;
    }
    else {
      bVar3 = false;
    }
  }
  else {
    bVar3 = true;
  }
  iVar12 = (local_88 - uVar15) + -1;
  if (iVar12 < 0) {
    local_4c = -iVar12;
    iVar12 = 0;
  }
  else {
    local_4c = 0;
  }
  if ((int)local_5c < 0) {
    local_68 = 0;
    local_4c = local_4c - local_5c;
    local_50 = -local_5c;
  }
  else {
    iVar12 = iVar12 + local_5c;
    local_68 = local_5c;
    local_50 = 0;
  }
  if (9 < in_t0) {
    local_38 = 0;
    bVar1 = true;
switchD_08990304_caseD_0:
    local_34 = 0;
    local_54 = 0xffffffff;
    local_58 = 0xffffffff;
    bVar4 = true;
    goto LAB_08990430;
  }
  local_38 = in_t0;
  if (5 < (int)in_t0) {
    local_38 = in_t0 - 4;
  }
  bVar1 = 5 >= (int)in_t0;
  local_34 = in_t1;
  switch(local_38) {
  case 0:
  case 1:
    goto switchD_08990304_caseD_0;
  case 2:
    bVar4 = false;
    break;
  case 3:
    bVar4 = false;
    goto LAB_08990ddc;
  case 4:
    bVar4 = true;
    break;
  case 5:
    bVar4 = true;
LAB_08990ddc:
    local_54 = local_5c + in_t1 + 1;
    local_58 = local_54 - 1;
    uVar15 = local_54;
    if (0 < (int)local_54) goto LAB_08990a7c;
    goto LAB_08990430;
  default:
    local_54 = 0xffffffff;
    local_58 = 0xffffffff;
    bVar4 = true;
    goto LAB_08990a7c;
  }
  uVar15 = in_t1;
  local_58 = in_t1;
  local_54 = in_t1;
  if ((int)in_t1 < 1) {
    local_34 = 1;
    local_54 = 1;
    local_58 = 1;
LAB_08990430:
    ptr->_result_k = 0;
  }
  else {
LAB_08990a7c:
    ptr->_result_k = 0;
    if (0x17 < uVar15) {
      iVar10 = 4;
      iVar16 = 0;
      do {
        iVar10 = iVar10 * 2;
        iVar16 = iVar16 + 1;
      } while (iVar10 + 0x14U <= uVar15);
      ptr->_result_k = iVar16;
    }
  }
  p_Var13 = _Balloc(ptr,ptr->_result_k);
  ptr->_result = p_Var13;
  if ((local_54 < 0xf) && (bVar1)) {
    if ((int)local_5c < 1) {
      iVar10 = 2;
      if (-local_5c != 0) {
        uVar15 = (int)-local_5c >> 4;
        __muldf3(in_f12_13,in_f14_15);
        if (uVar15 == 0) {
          iVar10 = 2;
        }
        else {
          iVar10 = 2;
          do {
            uVar7 = uVar15 & 1;
            uVar15 = (int)uVar15 >> 1;
            if (uVar7 != 0) {
              iVar10 = iVar10 + 1;
              __muldf3(in_f12_13,in_f14_15);
            }
          } while (uVar15 != 0);
        }
      }
    }
    else {
      uVar15 = (int)local_5c >> 4;
      if ((uVar15 & 0x10) == 0) {
        iVar10 = 2;
      }
      else {
        uVar15 = uVar15 & 0xf;
        iVar10 = 3;
        __divdf3(in_f12_13,in_f14_15);
      }
      while (uVar15 != 0) {
        uVar7 = uVar15 & 1;
        uVar15 = (int)uVar15 >> 1;
        if (uVar7 != 0) {
          __muldf3(in_f12_13,in_f14_15);
          iVar10 = iVar10 + 1;
        }
      }
      __divdf3(in_f12_13,in_f14_15);
    }
    if (((bVar3) && (SVar6 = __ltdf2(in_f12_13,in_f14_15), SVar6 < 0)) && (0 < (int)local_54)) {
      if (0 < (int)local_58) {
        local_7c = local_5c - 1;
        __muldf3(in_f12_13,in_f14_15);
        __floatsidf(iVar10 + 1);
        __muldf3(in_f12_13,in_f14_15);
        local_80 = local_58;
        __adddf3(in_f12_13,in_f14_15);
        goto LAB_08991018;
      }
      goto LAB_08990600;
    }
    __floatsidf(iVar10);
    __muldf3(in_f12_13,in_f14_15);
    __adddf3(in_f12_13,in_f14_15);
    if (local_54 != 0) {
      local_80 = local_54;
      local_7c = local_5c;
LAB_08991018:
      if (bVar4) {
        __divdf3(in_f12_13,in_f14_15);
        __subdf3(in_f12_13,in_f14_15);
        SVar6 = __fixdfsi(in_f12_13);
        __floatsidf(SVar6);
        __subdf3(in_f12_13,in_f14_15);
        *(char *)&p_Var13->_next = (char)SVar6 + '0';
        p_Var9 = (_Bigint *)((int)&p_Var13->_next + 1);
        SVar6 = __ltdf2(in_f12_13,in_f14_15);
        if (SVar6 < 0) {
LAB_089911f8:
          local_5c = local_7c;
          goto LAB_08990758;
        }
        __subdf3(in_f12_13,in_f14_15);
        SVar6 = __gtdf2(in_f12_13,in_f14_15);
        p_Var19 = p_Var9;
        if (SVar6 < 1) {
          if (1 < (int)local_80) {
            p_Var5 = p_Var13->_x;
            do {
              __muldf3(in_f12_13,in_f14_15);
              __muldf3(in_f12_13,in_f14_15);
              SVar6 = __fixdfsi(in_f12_13);
              __floatsidf(SVar6);
              __subdf3(in_f12_13,in_f14_15);
              *(char *)&p_Var9->_next = (char)SVar6 + '0';
              p_Var9 = (_Bigint *)((int)&p_Var9->_next + 1);
              SVar6 = __ltdf2(in_f12_13,in_f14_15);
              if (SVar6 < 0) goto LAB_089911f8;
              __subdf3(in_f12_13,in_f14_15);
              SVar6 = __ltdf2(in_f12_13,in_f14_15);
              p_Var19 = p_Var9;
              if (SVar6 < 0) goto LAB_08990e3c;
            } while (p_Var9 != (_Bigint *)((int)p_Var5 + (local_80 - 0x14)));
          }
          goto LAB_08990600;
        }
      }
      else {
        __muldf3(in_f12_13,in_f14_15);
        SVar6 = __fixdfsi(in_f12_13);
        __floatsidf(SVar6);
        __subdf3(in_f12_13,in_f14_15);
        *(char *)&p_Var13->_next = (char)SVar6 + '0';
        p_Var19 = (_Bigint *)((int)&p_Var13->_next + 1);
        if (local_80 != 1) {
          p_Var5 = p_Var13->_x;
          do {
            __muldf3(in_f12_13,in_f14_15);
            SVar6 = __fixdfsi(in_f12_13);
            __floatsidf(SVar6);
            __subdf3(in_f12_13,in_f14_15);
            *(char *)&p_Var19->_next = (char)SVar6 + '0';
            p_Var19 = (_Bigint *)((int)&p_Var19->_next + 1);
          } while (p_Var19 != (_Bigint *)((int)p_Var5 + (local_80 - 0x14)));
        }
        __adddf3(in_f12_13,in_f14_15);
        SVar6 = __ltdf2(in_f12_13,in_f14_15);
        if (-1 < SVar6) {
          __subdf3(in_f12_13,in_f14_15);
          SVar6 = __gtdf2(in_f12_13,in_f14_15);
          if (0 < SVar6) {
            do {
              p_Var9 = p_Var19;
              p_Var19 = (_Bigint *)((int)p_Var9[-1]._x + 3);
            } while (*(char *)&p_Var19->_next == '0');
            local_5c = local_7c;
            goto LAB_08990758;
          }
          goto LAB_08990600;
        }
      }
LAB_08990e3c:
      do {
        p_Var9 = p_Var19;
        p_Var19 = (_Bigint *)((int)p_Var9[-1]._x + 3);
        if (*(char *)&p_Var19->_next != '9') goto LAB_08990e6c;
      } while (p_Var19 != p_Var13);
      local_7c = local_7c + 1;
      *(char *)&p_Var13->_next = '0';
LAB_08990e6c:
      local_5c = local_7c;
      *(char *)&p_Var19->_next = *(char *)&p_Var19->_next + '\x01';
      goto LAB_08990758;
    }
    __subdf3(in_f12_13,in_f14_15);
    SVar6 = __gtdf2(in_f12_13,in_f14_15);
    if (SVar6 < 1) {
      SVar6 = __ltdf2(in_f12_13,in_f14_15);
      p_Var9 = p_Var13;
      if (-1 < SVar6) goto LAB_08990600;
      goto LAB_089905d4;
    }
LAB_0899133c:
    p_Var19 = (_Bigint *)0x0;
    b = (_Bigint *)0x0;
LAB_08991268:
    local_5c = local_5c + 1;
    p_Var9 = (_Bigint *)((int)&p_Var13->_next + 1);
    b_00 = (_Bigint *)0x0;
    *(char *)&p_Var13->_next = '1';
  }
  else {
LAB_08990600:
    p_Var9 = p_Var13;
    p_Var13 = p_Var9;
    if ((local_84 < 0) || (0xe < (int)local_5c)) {
      iVar10 = local_50;
      iVar16 = local_4c;
      if (bVar4) {
        if ((int)local_38 < 2) {
          if (bVar2) {
            uVar15 = local_84 + 0x433;
          }
          else {
            uVar15 = 0x36 - local_88;
          }
        }
        else {
          iVar8 = local_54 - 1;
          if (local_50 < iVar8) {
            iVar10 = 0;
            iVar8 = iVar8 - local_50;
            local_50 = local_50 + iVar8;
            local_68 = local_68 + iVar8;
          }
          else {
            iVar10 = local_50 - iVar8;
          }
          uVar15 = local_54;
          if ((int)local_54 < 0) {
            uVar15 = 0;
            iVar16 = local_4c - local_54;
          }
        }
        local_4c = local_4c + uVar15;
        iVar12 = iVar12 + uVar15;
        p_Var19 = __i2b(ptr,1);
        p_Var13 = p_Var9;
      }
      else {
        p_Var19 = (_Bigint *)0x0;
      }
      if ((0 < iVar16) && (0 < iVar12)) {
        iVar8 = iVar16 + iVar12;
        iVar12 = iVar12 - iVar8;
        local_4c = local_4c - iVar8;
        iVar16 = iVar16 - iVar8;
      }
      if (0 < local_50) {
        if (bVar4) {
          if (0 < iVar10) {
            p_Var19 = __pow5mult(ptr,p_Var19,iVar10);
            p_Var9 = __multiply(ptr,p_Var19,local_70);
            _Bfree(ptr,local_70);
            local_70 = p_Var9;
          }
          if (local_50 - iVar10 != 0) {
            local_70 = __pow5mult(ptr,local_70,local_50 - iVar10);
          }
        }
        else {
          local_70 = __pow5mult(ptr,local_70,local_50);
        }
      }
      b = __i2b(ptr,1);
      if (0 < (int)local_68) {
        b = __pow5mult(ptr,b,local_68);
      }
      bVar2 = false;
      if (((((int)local_38 < 2) && (uVar11 == 0)) && ((uVar14 & 0xfffff) == 0)) &&
         ((uVar14 & 0x7ff00000) != 0)) {
        iVar12 = iVar12 + 1;
        bVar2 = true;
        local_4c = local_4c + 1;
      }
      if (local_68 == 0) {
        iVar10 = 1;
      }
      else {
        iVar10 = __hi0bits(b->_x[b->_wds + -1]);
        iVar10 = 0x20 - iVar10;
      }
      uVar11 = iVar12 + iVar10 & 0x1f;
      if (uVar11 == 0) {
        iVar10 = 0x1c;
LAB_0899090c:
        local_4c = local_4c + iVar10;
        iVar12 = iVar12 + iVar10;
        iVar16 = iVar16 + iVar10;
      }
      else {
        iVar10 = -uVar11;
        if (4 < iVar10 + 0x20) {
          iVar10 = iVar10 + 0x1c;
          goto LAB_0899090c;
        }
        if (iVar10 + 0x20 < 4) {
          iVar10 = iVar10 + 0x3c;
          goto LAB_0899090c;
        }
      }
      if (0 < local_4c) {
        local_70 = __lshift(ptr,local_70,local_4c);
      }
      if (0 < iVar12) {
        b = __lshift(ptr,b,iVar12);
      }
      if ((bVar3) && (iVar12 = __mcmp(local_70,b), iVar12 < 0)) {
        local_70 = __multadd(ptr,local_70,10,0);
        local_5c = local_5c - 1;
        if (bVar4) {
          p_Var19 = __multadd(ptr,p_Var19,10,0);
          local_54 = local_58;
        }
        else {
          local_54 = local_58;
        }
      }
      if ((0 < (int)local_54) || ((int)local_38 < 3)) {
        if (bVar4) {
          b_00 = p_Var19;
          p_Var17 = p_Var13;
          if (0 < iVar16) {
            b_00 = __lshift(ptr,p_Var19,iVar16);
            p_Var17 = p_Var13;
          }
          p_Var19 = b_00;
          if (bVar2) {
            p_Var13 = _Balloc(ptr,b_00->_k);
            memcpy(&p_Var13->_sign,&b_00->_sign,b_00->_wds * 4 + 8);
            p_Var19 = __lshift(ptr,p_Var13,1);
          }
          p_Var13 = p_Var17;
LAB_08990b84:
          iVar12 = quorem(local_70,b);
          iVar10 = __mcmp(local_70,b_00);
          p_Var9 = __mdiff(ptr,b,p_Var19);
          uVar11 = iVar12 + 0x30;
          if (p_Var9->_sign == 0) {
            iVar16 = __mcmp(local_70,p_Var9);
            _Bfree(ptr,p_Var9);
            if (((iVar16 != 0) || (local_38 != 0)) || (((ulonglong)_d & 1) != 0)) goto LAB_08990bf8;
            if (uVar11 != 0x39) {
              if (iVar10 < 1) goto LAB_08990ec8;
              p_Var9 = (_Bigint *)((int)&p_Var17->_next + 1);
              *(char *)&p_Var17->_next = (char)iVar12 + '1';
              goto LAB_08990a20;
            }
LAB_08990ed4:
            *(char *)&p_Var17->_next = '9';
            p_Var9 = (_Bigint *)((int)&p_Var17->_next + 1);
            goto LAB_089909ec;
          }
          _Bfree(ptr,p_Var9);
          iVar16 = 1;
LAB_08990bf8:
          if ((iVar10 < 0) || (((iVar10 == 0 && (local_38 == 0)) && (((ulonglong)_d & 1) == 0)))) {
            if (0 < iVar16) {
              local_70 = __lshift(ptr,local_70,1);
              iVar10 = __mcmp(local_70,b);
              if (iVar10 < 1) {
                if (iVar10 != 0) goto LAB_08990ec8;
                if ((uVar11 & 1) == 0) {
                  p_Var9 = (_Bigint *)((int)&p_Var17->_next + 1);
                  *(char *)&p_Var17->_next = (char)uVar11;
                  goto LAB_08990a20;
                }
              }
              uVar11 = iVar12 + 0x31;
              if (uVar11 == 0x3a) goto LAB_08990ed4;
            }
LAB_08990ec8:
            p_Var9 = (_Bigint *)((int)&p_Var17->_next + 1);
            *(char *)&p_Var17->_next = (char)uVar11;
            goto LAB_08990a20;
          }
          if (0 < iVar16) {
            if (uVar11 == 0x39) goto LAB_08990ed4;
            p_Var9 = (_Bigint *)((int)&p_Var17->_next + 1);
            *(char *)&p_Var17->_next = (char)iVar12 + '1';
            goto LAB_08990a20;
          }
          *(char *)&p_Var17->_next = (char)uVar11;
          p_Var17 = (_Bigint *)((int)&p_Var17->_next + 1);
          if (p_Var17 != (_Bigint *)((int)p_Var13->_x + (local_54 - 0x14))) {
            local_70 = __multadd(ptr,local_70,10,0);
            if (b_00 == p_Var19) {
              b_00 = __multadd(ptr,p_Var19,10,0);
              p_Var19 = b_00;
            }
            else {
              b_00 = __multadd(ptr,b_00,10,0);
              p_Var19 = __multadd(ptr,p_Var19,10,0);
            }
            goto LAB_08990b84;
          }
        }
        else {
          iVar12 = 1;
          while( true ) {
            iVar10 = quorem(local_70,b);
            uVar11 = iVar10 + 0x30;
            p_Var17 = (_Bigint *)((int)p_Var13->_x + iVar12 + -0x14);
            *(char *)((int)p_Var17[-1]._x + 3) = (char)uVar11;
            if ((int)local_54 <= iVar12) break;
            local_70 = __multadd(ptr,local_70,10,0);
            iVar12 = iVar12 + 1;
          }
          b_00 = (_Bigint *)0x0;
        }
        local_70 = __lshift(ptr,local_70,1);
        iVar12 = __mcmp(local_70,b);
        p_Var9 = p_Var17;
        if (iVar12 < 1) {
          if (iVar12 == 0) {
            if ((uVar11 & 1) != 0) goto LAB_089909ec;
            pcVar18 = (char *)((int)p_Var17[-1]._x + 3);
          }
          else {
            pcVar18 = (char *)((int)p_Var17[-1]._x + 3);
          }
          for (; *pcVar18 == '0'; pcVar18 = pcVar18 + -1) {
          }
          p_Var9 = (_Bigint *)(pcVar18 + 1);
        }
        else {
LAB_089909ec:
          do {
            p_Var17 = (_Bigint *)((int)p_Var9[-1]._x + 3);
            if (*(char *)&p_Var17->_next != '9') {
              *(char *)&p_Var17->_next = *(char *)&p_Var17->_next + '\x01';
              goto LAB_08990a20;
            }
            p_Var9 = p_Var17;
          } while (p_Var13 != p_Var17);
          p_Var9 = (_Bigint *)((int)&p_Var13->_next + 1);
          local_5c = local_5c + 1;
          *(char *)&p_Var13->_next = '1';
        }
        goto LAB_08990a20;
      }
      p_Var9 = p_Var13;
      if (local_54 == 0) {
        b = __multadd(ptr,b,5,0);
        iVar12 = __mcmp(local_70,b);
        p_Var9 = p_Var13;
        if (0 < iVar12) goto LAB_08991268;
      }
    }
    else {
      if ((-1 < (int)local_34) || (0 < (int)local_54)) {
        p_Var5 = p_Var9->_x;
        do {
          __divdf3(in_f12_13,in_f14_15);
          uVar11 = __fixdfsi(in_f12_13);
          __floatsidf(uVar11);
          __muldf3(in_f12_13,in_f14_15);
          __subdf3(in_f12_13,in_f14_15);
          *(char *)&p_Var9->_next = (char)uVar11 + '0';
          p_Var9 = (_Bigint *)((int)&p_Var9->_next + 1);
          if ((_Bigint *)((int)p_Var5 + (local_54 - 0x14)) == p_Var9) {
            __adddf3(in_f12_13,in_f14_15);
            SVar6 = __ltdf2(in_f12_13,in_f14_15);
            if ((SVar6 < 0) ||
               ((SVar6 = __eqdf2(in_f12_13,in_f14_15), SVar6 == 0 && ((uVar11 & 1) != 0)))) {
              local_7c = local_5c;
              p_Var19 = p_Var9;
              goto LAB_08990e3c;
            }
            break;
          }
          __muldf3(in_f12_13,in_f14_15);
          SVar6 = __nedf2(in_f12_13,in_f14_15);
        } while (SVar6 != 0);
        goto LAB_08990758;
      }
      if (local_54 == 0) {
        __muldf3(in_f12_13,in_f14_15);
        SVar6 = __gedf2(in_f12_13,in_f14_15);
        p_Var13 = p_Var9;
        if (SVar6 < 0) goto LAB_0899133c;
      }
LAB_089905d4:
      p_Var19 = (_Bigint *)0x0;
      b = (_Bigint *)0x0;
    }
    local_5c = ~local_34;
    b_00 = (_Bigint *)0x0;
    p_Var13 = p_Var9;
  }
LAB_08990a20:
  _Bfree(ptr,b);
  if (p_Var19 != (_Bigint *)0x0) {
    if ((b_00 != (_Bigint *)0x0) && (b_00 != p_Var19)) {
      _Bfree(ptr,b_00);
    }
    _Bfree(ptr,p_Var19);
  }
LAB_08990758:
  _Bfree(ptr,local_70);
  *(char *)&p_Var9->_next = '\0';
  *in_t2 = local_5c + 1;
  if (local_res0 == (undefined4 *)0x0) {
    return (char *)p_Var13;
  }
  *local_res0 = p_Var9;
  return (char *)p_Var13;
}



----------------------------------------

// Function: __env_lock @ 08991640

void __env_lock(_reent *ptr)

{
  return;
}



----------------------------------------

// Function: __env_unlock @ 08991648

void __env_unlock(_reent *ptr)

{
  return;
}



----------------------------------------

// Function: __sflags @ 08991650

int __sflags(_reent *ptr,char *mode,int *optr)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: int m@[???]
                       Unresolved local var: int o@[???] */
  cVar1 = *mode;
  if (cVar1 == 'r') {
    iVar4 = 4;
    uVar3 = 0;
    uVar2 = 0;
  }
  else if (cVar1 == 'w') {
    iVar4 = 8;
    uVar3 = 1;
    uVar2 = 0x600;
  }
  else {
    if (cVar1 != 'a') {
      ptr->_errno = 0x16;
      return 0;
    }
    iVar4 = 0x108;
    uVar3 = 1;
    uVar2 = 0x208;
  }
  if ((mode[1] == '\0') || ((mode[1] != '+' && (mode[2] != '+')))) {
    *optr = uVar3 | uVar2;
  }
  else {
    iVar4 = 0x10;
    *optr = uVar2 | 2;
  }
  return iVar4;
}



----------------------------------------

// Function: __sfvwrite_r @ 089916f0

/* WARNING: Removing unreachable block (ram,0x08991868) */

int __sfvwrite_r(_reent *ptr,FILE *fp,__suio *uio)

{
  bool bVar1;
  ushort uVar2;
  int iVar3;
  size_t length;
  void *pvVar4;
  uint uVar5;
  uchar *puVar6;
  uint uVar7;
  size_t length_00;
  char *pcVar8;
  uint uVar9;
  __siov *p_Var10;
  
                    /* Unresolved local var: size_t len@[???]
                       Unresolved local var: char * p@[???]
                       Unresolved local var: __siov * iov@[???]
                       Unresolved local var: int w@[???]
                       Unresolved local var: int s@[???]
                       Unresolved local var: char * nl@[???]
                       Unresolved local var: int nlknown@[???]
                       Unresolved local var: int nldist@[???] */
  if (uio->uio_resid != 0) {
    uVar2 = fp->_flags;
    if (((uVar2 & 8) == 0) || ((fp->_bf)._base == (uchar *)0x0)) {
      iVar3 = __swsetup(fp);
      if (iVar3 != 0) {
        fp->_flags = fp->_flags | 0x40;
        ptr->_errno = 9;
        return -1;
      }
      uVar2 = fp->_flags;
      p_Var10 = uio->uio_iov;
    }
    else {
      p_Var10 = uio->uio_iov;
    }
    if ((uVar2 & 2) == 0) {
      uVar7 = 0;
      if ((uVar2 & 1) != 0) {
        pcVar8 = (char *)0x0;
        uVar9 = 0;
        do {
          bVar1 = false;
          if (uVar7 == 0) {
            pcVar8 = p_Var10->iov_base;
          }
          else {
            do {
              if (!bVar1) {
                pvVar4 = memchr(pcVar8,10,uVar7);
                if (pvVar4 == (void *)0x0) {
                  uVar9 = uVar7 + 1;
                  bVar1 = true;
                }
                else {
                  uVar9 = (int)pvVar4 + (1 - (int)pcVar8);
                  bVar1 = true;
                }
              }
              puVar6 = fp->_p;
              length = uVar9;
              if (uVar7 <= uVar9) {
                length = uVar7;
              }
              iVar3 = (fp->_bf)._size;
              if (((fp->_bf)._base < puVar6) &&
                 (length_00 = fp->_w + iVar3, (int)length_00 < (int)length)) {
                memmove(puVar6,pcVar8,length_00);
                fp->_p = fp->_p + length_00;
                iVar3 = fflush(fp);
                length = length_00;
                if (iVar3 != 0) {
                  uVar2 = fp->_flags;
                  goto LAB_08991940;
                }
LAB_089919f8:
                uVar9 = uVar9 - length;
                if (uVar9 == 0) goto LAB_08991aac;
LAB_08991a00:
                iVar3 = uio->uio_resid;
              }
              else {
                if (iVar3 <= (int)length) {
                  length = (*fp->_write)(fp->_cookie,pcVar8,iVar3);
                  if (0 < (int)length) goto LAB_089919f8;
                  goto LAB_0899193c;
                }
                memmove(puVar6,pcVar8,length);
                uVar9 = uVar9 - length;
                fp->_w = fp->_w - length;
                fp->_p = fp->_p + length;
                if (uVar9 != 0) goto LAB_08991a00;
LAB_08991aac:
                iVar3 = fflush(fp);
                bVar1 = false;
                if (iVar3 != 0) goto LAB_0899193c;
                iVar3 = uio->uio_resid;
              }
              uio->uio_resid = iVar3 - length;
              if (iVar3 - length == 0) {
                return 0;
              }
              uVar7 = uVar7 - length;
              pcVar8 = pcVar8 + length;
            } while (uVar7 != 0);
            pcVar8 = p_Var10->iov_base;
          }
          uVar7 = p_Var10->iov_len;
          p_Var10 = p_Var10 + 1;
        } while( true );
      }
      uVar7 = 0;
      pcVar8 = (char *)0x0;
LAB_0899180c:
      if (uVar7 != 0) {
LAB_08991814:
        uVar9 = fp->_w;
        if ((uVar2 & 0x200) == 0) {
          puVar6 = fp->_p;
          if ((fp->_bf)._base < puVar6) {
            if (uVar7 <= uVar9) {
              uVar9 = (fp->_bf)._size;
              goto LAB_08991a54;
            }
            memmove(puVar6,pcVar8,uVar9);
            fp->_p = fp->_p + uVar9;
            iVar3 = fflush(fp);
            if (iVar3 != 0) {
              uVar2 = fp->_flags;
              goto LAB_08991940;
            }
            iVar3 = uio->uio_resid;
            goto LAB_089918f0;
          }
          uVar9 = (fp->_bf)._size;
LAB_08991a54:
          if (uVar7 < uVar9) {
            memmove(puVar6,pcVar8,uVar7);
            fp->_w = fp->_w - uVar7;
            fp->_p = fp->_p + uVar7;
            uVar9 = uVar7;
            goto LAB_089918ec;
          }
          uVar9 = (*fp->_write)(fp->_cookie,pcVar8,uVar9);
          if ((int)uVar9 < 1) goto LAB_0899193c;
        }
        else {
          if (uVar7 < uVar9) {
LAB_089918bc:
            puVar6 = fp->_p;
            uVar9 = uVar7;
          }
          else {
            if ((uVar2 & 0x80) != 0) {
                    /* Unresolved local var: uchar * ptr@[???]
                       Unresolved local var: int curpos@[???]
                       Unresolved local var: int newsize@[???] */
              puVar6 = (fp->_bf)._base;
              iVar3 = (int)fp->_p - (int)puVar6;
              uVar5 = uVar7 + iVar3 + 1;
              uVar9 = ((fp->_bf)._size * 3) / 2;
              if (uVar9 < uVar5) {
                uVar9 = uVar5;
              }
              puVar6 = _realloc_r(_impure_ptr,puVar6,uVar9);
              if (puVar6 != (uchar *)0x0) {
                fp->_p = puVar6 + iVar3;
                fp->_w = uVar9 - iVar3;
                (fp->_bf)._base = puVar6;
                (fp->_bf)._size = uVar9;
                goto LAB_089918bc;
              }
              _free_r(_impure_ptr,(fp->_bf)._base);
              goto LAB_0899193c;
            }
            puVar6 = fp->_p;
          }
          memmove(puVar6,pcVar8,uVar9);
          fp->_w = fp->_w - uVar9;
          fp->_p = fp->_p + uVar9;
          uVar9 = uVar7;
        }
LAB_089918ec:
        iVar3 = uio->uio_resid;
LAB_089918f0:
        uio->uio_resid = iVar3 - uVar9;
        if (iVar3 - uVar9 == 0) {
          return 0;
        }
        uVar7 = uVar7 - uVar9;
        uVar2 = fp->_flags;
        pcVar8 = pcVar8 + uVar9;
        if (uVar7 == 0) goto code_r0x0899190c;
        goto LAB_08991814;
      }
      pcVar8 = p_Var10->iov_base;
      goto LAB_08991910;
    }
    uVar7 = 0;
    pcVar8 = (char *)0x0;
    do {
      while( true ) {
        uVar9 = 0x400;
        if (uVar7 < 0x401) {
          uVar9 = uVar7;
        }
        if (uVar7 != 0) break;
        pcVar8 = p_Var10->iov_base;
        uVar7 = p_Var10->iov_len;
        p_Var10 = p_Var10 + 1;
      }
      iVar3 = (*fp->_write)(fp->_cookie,pcVar8,uVar9);
      uVar7 = uVar7 - iVar3;
      pcVar8 = pcVar8 + iVar3;
      if (iVar3 < 1) {
LAB_0899193c:
        uVar2 = fp->_flags;
LAB_08991940:
        fp->_flags = uVar2 | 0x40;
        return -1;
      }
      iVar3 = uio->uio_resid - iVar3;
      uio->uio_resid = iVar3;
    } while (iVar3 != 0);
  }
  return 0;
code_r0x0899190c:
  pcVar8 = p_Var10->iov_base;
LAB_08991910:
  uVar7 = p_Var10->iov_len;
  p_Var10 = p_Var10 + 1;
  goto LAB_0899180c;
}



----------------------------------------

// Function: htinit @ 08991b9c

void htinit(uchar *h,uchar *s,int inc)

{
  char cVar1;
  uint uVar2;
  int iVar3;
  
                    /* Unresolved local var: int i@[DW_OP_reg7(a3)]
                       Unresolved local var: int j@[???] */
  uVar2 = (uint)*s;
  if (uVar2 != 0) {
    iVar3 = 0;
    do {
      cVar1 = (char)iVar3;
      iVar3 = iVar3 + 1;
      h[uVar2] = (char)inc + cVar1;
      uVar2 = (uint)s[iVar3];
    } while (uVar2 != 0);
  }
  return;
}



----------------------------------------

// Function: __hexdig_init @ 08991bdc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __hexdig_init(void)

{
  htinit(__hexdig,"0123456789",0x10);
  htinit(__hexdig,(uchar *)"abcdef",0x1a);
  htinit(__hexdig,"ABCDEF",0x1a);
  return;
}



----------------------------------------

// Function: rshift @ 08991c34

void rshift(_Bigint *b,int k)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  __ULong *p_Var4;
  __ULong *p_Var5;
  __ULong *p_Var6;
  __ULong *p_Var7;
  
                    /* Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * x1@[DW_OP_reg7(a3)]
                       Unresolved local var: __ULong * xe@[DW_OP_reg8(t0)]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: int n@[???] */
  p_Var7 = b->_x;
  p_Var5 = p_Var7;
  if (k >> 5 < b->_wds) {
    uVar3 = k & 0x1f;
    p_Var6 = p_Var7 + b->_wds;
    p_Var4 = p_Var7 + (k >> 5);
    if (uVar3 == 0) {
      iVar1 = 0;
      if (p_Var4 < p_Var6) {
        do {
          uVar3 = *p_Var4;
          p_Var4 = p_Var4 + 1;
          *p_Var5 = uVar3;
          p_Var5 = p_Var5 + 1;
        } while (p_Var4 < p_Var6);
        iVar1 = (int)p_Var5 - (int)p_Var7;
      }
      goto LAB_08991cb8;
    }
    uVar2 = *p_Var4;
    while( true ) {
      p_Var4 = p_Var4 + 1;
      uVar2 = uVar2 >> uVar3;
      if (p_Var6 <= p_Var4) break;
      *p_Var5 = *p_Var4 << (0x20 - uVar3 & 0x1f) | uVar2;
      uVar2 = *p_Var4;
      p_Var5 = p_Var5 + 1;
    }
    *p_Var5 = uVar2;
    if (uVar2 != 0) {
      p_Var5 = p_Var5 + 1;
    }
  }
  iVar1 = (int)p_Var5 - (int)p_Var7;
LAB_08991cb8:
  b->_wds = iVar1 >> 2;
  if (iVar1 >> 2 == 0) {
    b->_x[0] = 0;
  }
  return;
}



----------------------------------------

// Function: __gethex @ 08991d04

int __gethex(_reent *ptr,char **sp,FPI *fpi,Long *exp,_Bigint **bp,int sign)

{
  byte bVar1;
  bool bVar2;
  bool bVar3;
  char *pcVar4;
  char *pcVar5;
  _Bigint *b;
  _Bigint *p_Var6;
  uchar uVar7;
  byte *pbVar8;
  uint uVar9;
  __ULong *p_Var10;
  uint uVar11;
  __ULong _Var12;
  char *pcVar13;
  byte *pbVar14;
  byte *pbVar15;
  uint uVar16;
  undefined4 *in_t0;
  int in_t1;
  int iVar17;
  int iVar18;
  byte *pbVar19;
  Long LVar20;
  __ULong *local_38;
  
                    /* Unresolved local var: _Bigint * b@[???]
                       Unresolved local var: uchar * decpt@[???]
                       Unresolved local var: uchar * s0@[???]
                       Unresolved local var: uchar * s@[???]
                       Unresolved local var: uchar * s1@[???]
                       Unresolved local var: int esign@[???]
                       Unresolved local var: int havedig@[???]
                       Unresolved local var: int irv@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int nbits@[???]
                       Unresolved local var: int up@[???]
                       Unresolved local var: int zret@[???]
                       Unresolved local var: __ULong L@[???]
                       Unresolved local var: __ULong lostbits@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: Long e@[???]
                       Unresolved local var: Long e1@[???] */
  if (__hexdig[0x30] == '\0') {
    __hexdig_init();
    pcVar13 = *sp;
    uVar11 = (uint)(byte)pcVar13[2];
    pcVar4 = pcVar13;
    if (uVar11 != 0x30) goto LAB_08991f2c;
LAB_08991d70:
    do {
      pcVar5 = pcVar4;
      uVar11 = (uint)(byte)pcVar5[3];
      pcVar4 = pcVar5 + 1;
    } while (uVar11 == 0x30);
    iVar17 = (int)(pcVar5 + 1) - (int)pcVar13;
    pbVar8 = (byte *)(pcVar5 + 3);
  }
  else {
    pcVar13 = *sp;
    uVar11 = (uint)(byte)pcVar13[2];
    pcVar4 = pcVar13;
    if (uVar11 == 0x30) goto LAB_08991d70;
LAB_08991f2c:
    pbVar8 = (byte *)(pcVar13 + 2);
    iVar17 = 0;
  }
  pbVar19 = pbVar8;
  if (__hexdig[uVar11] == '\0') {
    if (uVar11 == 0x2e) {
      uVar11 = (uint)pbVar8[1];
      pbVar14 = pbVar8 + 1;
      if (__hexdig[uVar11] != '\0') {
        pbVar8 = pbVar14;
        if (uVar11 == 0x30) {
          do {
            pbVar8 = pbVar8 + 1;
            uVar11 = (uint)*pbVar8;
          } while (uVar11 == 0x30);
          if (__hexdig[uVar11] == '\0') {
            iVar17 = 1;
            bVar3 = true;
            uVar7 = '\0';
            pbVar19 = pbVar8;
            goto LAB_08991dbc;
          }
        }
        else {
          uVar11 = (uint)*pbVar14;
        }
        iVar17 = 1;
        bVar3 = false;
        pbVar19 = pbVar8;
        goto LAB_08991db4;
      }
      bVar3 = true;
      LVar20 = 0;
      pbVar15 = pbVar14;
    }
    else {
      uVar11 = (uint)*pbVar8;
      bVar3 = true;
      LVar20 = 0;
      pbVar15 = pbVar8;
    }
LAB_08991eb4:
    pbVar8 = pbVar15;
    if (uVar11 != 0x50) goto LAB_08991ec0;
LAB_08991dec:
    pbVar14 = pbVar8 + 1;
    if (pbVar8[1] == 0x2b) {
      bVar2 = false;
      pbVar14 = pbVar8 + 2;
    }
    else {
      bVar2 = true;
      if (pbVar8[1] == 0x2d) {
        pbVar14 = pbVar8 + 2;
      }
      else {
        bVar2 = false;
      }
    }
    uVar11 = (uint)__hexdig[*pbVar14];
    pbVar15 = pbVar8;
    if ((uVar11 != 0) && (uVar11 < 0x1a)) {
      bVar1 = __hexdig[pbVar14[1]];
      pbVar15 = pbVar14 + 1;
      while( true ) {
        uVar16 = (uint)bVar1;
        iVar18 = uVar11 - 0x10;
        if ((uVar16 == 0) || (0x19 < uVar16)) break;
        pbVar15 = pbVar15 + 1;
        bVar1 = __hexdig[*pbVar15];
        uVar11 = iVar18 * 10 + uVar16;
      }
      if (bVar2) {
        iVar18 = -iVar18;
      }
      LVar20 = LVar20 + iVar18;
    }
  }
  else {
    uVar11 = (uint)*pbVar8;
    pbVar14 = (byte *)0x0;
    bVar3 = false;
LAB_08991db4:
    while( true ) {
      uVar7 = __hexdig[uVar11];
LAB_08991dbc:
      if (uVar7 == '\0') break;
      pbVar8 = pbVar8 + 1;
      uVar11 = (uint)*pbVar8;
    }
    pbVar15 = pbVar8;
    if (uVar11 == 0x2e) {
      if (pbVar14 == (byte *)0x0) {
        pbVar15 = pbVar8 + 1;
        uVar11 = (uint)*pbVar15;
        LVar20 = 0;
        pbVar8 = pbVar15;
        if (__hexdig[uVar11] != '\0') {
          do {
            pbVar8 = pbVar8 + 1;
            uVar11 = (uint)*pbVar8;
          } while (__hexdig[uVar11] != '\0');
          LVar20 = ((int)pbVar15 - (int)pbVar8) * 4;
          pbVar15 = pbVar8;
        }
        goto LAB_08991eb4;
      }
    }
    else {
      LVar20 = 0;
      if (pbVar14 == (byte *)0x0) goto LAB_08991eb4;
    }
    LVar20 = ((int)pbVar14 - (int)pbVar8) * 4;
    if (uVar11 == 0x50) goto LAB_08991dec;
LAB_08991ec0:
    pbVar8 = pbVar15;
    if (uVar11 == 0x70) goto LAB_08991dec;
  }
  *sp = (char *)pbVar15;
  if (bVar3) {
    if (iVar17 != 0) {
      return 0;
    }
    return 6;
  }
  iVar17 = 0;
  for (pbVar14 = pbVar8 + (-1 - (int)pbVar19); 7 < (int)pbVar14;
      pbVar14 = (byte *)((int)pbVar14 >> 1)) {
    iVar17 = iVar17 + 1;
  }
  b = _Balloc(ptr,iVar17);
  local_38 = b->_x;
  p_Var10 = local_38;
  if (pbVar19 < pbVar8) {
    _Var12 = 0;
    uVar11 = 0;
    do {
      pbVar8 = pbVar8 + -1;
      uVar9 = (uint)*pbVar8;
      uVar16 = uVar11;
      if (uVar9 != 0x2e) {
        uVar16 = uVar11 + 4;
        if (uVar11 == 0x20) {
          *p_Var10 = _Var12;
          uVar9 = (uint)*pbVar8;
          uVar11 = 0;
          uVar16 = 4;
          p_Var10 = p_Var10 + 1;
          _Var12 = 0;
        }
        _Var12 = _Var12 | (__hexdig[uVar9] & 0xf) << (uVar11 & 0x1f);
      }
      uVar11 = uVar16;
    } while (pbVar19 < pbVar8);
  }
  else {
    _Var12 = 0;
  }
  *p_Var10 = _Var12;
  iVar18 = (int)p_Var10 + (4 - (int)local_38) >> 2;
  b->_wds = iVar18;
  iVar17 = __hi0bits(_Var12);
  uVar11 = fpi->nbits;
  iVar17 = iVar18 * 0x20 - iVar17;
  if ((int)uVar11 < iVar17) {
    iVar17 = iVar17 - uVar11;
    _Var12 = __any_on(b,iVar17);
    uVar16 = iVar17 - 1;
    if (_Var12 == 0) {
      _Var12 = 0;
    }
    else if ((1 << (uVar16 & 0x1f) & local_38[(int)uVar16 >> 5]) == 0) {
      _Var12 = 1;
    }
    else if ((int)uVar16 < 2) {
      _Var12 = 2;
    }
    else {
      _Var12 = __any_on(b,iVar17 + -2);
      if (_Var12 == 0) {
        _Var12 = 2;
      }
      else {
        _Var12 = 3;
      }
    }
    rshift(b,iVar17);
    LVar20 = LVar20 + iVar17;
  }
  else {
    if (iVar17 < (int)uVar11) {
      b = __lshift(ptr,b,uVar11 - iVar17);
      LVar20 = LVar20 - (uVar11 - iVar17);
      local_38 = b->_x;
    }
    _Var12 = 0;
  }
  if (fpi->emax < LVar20) {
LAB_08992124:
    _Bfree(ptr,b);
    uVar16 = 0xa3;
    *in_t0 = 0;
  }
  else {
    iVar17 = fpi->emin;
    uVar16 = iVar17 - LVar20;
    if (LVar20 < iVar17) {
      if ((int)uVar11 <= (int)uVar16) {
        iVar18 = fpi->rounding;
        if (iVar18 == 2) {
          if (in_t1 == 0) goto LAB_0899248c;
        }
        else if (iVar18 == 3) {
          if (in_t1 != 0) goto LAB_0899248c;
        }
        else if ((iVar18 == 1) && (uVar11 == uVar16)) {
          if (1 < (int)uVar11) {
            _Var12 = __any_on(b,uVar11 - 1);
            if (_Var12 == 0) goto LAB_0899225c;
            iVar17 = fpi->emin;
          }
LAB_0899248c:
          *exp = iVar17;
          *local_38 = 1;
          *in_t0 = b;
          b->_wds = 1;
          return 0x62;
        }
LAB_0899225c:
        _Bfree(ptr,b);
        *in_t0 = 0;
        return 0x50;
      }
      uVar9 = uVar16 - 1;
      if (_Var12 == 0) {
        if (0 < (int)uVar9) {
          _Var12 = __any_on(b,uVar9);
        }
      }
      else {
        _Var12 = 1;
      }
      if ((1 << (uVar9 & 0x1f) & local_38[(int)uVar9 >> 5]) != 0) {
        _Var12 = _Var12 | 2;
      }
      rshift(b,uVar16);
      LVar20 = fpi->emin;
      uVar11 = uVar11 - uVar16;
      uVar16 = 2;
    }
    else {
      uVar16 = 1;
    }
    if (_Var12 == 0) goto LAB_08992204;
    iVar17 = fpi->rounding;
    if (iVar17 == 2) {
      in_t1 = 1 - in_t1;
LAB_089922ec:
      if (in_t1 == 0) {
        uVar16 = uVar16 | 0x10;
      }
      else {
        iVar17 = b->_wds;
                    /* Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * xe@[???]
                       Unresolved local var: _Bigint * b1@[???] */
LAB_089922fc:
        p_Var10 = local_38;
        do {
          if (*p_Var10 != 0xffffffff) {
            *p_Var10 = *p_Var10 + 1;
            iVar18 = iVar17;
            goto LAB_089923b0;
          }
          *p_Var10 = 0;
          p_Var10 = p_Var10 + 1;
        } while (p_Var10 < local_38 + iVar17);
        iVar18 = iVar17;
        p_Var6 = b;
        if (b->_maxwds <= iVar17) {
          p_Var6 = _Balloc(ptr,b->_k + 1);
          memcpy(&p_Var6->_sign,&b->_sign,b->_wds * 4 + 8);
          _Bfree(ptr,b);
          iVar18 = p_Var6->_wds;
          local_38 = p_Var6->_x;
        }
        p_Var6->_x[iVar18] = 1;
        p_Var6->_wds = iVar18 + 1;
        iVar18 = iVar18 + 1;
        b = p_Var6;
LAB_089923b0:
        if (uVar16 == 2) {
          if (uVar11 == fpi->nbits - 1U) {
            if ((1 << (uVar11 & 0x1f) & local_38[(int)uVar11 >> 5]) == 0) {
              uVar16 = 0x22;
            }
            else {
              uVar16 = 0x21;
            }
          }
          else {
            uVar16 = 0x22;
          }
        }
        else if (iVar17 < iVar18) {
LAB_089923f8:
          rshift(b,1);
          LVar20 = LVar20 + 1;
          if (fpi->emax < LVar20) goto LAB_08992124;
          uVar16 = uVar16 | 0x20;
        }
        else if ((uVar11 & 0x1f) == 0) {
          uVar16 = uVar16 | 0x20;
        }
        else {
          iVar17 = __hi0bits(local_38[iVar17 + -1]);
          if (iVar17 < (int)(0x20 - (uVar11 & 0x1f))) goto LAB_089923f8;
          uVar16 = uVar16 | 0x20;
        }
      }
    }
    else {
      if (iVar17 == 3) goto LAB_089922ec;
      if (iVar17 == 1) {
        if ((_Var12 & 2) == 0) {
          uVar16 = uVar16 | 0x10;
          goto LAB_08992204;
        }
        if (((_Var12 | *local_38) & 1) == 0) {
          uVar16 = uVar16 | 0x10;
          goto LAB_08992204;
        }
        iVar17 = b->_wds;
        goto LAB_089922fc;
      }
      uVar16 = uVar16 | 0x10;
    }
LAB_08992204:
    *in_t0 = b;
    *exp = LVar20;
  }
  return uVar16;
}



----------------------------------------

// Function: L_shift @ 089924f8

void L_shift(__ULong *x,__ULong *x1,int i)

{
  uint uVar1;
  __ULong _Var2;
  uint *puVar3;
  
                    /* Unresolved local var: int j@[DW_OP_reg8(t0)] */
  _Var2 = *x;
  do {
    puVar3 = x + 1;
    uVar1 = *puVar3 >> ((8 - i) * 4 & 0x1fU);
    *x = _Var2 | *puVar3 << ((8 - i) * -4 + 0x20U & 0x1f);
    *puVar3 = uVar1;
    _Var2 = uVar1;
    x = puVar3;
  } while (puVar3 < x1);
  return;
}



----------------------------------------

// Function: __hexnan @ 0899254c

int __hexnan(char **sp,FPI *fpi,__ULong *x0)

{
  byte bVar1;
  __ULong *p_Var2;
  uint uVar3;
  int i;
  uint *x;
  byte *pbVar4;
  int iVar5;
  uint *puVar6;
  uint *x1;
  int iVar7;
  uint uVar8;
  
                    /* Unresolved local var: __ULong c@[???]
                       Unresolved local var: __ULong h@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * x1@[???]
                       Unresolved local var: __ULong * xe@[???]
                       Unresolved local var: char * s@[???]
                       Unresolved local var: int havedig@[???]
                       Unresolved local var: int hd0@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int nbits@[???] */
  if (__hexdig[0x30] == '\0') {
    __hexdig_init();
    uVar3 = fpi->nbits;
  }
  else {
    uVar3 = fpi->nbits;
  }
  uVar8 = uVar3 & 0x1f;
  p_Var2 = x0 + ((int)uVar3 >> 5);
  if (uVar8 != 0) {
    p_Var2 = p_Var2 + 1;
  }
  puVar6 = p_Var2 + -1;
  pbVar4 = (byte *)*sp;
  iVar5 = 0;
  i = 0;
  p_Var2[-1] = 0;
  x = puVar6;
  x1 = puVar6;
  iVar7 = 0;
LAB_089925d8:
  pbVar4 = pbVar4 + 1;
LAB_089925dc:
  bVar1 = *pbVar4;
  do {
    uVar3 = (uint)bVar1;
    if (uVar3 == 0) {
      if (iVar5 == 0) {
        return 4;
      }
LAB_08992648:
      if ((x < x1) && (i < 8)) {
        L_shift(x,x1,i);
      }
      p_Var2 = x0;
      if (x0 < x) {
        do {
          uVar3 = *x;
          x = x + 1;
          *p_Var2 = uVar3;
          p_Var2 = p_Var2 + 1;
        } while (x <= puVar6);
        *p_Var2 = 0;
        while (p_Var2 = p_Var2 + 1, p_Var2 <= puVar6) {
          *p_Var2 = 0;
        }
        uVar3 = *puVar6;
      }
      else {
        uVar3 = *puVar6;
        if (uVar8 != 0) {
          uVar3 = uVar3 & 0xffffffffU >> (-uVar8 & 0x1f);
          *puVar6 = uVar3;
        }
      }
      while( true ) {
        if (uVar3 != 0) {
          return 5;
        }
        if (x0 == puVar6) break;
        puVar6 = puVar6 + -1;
        uVar3 = *puVar6;
      }
      *x0 = 1;
      return 5;
    }
    bVar1 = __hexdig[uVar3];
    if (bVar1 != 0) {
      i = i + 1;
      iVar5 = iVar5 + 1;
      if (8 < i) {
        if (x <= x0) {
          pbVar4 = pbVar4 + 1;
          goto LAB_089925dc;
        }
        x = x + -1;
        *x = 0;
        i = 1;
      }
      *x = *x << 4 | bVar1 & 0xf;
      goto LAB_089925d8;
    }
    if (0x20 < uVar3) {
      if (uVar3 != 0x29) {
        return 4;
      }
      if (iVar5 == 0) {
        return 4;
      }
      *sp = (char *)(pbVar4 + 1);
      goto LAB_08992648;
    }
    if (iVar5 <= iVar7) break;
    if ((x < x1) && (i < 8)) {
      L_shift(x,x1,i);
    }
    if (x0 < x) {
      x = x + -1;
      i = 0;
      *x = 0;
      x1 = x;
      iVar7 = iVar5;
      goto LAB_089925d8;
    }
    pbVar4 = pbVar4 + 1;
    bVar1 = *pbVar4;
    i = 8;
  } while( true );
  pbVar4 = pbVar4 + 1;
  goto LAB_089925dc;
}



----------------------------------------

// Function: isdigit @ 08992838

int isdigit(int c)

{
  return (byte)""[c + 1] & 4;
}



----------------------------------------

// Function: __locale_charset @ 08992850

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

char * __locale_charset(void)

{
  return charset;
}



----------------------------------------

// Function: _localeconv_r @ 08992860

lconv * _localeconv_r(_reent *data)

{
  return &lconv;
}



----------------------------------------

// Function: localeconv @ 08992870

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

lconv * localeconv(void)

{
  lconv *plVar1;
  
  plVar1 = _localeconv_r(_impure_ptr);
  return plVar1;
}



----------------------------------------

// Function: _setlocale_r @ 08992880

char * _setlocale_r(_reent *p,int category,char *locale)

{
  int iVar1;
  
  if (locale != (char *)0x0) {
    iVar1 = strcmp(locale,"C");
    if ((iVar1 != 0) && (iVar1 = strcmp(locale,""), iVar1 != 0)) {
      return (char *)0x0;
    }
    p->_current_locale = locale;
    p->_current_category = category;
  }
  return "C";
}



----------------------------------------

// Function: setlocale @ 08992910

char * setlocale(int category,char *locale)

{
  char *pcVar1;
  
  pcVar1 = _setlocale_r(_impure_ptr,category,locale);
  return pcVar1;
}



----------------------------------------

// Function: _lseek_r @ 08992928

_off_t _lseek_r(_reent *ptr,int fd,_off_t pos,int whence)

{
  off_t oVar1;
  
                    /* Unresolved local var: _off_t ret@[???] */
  errno = 0;
  oVar1 = _lseek(fd,pos,whence);
  if ((oVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return oVar1;
}



----------------------------------------

// Function: _Bfree @ 08992998

void _Bfree(_reent *ptr,_Bigint *v)

{
  _Bigint **pp_Var1;
  
  if (v != (_Bigint *)0x0) {
    pp_Var1 = ptr->_freelist;
    v->_next = pp_Var1[v->_k];
    pp_Var1[v->_k] = v;
  }
  return;
}



----------------------------------------

// Function: __hi0bits @ 089929c4

int __hi0bits(__ULong x)

{
  int iVar1;
  
                    /* Unresolved local var: int k@[???] */
  if ((x & 0xffff0000) == 0) {
    x = x << 0x10;
    iVar1 = 0x10;
  }
  else {
    iVar1 = 0;
  }
  if ((x & 0xff000000) == 0) {
    iVar1 = iVar1 + 8;
    x = x << 8;
  }
  if ((x & 0xf0000000) == 0) {
    iVar1 = iVar1 + 4;
    x = x << 4;
  }
  if ((x & 0xc0000000) == 0) {
    iVar1 = iVar1 + 2;
    x = x << 2;
  }
  if ((-1 < (int)x) && (iVar1 = iVar1 + 1, (x & 0x40000000) == 0)) {
    return 0x20;
  }
  return iVar1;
}



----------------------------------------

// Function: __lo0bits @ 08992a4c

int __lo0bits(__ULong *y)

{
  uint uVar1;
  int iVar2;
  
                    /* Unresolved local var: int k@[???]
                       Unresolved local var: __ULong x@[DW_OP_reg3(v1)] */
  uVar1 = *y;
  if ((uVar1 & 7) == 0) {
    if ((uVar1 & 0xffff) == 0) {
      uVar1 = uVar1 >> 0x10;
      iVar2 = 0x10;
    }
    else {
      iVar2 = 0;
    }
    if ((uVar1 & 0xff) == 0) {
      iVar2 = iVar2 + 8;
      uVar1 = uVar1 >> 8;
    }
    if ((uVar1 & 0xf) == 0) {
      iVar2 = iVar2 + 4;
      uVar1 = uVar1 >> 4;
    }
    if ((uVar1 & 3) == 0) {
      iVar2 = iVar2 + 2;
      uVar1 = uVar1 >> 2;
    }
    if ((uVar1 & 1) == 0) {
      uVar1 = uVar1 >> 1;
      iVar2 = iVar2 + 1;
      if (uVar1 == 0) {
        return 0x20;
      }
    }
    *y = uVar1;
    return iVar2;
  }
  if ((uVar1 & 1) != 0) {
    return 0;
  }
  if ((uVar1 & 2) == 0) {
    iVar2 = 2;
    *y = uVar1 >> 2;
  }
  else {
    iVar2 = 1;
    *y = uVar1 >> 1;
  }
  return iVar2;
}



----------------------------------------

// Function: __mcmp @ 08992b1c

int __mcmp(_Bigint *a,_Bigint *b)

{
  __ULong *p_Var1;
  int iVar2;
  __ULong *p_Var3;
  int iVar4;
  
                    /* Unresolved local var: __ULong * xa@[???]
                       Unresolved local var: __ULong * xa0@[DW_OP_reg4(a0)]
                       Unresolved local var: __ULong * xb@[???]
                       Unresolved local var: __ULong * xb0@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???] */
  iVar2 = b->_wds;
  iVar4 = a->_wds - iVar2;
  if (iVar4 == 0) {
    p_Var1 = b->_x + iVar2;
    p_Var3 = a->_x + iVar2;
    do {
      p_Var3 = p_Var3 + -1;
      p_Var1 = p_Var1 + -1;
      if (*p_Var3 != *p_Var1) {
        iVar2 = -1;
        if (*p_Var1 <= *p_Var3) {
          iVar2 = 1;
        }
        return iVar2;
      }
    } while (a->_x < p_Var3);
  }
  return iVar4;
}



----------------------------------------

// Function: __ulp @ 08992b80

double __ulp(double _x)

{
  uint in_a1;
  int iVar1;
  double in_f0_1;
  
                    /* Unresolved local var: double_union x@[???]
                       Unresolved local var: double_union a@[???]
                       Unresolved local var: long L@[???] */
  iVar1 = (in_a1 & 0x7ff00000) + 0xfcc00000;
  if (0 < iVar1) {
    return in_f0_1;
  }
  if (0x13 < -iVar1 >> 0x14) {
    return in_f0_1;
  }
  return in_f0_1;
}



----------------------------------------

// Function: __b2d @ 08992c00

double __b2d(_Bigint *a,int *e)

{
  int iVar1;
  double in_f0_1;
  
                    /* Unresolved local var: __ULong * xa@[???]
                       Unresolved local var: __ULong * xa0@[???]
                       Unresolved local var: __ULong w@[???]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: __ULong z@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: double_union d@[???] */
  iVar1 = __hi0bits(a->_x[a->_wds + -1]);
  *e = 0x20 - iVar1;
  if (iVar1 < 0xb) {
    return in_f0_1;
  }
  if (iVar1 != 0xb) {
    return in_f0_1;
  }
  return in_f0_1;
}



----------------------------------------

// Function: __ratio @ 08992d90

double __ratio(_Bigint *a,_Bigint *b)

{
  FLO_type_conflict FVar1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  int local_20;
  int local_1c;
  
                    /* Unresolved local var: double_union da@[???]
                       Unresolved local var: double_union db@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int ka@[???]
                       Unresolved local var: int kb@[???] */
  __b2d(a,&local_20);
  __b2d(b,&local_1c);
  if (0 < (local_20 - local_1c) + (a->_wds - b->_wds) * 0x20) {
    FVar1 = __divdf3(in_f12_13,in_f14_15);
    return FVar1;
  }
  FVar1 = __divdf3(in_f12_13,in_f14_15);
  return FVar1;
}



----------------------------------------

// Function: _mprec_log10 @ 08992e54

double _mprec_log10(int dig)

{
  double in_f0_1;
  FLO_type_conflict FVar1;
  FLO_type_conflict in_f12_13;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: double v@[???] */
  if (0x17 < dig) {
    do {
      dig = dig + -1;
      FVar1 = __muldf3(in_f12_13,in_f14_15);
    } while (dig != 0);
    return FVar1;
  }
  return in_f0_1;
}



----------------------------------------

// Function: __copybits @ 08992efc

void __copybits(__ULong *c,int n,_Bigint *b)

{
  __ULong _Var1;
  __ULong *p_Var2;
  __ULong *p_Var3;
  __ULong *p_Var4;
  
                    /* Unresolved local var: __ULong * ce@[DW_OP_reg5(a1)]
                       Unresolved local var: __ULong * x@[DW_OP_reg6(a2)]
                       Unresolved local var: __ULong * xe@[DW_OP_reg7(a3)] */
  p_Var3 = b->_x;
  p_Var4 = p_Var3 + b->_wds;
  p_Var2 = c + (n + -1 >> 5) + 1;
  if (p_Var4 <= p_Var3) goto LAB_08992f54;
  do {
    _Var1 = *p_Var3;
    p_Var3 = p_Var3 + 1;
    *c = _Var1;
    c = c + 1;
  } while (p_Var3 < p_Var4);
  if (c < p_Var2) {
    *c = 0;
    while( true ) {
      c = c + 1;
LAB_08992f54:
      if (p_Var2 <= c) break;
      *c = 0;
    }
  }
  return;
}



----------------------------------------

// Function: __any_on @ 08992f68

__ULong __any_on(_Bigint *b,int k)

{
  bool bVar1;
  uint uVar2;
  int iVar3;
  int *piVar4;
  __ULong *p_Var5;
  int iVar6;
  __ULong *p_Var7;
  
                    /* Unresolved local var: int n@[???]
                       Unresolved local var: int nwds@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * x0@[???]
                       Unresolved local var: __ULong x1@[???]
                       Unresolved local var: __ULong x2@[???] */
  iVar3 = b->_wds;
  iVar6 = k >> 5;
  p_Var5 = b->_x;
  if (iVar3 < iVar6) {
    p_Var7 = p_Var5 + iVar3;
  }
  else if (iVar6 < iVar3) {
    uVar2 = k & 0x1f;
    if (uVar2 == 0) {
      p_Var7 = p_Var5 + iVar6;
    }
    else {
      p_Var7 = p_Var5 + iVar6;
      if (*p_Var7 != (*p_Var7 >> uVar2) << uVar2) {
        return 1;
      }
    }
  }
  else {
    p_Var7 = p_Var5 + iVar6;
  }
  if (p_Var5 < p_Var7) {
    uVar2 = p_Var7[-1];
    piVar4 = (int *)(p_Var7 + -1);
    while( true ) {
      if (uVar2 != 0) {
        return 1;
      }
      bVar1 = piVar4 <= p_Var5;
      piVar4 = piVar4 + -1;
      if (bVar1) break;
      uVar2 = *piVar4;
    }
    return 0;
  }
  return 0;
}



----------------------------------------

// Function: _Balloc @ 08993008

_Bigint * _Balloc(_reent *ptr,int k)

{
  _Bigint **pp_Var1;
  _Bigint *p_Var2;
  int iVar3;
  
                    /* Unresolved local var: int x@[???]
                       Unresolved local var: _Bigint * rv@[???] */
  pp_Var1 = ptr->_freelist;
  if (pp_Var1 == (_Bigint **)0x0) {
    pp_Var1 = _calloc_r(ptr,4,0x10);
    ptr->_freelist = pp_Var1;
    if (pp_Var1 == (_Bigint **)0x0) {
      return (_Bigint *)0x0;
    }
  }
  p_Var2 = pp_Var1[k];
  iVar3 = 1 << (k & 0x1fU);
  if (p_Var2 == (_Bigint *)0x0) {
    p_Var2 = _calloc_r(ptr,1,iVar3 * 4 + 0x14);
    if (p_Var2 == (_Bigint *)0x0) {
      return (_Bigint *)0x0;
    }
    p_Var2->_k = k;
    p_Var2->_maxwds = iVar3;
  }
  else {
    pp_Var1[k] = p_Var2->_next;
  }
  p_Var2->_wds = 0;
  p_Var2->_sign = 0;
  return p_Var2;
}



----------------------------------------

// Function: __d2b @ 089930cc

_Bigint * __d2b(_reent *ptr,double _d,int *e,int *bits)

{
  _Bigint *p_Var1;
  uint uVar2;
  int iVar3;
  __ULong x;
  int *in_t0;
  int *in_t1;
  int iVar4;
  uint uVar5;
  uint local_28;
  _Bigint *local_24;
  
                    /* Unresolved local var: double_union d@[???]
                       Unresolved local var: _Bigint * b@[???]
                       Unresolved local var: int de@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: __ULong z@[???] */
  uVar5 = (uint)((ulonglong)_d >> 0x20);
  p_Var1 = _Balloc(ptr,1);
  local_24 = (_Bigint *)(uVar5 & 0xfffff);
  uVar5 = (uVar5 & 0x7fff0000) >> 0x14;
  if (uVar5 != 0) {
    local_24 = (_Bigint *)((uint)local_24 | 0x100000);
  }
  if (SUB84(_d,0) == 0) {
    iVar4 = __lo0bits((__ULong *)&local_24);
    p_Var1->_wds = 1;
    p_Var1->_x[0] = (__ULong)local_24;
    uVar2 = iVar4 + 0x20;
    iVar4 = 1;
  }
  else {
    local_28 = SUB84(_d,0);
    uVar2 = __lo0bits(&local_28);
    if (uVar2 == 0) {
      p_Var1->_x[0] = local_28;
    }
    else {
      p_Var1->_x[0] = (int)local_24 << (-uVar2 & 0x1f) | local_28;
      local_24 = (_Bigint *)((uint)local_24 >> (uVar2 & 0x1f));
    }
    iVar4 = 2;
    if (local_24 == (_Bigint *)0x0) {
      iVar4 = 1;
    }
    p_Var1[1]._next = local_24;
    p_Var1->_wds = iVar4;
  }
  if (uVar5 != 0) {
    *in_t0 = uVar2 + uVar5 + -0x433;
    *in_t1 = 0x35 - uVar2;
    return p_Var1;
  }
  x = p_Var1->_x[iVar4 + -1];
  *in_t0 = uVar2 - 0x432;
  iVar3 = __hi0bits(x);
  *in_t1 = iVar4 * 0x20 - iVar3;
  return p_Var1;
}



----------------------------------------

// Function: __mdiff @ 0899325c

_Bigint * __mdiff(_reent *ptr,_Bigint *a,_Bigint *b)

{
  int iVar1;
  _Bigint *p_Var2;
  int iVar3;
  __ULong _Var4;
  _Bigint *p_Var5;
  int *piVar6;
  uint uVar7;
  __ULong *p_Var8;
  __ULong *p_Var9;
  __ULong *p_Var10;
  __ULong *p_Var11;
  int iVar12;
  __ULong *p_Var13;
  __ULong *p_Var14;
  
                    /* Unresolved local var: _Bigint * c@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int wa@[???]
                       Unresolved local var: int wb@[???]
                       Unresolved local var: long borrow@[???]
                       Unresolved local var: long y@[???]
                       Unresolved local var: __ULong * xa@[???]
                       Unresolved local var: __ULong * xae@[???]
                       Unresolved local var: __ULong * xb@[???]
                       Unresolved local var: __ULong * xbe@[???]
                       Unresolved local var: __ULong * xc@[???]
                       Unresolved local var: long z@[???] */
  iVar1 = __mcmp(a,b);
  if (iVar1 != 0) {
    p_Var5 = b;
    if (iVar1 >= 0) {
      p_Var5 = a;
      a = b;
    }
    p_Var2 = _Balloc(ptr,p_Var5->_k);
    iVar12 = p_Var5->_wds;
    iVar3 = a->_wds;
    p_Var11 = p_Var5->_x;
    p_Var8 = a->_x;
    p_Var2->_sign = (uint)(iVar1 < 0);
    p_Var14 = p_Var11 + iVar12;
    p_Var13 = p_Var8 + iVar3;
    iVar1 = 0;
    p_Var10 = p_Var2->_x;
    do {
      p_Var9 = p_Var10;
      uVar7 = *p_Var8;
      p_Var8 = p_Var8 + 1;
      iVar1 = ((*p_Var11 & 0xffff) - (uVar7 & 0xffff)) + iVar1;
      iVar3 = ((*p_Var11 >> 0x10) - (uVar7 >> 0x10)) + (iVar1 >> 0x10);
      *(short *)((int)p_Var9 + 2) = (short)iVar3;
      *(short *)p_Var9 = (short)iVar1;
      p_Var11 = p_Var11 + 1;
      p_Var10 = p_Var9 + 1;
      iVar1 = iVar3 >> 0x10;
    } while (p_Var8 < p_Var13);
    if (p_Var11 < p_Var14) {
      do {
        p_Var8 = p_Var10;
        uVar7 = *p_Var11;
        p_Var11 = p_Var11 + 1;
        iVar1 = (uVar7 & 0xffff) + iVar1;
        iVar3 = (uVar7 >> 0x10) + (iVar1 >> 0x10);
        *(short *)((int)p_Var8 + 2) = (short)iVar3;
        *(short *)p_Var8 = (short)iVar1;
        iVar1 = iVar3 >> 0x10;
        p_Var10 = p_Var8 + 1;
      } while (p_Var11 < p_Var14);
      _Var4 = *p_Var8;
    }
    else {
      _Var4 = *p_Var9;
    }
    piVar6 = (int *)(p_Var10 + -1);
    while (_Var4 == 0) {
      piVar6 = piVar6 + -1;
      iVar12 = iVar12 + -1;
      _Var4 = *piVar6;
    }
    p_Var2->_wds = iVar12;
    return p_Var2;
  }
  p_Var5 = _Balloc(ptr,0);
  p_Var5->_wds = 1;
  p_Var5->_x[0] = 0;
  return p_Var5;
}



----------------------------------------

// Function: __lshift @ 089933f0

_Bigint * __lshift(_reent *ptr,_Bigint *b,int k)

{
  _Bigint *p_Var1;
  uint uVar2;
  __ULong *p_Var3;
  __ULong *p_Var4;
  int k_00;
  __ULong *p_Var5;
  int iVar6;
  uint uVar7;
  __ULong *p_Var8;
  int iVar9;
  int iVar10;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int k1@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int n1@[???]
                       Unresolved local var: _Bigint * b1@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * x1@[???]
                       Unresolved local var: __ULong * xe@[???]
                       Unresolved local var: __ULong z@[???] */
  iVar9 = k >> 5;
  iVar10 = iVar9 + b->_wds + 1;
  k_00 = b->_k;
  for (iVar6 = b->_maxwds; iVar6 < iVar10; iVar6 = iVar6 << 1) {
    k_00 = k_00 + 1;
  }
  p_Var1 = _Balloc(ptr,k_00);
  p_Var5 = p_Var1->_x;
  if (0 < iVar9) {
    iVar6 = 0;
    do {
      iVar6 = iVar6 + 1;
      *p_Var5 = 0;
      p_Var5 = p_Var5 + 1;
    } while (iVar9 != iVar6);
  }
  p_Var3 = b->_x;
  uVar7 = k & 0x1f;
  p_Var8 = p_Var3 + b->_wds;
  if (uVar7 == 0) {
    do {
      p_Var4 = p_Var3 + 1;
      *p_Var5 = *p_Var3;
      if (p_Var8 <= p_Var4) break;
      p_Var3 = p_Var3 + 2;
      p_Var5[1] = *p_Var4;
      p_Var5 = p_Var5 + 2;
    } while (p_Var3 < p_Var8);
  }
  else {
    uVar2 = 0;
    do {
      *p_Var5 = uVar2 | *p_Var3 << uVar7;
      uVar2 = *p_Var3;
      p_Var3 = p_Var3 + 1;
      p_Var5 = p_Var5 + 1;
      uVar2 = uVar2 >> (0x20 - uVar7 & 0x1f);
    } while (p_Var3 < p_Var8);
    *p_Var5 = uVar2;
    if (uVar2 != 0) {
      iVar10 = iVar10 + 1;
    }
  }
  p_Var1->_wds = iVar10 + -1;
  _Bfree(ptr,b);
  return p_Var1;
}



----------------------------------------

// Function: __multiply @ 08993540

_Bigint * __multiply(_reent *ptr,_Bigint *a,_Bigint *b)

{
  _Bigint *p_Var1;
  __ULong *p_Var2;
  uint uVar3;
  int *piVar4;
  __ULong *p_Var5;
  uint uVar6;
  __ULong *p_Var7;
  uint uVar8;
  __ULong _Var9;
  __ULong *p_Var10;
  uint uVar11;
  __ULong *p_Var12;
  __ULong *p_Var13;
  int iVar14;
  _Bigint *p_Var15;
  int iVar16;
  int iVar17;
  __ULong *p_Var18;
  int iVar19;
  
                    /* Unresolved local var: _Bigint * c@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: int wa@[???]
                       Unresolved local var: int wb@[???]
                       Unresolved local var: int wc@[???]
                       Unresolved local var: __ULong carry@[???]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: __ULong z@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong * xa@[???]
                       Unresolved local var: __ULong * xae@[DW_OP_reg12(t4)]
                       Unresolved local var: __ULong * xb@[DW_OP_reg11(t3)]
                       Unresolved local var: __ULong * xbe@[???]
                       Unresolved local var: __ULong * xc@[???]
                       Unresolved local var: __ULong * xc0@[DW_OP_reg13(t5)]
                       Unresolved local var: __ULong z2@[???] */
  iVar16 = b->_wds;
  p_Var15 = a;
  iVar17 = iVar16;
  iVar19 = a->_wds;
  if (a->_wds < iVar16) {
    iVar17 = a->_wds;
    p_Var15 = b;
    b = a;
    iVar19 = iVar16;
  }
  iVar14 = iVar19 + iVar17;
  iVar16 = p_Var15->_k;
  if (p_Var15->_maxwds < iVar14) {
    iVar16 = iVar16 + 1;
  }
  p_Var1 = _Balloc(ptr,iVar16);
  p_Var5 = p_Var1->_x;
  p_Var13 = p_Var5 + iVar14;
  if (p_Var5 < p_Var13) {
    *p_Var5 = 0;
    p_Var2 = p_Var5;
    while (p_Var2 = p_Var2 + 1, p_Var2 < p_Var13) {
      *p_Var2 = 0;
    }
  }
  p_Var2 = b->_x;
  p_Var18 = p_Var2 + iVar17;
  p_Var12 = p_Var15->_x;
  for (; p_Var2 < p_Var18; p_Var2 = p_Var2 + 1) {
    uVar3 = *p_Var2;
    uVar11 = uVar3 & 0xffff;
    if (uVar11 != 0) {
      uVar3 = 0;
      p_Var7 = p_Var5;
      p_Var10 = p_Var12;
      do {
        uVar8 = *p_Var10;
        uVar6 = *p_Var7;
        p_Var10 = p_Var10 + 1;
        uVar3 = uVar11 * (uVar8 & 0xffff) + uVar3 + (uVar6 & 0xffff);
        *(short *)p_Var7 = (short)uVar3;
        uVar3 = (uVar3 >> 0x10) + uVar11 * (uVar8 >> 0x10) + (uVar6 >> 0x10);
        *(short *)((int)p_Var7 + 2) = (short)uVar3;
        p_Var7 = p_Var7 + 1;
        uVar3 = uVar3 >> 0x10;
      } while (p_Var10 < p_Var12 + iVar19);
      *p_Var7 = uVar3;
      uVar3 = *p_Var2;
    }
    uVar3 = uVar3 >> 0x10;
    if (uVar3 != 0) {
      uVar8 = *p_Var5;
      uVar11 = 0;
      p_Var7 = p_Var5;
      _Var9 = uVar8;
      p_Var10 = p_Var12;
      do {
        uVar6 = *p_Var10;
        *(short *)p_Var7 = (short)_Var9;
        p_Var10 = p_Var10 + 1;
        uVar11 = uVar3 * (uVar6 & 0xffff) + uVar11 + (uVar8 >> 0x10);
        *(short *)((int)p_Var7 + 2) = (short)uVar11;
        p_Var7 = p_Var7 + 1;
        uVar8 = *p_Var7;
        _Var9 = (uVar11 >> 0x10) + uVar3 * (uVar6 >> 0x10) + (uVar8 & 0xffff);
        uVar11 = _Var9 >> 0x10;
      } while (p_Var10 < p_Var12 + iVar19);
      *p_Var7 = _Var9;
    }
    p_Var5 = p_Var5 + 1;
  }
  if (iVar14 < 1) {
    p_Var1->_wds = iVar14;
  }
  else {
    piVar4 = (int *)(p_Var13 + -1);
    if (p_Var13[-1] == 0) {
      do {
        iVar14 = iVar14 + -1;
        piVar4 = piVar4 + -1;
        if (iVar14 == 0) {
          p_Var1->_wds = 0;
          return p_Var1;
        }
      } while (*piVar4 == 0);
      p_Var1->_wds = iVar14;
    }
    else {
      p_Var1->_wds = iVar14;
    }
  }
  return p_Var1;
}



----------------------------------------

// Function: __i2b @ 0899375c

_Bigint * __i2b(_reent *ptr,int i)

{
  _Bigint *p_Var1;
  
                    /* Unresolved local var: _Bigint * b@[???] */
  p_Var1 = _Balloc(ptr,1);
  p_Var1->_wds = 1;
  p_Var1->_x[0] = i;
  return p_Var1;
}



----------------------------------------

// Function: __multadd @ 08993790

_Bigint * __multadd(_reent *ptr,_Bigint *b,int m,int a)

{
  _Bigint *p_Var1;
  uint uVar2;
  uint uVar3;
  __ULong *p_Var4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int wds@[???]
                       Unresolved local var: __ULong * x@[???]
                       Unresolved local var: __ULong y@[???]
                       Unresolved local var: __ULong xi@[???]
                       Unresolved local var: __ULong z@[???]
                       Unresolved local var: _Bigint * b1@[???] */
  iVar6 = b->_wds;
  p_Var4 = b->_x;
  iVar5 = 0;
  do {
    iVar5 = iVar5 + 1;
    uVar2 = (*p_Var4 & 0xffff) * m + a;
    uVar3 = (*p_Var4 >> 0x10) * m + (uVar2 >> 0x10);
    *p_Var4 = uVar3 * 0x10000 + (uVar2 & 0xffff);
    a = uVar3 >> 0x10;
    p_Var4 = p_Var4 + 1;
  } while (iVar5 < iVar6);
  if (a != 0) {
    if (b->_maxwds <= iVar6) {
      p_Var1 = _Balloc(ptr,b->_k + 1);
      memcpy(&p_Var1->_sign,&b->_sign,b->_wds * 4 + 8);
      _Bfree(ptr,b);
      b = p_Var1;
    }
    b->_x[iVar6] = a;
    b->_wds = iVar6 + 1;
  }
  return b;
}



----------------------------------------

// Function: __pow5mult @ 089938a0

_Bigint * __pow5mult(_reent *ptr,_Bigint *b,int k)

{
  uint uVar1;
  _Bigint *p_Var2;
  _Bigint *b_00;
  uint uVar3;
  
                    /* Unresolved local var: _Bigint * b1@[???]
                       Unresolved local var: _Bigint * p5@[???]
                       Unresolved local var: _Bigint * p51@[???]
                       Unresolved local var: int i@[???] */
  if ((k & 3U) != 0) {
    b = __multadd(ptr,b,*(int *)((int)__mprec_tinytens + (k & 3U) * 4 + 0x24),0);
  }
  uVar3 = k >> 2;
  if (uVar3 != 0) {
    p_Var2 = ptr->_p5s;
    if (ptr->_p5s == (_Bigint *)0x0) {
      p_Var2 = __i2b(ptr,0x271);
      ptr->_p5s = p_Var2;
      p_Var2->_next = (_Bigint *)0x0;
    }
    while( true ) {
      b_00 = p_Var2;
      uVar1 = uVar3 & 1;
      uVar3 = (int)uVar3 >> 1;
      if (uVar1 != 0) {
        p_Var2 = __multiply(ptr,b,b_00);
        _Bfree(ptr,b);
        b = p_Var2;
      }
      if (uVar3 == 0) break;
      p_Var2 = b_00->_next;
      if (b_00->_next == (_Bigint *)0x0) {
        p_Var2 = __multiply(ptr,b_00,b_00);
        b_00->_next = p_Var2;
        p_Var2->_next = (_Bigint *)0x0;
      }
    }
  }
  return b;
}



----------------------------------------

// Function: __s2b @ 089939cc

/* WARNING: Removing unreachable block (ram,0x089939dc) */

_Bigint * __s2b(_reent *ptr,char *s,int nd0,int nd,__ULong y9)

{
  _Bigint *b;
  char *pcVar1;
  int iVar2;
  int iVar3;
  __ULong in_t0;
  char *pcVar4;
  int iVar5;
  
                    /* Unresolved local var: _Bigint * b@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int k@[???]
                       Unresolved local var: long x@[???]
                       Unresolved local var: long y@[???] */
  iVar5 = (nd + 8) / 9;
  if (iVar5 < 2) {
    iVar3 = 0;
  }
  else {
    iVar3 = 0;
    iVar2 = 1;
    do {
      iVar2 = iVar2 << 1;
      iVar3 = iVar3 + 1;
    } while (iVar2 < iVar5);
  }
  b = _Balloc(ptr,iVar3);
  b->_x[0] = in_t0;
  b->_wds = 1;
  if (nd0 < 10) {
    pcVar1 = s + 10;
    iVar5 = 9;
  }
  else {
    iVar5 = 9;
    do {
      iVar3 = iVar5;
      b = __multadd(ptr,b,10,s[iVar3] + -0x30);
      iVar5 = iVar3 + 1;
    } while (nd0 != iVar5);
    pcVar1 = s + iVar3 + 2;
  }
  if (iVar5 < nd) {
    pcVar4 = pcVar1 + (nd - iVar5);
    do {
      b = __multadd(ptr,b,10,*pcVar1 + -0x30);
      pcVar1 = pcVar1 + 1;
    } while (pcVar4 != pcVar1);
  }
  return b;
}



----------------------------------------

// Function: _read_r @ 08993af0

_ssize_t _read_r(_reent *ptr,int fd,void *buf,size_t cnt)

{
  int iVar1;
  
                    /* Unresolved local var: _ssize_t ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _read(fd,buf,cnt);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: __isinfd @ 08993b60

int __isinfd(double x)

{
  uint uVar1;
  uint in_a0;
  uint in_a1;
  
                    /* Unresolved local var: __int32_t hx@[???]
                       Unresolved local var: __int32_t lx@[???]
                       Unresolved local var: ieee_double_shape_type ew_u@[???] */
  uVar1 = 0x7ff00000 - ((-in_a0 | in_a0) >> 0x1f | in_a1 & 0x7fffffff);
  return ((int)(uVar1 | -uVar1) >> 0x1f) + 1;
}



----------------------------------------

// Function: nanf @ 08993ba4

float nanf(char *unused)

{
                    /* Unresolved local var: float x@[???] */
  return DAT_089ed300;
}



----------------------------------------

// Function: stat @ 08993bb4

int stat(char *file,stat *pstat)

{
  int iVar1;
  time_t tVar2;
  int *piVar3;
  uint uVar4;
  uint *puVar5;
  uint uVar6;
  undefined4 uVar7;
  undefined4 in_a3;
  ScePspDateTime psp_time;
  ScePspDateTime psp_time_00;
  ScePspDateTime psp_time_01;
  uint auStack_470 [2];
  undefined4 uStack_468;
  undefined1 auStack_460 [16];
  undefined1 auStack_450 [16];
  undefined1 auStack_440 [40];
  char acStack_418 [1032];
  
  puVar5 = auStack_470;
  iVar1 = __psp_path_absolute(file,acStack_418,0x400);
  if (iVar1 < 0) {
    piVar3 = __errno();
    iVar1 = -1;
    *piVar3 = 0x5b;
  }
  else {
    uVar7 = 0x3c;
    memset(pstat,0,0x3c);
    iVar1 = sceIoGetstat(acStack_418);
    if (iVar1 < 0) {
      iVar1 = __psp_set_errno(iVar1);
      return iVar1;
    }
    psp_time._0_4_ = auStack_460;
    psp_time._4_4_ = puVar5;
    psp_time.microsecond = in_a3;
    psp_time.minute = (short)uVar7;
    psp_time.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time);
    *(time_t *)(pstat + 0x24) = tVar2;
    psp_time_00._0_4_ = auStack_450;
    psp_time_00._4_4_ = puVar5;
    psp_time_00.microsecond = in_a3;
    psp_time_00.minute = (short)uVar7;
    psp_time_00.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time_00);
    *(time_t *)(pstat + 0x14) = tVar2;
    psp_time_01._0_4_ = auStack_440;
    psp_time_01._4_4_ = puVar5;
    psp_time_01.microsecond = in_a3;
    psp_time_01.minute = (short)uVar7;
    psp_time_01.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time_01);
    uVar6 = 0x4000;
    *(time_t *)(pstat + 0x1c) = tVar2;
    uVar4 = auStack_470[0] & 0xf000;
    auStack_470[0] = auStack_470[0] & 0xfff;
    if (uVar4 == 0x4000) {
      auStack_470[0] = auStack_470[0] | 0xa000;
      uVar6 = 0;
    }
    else if (uVar4 == 0x2000) {
      auStack_470[0] = auStack_470[0] | 0x8000;
      uVar6 = 0;
    }
    else if (uVar4 != 0x1000) {
      uVar6 = 0;
    }
    iVar1 = 0;
    *(uint *)(pstat + 4) = uVar6 | auStack_470[0];
    *(undefined4 *)(pstat + 0x10) = uStack_468;
  }
  return iVar1;
}



----------------------------------------

// Function: __psp_pipe_nonblocking_write @ 08993bbc

int __psp_pipe_nonblocking_write(int fd,void *buf,size_t len)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  size_t sVar4;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: int sceuid@[???]
                       Unresolved local var: char * cbuf@[???] */
  if ((uint)fd < 0x400) {
    p_Var3 = __psp_descriptormap[fd];
    if (p_Var3 != (__psp_descriptormap_type *)0x0) {
      sVar4 = 0x200;
      if (len < 0x201) {
        sVar4 = len;
      }
      if (p_Var3->type == '\x01') {
        iVar2 = sceKernelTrySendMsgPipe(p_Var3->sce_descriptor,buf,sVar4,0);
        if (iVar2 == 0) {
          return sVar4;
        }
        if (iVar2 == -0x7ffdfe4d) {
          piVar1 = __errno();
          *piVar1 = 0xb;
          return -1;
        }
        iVar2 = __psp_set_errno(iVar2);
        return iVar2;
      }
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: __psp_pipe_write @ 08993c80

int __psp_pipe_write(int fd,void *buf,size_t len)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  size_t sVar4;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: int sceuid@[???]
                       Unresolved local var: char * cbuf@[???] */
  if ((uint)fd < 0x400) {
    p_Var3 = __psp_descriptormap[fd];
    if (p_Var3 != (__psp_descriptormap_type *)0x0) {
      sVar4 = 0x200;
      if (len < 0x201) {
        sVar4 = len;
      }
      if (p_Var3->type == '\x01') {
        iVar2 = sceKernelSendMsgPipe(p_Var3->sce_descriptor,buf,sVar4,0);
        if (iVar2 == 0) {
          return sVar4;
        }
        iVar2 = __psp_set_errno(iVar2);
        return iVar2;
      }
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: __psp_pipe_read @ 08993d20

int __psp_pipe_read(int fd,void *buf,size_t len)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  size_t sVar4;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: int sceuid@[???]
                       Unresolved local var: int size@[???] */
  if ((uint)fd < 0x400) {
    p_Var3 = __psp_descriptormap[fd];
    if (p_Var3 != (__psp_descriptormap_type *)0x0) {
      sVar4 = 0x200;
      if (len < 0x201) {
        sVar4 = len;
      }
      if (p_Var3->type == '\x01') {
        iVar2 = sceKernelReceiveMsgPipe(p_Var3->sce_descriptor,buf,sVar4,0);
        if (iVar2 == 0) {
          return sVar4;
        }
        iVar2 = __psp_set_errno(iVar2);
        return iVar2;
      }
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: __psp_pipe_close @ 08993dc0

int __psp_pipe_close(int fd)

{
  int *piVar1;
  int code;
  __psp_descriptormap_type *p_Var2;
  int iVar3;
  
                    /* Unresolved local var: int ret@[???] */
  if ((((uint)fd < 0x400) &&
      (p_Var2 = __psp_descriptormap[fd], p_Var2 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var2->type == '\x01')) {
    if (p_Var2->ref_count != 1) {
      __psp_fdman_release_descriptor(fd);
      return 0;
    }
    code = sceKernelDeleteMsgPipe(p_Var2->sce_descriptor);
    __psp_fdman_release_descriptor(fd);
    iVar3 = 0;
    if (code < 0) {
      iVar3 = __psp_set_errno(code);
      return iVar3;
    }
  }
  else {
    piVar1 = __errno();
    iVar3 = -1;
    *piVar1 = 9;
  }
  return iVar3;
}



----------------------------------------

// Function: pipe @ 08993e90

int pipe(int *fildes)

{
  u32 uVar1;
  int iVar2;
  int *piVar3;
  __psp_descriptormap_type *p_Var4;
  char acStack_38 [32];
  
                    /* Unresolved local var: char[32] name@[???]
                       Unresolved local var: SceUID uid@[???] */
  pipe::iIndex = pipe::iIndex + 1;
  sprintf(acStack_38,"__psp_pipe_%02d",pipe::iIndex);
  uVar1 = sceKernelCreateMsgPipe(acStack_38,2,0,0x200);
  if ((int)uVar1 < 0) {
    piVar3 = __errno();
    *piVar3 = 0xe;
  }
  else {
    iVar2 = __psp_fdman_get_new_descriptor();
    *fildes = iVar2;
    if (iVar2 != -1) {
      p_Var4 = __psp_descriptormap[iVar2];
      p_Var4->type = '\x01';
      iVar2 = *fildes;
      p_Var4->sce_descriptor = uVar1;
      iVar2 = __psp_fdman_get_dup_descriptor(iVar2);
      fildes[1] = iVar2;
      if (iVar2 != -1) {
        __psp_descriptormap[iVar2]->sce_descriptor = uVar1;
        return 0;
      }
    }
    sceKernelDeleteMsgPipe(uVar1);
    piVar3 = __errno();
    *piVar3 = 0xe;
  }
  return -1;
}



----------------------------------------

// Function: __psp_pipe_peekmsgsize @ 08993fac

size_t __psp_pipe_peekmsgsize(int fd)

{
  int *piVar1;
  int iVar2;
  size_t sVar3;
  __psp_descriptormap_type *p_Var4;
  undefined4 local_40 [10];
  int local_18;
  int local_14;
  
                    /* Unresolved local var: SceKernelMppInfo info@[???] */
  local_40[0] = 0x38;
  if ((((uint)fd < 0x400) &&
      (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var4->type == '\x01')) {
    iVar2 = sceKernelReferMsgPipeStatus(p_Var4->sce_descriptor,local_40);
    sVar3 = 0xffffffff;
    if (iVar2 == 0) {
      sVar3 = local_18 - local_14;
    }
  }
  else {
    piVar1 = __errno();
    sVar3 = 0xffffffff;
    *piVar1 = 9;
  }
  return sVar3;
}



----------------------------------------

// Function: __psp_pipe_nonblocking_read @ 08994030

int __psp_pipe_nonblocking_read(int fd,void *buf,size_t len)

{
  int *piVar1;
  size_t sVar2;
  int iVar3;
  __psp_descriptormap_type *p_Var4;
  u32 uVar5;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: int sceuid@[???]
                       Unresolved local var: int size@[???] */
  if ((((uint)fd < 0x400) &&
      (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var4->type == '\x01')) {
    uVar5 = p_Var4->sce_descriptor;
    sVar2 = __psp_pipe_peekmsgsize(fd);
    if ((int)sVar2 < 1) {
      if (sVar2 != 0) goto LAB_0899407c;
    }
    else {
      if (sVar2 <= len) {
        len = sVar2;
      }
      iVar3 = sceKernelTryReceiveMsgPipe(uVar5,buf,len,0);
      if (iVar3 == 0) {
        return len;
      }
      if (iVar3 != -0x7ffdfe4c) {
        iVar3 = __psp_set_errno(iVar3);
        return iVar3;
      }
    }
    piVar1 = __errno();
    *piVar1 = 0xb;
  }
  else {
LAB_0899407c:
    piVar1 = __errno();
    *piVar1 = 9;
  }
  return -1;
}



----------------------------------------

// Function: __psp_get_drive @ 08994130

int __psp_get_drive(char *d)

{
  char cVar1;
  int iVar2;
  
                    /* Unresolved local var: int i@[DW_OP_reg6(a2)] */
  cVar1 = *d;
  iVar2 = 0;
  while( true ) {
    if (cVar1 == '\0') {
      return -1;
    }
    if ((0x19 < (byte)(cVar1 + 0x9fU)) && (9 < (byte)(cVar1 - 0x30U))) break;
    iVar2 = iVar2 + 1;
    cVar1 = d[iVar2];
  }
  if (cVar1 != ':') {
    return -1;
  }
  return iVar2 + 1;
}



----------------------------------------

// Function: __psp_safe_strcpy @ 08994190

int __psp_safe_strcpy(char *out,char *in,int maxlen)

{
  char cVar1;
  
  if (maxlen < 1) {
    return 0;
  }
  cVar1 = *in;
  while( true ) {
    if (cVar1 == '\0') {
      *out = '\0';
      return 1;
    }
    maxlen = maxlen + -1;
    *out = cVar1;
    in = in + 1;
    out = out + 1;
    if (maxlen == 0) break;
    cVar1 = *in;
  }
  return 0;
}



----------------------------------------

// Function: __psp_safe_strcat @ 089941d4

int __psp_safe_strcat(char *out,char *in,int maxlen)

{
  char cVar1;
  int iVar2;
  
  cVar1 = *out;
  while (cVar1 != '\0') {
    out = out + 1;
    maxlen = maxlen + -1;
    cVar1 = *out;
  }
  iVar2 = __psp_safe_strcpy(out,in,maxlen);
  return iVar2;
}



----------------------------------------

// Function: __psp_path_normalize @ 089941f8

int __psp_path_normalize(char *out,int len)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  char *pcVar4;
  char cVar5;
  char cVar6;
  char *pcVar7;
  int iVar8;
  char *pcVar9;
  int iVar10;
  char *pcVar11;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: int first@[???]
                       Unresolved local var: int next@[???] */
  iVar3 = __psp_safe_strcat(out,"/",len);
  if (iVar3 == 0) {
    return -10;
  }
  cVar5 = out[1];
  pcVar11 = out + 1;
  if (cVar5 == '\0') {
LAB_089942ac:
    cVar5 = *out;
  }
  else {
    iVar3 = 0;
    pcVar7 = out;
    do {
      cVar2 = *pcVar7;
      while ((cVar2 == '/' && (cVar5 == '/'))) {
        if (out[iVar3 + 1] != '\0') {
          pcVar7 = pcVar7 + 2;
          pcVar4 = out + iVar3 + 1;
          do {
            pcVar9 = pcVar7;
            *pcVar4 = *pcVar9;
            pcVar7 = pcVar9 + 1;
            pcVar4 = pcVar9;
          } while (*pcVar9 != '\0');
        }
        pcVar7 = out + iVar3;
        cVar5 = pcVar7[1];
        if (cVar5 == '\0') goto LAB_089942ac;
        cVar2 = *pcVar7;
      }
      iVar3 = iVar3 + 1;
      pcVar7 = out + iVar3;
      cVar5 = pcVar7[1];
    } while (cVar5 != '\0');
    cVar5 = *out;
  }
  iVar3 = 0;
  if (((cVar5 != '\0') && (cVar2 = *pcVar11, cVar2 != '\0')) && (cVar6 = out[2], cVar6 != '\0')) {
    do {
      if (((cVar5 == '/') && (cVar2 == '.')) && (cVar6 == '/')) {
        if (out[iVar3 + 1] != '\0') {
          pcVar7 = out + iVar3 + 2;
          pcVar4 = out + iVar3 + 1;
          do {
            pcVar9 = pcVar7;
            *pcVar4 = pcVar9[1];
            pcVar7 = pcVar9 + 1;
            pcVar4 = pcVar9;
          } while (*pcVar9 != '\0');
        }
        pcVar7 = out + iVar3;
        cVar5 = *pcVar7;
        if (cVar5 == '\0') break;
        cVar2 = pcVar7[1];
      }
      else {
        iVar3 = iVar3 + 1;
        pcVar7 = out + iVar3;
        cVar5 = *pcVar7;
        if (cVar5 == '\0') break;
        cVar2 = pcVar7[1];
      }
      if ((cVar2 == '\0') || (cVar6 = pcVar7[2], cVar6 == '\0')) break;
    } while( true );
  }
  iVar3 = 0;
  cVar5 = out[1];
  iVar10 = 0;
  pcVar7 = out;
  if (cVar5 == '.') goto LAB_08994428;
  iVar8 = 1;
LAB_08994388:
  pcVar4 = out + iVar8;
LAB_0899438c:
  cVar5 = *pcVar4;
  iVar10 = iVar3;
  do {
    if (cVar5 == '\0') {
LAB_089943c0:
      if (*pcVar11 != '\0') {
        for (iVar3 = 2; pcVar11 = out + iVar3, *pcVar11 != '\0'; iVar3 = iVar3 + 1) {
        }
        if (iVar3 < 1) {
          return 0;
        }
      }
      if (pcVar11[-1] != '/') {
        return 0;
      }
      pcVar11[-1] = '\0';
      return 0;
    }
    iVar3 = iVar8;
    if (cVar5 != '/') {
      cVar5 = pcVar7[2];
      while( true ) {
        iVar8 = iVar8 + 1;
        if (cVar5 == '\0') goto LAB_089943c0;
        iVar3 = iVar8;
        if (cVar5 == '/') break;
        cVar5 = pcVar7[3];
        pcVar7 = pcVar7 + 1;
      }
    }
    while( true ) {
      pcVar7 = out + iVar3;
      cVar5 = pcVar7[1];
      iVar8 = iVar3 + 1;
      if (cVar5 != '.') goto LAB_08994388;
LAB_08994428:
      iVar8 = iVar3 + 1;
      if (pcVar7[2] == '\0') goto LAB_08994388;
      pcVar4 = out + iVar8;
      if (pcVar7[2] != cVar5) goto LAB_0899438c;
      if (pcVar7[3] == '\0') break;
      pcVar4 = out + iVar8;
      if (pcVar7[3] != '/') goto LAB_0899438c;
      if (out[iVar10 + 1] != '\0') {
        pcVar4 = out + iVar10 + 1;
        pcVar9 = out + iVar10 + 2;
        do {
          pcVar1 = pcVar7 + 4;
          pcVar7 = pcVar7 + 1;
          *pcVar4 = *pcVar1;
          cVar5 = *pcVar9;
          pcVar4 = pcVar9;
          pcVar9 = pcVar9 + 1;
        } while (cVar5 != '\0');
      }
      iVar10 = 0;
      iVar3 = 0;
    }
    cVar5 = *pcVar4;
    iVar10 = iVar3;
  } while( true );
}



----------------------------------------

// Function: __psp_path_absolute @ 089944bc

int __psp_path_absolute(char *in,char *out,int len)

{
  int iVar1;
  size_t sVar2;
  int iVar3;
  
                    /* Unresolved local var: int dr@[???] */
  iVar1 = __psp_get_drive(in);
  if ((iVar1 < 1) || (in[iVar1] != '/')) {
    if (*in == '/') {
      sVar2 = strlen(__psp_cwd);
      if ((uint)len <= sVar2) {
        return -2;
      }
      strcpy(out,__psp_cwd);
      iVar1 = __psp_get_drive(out);
      out[iVar1] = '\0';
      iVar3 = __psp_safe_strcat(out,in,len);
      iVar1 = -3;
    }
    else {
      sVar2 = strlen(__psp_cwd);
      if ((uint)len <= sVar2) {
        return -4;
      }
      strcpy(out,__psp_cwd);
      iVar1 = __psp_safe_strcat(out,"/",len);
      if (iVar1 == 0) {
        return -6;
      }
      iVar3 = __psp_safe_strcat(out,in,len);
      iVar1 = -7;
    }
  }
  else {
    iVar3 = __psp_safe_strcpy(out,in,len);
    iVar1 = -1;
  }
  if (iVar3 == 0) {
    return iVar1;
  }
  iVar1 = __psp_get_drive(out);
  iVar1 = __psp_path_normalize(out + iVar1,len - iVar1);
  return iVar1;
}



----------------------------------------

// Function: __psp_init_cwd @ 08994648

void __psp_init_cwd(char *argv_0)

{
  char *pcVar1;
  char acStack_410 [1024];
  undefined1 local_10;
  
                    /* Unresolved local var: char[1025] base_path@[???]
                       Unresolved local var: char * end@[???] */
  if (argv_0 != (char *)0x0) {
    strncpy(acStack_410,argv_0,0x400);
    local_10 = 0;
    pcVar1 = strrchr(acStack_410,0x2f);
    if (pcVar1 != (char *)0x0) {
      pcVar1[1] = '\0';
      chdir(acStack_410);
    }
  }
  return;
}



----------------------------------------

// Function: __psp_set_errno @ 08994698

int __psp_set_errno(int code)

{
  uint *puVar1;
  uint uVar2;
  
  if ((code & 0x80010000U) == 0x80010000) {
    puVar1 = (uint *)__errno();
    uVar2 = code & 0xffff;
    code = -1;
    *puVar1 = uVar2;
  }
  return code;
}



----------------------------------------

// Function: _close @ 089946e0

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x00000000) */

int _close(int fd)

{
  u8 uVar1;
  u32 uVar2;
  int *piVar3;
  int iVar4;
  __psp_descriptormap_type *p_Var5;
  
                    /* Unresolved local var: int ret@[???] */
  if ((0x3ff < (uint)fd) ||
     (p_Var5 = __psp_descriptormap[fd], p_Var5 == (__psp_descriptormap_type *)0x0)) {
    piVar3 = __errno();
    *piVar3 = 9;
    return -1;
  }
  uVar1 = p_Var5->type;
  if (uVar1 == '\x01') {
    iVar4 = __psp_pipe_close(fd);
    return iVar4;
  }
  if (uVar1 == '\0') {
    uVar2 = p_Var5->ref_count;
  }
  else {
    if ((uVar1 == '\x02') || (uVar1 != '\x03')) {
      piVar3 = __errno();
      *piVar3 = 9;
      return -1;
    }
    uVar2 = p_Var5->ref_count;
  }
  if (uVar2 == 1) {
    iVar4 = sceIoClose(p_Var5->sce_descriptor);
    iVar4 = __psp_set_errno(iVar4);
  }
  else {
    iVar4 = 0;
  }
  __psp_fdman_release_descriptor(fd);
  return iVar4;
}



----------------------------------------

// Function: _lseek @ 08994804

off_t _lseek(int fd,off_t offset,int whence)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  
  if ((((uint)fd < 0x400) &&
      (p_Var3 = __psp_descriptormap[fd], p_Var3 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var3->type == '\0')) {
    iVar2 = sceIoLseek(p_Var3->sce_descriptor,offset,offset,offset >> 0x1f);
    iVar2 = __psp_set_errno(iVar2);
    return iVar2;
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: _read @ 0899487c

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x00000000) */

int _read(int fd,void *buf,size_t size)

{
  u8 uVar1;
  int *piVar2;
  int iVar3;
  __psp_descriptormap_type *p_Var4;
  
  if (((uint)fd < 0x400) &&
     (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) {
    uVar1 = p_Var4->type;
    if (uVar1 == '\x01') {
      if ((p_Var4->flags & 0x4000) == 0) {
        iVar3 = __psp_pipe_read(fd,buf,size);
        return iVar3;
      }
      iVar3 = __psp_pipe_nonblocking_read(fd,buf,size);
      return iVar3;
    }
    if ((uVar1 == '\0') || ((uVar1 != '\x02' && (uVar1 == '\x03')))) {
      iVar3 = sceIoRead(p_Var4->sce_descriptor);
      iVar3 = __psp_set_errno(iVar3);
      return iVar3;
    }
  }
  piVar2 = __errno();
  *piVar2 = 9;
  return -1;
}



----------------------------------------

// Function: psp_to_epoch_time @ 08994940

time_t psp_to_epoch_time(ScePspDateTime psp_time)

{
  time_t tVar1;
  ushort *puVar2;
  tm local_30;
  
                    /* Unresolved local var: tm conv_time@[???] */
  puVar2 = psp_time._0_4_;
  local_30.tm_mon = (int)puVar2[1];
  local_30.tm_year = (int)*puVar2;
  local_30.tm_sec = (int)puVar2[5];
  local_30.tm_min = (int)puVar2[4];
  local_30.tm_hour = (int)puVar2[3];
  local_30.tm_mday = (int)puVar2[2];
  local_30.tm_isdst = -1;
  tVar1 = mktime(&local_30);
  return tVar1;
}



----------------------------------------

// Function: _stat @ 08994994

int _stat(char *filename,stat *buf)

{
  int iVar1;
  time_t tVar2;
  int *piVar3;
  uint uVar4;
  uint *puVar5;
  uint uVar6;
  undefined4 uVar7;
  undefined4 in_a3;
  ScePspDateTime psp_time;
  ScePspDateTime psp_time_00;
  ScePspDateTime psp_time_01;
  uint local_470 [2];
  off_t local_468;
  undefined1 auStack_460 [16];
  undefined1 auStack_450 [16];
  undefined1 auStack_440 [40];
  char acStack_418 [1032];
  
                    /* Unresolved local var: SceIoStat psp_stat@[???]
                       Unresolved local var: char[1025] dest@[???]
                       Unresolved local var: int ret@[???] */
  puVar5 = local_470;
  iVar1 = __psp_path_absolute(filename,acStack_418,0x400);
  if (iVar1 < 0) {
    piVar3 = __errno();
    iVar1 = -1;
    *piVar3 = 0x5b;
  }
  else {
    uVar7 = 0x3c;
    memset(buf,0,0x3c);
    iVar1 = sceIoGetstat(acStack_418);
    if (iVar1 < 0) {
      iVar1 = __psp_set_errno(iVar1);
      return iVar1;
    }
    psp_time._0_4_ = auStack_460;
    psp_time._4_4_ = puVar5;
    psp_time.microsecond = in_a3;
    psp_time.minute = (short)uVar7;
    psp_time.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time);
    buf->st_ctime = tVar2;
    psp_time_00._0_4_ = auStack_450;
    psp_time_00._4_4_ = puVar5;
    psp_time_00.microsecond = in_a3;
    psp_time_00.minute = (short)uVar7;
    psp_time_00.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time_00);
    buf->st_atime = tVar2;
    psp_time_01._0_4_ = auStack_440;
    psp_time_01._4_4_ = puVar5;
    psp_time_01.microsecond = in_a3;
    psp_time_01.minute = (short)uVar7;
    psp_time_01.second = (short)((uint)uVar7 >> 0x10);
    tVar2 = psp_to_epoch_time(psp_time_01);
    uVar6 = 0x4000;
    buf->st_mtime = tVar2;
    uVar4 = local_470[0] & 0xf000;
    local_470[0] = local_470[0] & 0xfff;
    if (uVar4 == 0x4000) {
      local_470[0] = local_470[0] | 0xa000;
      uVar6 = 0;
    }
    else if (uVar4 == 0x2000) {
      local_470[0] = local_470[0] | 0x8000;
      uVar6 = 0;
    }
    else if (uVar4 != 0x1000) {
      uVar6 = 0;
    }
    iVar1 = 0;
    buf->st_mode = uVar6 | local_470[0];
    buf->st_size = local_468;
  }
  return iVar1;
}



----------------------------------------

// Function: chdir @ 08994aac

int chdir(char *path)

{
  int iVar1;
  int *piVar2;
  char acStack_410 [1032];
  
                    /* Unresolved local var: char[1025] dest@[???]
                       Unresolved local var: SceUID uid@[???] */
  iVar1 = __psp_path_absolute(path,acStack_410,0x400);
  if (iVar1 < 0) {
    piVar2 = __errno();
    iVar1 = -1;
    *piVar2 = 0x5b;
  }
  else {
    iVar1 = sceIoDopen(acStack_410);
    if (iVar1 < 0) {
      piVar2 = __errno();
      iVar1 = -1;
      *piVar2 = 0x14;
    }
    else {
      sceIoDclose(iVar1);
      sceIoChdir(acStack_410);
      strcpy(__psp_cwd,acStack_410);
      iVar1 = 0;
    }
  }
  return iVar1;
}



----------------------------------------

// Function: validate_structure @ 08994b3c

/* WARNING: Removing unreachable block (ram,0x08994d5c) */
/* WARNING: Removing unreachable block (ram,0x08994c7c) */
/* WARNING: Removing unreachable block (ram,0x08994ba8) */
/* WARNING: Removing unreachable block (ram,0x08994bcc) */
/* WARNING: Removing unreachable block (ram,0x08994c9c) */
/* WARNING: Removing unreachable block (ram,0x08994e98) */

void validate_structure(tm *tim_p)

{
  int iVar1;
  div_t *extraout_v1;
  int extraout_v1_00;
  int extraout_v1_01;
  int extraout_v1_02;
  undefined1 *puVar2;
  div_t *pdVar3;
  int in_a2;
  int iVar4;
  uint uVar5;
  uint uVar6;
  int iVar7;
  
                    /* Unresolved local var: div_t res@[???]
                       Unresolved local var: int days_in_feb@[???] */
  if ((div_t *)tim_p->tm_sec < (div_t *)0x3c) {
    pdVar3 = (div_t *)tim_p->tm_min;
  }
  else {
    pdVar3 = div((div_t *)tim_p->tm_sec,0x3c,in_a2);
    pdVar3 = (div_t *)((int)&pdVar3->quot + tim_p->tm_min);
    tim_p->tm_min = (int)pdVar3;
    tim_p->tm_sec = extraout_v1_00;
    if (extraout_v1_00 < 0) {
      pdVar3 = (div_t *)((int)&pdVar3[-1].rem + 3);
      tim_p->tm_sec = extraout_v1_00 + 0x3c;
      tim_p->tm_min = (int)pdVar3;
    }
  }
  if (pdVar3 < (div_t *)0x3c) {
    pdVar3 = (div_t *)tim_p->tm_hour;
  }
  else {
    pdVar3 = div(pdVar3,0x3c,in_a2);
    pdVar3 = (div_t *)((int)&pdVar3->quot + tim_p->tm_hour);
    tim_p->tm_hour = (int)pdVar3;
    tim_p->tm_min = extraout_v1_02;
    if (extraout_v1_02 < 0) {
      pdVar3 = (div_t *)((int)&pdVar3[-1].rem + 3);
      tim_p->tm_min = extraout_v1_02 + 0x3c;
      tim_p->tm_hour = (int)pdVar3;
    }
  }
  if ((div_t *)0x17 < pdVar3) {
    pdVar3 = div(pdVar3,0x18,in_a2);
    in_a2 = (int)&pdVar3->quot + tim_p->tm_mday;
    tim_p->tm_mday = in_a2;
    tim_p->tm_hour = extraout_v1_01;
    if (extraout_v1_01 < 0) {
      in_a2 = in_a2 + -1;
      tim_p->tm_hour = extraout_v1_01 + 0x18;
      tim_p->tm_mday = in_a2;
    }
  }
  pdVar3 = (div_t *)tim_p->tm_mon;
  if ((int)pdVar3 < 0xc) {
    uVar6 = tim_p->tm_year;
  }
  else {
    pdVar3 = div(pdVar3,0xc,in_a2);
    uVar6 = (int)&pdVar3->quot + tim_p->tm_year;
    tim_p->tm_year = uVar6;
    tim_p->tm_mon = (int)extraout_v1;
    pdVar3 = extraout_v1;
    if ((int)extraout_v1 < 0) {
      pdVar3 = (div_t *)&extraout_v1[1].rem;
      uVar6 = uVar6 - 1;
      tim_p->tm_mon = (int)pdVar3;
      tim_p->tm_year = uVar6;
    }
  }
  iVar7 = 0x1c;
  if ((uVar6 & 3) == 0) {
    if ((int)uVar6 % 100 == 0) {
      iVar7 = 0x1d;
      if ((int)(uVar6 + 0x76c) % 400 != 0) {
        iVar7 = 0x1c;
      }
    }
    else {
      iVar7 = 0x1d;
    }
  }
  iVar4 = tim_p->tm_mday;
  if (0 < iVar4) {
LAB_08994bec:
    if (pdVar3 == (div_t *)0x1) goto LAB_08994cc4;
    do {
      uVar5 = uVar6;
      if (iVar4 <= DAYS_IN_MONTH[(int)pdVar3]) {
        return;
      }
      while( true ) {
        iVar1 = iVar7;
        if (pdVar3 != (div_t *)0x1) {
          iVar1 = DAYS_IN_MONTH[(int)pdVar3];
        }
        iVar4 = iVar4 - iVar1;
        pdVar3 = (div_t *)((int)&pdVar3->quot + 1);
        tim_p->tm_mday = iVar4;
        tim_p->tm_mon = (int)pdVar3;
        uVar6 = uVar5;
        if (pdVar3 != (div_t *)0xc) goto LAB_08994bec;
        uVar6 = uVar5 + 1;
        tim_p->tm_year = uVar6;
        tim_p->tm_mon = 0;
        pdVar3 = (div_t *)0x0;
        if ((uVar6 & 3) != 0) {
          iVar7 = 0x1c;
          goto LAB_08994bec;
        }
        if ((int)uVar6 % 100 == 0) {
          iVar7 = 0x1c;
          if ((int)(uVar5 + 0x76d) % 400 != 0) goto LAB_08994bec;
          pdVar3 = (div_t *)tim_p->tm_mon;
        }
        else {
          pdVar3 = (div_t *)tim_p->tm_mon;
        }
        iVar4 = tim_p->tm_mday;
        iVar7 = 0x1d;
        if (pdVar3 != (div_t *)0x1) break;
LAB_08994cc4:
        uVar5 = uVar6;
        if (iVar4 <= iVar7) {
          return;
        }
      }
    } while( true );
  }
  do {
    puVar2 = (undefined1 *)((int)&pdVar3[-1].rem + 3);
    tim_p->tm_mon = (int)puVar2;
    if (puVar2 == (undefined1 *)0xffffffff) {
      uVar5 = uVar6 - 1;
      tim_p->tm_mon = 0xb;
      tim_p->tm_year = uVar5;
      if (((uVar5 & 3) == 0) && (((int)uVar5 % 100 != 0 || ((int)(uVar6 + 0x76b) % 400 == 0)))) {
        puVar2 = (undefined1 *)0xb;
        uVar6 = uVar5;
        iVar1 = 0x1d;
      }
      else {
        puVar2 = (undefined1 *)0xb;
        uVar6 = uVar5;
        iVar1 = 0x1c;
      }
LAB_08994cec:
      iVar7 = DAYS_IN_MONTH[(int)puVar2];
    }
    else {
      iVar1 = iVar7;
      if (puVar2 != (undefined1 *)0x1) goto LAB_08994cec;
    }
    iVar4 = iVar7 + iVar4;
    tim_p->tm_mday = iVar4;
    if (0 < iVar4) {
      return;
    }
    pdVar3 = (div_t *)tim_p->tm_mon;
    iVar7 = iVar1;
  } while( true );
}



----------------------------------------

// Function: mktime @ 08994eb0

/* WARNING: Removing unreachable block (ram,0x08995224) */
/* WARNING: Removing unreachable block (ram,0x08995114) */
/* WARNING: Removing unreachable block (ram,0x08994fc4) */
/* WARNING: Removing unreachable block (ram,0x08994f74) */
/* WARNING: Removing unreachable block (ram,0x08995074) */
/* WARNING: Removing unreachable block (ram,0x089951e0) */
/* WARNING: Removing unreachable block (ram,0x08994f8c) */
/* WARNING: Removing unreachable block (ram,0x089950fc) */
/* WARNING: Removing unreachable block (ram,0x08995150) */
/* WARNING: Removing unreachable block (ram,0x08995178) */

time_t mktime(tm *tim_p)

{
  __tzinfo_type *p_Var1;
  uint uVar2;
  int iVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  
                    /* Unresolved local var: time_t tim@[???]
                       Unresolved local var: long days@[???]
                       Unresolved local var: int year@[???]
                       Unresolved local var: int isdst@[???]
                       Unresolved local var: __tzinfo_type * tz@[???] */
  p_Var1 = __gettzinfo();
  validate_structure(tim_p);
  iVar6 = tim_p->tm_mday + -1 + _DAYS_BEFORE_MONTH[tim_p->tm_mon];
  if (tim_p->tm_mon < 2) {
    uVar5 = tim_p->tm_year;
LAB_08994f28:
    tim_p->tm_yday = iVar6;
  }
  else {
    uVar5 = tim_p->tm_year;
    if (((uVar5 & 3) != 0) || (((int)uVar5 % 100 == 0 && ((int)(uVar5 + 0x76c) % 400 != 0))))
    goto LAB_08994f28;
    iVar6 = iVar6 + 1;
    tim_p->tm_yday = iVar6;
  }
  if (20000 < uVar5 + 10000) {
    return -1;
  }
  if ((int)uVar5 < 0x47) {
    if (0x45 < (int)uVar5) goto LAB_08994fb8;
    if ((int)uVar5 < 0x45) {
      uVar2 = 0x44;
LAB_089950dc:
      iVar6 = iVar6 + -0x16d;
      if (uVar5 != uVar2) {
        while ((uVar2 & 3) == 0) {
          if (((int)uVar2 % 100 == 0) && ((int)(uVar2 + 0x76c) % 400 != 0)) {
            uVar2 = uVar2 - 1;
            goto LAB_089950dc;
          }
          uVar2 = uVar2 - 1;
          iVar6 = iVar6 + -0x16e;
          if (uVar5 == uVar2) goto LAB_0899513c;
        }
        uVar2 = uVar2 - 1;
        goto LAB_089950dc;
      }
LAB_0899513c:
      if (((uVar5 & 3) != 0) || (((int)uVar5 % 100 == 0 && ((int)(uVar5 + 0x76c) % 400 != 0))))
      goto LAB_08995234;
      iVar6 = iVar6 + -0x16e;
    }
    else {
LAB_08995234:
      iVar6 = iVar6 + -0x16d;
    }
    iVar8 = (iVar6 + 4) % 7;
    tim_p->tm_wday = iVar8;
  }
  else {
    uVar2 = 0x47;
LAB_08994f54:
    iVar6 = iVar6 + 0x16d;
    if (uVar5 != uVar2) {
      while ((uVar2 & 3) == 0) {
        if (((int)uVar2 % 100 == 0) && ((int)(uVar2 + 0x76c) % 400 != 0)) {
          uVar2 = uVar2 + 1;
          goto LAB_08994f54;
        }
        uVar2 = uVar2 + 1;
        iVar6 = iVar6 + 0x16e;
        if (uVar5 == uVar2) goto LAB_08994fb8;
      }
      uVar2 = uVar2 + 1;
      goto LAB_08994f54;
    }
LAB_08994fb8:
    iVar8 = (iVar6 + 4) % 7;
    tim_p->tm_wday = iVar8;
  }
  if (iVar8 < 0) {
    tim_p->tm_wday = iVar8 + 7;
  }
  uVar2 = tim_p->tm_isdst;
  iVar6 = tim_p->tm_min * 0x3c + tim_p->tm_sec + tim_p->tm_hour * 0xe10 + iVar6 * 0x15180;
  if (_daylight != 0) {
                    /* Unresolved local var: int y@[???] */
    if (uVar5 + 0x76c == p_Var1->__tzyear) {
      iVar8 = p_Var1->__tzrule[1].change;
    }
    else {
      iVar8 = __tzcalc_limits(uVar5 + 0x76c);
      if (iVar8 == 0) goto LAB_0899503c;
      iVar8 = p_Var1->__tzrule[1].change;
    }
                    /* Unresolved local var: time_t startdst_dst@[???]
                       Unresolved local var: time_t startstd_dst@[???]
                       Unresolved local var: time_t startstd_std@[???] */
    iVar7 = p_Var1->__tzrule[0].offset;
    uVar5 = (uint)(iVar6 < iVar8 - iVar7);
    iVar4 = p_Var1->__tzrule[1].offset;
    if (uVar5 == 0) {
      if (iVar6 < iVar8 - iVar4) goto LAB_0899503c;
      iVar8 = p_Var1->__tznorth;
    }
    else {
      iVar8 = p_Var1->__tznorth;
    }
    iVar3 = p_Var1->__tzrule[0].change - iVar4;
    if (iVar8 == 0) {
      uVar2 = 1;
      if (iVar6 < iVar3) {
        uVar2 = uVar5;
      }
    }
    else {
      uVar2 = uVar5;
      if (iVar6 < iVar3) {
        uVar2 = 0;
      }
    }
    if ((uVar2 ^ tim_p->tm_isdst) == 1) {
                    /* Unresolved local var: int diff@[???] */
      iVar7 = iVar7 - iVar4;
      if (uVar2 == 0) {
        iVar7 = -iVar7;
      }
      iVar6 = iVar6 + iVar7;
      tim_p->tm_sec = tim_p->tm_sec + iVar7;
      validate_structure(tim_p);
    }
  }
LAB_0899503c:
  if (uVar2 == 1) {
    iVar8 = p_Var1->__tzrule[1].offset;
  }
  else {
    iVar8 = p_Var1->__tzrule[0].offset;
  }
  tim_p->tm_isdst = uVar2;
  return iVar6 + iVar8;
}



----------------------------------------

// Function: __tzcalc_limits @ 08995290

/* WARNING: Removing unreachable block (ram,0x0899532c) */
/* WARNING: Removing unreachable block (ram,0x0899530c) */
/* WARNING: Removing unreachable block (ram,0x089952c4) */
/* WARNING: Removing unreachable block (ram,0x0899531c) */
/* WARNING: Removing unreachable block (ram,0x089953bc) */

int __tzcalc_limits(int year)

{
  char cVar1;
  __tzinfo_type *p_Var2;
  int iVar3;
  int iVar4;
  int *piVar5;
  int iVar6;
  int iVar7;
  int (*paiVar8) [12];
  __tzinfo_type *p_Var9;
  int iVar10;
  int iVar11;
  int iVar12;
  
                    /* Unresolved local var: int days@[???]
                       Unresolved local var: int year_days@[???]
                       Unresolved local var: int years@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: int j@[???]
                       Unresolved local var: __tzinfo_type * tz@[DW_OP_reg10(t2)] */
  p_Var2 = __gettzinfo();
  if (year < 0x7b2) {
    return 0;
  }
  p_Var2->__tzyear = year;
                    /* Unresolved local var: int yleap@[???]
                       Unresolved local var: int m_day@[???]
                       Unresolved local var: int m_wday@[???]
                       Unresolved local var: int wday_diff@[???]
                       Unresolved local var: int * ip@[???] */
  iVar10 = 0;
  iVar12 = year % 400;
  iVar11 = (((year + -0x7b2) * 0x16d + (year + -0x7b1 >> 2)) - (year + -0x76d) / 100) +
           (year + -0x641) / 400;
  p_Var9 = p_Var2;
  do {
    cVar1 = p_Var9->__tzrule[0].ch;
    if (cVar1 == 'J') {
      iVar4 = p_Var9->__tzrule[0].d;
      if ((((year & 3U) == 0) && (year % 100 != 0)) || (iVar12 == 0)) {
        iVar4 = (iVar4 < 0x3c ^ 1) + iVar11 + iVar4;
      }
      else {
        iVar4 = iVar11 + iVar4;
      }
    }
    else if (cVar1 == 'D') {
      iVar4 = iVar11 + p_Var9->__tzrule[0].d;
    }
    else {
      if ((year & 3U) == 0) {
        if ((year % 100 == 0) && (iVar12 != 0)) goto LAB_08995474;
LAB_08995374:
        paiVar8 = mon_lengths + 1;
        iVar4 = p_Var9->__tzrule[0].m;
      }
      else {
        if (iVar12 == 0) goto LAB_08995374;
LAB_08995474:
        paiVar8 = mon_lengths;
        iVar4 = p_Var9->__tzrule[0].m;
      }
      iVar7 = iVar11;
      if (iVar4 < 2) {
        iVar6 = 4;
      }
      else {
        iVar6 = 1;
        piVar5 = *paiVar8;
        do {
          iVar3 = *piVar5;
          iVar6 = iVar6 + 1;
          piVar5 = piVar5 + 1;
          iVar7 = iVar7 + iVar3;
        } while (iVar4 != iVar6);
        iVar6 = iVar6 * 4;
      }
      iVar3 = p_Var9->__tzrule[0].d - (iVar7 + 4) % 7;
      if (iVar3 < 0) {
        iVar3 = iVar3 + 7;
      }
      iVar6 = *(int *)((int)paiVar8 + iVar6 + -4);
      iVar3 = iVar3 + p_Var9->__tzrule[0].n * 7 + -7;
      iVar4 = iVar7 + iVar3;
      if (iVar6 <= iVar3) {
        do {
          iVar3 = iVar3 + -7;
        } while (iVar6 <= iVar3);
        iVar4 = iVar7 + iVar3;
      }
    }
    iVar10 = iVar10 + 1;
    p_Var9->__tzrule[0].change =
         iVar4 * 0x15180 + p_Var9->__tzrule[0].s + p_Var9->__tzrule[0].offset;
    p_Var9 = (__tzinfo_type *)&p_Var9->__tzrule[0].change;
    if (iVar10 == 2) {
      p_Var2->__tznorth = (uint)(p_Var2->__tzrule[0].change < p_Var2->__tzrule[1].change);
      return 1;
    }
  } while( true );
}



----------------------------------------

// Function: _mktm_r @ 089954f8

/* WARNING: Removing unreachable block (ram,0x08995a40) */
/* WARNING: Removing unreachable block (ram,0x089957d4) */
/* WARNING: Removing unreachable block (ram,0x08995744) */
/* WARNING: Removing unreachable block (ram,0x089955cc) */
/* WARNING: Removing unreachable block (ram,0x08995594) */
/* WARNING: Removing unreachable block (ram,0x08995540) */
/* WARNING: Removing unreachable block (ram,0x089955b8) */
/* WARNING: Removing unreachable block (ram,0x0899572c) */
/* WARNING: Removing unreachable block (ram,0x0899561c) */
/* WARNING: Removing unreachable block (ram,0x08995800) */
/* WARNING: Removing unreachable block (ram,0x08995a5c) */
/* WARNING: Removing unreachable block (ram,0x08995634) */

tm * _mktm_r(time_t *tim_p,tm *res,int is_gmtime)

{
  __tzinfo_type *p_Var1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  int (*paiVar5) [12];
  int iVar6;
  int iVar7;
  int iVar8;
  
                    /* Unresolved local var: long days@[???]
                       Unresolved local var: long rem@[???]
                       Unresolved local var: time_t lcltime@[???]
                       Unresolved local var: int y@[???]
                       Unresolved local var: int yleap@[???]
                       Unresolved local var: int * ip@[???]
                       Unresolved local var: __tzinfo_type * tz@[???] */
  p_Var1 = __gettzinfo();
  iVar6 = *tim_p / 0x15180;
  for (iVar7 = *tim_p % 0x15180; iVar7 < 0; iVar7 = iVar7 + 0x15180) {
    iVar6 = iVar6 + -1;
  }
  for (; 0x1517f < iVar7; iVar7 = iVar7 + -0x15180) {
    iVar6 = iVar6 + 1;
  }
  res->tm_hour = iVar7 / 0xe10;
  iVar8 = (iVar6 + 4) % 7;
  res->tm_wday = iVar8;
  res->tm_sec = (iVar7 % 0xe10) % 0x3c;
  res->tm_min = (iVar7 % 0xe10) / 0x3c;
  if (iVar8 < 0) {
    res->tm_wday = iVar8 + 7;
    if (iVar6 < 0) goto LAB_08995704;
LAB_089955ec:
    uVar4 = 0x7b2;
    while( true ) {
      if (((uVar4 & 3) != 0) || (uVar3 = 1, (int)uVar4 % 100 == 0)) {
        uVar3 = (uint)((int)uVar4 % 400 == 0);
      }
      if (iVar6 < year_lengths[uVar3]) break;
      iVar6 = iVar6 - year_lengths[uVar3];
      uVar4 = uVar4 + 1;
    }
  }
  else {
    if (-1 < iVar6) goto LAB_089955ec;
LAB_08995704:
    uVar4 = 0x7b1;
    while( true ) {
      if (((uVar4 & 3) != 0) || (uVar3 = 1, (int)uVar4 % 100 == 0)) {
        uVar3 = (uint)((int)uVar4 % 400 == 0);
      }
      iVar6 = iVar6 + year_lengths[uVar3];
      if (-1 < iVar6) break;
      uVar4 = uVar4 - 1;
    }
  }
  res->tm_year = uVar4 - 0x76c;
  res->tm_yday = iVar6;
  res->tm_mon = 0;
  paiVar5 = mon_lengths + uVar3;
  iVar7 = (*paiVar5)[0];
  if (iVar7 <= iVar6) {
    piVar2 = mon_lengths[uVar3];
    iVar8 = 1;
    do {
      piVar2 = piVar2 + 1;
      res->tm_mon = iVar8;
      iVar6 = iVar6 - iVar7;
      iVar7 = *piVar2;
      iVar8 = iVar8 + 1;
    } while (iVar7 <= iVar6);
  }
  res->tm_mday = iVar6 + 1;
  if (is_gmtime != 0) {
    res->tm_isdst = 0;
    return res;
  }
                    /* Unresolved local var: long offset@[???]
                       Unresolved local var: int hours@[???]
                       Unresolved local var: int mins@[???]
                       Unresolved local var: int secs@[???] */
  __tz_lock();
  if (_daylight == 0) {
    res->tm_isdst = 0;
LAB_089957c4:
    iVar6 = p_Var1->__tzrule[0].offset;
  }
  else {
    if (uVar4 == p_Var1->__tzyear) {
      iVar6 = p_Var1->__tznorth;
    }
    else {
      iVar6 = __tzcalc_limits(uVar4);
      if (iVar6 == 0) {
        res->tm_isdst = -1;
        goto LAB_089957c4;
      }
      iVar6 = p_Var1->__tznorth;
    }
    iVar7 = *tim_p;
    if (iVar6 != 0) {
      if (iVar7 < p_Var1->__tzrule[0].change) {
        res->tm_isdst = 0;
      }
      else {
        uVar4 = (uint)(iVar7 < p_Var1->__tzrule[1].change);
        res->tm_isdst = uVar4;
        if (uVar4 == 1) {
          iVar6 = p_Var1->__tzrule[1].offset;
          goto LAB_089957c8;
        }
      }
      goto LAB_089957c4;
    }
    if (iVar7 < p_Var1->__tzrule[0].change) {
      if (p_Var1->__tzrule[1].change <= iVar7) {
        res->tm_isdst = 0;
        goto LAB_089957c4;
      }
      res->tm_isdst = 1;
    }
    else {
      res->tm_isdst = 1;
    }
    iVar6 = p_Var1->__tzrule[1].offset;
  }
LAB_089957c8:
  iVar8 = res->tm_hour - iVar6 / 0xe10;
  res->tm_hour = iVar8;
  iVar7 = res->tm_sec - (iVar6 % 0xe10) % 0x3c;
  iVar6 = res->tm_min - (iVar6 % 0xe10) / 0x3c;
  res->tm_sec = iVar7;
  res->tm_min = iVar6;
  if (iVar7 < 0x3c) {
    if (iVar7 < 0) {
      iVar6 = iVar6 + -1;
      res->tm_sec = iVar7 + 0x3c;
      res->tm_min = iVar6;
    }
  }
  else {
    iVar6 = iVar6 + 1;
    res->tm_sec = iVar7 + -0x3c;
    res->tm_min = iVar6;
  }
  if (iVar6 < 0x3c) {
    if (iVar6 < 0) {
      iVar8 = iVar8 + -1;
      res->tm_min = iVar6 + 0x3c;
      res->tm_hour = iVar8;
    }
  }
  else {
    iVar8 = iVar8 + 1;
    res->tm_min = iVar6 + -0x3c;
    res->tm_hour = iVar8;
  }
  if (iVar8 < 0x18) {
    if (iVar8 < 0) {
      iVar6 = res->tm_wday + -1;
      res->tm_yday = res->tm_yday + -1;
      res->tm_wday = iVar6;
      if (iVar6 < 0) {
        res->tm_wday = 6;
      }
      res->tm_hour = iVar8 + 0x18;
      iVar6 = res->tm_mday + -1;
      res->tm_mday = iVar6;
      if (iVar6 == 0) {
        iVar6 = res->tm_mon + -1;
        res->tm_mon = iVar6;
        if (iVar6 < 0) {
          res->tm_mon = 0xb;
          uVar4 = res->tm_year - 1;
          res->tm_year = uVar4;
          if (((uVar4 & 3) == 0) && ((int)uVar4 % 100 != 0)) {
            iVar6 = res->tm_mon;
          }
          else {
            iVar6 = res->tm_mon;
            if ((int)uVar4 % 400 != 0) {
              res->tm_yday = 0x16d;
              goto LAB_0899595c;
            }
          }
          res->tm_yday = 0x16e;
        }
LAB_0899595c:
        res->tm_mday = (*paiVar5)[iVar6];
        __tz_unlock();
        return res;
      }
    }
  }
  else {
    iVar6 = res->tm_wday + 1;
    res->tm_yday = res->tm_yday + 1;
    res->tm_wday = iVar6;
    if (6 < iVar6) {
      res->tm_wday = 0;
    }
    iVar6 = res->tm_mday + 1;
    res->tm_hour = iVar8 + -0x18;
    res->tm_mday = iVar6;
    if ((*paiVar5)[res->tm_mon] < iVar6) {
      iVar7 = res->tm_mon + 1;
      res->tm_mday = iVar6 - (*paiVar5)[res->tm_mon];
      res->tm_mon = iVar7;
      if (iVar7 == 0xc) {
        res->tm_mon = 0;
        res->tm_yday = 0;
        res->tm_year = res->tm_year + 1;
        __tz_unlock();
        return res;
      }
    }
  }
  __tz_unlock();
  return res;
}



----------------------------------------

// Function: __tz_lock @ 08995a84

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __tz_lock(void)

{
  return;
}



----------------------------------------

// Function: __tz_unlock @ 08995a8c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __tz_unlock(void)

{
  return;
}



----------------------------------------

// Function: div @ 08995a94

div_t * div(div_t *__return_storage_ptr__,int num,int denom)

{
  div_t *pdVar1;
  
                    /* Unresolved local var: div_t r@[???] */
  pdVar1 = (div_t *)((int)__return_storage_ptr__ / num);
  if (num == 0) {
    trap(7);
  }
  if ((int)__return_storage_ptr__ < 0) {
    if (0 < (int)__return_storage_ptr__ % num) {
      return (div_t *)((int)&pdVar1[-1].rem + 3);
    }
  }
  else if ((int)__return_storage_ptr__ % num < 0) {
    pdVar1 = (div_t *)((int)&pdVar1->quot + 1);
  }
  return pdVar1;
}



----------------------------------------

// Function: __gettzinfo @ 08995af0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

__tzinfo_type * __gettzinfo(void)

{
  return &tzinfo;
}



----------------------------------------

// Function: pspIrKeybOutputMode @ 08995b00

undefined4 pspIrKeybOutputMode(uint param_1)

{
  undefined4 uVar1;
  
  uVar1 = 0xffffffff;
  if (param_1 < 4) {
    uVar1 = 0;
    g_outputmode = param_1;
  }
  return uVar1;
}



----------------------------------------

// Function: pspIrKeybGetOutputMode @ 08995b20

undefined4 pspIrKeybGetOutputMode(void)

{
  return g_outputmode;
}



----------------------------------------

// Function: pspIrKeybInit @ 08995b2c

undefined4 pspIrKeybInit(char *param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  char *pcVar3;
  size_t sVar4;
  char *dst0;
  char acStack_1019 [4097];
  
  dst0 = acStack_1019 + 1;
  if (g_keyboard != 0) {
switchD_08995c5c_caseD_0:
    return 0xfffffff8;
  }
  if (param_1 == (char *)0x0) {
    param_1 = "ms0:/seplugins/pspirkeyb.ini";
  }
  acStack_1019[1] = 0;
  iVar1 = iniparser_new(param_1);
  if (iVar1 == 0) {
    return 0xfffffff9;
  }
  g_kernelmode = param_2;
  uVar2 = iniparser_getint(iVar1,"KEYBOARD:keyboard",0);
  pcVar3 = (char *)iniparser_getstring(iVar1,"KEYBOARD:mapfile_dir",0);
  if (pcVar3 != (char *)0x0) {
    strcpy(acStack_1019 + 1,pcVar3);
    sVar4 = strlen(pcVar3);
    dst0 = acStack_1019 + sVar4 + 1;
    if (acStack_1019[sVar4] != '/') {
      *dst0 = '/';
      dst0 = acStack_1019 + sVar4 + 2;
      *dst0 = '\0';
    }
  }
  pcVar3 = (char *)iniparser_getstring(iVar1,"KEYBOARD:map",0);
  if (pcVar3 != (char *)0x0) {
    strcpy(dst0,pcVar3);
  }
  iniparser_free(iVar1);
  g_outputmode = 0;
  switch(uVar2) {
  default:
    goto switchD_08995c5c_caseD_0;
  case 1:
    g_keyboard_input_CB = compaq_foldable;
    goto LAB_08995c6c;
  case 2:
    g_keyboard_input_CB = snapntype;
    g_baudrate = 0x960;
    goto LAB_08995c80;
  case 5:
    g_keyboard_input_CB = hpslim;
    goto LAB_08995c6c;
  case 8:
    g_keyboard_input_CB = belkin_infrared;
    break;
  case 9:
    g_keyboard_input_CB = flexis;
    break;
  case 10:
    g_keyboard_input_CB = benqgamepad;
    goto LAB_08995c6c;
  case 0xb:
    g_keyboard_input_CB = micro_innovations;
    break;
  case 0xc:
    g_keyboard_input_CB = micro_foldaway;
    break;
  case 0xd:
    g_keyboard_input_CB = micro_datapad;
    break;
  case 0xe:
    g_keyboard_input_CB = compaq_microkbd;
LAB_08995c6c:
    g_baudrate = 0x12c0;
    goto LAB_08995c80;
  case 0xf:
    g_keyboard_input_CB = targus_infrared;
    break;
  case 0x12:
    g_keyboard_input_CB = freedom_keyboard;
    break;
  case 0x13:
    g_keyboard_input_CB = novaets_kis2;
    break;
  case 0x14:
    g_keyboard_input_CB = palmuw;
    break;
  case 0x15:
    g_keyboard_input_CB = hama;
  }
  g_baudrate = 0x2580;
LAB_08995c80:
  g_keyboard = uVar2;
  uVar2 = maptable_load_map(acStack_1019 + 1);
  return uVar2;
}



----------------------------------------

// Function: hama @ 08995d6c

undefined4 hama(undefined4 param_1)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  byte local_30 [8];
  
  iVar6 = 0;
  bVar1 = true;
  iVar4 = 0;
  uVar5 = 0;
  do {
    while( true ) {
      while( true ) {
        if ((!bVar1) && (4 < iVar4)) {
          scePowerTick(0);
          if (uVar5 < 0x48) {
            keymap_decode(g_outputmode,(&hama_keymap)[uVar5],1,param_1);
            lastkeypressed = uVar5;
            return 0;
          }
          if (((uVar5 < 0x90) && (uVar5 = uVar5 - 0x48 & 0xff, uVar5 < 0x90)) &&
             (keymap_decode(g_outputmode,(&hama_keymap)[uVar5],0,param_1), uVar5 == lastkeypressed))
          {
            lastkeypressed = 0x96;
          }
          return 0;
        }
        iVar2 = sceIoRead(g_irdafd,local_30,1);
        if (iVar2 == -1) {
          return 0xffffffff;
        }
        uVar3 = (uint)local_30[0];
        if (iVar2 == 1) break;
        iVar4 = iVar4 + 1;
      }
      if (uVar3 != 0xc0) break;
      iVar6 = 0;
      iVar4 = 1;
LAB_08995e38:
      uVar3 = uVar5;
      if (iVar6 == 5) {
        iVar6 = 6;
        bVar1 = false;
      }
      else {
LAB_08995e5c:
        iVar6 = iVar6 + 1;
        bVar1 = iVar6 < 5;
        uVar5 = uVar3;
      }
    }
    if (iVar6 == 1) {
      iVar4 = iVar4 + 1;
      goto LAB_08995e5c;
    }
    if (iVar6 == 2) {
      iVar4 = iVar4 + 1;
      iVar6 = 3;
      bVar1 = true;
    }
    else if (iVar6 == 3) {
      iVar6 = 4;
      bVar1 = true;
      iVar4 = iVar4 + 1;
    }
    else {
      iVar4 = iVar4 + 1;
      if (iVar6 != 4) goto LAB_08995e38;
      iVar6 = 5;
      bVar1 = false;
    }
  } while( true );
}



----------------------------------------

// Function: palmuw @ 08995fc8

undefined4 palmuw(undefined4 param_1)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  char local_20 [8];
  
LAB_08995ff4:
  do {
    iVar3 = sceIoRead(g_irdafd,local_20,1);
    iVar2 = pi_5446;
    while( true ) {
      if (iVar3 < 1) {
        pi_5446 = iVar2;
        return 0xffffffff;
      }
      pi_5446 = iVar2 + 1;
      bVar1 = 5 < pi_5446;
      if (iVar2 != 0) break;
      pi_5446 = iVar2;
      if (local_20[0] != -1) goto LAB_08995ff4;
      pi_5446 = 1;
      pbuf_5447 = -1;
      iVar3 = sceIoRead(g_irdafd,local_20,1);
      iVar2 = pi_5446;
    }
    (&pbuf_5447)[iVar2] = local_20[0];
    if (bVar1) {
      pi_5446 = 0;
      scePowerTick(0);
      if (pbuf_5447 != -1) {
        return 0xffffffff;
      }
      if (DAT_08a1dc39 != -0x40) {
        return 0xffffffff;
      }
      if (DAT_08a1dc3d != -0x3f) {
        return 0xffffffff;
      }
      uVar4 = (uint)DAT_08a1dc3a;
      if (uVar4 + DAT_08a1dc3b != 0xff) {
        return 0xffffffff;
      }
      if (-1 < (char)DAT_08a1dc3a) {
        keymap_decode(g_outputmode,palmuw_normal[uVar4 * 2],1,param_1);
        return 0;
      }
      keymap_decode(g_outputmode,palmuw_normal[(uVar4 ^ 0x80) * 2],0,param_1);
      return 0;
    }
  } while( true );
}



----------------------------------------

// Function: targus_infrared @ 08996158

undefined4 targus_infrared(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  byte local_18 [8];
  
  iVar1 = sceIoRead(g_irdafd,local_18,1);
  uVar2 = 0xffffffff;
  if (iVar1 == 1) {
    scePowerTick(0);
    if (-1 < (char)local_18[0]) {
      keymap_decode(g_outputmode,local_18[0] & 0x7f,1,param_1);
      return 0;
    }
    keymap_decode(g_outputmode,local_18[0] & 0x7f,0,param_1);
    uVar2 = 0;
  }
  return uVar2;
}



----------------------------------------

// Function: compaq_microkbd @ 0899621c

undefined4 compaq_microkbd(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  char cVar4;
  uint uVar5;
  byte local_18 [8];
  
  iVar1 = sceIoRead(g_irdafd,local_18,2);
  uVar2 = 0xffffffff;
  if (iVar1 == 2) {
    scePowerTick(0);
    uVar3 = (uint)local_18[0];
    uVar5 = uVar3 & 0x7f;
    if ((char)local_18[0] < '\0') {
      if (uVar5 == 2) {
        uVar2 = 0;
        symb_5412 = '\0';
      }
      else {
        if (symb_5412 == '\0') {
          cVar4 = compaq_normal[uVar5];
        }
        else {
          cVar4 = compaq_function[uVar5];
        }
        if (cVar4 == '\0') {
          uVar2 = 0;
        }
        else {
          local_18[0] = (byte)uVar5;
          keymap_decode(g_outputmode,cVar4,0,param_1);
          uVar2 = 0;
        }
      }
    }
    else if (uVar3 == 2) {
      uVar2 = 0;
      symb_5412 = '\x01';
    }
    else {
      if (symb_5412 == '\0') {
        cVar4 = compaq_normal[uVar3];
        if (cVar4 == '\0') {
          return 0;
        }
      }
      else {
        cVar4 = compaq_function[uVar3];
        if (cVar4 == '\0') {
          return 0;
        }
      }
      keymap_decode(g_outputmode,cVar4,1,param_1);
      uVar2 = 0;
    }
  }
  return uVar2;
}



----------------------------------------

// Function: micro_datapad @ 08996378

undefined4 micro_datapad(undefined4 param_1)

{
  int iVar1;
  uint uVar2;
  byte local_28 [16];
  
  iVar1 = sceIoRead(g_irdafd,local_28,1);
  if (iVar1 != 1) {
    return 0xffffffff;
  }
  scePowerTick(0);
  uVar2 = (uint)local_28[0];
  if ((char)local_28[0] < '\0') {
    if (-uVar2 + 0x9e < 4) {
      local_28[0] = micro_innovations_punct[-uVar2 + 0x1f];
      keymap_decode(g_outputmode,local_28[0],0,param_1);
    }
    else if ((uVar2 == 0x85) && (lastkey_5389 != 0)) {
      keymap_decode(g_outputmode,lastkey_5389,0,param_1);
      lastkey_5389 = 0;
    }
    iVar1 = sceIoRead(g_irdafd,local_28,1);
    if (iVar1 != 1) {
      return 0xffffffff;
    }
  }
  else {
    local_28[0] = micro_datapad_normal[uVar2];
    if (local_28[0] != 0) {
      if (4 < uVar2) {
        lastkey_5389 = local_28[0];
      }
      keymap_decode(g_outputmode,local_28[0],1,param_1);
      return 0;
    }
  }
  return 0;
}



----------------------------------------

// Function: micro_foldaway @ 08996510

undefined4 micro_foldaway(undefined4 param_1)

{
  int iVar1;
  uint uVar2;
  byte local_28 [16];
  
  iVar1 = sceIoRead(g_irdafd,local_28,1);
  if (iVar1 != 1) {
    return 0xffffffff;
  }
  scePowerTick(0);
  uVar2 = (uint)local_28[0];
  if ((char)local_28[0] < '\0') {
    if (-uVar2 + 0x9e < 4) {
      local_28[0] = micro_innovations_punct[-uVar2 + 0x1f];
      keymap_decode(g_outputmode,local_28[0],0,param_1);
    }
    else if ((uVar2 == 0x85) && (lastkey_5367 != 0)) {
      keymap_decode(g_outputmode,lastkey_5367,0,param_1);
      lastkey_5367 = 0;
    }
    iVar1 = sceIoRead(g_irdafd,local_28,1);
    if (iVar1 != 1) {
      return 0xffffffff;
    }
  }
  else {
    local_28[0] = micro_foldaway_normal[uVar2];
    if (local_28[0] != 0) {
      if (4 < uVar2) {
        lastkey_5367 = local_28[0];
      }
      keymap_decode(g_outputmode,local_28[0],1,param_1);
      return 0;
    }
  }
  return 0;
}



----------------------------------------

// Function: micro_innovations @ 089966a8

undefined4 micro_innovations(undefined4 param_1)

{
  ushort uVar1;
  int iVar2;
  undefined1 *puVar3;
  uint uVar4;
  byte local_30 [16];
  
  iVar2 = sceIoRead(g_irdafd,local_30,1);
  if (iVar2 != 1) {
    return 0xffffffff;
  }
  scePowerTick(0);
  uVar4 = (uint)local_30[0];
  if ((char)local_30[0] < '\0') {
    uVar4 = uVar4 & 0x7f;
    local_30[0] = (byte)uVar4;
    key_count_5333 = key_count_5333 + -1;
    if (uVar4 == 0x6e) {
      fkey_num_5330 = '\0';
    }
    else if (uVar4 == 0x76) {
      fkey_punct_5331 = '\0';
    }
    else if (uVar4 == 0x3c) {
      fkey_func_5332 = '\0';
    }
    else if (fkey_punct_5331 == '\0') {
      if (fkey_num_5330 == '\0') {
        if (fkey_func_5332 == '\0') {
          puVar3 = micro_innovations_normal;
        }
        else {
          puVar3 = micro_innovations_func;
        }
      }
      else {
        puVar3 = micro_innovations_num;
      }
      local_30[0] = puVar3[uVar4];
      keymap_decode(g_outputmode,local_30[0],0,param_1);
    }
    else {
      uVar1 = *(ushort *)(micro_innovations_punct + uVar4 * 2);
      keymap_decode(g_outputmode,uVar1 & 0x7f,0,param_1);
      if ((uVar1 & 0x8000) != 0) {
        keymap_decode(g_outputmode,0x2a,0,param_1);
      }
    }
    if ((key_count_5333 == 0) && (iVar2 = sceIoRead(g_irdafd,local_30,1), iVar2 != 1)) {
      return 0xffffffff;
    }
  }
  else if (uVar4 != 0) {
    key_count_5333 = key_count_5333 + 1;
    if (uVar4 == 0x6e) {
      fkey_num_5330 = 1;
      return 0;
    }
    if (uVar4 == 0x76) {
      fkey_punct_5331 = 1;
      return 0;
    }
    if (uVar4 == 0x3c) {
      fkey_func_5332 = 1;
      return 0;
    }
    if (fkey_punct_5331 != '\0') {
      uVar1 = *(ushort *)(micro_innovations_punct + uVar4 * 2);
      if ((uVar1 & 0x8000) != 0) {
        keymap_decode(g_outputmode,0x2a,1,param_1);
      }
      keymap_decode(g_outputmode,uVar1 & 0x7f,1,param_1);
      return 0;
    }
    if (fkey_num_5330 == '\0') {
      if (fkey_func_5332 == '\0') {
        puVar3 = micro_innovations_normal;
      }
      else {
        puVar3 = micro_innovations_func;
      }
    }
    else {
      puVar3 = micro_innovations_num;
    }
    local_30[0] = puVar3[uVar4];
    keymap_decode(g_outputmode,local_30[0],1,param_1);
    return 0;
  }
  return 0;
}



----------------------------------------

// Function: benqgamepad @ 089969d0

undefined4 benqgamepad(undefined4 param_1)

{
  byte bVar1;
  int iVar2;
  byte *pbVar3;
  char *pcVar4;
  byte local_20 [16];
  
  iVar2 = sceIoRead(g_irdafd,local_20,2);
  if (iVar2 != 2) {
    return 0xffffffff;
  }
  scePowerTick(0);
  if ((char)local_20[0] < '\0') {
    pbVar3 = &benq_gamepad_map;
    local_20[0] = local_20[0] & 0x7f;
    iVar2 = 0;
    pcVar4 = "g`l^i/jZ\x11\x1c\x1e2\x1f\\ !\x01#\x1c";
    do {
      bVar1 = *pbVar3;
      iVar2 = iVar2 + 1;
      pbVar3 = pbVar3 + 2;
      if (bVar1 == local_20[0]) {
        if (*pcVar4 == '\0') {
          return 0;
        }
        keymap_decode(g_outputmode,*pcVar4,0,param_1);
        return 0;
      }
      pcVar4 = pcVar4 + 2;
    } while (iVar2 != 10);
  }
  else {
    pbVar3 = &benq_gamepad_map;
    iVar2 = 0;
    pcVar4 = "g`l^i/jZ\x11\x1c\x1e2\x1f\\ !\x01#\x1c";
    do {
      bVar1 = *pbVar3;
      iVar2 = iVar2 + 1;
      pbVar3 = pbVar3 + 2;
      if (bVar1 == local_20[0]) {
        if (*pcVar4 == '\0') {
          return 0;
        }
        keymap_decode(g_outputmode,*pcVar4,1,param_1);
        return 0;
      }
      pcVar4 = pcVar4 + 2;
    } while (iVar2 != 10);
  }
  return 0;
}



----------------------------------------

// Function: flexis @ 08996b04

undefined4 flexis(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  byte local_28;
  undefined1 auStack_27 [15];
  
  iVar1 = sceIoRead(g_irdafd,&local_28,1);
  uVar2 = 0xffffffff;
  if (iVar1 == 1) {
    scePowerTick(0);
    if (-1 < (char)local_28) {
      local_28 = flexis_fx100_normal[local_28];
      if (local_28 != 0) {
        keymap_decode(g_outputmode,local_28,0,param_1);
      }
      return 0;
    }
    local_28 = flexis_fx100_normal[local_28 & 0x7f];
    if ((((local_28 == 0x2a) || (local_28 == 0x36)) || (local_28 == 0x1d)) ||
       (((local_28 == 0x61 || (local_28 == 0x38)) || (local_28 == 100)))) {
      keymap_decode(g_outputmode,local_28,1,param_1);
      uVar2 = 0;
    }
    else {
      iVar1 = sceIoRead(g_irdafd,auStack_27,1);
      if (iVar1 == 1) {
        keymap_decode(g_outputmode,local_28,1,param_1);
        keymap_decode(g_outputmode,local_28,0,param_1);
        uVar2 = 0;
      }
      else {
        uVar2 = 0xffffffff;
      }
    }
  }
  return uVar2;
}



----------------------------------------

// Function: hpslim @ 08996ca4

undefined4 hpslim(undefined4 param_1)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  byte local_20 [8];
  
  iVar1 = sceIoRead(g_irdafd,local_20,1);
  if (iVar1 != 1) {
    return 0xffffffff;
  }
  scePowerTick(0);
  uVar2 = (uint)local_20[0];
  if ((char)local_20[0] < '\0') {
    uVar2 = uVar2 & 0x7f;
    if (uVar2 != 0x36) {
      if (uVar2 == 0x73) {
        symb_5244 = 0;
        return 0;
      }
      if (uVar2 != 0x2a) goto LAB_08996e4c;
    }
    shft_5245 = '\0';
LAB_08996e4c:
    if (symb_5244 == '\0') {
      if (((numlck_5247 == '\0') || (uVar2 < 0x10)) || (0x19 < uVar2)) {
        uVar3 = (uint)(byte)hpslim_normal[uVar2];
      }
      else {
        uVar3 = uVar2 - 0xe & 0xff;
      }
    }
    else {
      uVar3 = (uint)(byte)hpslim_symbol[uVar2];
    }
    if (uVar3 != 0) {
      local_20[0] = (byte)uVar2;
      keymap_decode(g_outputmode,uVar3,0,param_1);
      if (symshft_5246 != '\0') {
        keymap_decode(g_outputmode,0x36,0,param_1);
      }
      if (uVar3 != 0x45) {
        symshft_5246 = 0;
        return 0;
      }
      numlck_5247 = numlck_5247 == '\0';
      symshft_5246 = 0;
      return 0;
    }
    return 0;
  }
  if (uVar2 != 0x36) {
    if (uVar2 == 0x73) {
      symb_5244 = 1;
      return 0;
    }
    if (uVar2 != 0x2a) goto LAB_08996d40;
  }
  shft_5245 = '\x01';
LAB_08996d40:
  if (symb_5244 == '\0') {
    if (((numlck_5247 == '\0') || (uVar2 < 0x10)) || (0x19 < uVar2)) {
      uVar2 = (uint)(byte)hpslim_normal[uVar2];
    }
    else {
      uVar2 = uVar2 - 0xe & 0xff;
    }
  }
  else {
    symshft_5246 = hpslim_symshft[uVar2] != '\0' && shft_5245 == '\0';
    uVar2 = (uint)(byte)hpslim_symbol[uVar2];
  }
  if (uVar2 == 0) {
    return 0;
  }
  if (symshft_5246 != '\0') {
    keymap_decode(g_outputmode,0x36,1,param_1);
  }
  keymap_decode(g_outputmode,uVar2,1,param_1);
  return 0;
}



----------------------------------------

// Function: snapntype @ 08996f7c

undefined4 snapntype(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  byte local_28;
  undefined1 auStack_27 [15];
  
  iVar1 = sceIoRead(g_irdafd,&local_28,1);
  uVar2 = 0xffffffff;
  if (iVar1 == 1) {
    scePowerTick(0);
    uVar3 = (uint)local_28;
    if ((char)local_28 < '\0') {
      iVar1 = sceIoRead(g_irdafd,auStack_27,1);
      uVar2 = 0xffffffff;
      if (iVar1 == 1) {
        uVar3 = local_28 & 0x7f;
        if (uVar3 == 0x1b) {
          uVar2 = 0;
          symb_5224 = '\0';
        }
        else {
          if (symb_5224 == '\0') {
            local_28 = snapntype_normal[uVar3];
          }
          else {
            local_28 = snapntype_symbol[uVar3];
          }
          if (local_28 == 0) {
            uVar2 = 0;
          }
          else {
            keymap_decode(g_outputmode,local_28,0,param_1);
            uVar2 = 0;
          }
        }
      }
    }
    else if (uVar3 == 0x1b) {
      uVar2 = 0;
      symb_5224 = '\x01';
    }
    else {
      if (symb_5224 == '\0') {
        local_28 = snapntype_normal[uVar3];
      }
      else {
        local_28 = snapntype_symbol[uVar3];
      }
      if (local_28 == 0) {
        uVar2 = 0;
      }
      else {
        keymap_decode(g_outputmode,local_28,1,param_1);
        uVar2 = 0;
      }
    }
  }
  return uVar2;
}



----------------------------------------

// Function: freedom_keyboard @ 0899710c

undefined4 freedom_keyboard(undefined4 param_1)

{
  int iVar1;
  uint uVar2;
  byte local_20 [16];
  
  iVar1 = sceIoRead(g_irdafd,local_20,1);
  if (iVar1 != 1) {
    return 0xffffffff;
  }
  scePowerTick(0);
  uVar2 = (uint)local_20[0];
  if (uVar2 < 0x3f) {
    keymap_decode(g_outputmode,freedom_kbd[uVar2],1,param_1);
    return 0;
  }
  keymap_decode(g_outputmode,freedom_kbd[uVar2 - 0x3f & 0x3f],0,param_1);
  return 0;
}



----------------------------------------

// Function: belkin_infrared @ 089971fc

undefined4 belkin_infrared(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  undefined1 uStack_20;
  byte local_1f;
  
  iVar1 = sceIoRead(g_irdafd,&uStack_20,2);
  uVar2 = 0xffffffff;
  if (iVar1 == 2) {
    scePowerTick(0);
    if (-1 < (char)local_1f) {
      keymap_decode(g_outputmode,belkin_irda_normal[local_1f & 0x7f],1,param_1);
      return 0;
    }
    keymap_decode(g_outputmode,belkin_irda_normal[local_1f & 0x7f],0,param_1);
    uVar2 = 0;
  }
  return uVar2;
}



----------------------------------------

// Function: compaq_foldable @ 089972cc

undefined4 compaq_foldable(undefined4 param_1)

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  uint uVar4;
  byte local_20;
  byte local_1f;
  
  iVar1 = sceIoRead(g_irdafd,&local_20,2);
  uVar2 = 0xffffffff;
  if (iVar1 == 2) {
    scePowerTick(0);
    uVar3 = (uint)local_20;
    uVar4 = uVar3 & 0x7f;
    if (uVar3 == (~(uint)local_1f & 0xff)) {
      if (uVar3 == 2) {
        uVar2 = 0;
        fn_5165 = '\x01';
      }
      else {
        if (fn_5165 == '\0') {
          local_20 = (byte)*(undefined2 *)(foldable_normal + uVar3 * 2);
        }
        else {
          local_20 = (byte)*(undefined2 *)(foldable_function + uVar3 * 2);
        }
        if (local_20 == 0) {
          return 0;
        }
        keymap_decode(g_outputmode,local_20,1,param_1);
        uVar2 = 0;
      }
    }
    else {
      if (uVar4 != (~(uint)local_1f & 0xff)) {
        return 0;
      }
      if (uVar4 == 2) {
        uVar2 = 0;
        fn_5165 = '\0';
      }
      else {
        if (fn_5165 == '\0') {
          local_20 = (byte)*(undefined2 *)(foldable_normal + uVar4 * 2);
        }
        else {
          local_20 = (byte)*(undefined2 *)(foldable_function + uVar4 * 2);
        }
        if (local_20 == 0) {
          return 0;
        }
        keymap_decode(g_outputmode,local_20,0,param_1);
        uVar2 = 0;
      }
    }
  }
  return uVar2;
}



----------------------------------------

// Function: novaets_kis2 @ 08997468

undefined4 novaets_kis2(undefined4 param_1)

{
  undefined1 uVar1;
  int iVar2;
  char local_38 [4];
  int local_34;
  int local_30;
  int local_2c;
  undefined1 auStack_28 [16];
  
  iVar2 = sceIoRead(g_irdafd,auStack_28,2);
  if (iVar2 == 2) {
    scePowerTick(0);
    iVar2 = novaets_kis2_cycle_decode(auStack_28,&local_34,&local_30,local_38);
    if (iVar2 == 0) {
      uVar1 = novaets_kis2_keycode_table[local_30 + local_34 * 0xe];
      keymap_decode(g_outputmode,uVar1,local_38[0],param_1);
      if (local_2c != 0) {
        return 0;
      }
      if (local_38[0] == '\0') {
        return 0;
      }
      keymap_decode(g_outputmode,uVar1,0,param_1);
      return 0;
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: pspIrdaSetBaud @ 08997568

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

undefined4 pspIrdaSetBaud(int param_1)

{
  if ((param_1 != 0x2580) || (g_kernelmode != 0)) {
    if (param_1 == 0) {
      trap(7);
    }
    _DAT_be540028 = 96000000 / param_1 & 0x3f;
    _DAT_be540024 = 96000000 / param_1 >> 6;
    _DAT_be54002c = 0x60;
  }
  return 0;
}



----------------------------------------

// Function: pspIrKeybFinish @ 089975d0

undefined4 pspIrKeybFinish(void)

{
  if (-1 < g_irdafd) {
    sceIoClose(g_irdafd);
    g_irdafd = -1;
    g_baudrate = 0;
    g_keyboard = 0;
    g_keyboard_input_CB = 0;
    g_outputmode = 0;
    maptable_unload_map();
    pspIrdaSetBaud(0x2580);
  }
  return 0;
}



----------------------------------------

// Function: pspIrKeybReadinput @ 0899763c

undefined4 pspIrKeybReadinput(int param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  
  if (((param_1 == 0) || (param_2 == (undefined4 *)0x0)) || (g_keyboard_input_CB == (code *)0x0)) {
    return 0xffffffff;
  }
  *param_2 = 0;
  if (g_irdafd < 0) {
    g_irdafd = sceIoOpen("irda0:",3,0);
    if (g_irdafd < 0) {
      return 0xffffffff;
    }
    iVar2 = pspIrdaSetBaud(g_baudrate);
    if (iVar2 < 0) {
      return 0xfffffffa;
    }
  }
                    /* WARNING: Could not recover jumptable at 0x089976d4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  uVar1 = (*g_keyboard_input_CB)(param_1,param_2);
  return uVar1;
}



----------------------------------------

// Function: maptable_entry @ 08997708

char * maptable_entry(char param_1)

{
  int iVar1;
  char *pcVar2;
  
  if (g_map_entries < 0) {
    pcVar2 = (char *)0x0;
  }
  else {
    pcVar2 = (char *)0x0;
    if ((0 < g_map_entries + 1) && (pcVar2 = g_map, *g_map != param_1)) {
      iVar1 = 0;
      do {
        pcVar2 = pcVar2 + 0x2b;
        iVar1 = iVar1 + 1;
        if (g_map_entries + 1 == iVar1) {
          return (char *)0x0;
        }
      } while (*pcVar2 != param_1);
    }
  }
  return pcVar2;
}



----------------------------------------

// Function: maptable_unload_map @ 08997770

undefined4 maptable_unload_map(void)

{
  undefined4 uVar1;
  
  uVar1 = 0xffffffff;
  if (g_map != (void *)0x0) {
    free(g_map);
    g_map_entries = 0;
    g_map = (void *)0x0;
    g_map_entry_slots = 0;
    uVar1 = 0;
  }
  return uVar1;
}



----------------------------------------

// Function: init_map_entry_array @ 089977c4

void init_map_entry_array(void)

{
  g_map = malloc(0x2b0);
  g_map_entries = 0xffffffff;
  g_map_entry_slots = 0x10;
  return;
}



----------------------------------------

// Function: maptable_load_map_rec @ 08997800

/* WARNING: Removing unreachable block (ram,0x08997b24) */
/* WARNING: Removing unreachable block (ram,0x08997c14) */

int maptable_load_map_rec(char *param_1,int param_2)

{
  byte bVar1;
  size_t sVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  char *pcVar6;
  char cVar7;
  int iVar8;
  char *pcVar9;
  int iVar10;
  undefined4 uVar11;
  char *pcVar12;
  undefined4 *puVar13;
  int iVar14;
  undefined **ppuVar15;
  char local_1140;
  char local_113f;
  undefined1 local_113e;
  undefined1 local_113c [4];
  char acStack_1138 [254];
  char acStack_103a [4098];
  undefined **local_38;
  char *local_34;
  int local_30;
  
  if (param_1 == (char *)0x0) {
    iVar8 = -1;
  }
  else {
    iVar8 = -1;
    if ((g_map != (char *)0x0) && (iVar8 = -4, param_2 < 4)) {
      iVar8 = iniparser_new();
      if (iVar8 == 0) {
        iVar8 = -3;
        if (param_2 != 0) {
          iVar8 = -5;
        }
      }
      else {
        pcVar9 = acStack_103a + 1;
        strcpy(pcVar9,param_1);
        sVar2 = strlen(pcVar9);
        pcVar6 = acStack_103a + sVar2;
        if (pcVar9 != pcVar6) {
          pcVar12 = pcVar6;
          if (acStack_103a[sVar2] == '/') {
            pcVar5 = acStack_103a + sVar2 + 1;
          }
          else {
            do {
              pcVar5 = pcVar12;
              pcVar12 = pcVar5 + -1;
              if (pcVar12 == (char *)((((int)pcVar9 * 2 + sVar2) - (int)pcVar6) + -1))
              goto LAB_089978fc;
            } while (*pcVar12 != '/');
          }
          pcVar12[1] = '\0';
          if ((pcVar9 != pcVar5) &&
             (pcVar6 = (char *)iniparser_getstring(iVar8,"GLOBAL:include",0), pcVar6 != (char *)0x0)
             ) {
            strcat(pcVar9,pcVar6);
            iniparser_free(iVar8);
            iVar8 = maptable_load_map_rec(pcVar9,param_2 + 1);
            if (iVar8 < 0) {
              return iVar8;
            }
            iVar8 = iniparser_new(param_1);
          }
        }
LAB_089978fc:
        if (0 < g_maxKeys) {
          local_38 = &PTR_s_KEY_RESERVED_08a05e30;
          local_30 = 0;
          do {
            iVar14 = 0;
            local_34 = (char *)0x0;
            ppuVar15 = &g_sections;
            do {
              if (((iVar8 != 0) && (*local_38 != (undefined *)0x0)) &&
                 (*ppuVar15 != (undefined *)0x0)) {
                sprintf(acStack_1138,"%s:%s");
                pcVar6 = (char *)iniparser_getstring(iVar8,acStack_1138,0);
                if (pcVar6 != (char *)0x0) {
                  pcVar9 = local_34;
                  if (local_34 == (char *)0x0) {
                    cVar7 = *(char *)(local_38 + -1);
                    if (g_map_entry_slots == 0) {
                      init_map_entry_array();
                    }
                    iVar4 = g_map_entries + 1;
                    if ((g_map_entries < 0) || (iVar4 < 1)) {
LAB_08997b00:
                      iVar3 = g_map_entries + 2;
                      g_map_entries = iVar4;
                      if (g_map_entry_slots < iVar3) {
                        iVar4 = 8;
                        if (7 < g_map_entry_slots / 2) {
                          iVar4 = g_map_entry_slots / 2;
                        }
                        g_map_entry_slots = iVar4 + g_map_entry_slots;
                        g_map = realloc(g_map,g_map_entry_slots * 0x2b);
                      }
                      pcVar9 = local_34;
                      if (g_map != (char *)0x0) {
                        local_34 = g_map + g_map_entries * 0x2b;
                        memset(local_34,0,0x2b);
                        *local_34 = cVar7;
                        pcVar9 = local_34;
                      }
                    }
                    else {
                      iVar3 = 0;
                      pcVar9 = g_map;
                      if (*g_map == cVar7) {
                        local_34 = g_map;
                        pcVar9 = local_34;
                      }
                      else {
                        do {
                          pcVar9 = pcVar9 + 0x2b;
                          iVar3 = iVar3 + 1;
                          if (iVar3 == iVar4) goto LAB_08997b00;
                        } while (cVar7 != *pcVar9);
                      }
                    }
                  }
                  local_34 = pcVar9;
                  pcVar9 = local_34;
                  pcVar12 = local_34 + iVar14 * 6 + 1;
                  if (pcVar12 != (char *)0x0) {
                    sVar2 = strlen(pcVar6);
                    pcVar9[iVar14 * 6 + 5] = '\0';
                    pcVar9[iVar14 * 6 + 6] = '\0';
                    if (sVar2 == 1) {
                      cVar7 = *pcVar6;
                      pcVar9[iVar14 * 6 + 5] = '\x01';
                      pcVar9[iVar14 * 6 + 1] = cVar7;
                    }
                    if (2 < (int)sVar2) {
                      cVar7 = *pcVar6;
                      if (cVar7 == '0') {
                        if ((pcVar6[1] != 'x') && (pcVar6[1] != 'X')) goto LAB_089979e8;
                        iVar4 = sscanf(pcVar6 + 2,"%x",local_113c);
                        if (iVar4 == 0) {
                          cVar7 = *pcVar6;
                        }
                        else {
                          pcVar9[iVar14 * 6 + 5] = '\x01';
                          pcVar9[iVar14 * 6 + 1] = local_113c[0];
                          cVar7 = *pcVar6;
                        }
                      }
                      if (cVar7 == 'u') {
                        cVar7 = pcVar6[1];
                      }
                      else {
                        if (cVar7 != 'U') goto LAB_089979e8;
                        cVar7 = pcVar6[1];
                      }
                      if (cVar7 == '+') {
                        iVar4 = 2;
                        local_1140 = pcVar6[2];
                        pcVar5 = pcVar6;
                        while( true ) {
                          local_113f = pcVar5[3];
                          local_113e = 0;
                          iVar3 = sscanf(&local_1140,"%x",local_113c);
                          iVar10 = iVar4 + -2;
                          iVar4 = iVar4 + 2;
                          if (iVar3 != 0) {
                            pcVar9[iVar14 * 6 + 5] = pcVar9[iVar14 * 6 + 5] + '\x01';
                            pcVar12[iVar10 / 2] = local_113c[0];
                          }
                          if ((int)sVar2 <= iVar4) break;
                          local_1140 = pcVar5[4];
                          pcVar5 = pcVar5 + 2;
                        }
                      }
                    }
LAB_089979e8:
                    iVar4 = g_maxKeys;
                    if ((int)sVar2 < 5) {
                      bVar1 = pcVar9[iVar14 * 6 + 5];
                    }
                    else if (*pcVar6 == 'K') {
                      if (pcVar6[1] == 'E') {
                        if (pcVar6[2] == 'Y') {
                          cVar7 = pcVar6[3];
LAB_08997c68:
                          if (cVar7 == '_') {
                            if (0 < g_maxKeys) {
                              puVar13 = &keys;
                              iVar3 = 0;
                              do {
                                iVar3 = iVar3 + 1;
                                iVar10 = strcmp((char *)puVar13[1],pcVar6);
                                if (iVar10 == 0) {
                                  uVar11 = *puVar13;
                                  pcVar9[iVar14 * 6 + 6] = '\x01';
                                  *pcVar12 = (char)uVar11;
                                  pcVar9[iVar14 * 6 + 5] = '\x01';
                                  break;
                                }
                                puVar13 = puVar13 + 2;
                              } while (iVar3 != iVar4);
                            }
                            goto LAB_08997a08;
                          }
                          bVar1 = pcVar9[iVar14 * 6 + 5];
                        }
                        else {
                          bVar1 = pcVar9[iVar14 * 6 + 5];
                        }
                      }
                      else {
                        bVar1 = pcVar9[iVar14 * 6 + 5];
                      }
                    }
                    else if (*pcVar6 == 'B') {
                      if (pcVar6[1] == 'T') {
                        if (pcVar6[2] == 'N') {
                          cVar7 = pcVar6[3];
                          goto LAB_08997c68;
                        }
                        bVar1 = pcVar9[iVar14 * 6 + 5];
                      }
                      else {
                        bVar1 = pcVar9[iVar14 * 6 + 5];
                      }
                    }
                    else {
LAB_08997a08:
                      bVar1 = pcVar9[iVar14 * 6 + 5];
                    }
                    if (4 < bVar1) {
                      pcVar9[iVar14 * 6 + 5] = '\x04';
                    }
                  }
                }
              }
              iVar14 = iVar14 + 1;
              ppuVar15 = ppuVar15 + 1;
            } while (iVar14 != 7);
            local_30 = local_30 + 1;
            local_38 = local_38 + 2;
          } while (local_30 < g_maxKeys);
        }
        iniparser_free(iVar8);
        iVar8 = 0;
        if ((0 < g_map_entries) && (param_2 == 0)) {
          g_map_entry_slots = g_map_entries + 1;
          g_map = realloc(g_map,(g_map_entries + 1) * 0x2b);
          iVar8 = 0;
        }
      }
    }
  }
  return iVar8;
}



----------------------------------------

// Function: maptable_load_map @ 08997db8

undefined4 maptable_load_map(undefined4 param_1)

{
  undefined4 uVar1;
  
  if (g_map != 0) {
    maptable_unload_map();
  }
  init_map_entry_array();
  if (g_map != 0) {
    uVar1 = maptable_load_map_rec(param_1,0);
    return uVar1;
  }
  return 0xffffffff;
}



----------------------------------------

// Function: novaets_is_mod @ 08997e24

undefined4 novaets_is_mod(int param_1,int param_2)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  
  if ((-1 < DAT_08a04d68) && (-1 < novaets_cycle_modkey_table)) {
    piVar1 = &DAT_08a04d70;
    iVar2 = novaets_cycle_modkey_table;
    iVar3 = DAT_08a04d68;
    do {
      if (param_1 == iVar2) {
        if (param_2 == iVar3) {
          return 1;
        }
        iVar3 = piVar1[1];
      }
      else {
        iVar3 = piVar1[1];
      }
      if (iVar3 < 0) {
        return 0;
      }
      iVar2 = *piVar1;
      piVar1 = piVar1 + 3;
    } while (-1 < iVar2);
  }
  return 0;
}



----------------------------------------

// Function: novaets_kis2_cycle_decode @ 08997e80

undefined4 novaets_kis2_cycle_decode(char *param_1,int *param_2,int *param_3,char *param_4)

{
  char *pcVar1;
  int *in_t0;
  int iVar2;
  int iVar3;
  undefined **ppuVar4;
  int iVar5;
  int iVar6;
  
  if (param_1 != (char *)0x0) {
    if (param_2 == (int *)0x0) {
      return 0xffffffff;
    }
    if (param_3 == (int *)0x0) {
      return 0xffffffff;
    }
    if (param_4 == (char *)0x0) {
      return 0xffffffff;
    }
    if (in_t0 == (int *)0x0) {
      return 0xffffffff;
    }
    *in_t0 = 0;
    *param_2 = -1;
    *param_3 = -1;
    *param_4 = '\0';
    if (*param_1 < '\0') {
      *param_4 = '\x01';
    }
    iVar5 = 0;
    iVar6 = 0;
    do {
      iVar3 = 0;
      ppuVar4 = &novaets_cycle_keycode_table + iVar6 * 0xe;
      do {
        pcVar1 = *ppuVar4;
        if (pcVar1 != (char *)0x0) {
          iVar2 = 0;
          do {
            iVar2 = iVar2 + 1;
            if ((*pcVar1 == *param_1) && (pcVar1[1] == param_1[1])) {
              iVar5 = iVar5 + 1;
              if (*param_4 == '\0') {
                if (1 < iVar5) {
                  return 0xffffffff;
                }
                *param_3 = iVar3;
              }
              else {
                *param_3 = iVar3;
              }
              *param_2 = iVar6;
              if (*param_4 != '\0') {
                iVar5 = novaets_is_mod(iVar6,*param_3);
                *in_t0 = iVar5;
                return 0;
              }
            }
            pcVar1 = pcVar1 + 2;
          } while (iVar2 != 0x20);
        }
        iVar3 = iVar3 + 1;
        ppuVar4 = ppuVar4 + 1;
      } while (iVar3 != 0xe);
      iVar6 = iVar6 + 1;
    } while (iVar6 != 5);
    if (iVar5 != 1) {
      return 0xffffffff;
    }
    if (*param_4 != '\0') {
      return 0xffffffff;
    }
    iVar5 = novaets_is_mod(*param_2,*param_3);
    *in_t0 = iVar5;
    if (iVar5 != 0) {
      return 0;
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: decoded_to_buffer_with_map @ 08997ff0

void decoded_to_buffer_with_map
               (int param_1,undefined1 param_2,undefined1 *param_3,undefined1 param_4)

{
  char cVar1;
  int iVar2;
  undefined1 *puVar3;
  undefined1 in_t0;
  undefined1 in_t1;
  char in_t2;
  int in_t3;
  int *local_res0;
  undefined1 local_18 [8];
  
  cVar1 = param_3[5];
  if (param_1 == 2) {
    iVar2 = *local_res0;
    *local_res0 = iVar2 + 5;
    puVar3 = (undefined1 *)(in_t3 + iVar2);
    if (cVar1 == '\0') {
      puVar3[4] = param_2;
    }
    else {
      puVar3[4] = *param_3;
    }
    puVar3[3] = in_t2;
    *puVar3 = param_4;
    puVar3[1] = in_t0;
    puVar3[2] = in_t1;
    return;
  }
  local_18[0] = param_2;
  if (param_1 == 0) {
    if (in_t2 != '\0') {
      if ((byte)param_3[4] != 0) {
        memcpy((void *)(in_t3 + *local_res0),param_3,(uint)(byte)param_3[4]);
        *local_res0 = *local_res0 + (uint)(byte)param_3[4];
        return;
      }
    }
  }
  else if ((param_1 == 3) && (in_t2 != '\0')) {
    if (cVar1 == '\0') {
      if (param_3[4] == '\0') {
        vt100_output_map(local_18,1,1);
      }
      else {
        vt100_output_map(param_3,param_3[4],0);
      }
    }
    else {
      vt100_output_map(local_18,1,cVar1);
    }
  }
  return;
}



----------------------------------------

// Function: decoded_to_buffer @ 0899813c

void decoded_to_buffer(int param_1,byte *param_2,int param_3,undefined1 param_4)

{
  byte bVar1;
  int iVar2;
  char *pcVar3;
  char in_t0;
  char in_t1;
  char in_t2;
  char in_t3;
  undefined1 *local_res0;
  int *local_res4;
  undefined1 local_1008;
  
  if (param_1 == 1) {
    iVar2 = *local_res4;
    *local_res4 = iVar2 + 2;
    bVar1 = *param_2;
    local_res0[iVar2] = in_t3;
    (local_res0 + iVar2)[1] = bVar1;
    return;
  }
  if (param_1 == 2) {
    iVar2 = *local_res4;
    *local_res4 = iVar2 + 5;
    bVar1 = *param_2;
    pcVar3 = local_res0 + iVar2;
    pcVar3[3] = in_t3;
    pcVar3[4] = bVar1;
    *pcVar3 = in_t0;
    pcVar3[1] = in_t1;
    pcVar3[2] = in_t2;
    return;
  }
  if (param_1 != 0) {
    if (param_1 != 3) {
      return;
    }
    if (param_3 != 1) {
      return;
    }
    if (in_t3 == '\0') {
      return;
    }
    vt100_output_map(param_2,1,param_4);
    return;
  }
  if (param_3 != 1) {
    return;
  }
  if (in_t3 == '\0') {
    return;
  }
  bVar1 = *param_2;
  if (bVar1 != 0x1c) {
    if (bVar1 < 0x1d) {
      if (bVar1 != 0xf) {
        return;
      }
      if (in_t0 != '\0') {
        return;
      }
      local_1008 = 9;
      goto LAB_089981cc;
    }
    if (bVar1 == 0x39) {
      local_1008 = 0x20;
      goto LAB_089981cc;
    }
    if (bVar1 != 0x60) {
      return;
    }
  }
  local_1008 = 10;
LAB_089981cc:
  *local_res0 = local_1008;
  *local_res4 = *local_res4 + 1;
  return;
}



----------------------------------------

// Function: keymap_decode_maptable_rec @ 0899828c

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void keymap_decode_maptable_rec(int param_1,undefined4 param_2,char param_3,char param_4)

{
  byte bVar1;
  ushort uVar2;
  undefined3 uVar3;
  uint uVar4;
  undefined2 uVar5;
  byte bVar6;
  byte bVar7;
  byte bVar8;
  char cVar9;
  int iVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  char local_40 [4];
  uint local_3c;
  uint local_38;
  uint local_34;
  int local_30;
  
  cVar9 = DAT_08a4040e;
  bVar8 = DAT_08a4040d;
  bVar7 = DAT_08a4040c;
  uVar4 = _g_modifierState;
  if (3 < param_1) {
    return;
  }
  bVar1 = g_modifierState;
  bVar6 = DAT_08a4040b;
  uVar2 = _g_modifierState;
  uVar5 = _DAT_08a4040a;
  uVar3 = _g_modifierState;
  switch(param_3) {
  case '\x1d':
    if (param_4 == '\0') {
LAB_08998ad4:
      _g_modifierState = (ushort)bVar1;
      _g_modifierState = CONCAT22(uVar5,_g_modifierState);
    }
    else {
      _g_modifierState = CONCAT11(2,bVar1);
      _g_modifierState = CONCAT22(uVar5,_g_modifierState);
    }
    break;
  case '*':
    if (param_4 == '\0') {
      _g_modifierState = (uint)_DAT_08a40409 << 8;
    }
    else {
      _g_modifierState = CONCAT31(_DAT_08a40409,2);
    }
    break;
  case '6':
    if (param_4 == '\0') {
      _g_modifierState = (uint)_DAT_08a40409 << 8;
    }
    else {
      _g_modifierState = CONCAT31(_DAT_08a40409,3);
    }
    break;
  case '8':
    if (param_4 == '\0') {
LAB_08998ae4:
      _g_modifierState = (uint3)uVar2;
      _g_modifierState = CONCAT13(bVar6,_g_modifierState);
    }
    else {
      _g_modifierState = CONCAT12(2,uVar2);
      _g_modifierState = CONCAT13(bVar6,_g_modifierState);
    }
    break;
  case ':':
    if (param_4 == '\0') goto LAB_08998384;
    if (DAT_08a4040e == '\0') {
      local_3c = (uint)DAT_08a4040d;
      local_34 = (uint)DAT_08a4040c;
      uVar11 = _g_modifierState & 0xff;
      uVar13 = (uint)DAT_08a4040a;
      local_38 = (uint)bVar6;
      uVar12 = (uint)DAT_08a40409;
      DAT_08a4040e = '\x01';
      goto LAB_089983b0;
    }
    local_3c = (uint)DAT_08a4040d;
    local_34 = (uint)DAT_08a4040c;
    uVar11 = _g_modifierState & 0xff;
    uVar13 = (uint)DAT_08a4040a;
    local_38 = (uint)bVar6;
    uVar12 = (uint)DAT_08a40409;
    DAT_08a4040e = '\0';
    goto LAB_089983c8;
  case 'E':
    if (param_4 == '\0') goto LAB_08998384;
    if (DAT_08a4040d == 0) {
      DAT_08a4040d = 1;
    }
    else {
      DAT_08a4040d = 0;
    }
    break;
  case 'a':
    if (param_4 == '\0') goto LAB_08998ad4;
    _g_modifierState = CONCAT11(3,bVar1);
    _g_modifierState = CONCAT22(uVar5,_g_modifierState);
    break;
  case 'd':
    if (param_4 == '\0') goto LAB_08998ae4;
    _g_modifierState = CONCAT12(3,uVar2);
    _g_modifierState = CONCAT13(bVar6,_g_modifierState);
    break;
  case '}':
    if (param_4 == '\0') {
LAB_08998adc:
      _g_modifierState = _g_modifierState & 0xffffff;
    }
    else {
      _g_modifierState = CONCAT13(2,uVar3);
    }
    break;
  case '~':
    if (param_4 == '\0') goto LAB_08998adc;
    _g_modifierState = CONCAT13(3,uVar3);
    break;
  case '\x7f':
    if (param_4 == '\0') {
      DAT_08a4040c = 0;
      goto LAB_08998384;
    }
    DAT_08a4040c = 1;
  }
LAB_08998384:
  local_34 = (uint)DAT_08a4040c;
  uVar13 = _g_modifierState >> 0x10 & 0xff;
  uVar12 = _g_modifierState >> 8 & 0xff;
  local_38 = _g_modifierState >> 0x18;
  local_3c = (uint)DAT_08a4040d;
  uVar11 = _g_modifierState & 0xff;
  if (DAT_08a4040e != '\0') {
LAB_089983b0:
    if ((byte)(param_3 - 0x10U) < 10) {
      uVar11 = (uint)(uVar11 == 0);
    }
    else if ((byte)(param_3 - 0x1eU) < 9) {
      uVar11 = (uint)(uVar11 == 0);
    }
    else if ((byte)(param_3 - 0x2cU) < 7) {
      uVar11 = (uint)(uVar11 == 0);
    }
  }
LAB_089983c8:
  local_40[0] = param_3;
  local_30 = param_1;
  iVar10 = maptable_entry(param_3);
  if (iVar10 == 0) {
LAB_0899884c:
    decoded_to_buffer(param_2,local_40,1,1);
    return;
  }
  if ((local_38 + uVar11 + uVar13 + local_3c + local_34 + uVar12 & 0xff) == 0) {
    if (*(char *)(iVar10 + 6) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 1,uVar11);
    }
    else if (*(char *)(iVar10 + 5) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 1),param_4);
    }
  }
  if (uVar11 != 0) {
    if (*(char *)(iVar10 + 0xc) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 7,uVar11);
    }
    else if (*(char *)(iVar10 + 0xb) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 7),param_4);
    }
  }
  if (uVar12 != 0) {
    if (*(char *)(iVar10 + 0x12) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 0xd,uVar11);
    }
    else if (*(char *)(iVar10 + 0x11) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 0xd),param_4);
    }
  }
  if (uVar13 != 0) {
    if (*(char *)(iVar10 + 0x18) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 0x13,uVar11);
    }
    else if (*(char *)(iVar10 + 0x17) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 0x13),param_4);
    }
  }
  if (local_34 != 0) {
    if (*(char *)(iVar10 + 0x1e) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 0x19,uVar11);
    }
    else if (*(char *)(iVar10 + 0x1d) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 0x19),param_4);
    }
  }
  if (local_38 != 0) {
    if (*(char *)(iVar10 + 0x24) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 0x1f,uVar11);
    }
    else if (*(char *)(iVar10 + 0x23) == '\0') {
      decoded_to_buffer(param_2,local_40,1,1);
    }
    else {
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 0x1f),param_4);
    }
  }
  if (local_3c != 0) {
    if (*(char *)(iVar10 + 0x2a) == '\0') {
      decoded_to_buffer_with_map(param_2,local_40[0],iVar10 + 0x25,uVar11);
    }
    else {
      if (*(char *)(iVar10 + 0x29) == '\0') goto LAB_0899884c;
      _g_modifierState = uVar4;
      DAT_08a4040c = bVar7;
      DAT_08a4040d = bVar8;
      DAT_08a4040e = cVar9;
      keymap_decode_maptable_rec(local_30 + 1,param_2,*(undefined1 *)(iVar10 + 0x25),param_4);
    }
  }
  return;
}



----------------------------------------

// Function: keymap_decode @ 08998b30

void keymap_decode(int param_1,undefined1 param_2,undefined1 param_3,int param_4)

{
  int in_t0;
  undefined1 local_10 [8];
  
  if ((param_4 != 0) && (in_t0 != 0)) {
    if (param_1 == 1) {
      local_10[0] = param_2;
      decoded_to_buffer(1,local_10,1,1);
      return;
    }
    if (param_1 < 2) {
      if (param_1 != 0) {
        return;
      }
    }
    else if (3 < param_1) {
      return;
    }
    keymap_decode_maptable_rec(0,param_1,param_2,param_3);
  }
  return;
}



----------------------------------------

// Function: keymap_reset_state @ 08998bd8

void keymap_reset_state(void)

{
  DAT_08a4040e = 0;
  g_modifierState = 0;
  DAT_08a40409 = 0;
  DAT_08a4040a = 0;
  DAT_08a4040b = 0;
  DAT_08a4040c = 0;
  DAT_08a4040d = 0;
  return;
}



----------------------------------------

// Function: pspIrKeybRawkeyName @ 08998c00

int pspIrKeybRawkeyName(int param_1)

{
  int *piVar1;
  int iVar2;
  int *piVar3;
  
  if (g_maxKeys < 1) {
    return 0;
  }
  iVar2 = 0;
  if (param_1 == keys) {
    piVar3 = &keys;
  }
  else {
    piVar1 = &DAT_08a05e34;
    do {
      piVar3 = piVar1;
      iVar2 = iVar2 + 1;
      if (iVar2 == g_maxKeys) {
        return 0;
      }
      piVar1 = piVar3 + 2;
    } while (*piVar3 != param_1);
  }
  return piVar3[1];
}



----------------------------------------

// Function: vt100_output_map @ 08998c54

void vt100_output_map(char *param_1,size_t param_2,char param_3,char param_4)

{
  char cVar1;
  int iVar2;
  size_t len0;
  bool *pbVar3;
  char in_t0;
  char in_t2;
  int in_t3;
  char *__s;
  int *local_res0;
  
  if ((((in_t3 != 0) && (local_res0 != (int *)0x0)) && (param_1 != (char *)0x0)) &&
     ((in_t2 != '\0' && (0 < (int)param_2)))) {
    if (param_3 == '\0') {
      memcpy((void *)(in_t3 + *local_res0),param_1,param_2);
      *local_res0 = *local_res0 + param_2;
      return;
    }
    if (param_2 == 1) {
      pbVar3 = (bool *)&g_vt100_map;
      do {
        if (*pbVar3 == (bool)*param_1) {
          if (pbVar3[1] < 0) {
            cVar1 = pbVar3[2];
          }
          else {
            if ((int)pbVar3[1] != (uint)(param_4 != '\0')) goto LAB_08998cf4;
            cVar1 = pbVar3[2];
          }
          if (cVar1 < 0) {
            iVar2 = *local_res0;
LAB_08998d34:
            __s = *(char **)(pbVar3 + 4);
            if (__s == (char *)0x0) {
              len0 = 1;
              *(char *)(in_t3 + iVar2) = pbVar3[8];
            }
            else {
              len0 = strlen(__s);
              memcpy((char *)(in_t3 + iVar2),__s,len0);
            }
            *local_res0 = *local_res0 + len0;
            return;
          }
          if ((int)cVar1 == (uint)(in_t0 != '\0')) {
            iVar2 = *local_res0;
            goto LAB_08998d34;
          }
        }
LAB_08998cf4:
        pbVar3 = pbVar3 + 0xc;
      } while (pbVar3 != &std::ios_base::Init::_S_synced_with_stdio);
    }
  }
  return;
}



----------------------------------------

// Function: iniparser_free @ 08998db8

void iniparser_free(void *param_1)

{
  int iVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  
  if (param_1 != (void *)0x0) {
    iVar4 = 0;
    if (0 < *(int *)((int)param_1 + 4)) {
      iVar1 = *(int *)((int)param_1 + 0xc);
      while( true ) {
        iVar3 = iVar4 * 4;
        iVar4 = iVar4 + 1;
        pvVar2 = *(void **)(iVar1 + iVar3);
        if (pvVar2 != (void *)0x0) {
          free(pvVar2);
        }
        pvVar2 = *(void **)(*(int *)((int)param_1 + 8) + iVar3);
        if (pvVar2 != (void *)0x0) {
          free(pvVar2);
        }
        if (*(int *)((int)param_1 + 4) <= iVar4) break;
        iVar1 = *(int *)((int)param_1 + 0xc);
      }
    }
    free(*(void **)((int)param_1 + 8));
    free(*(void **)((int)param_1 + 0xc));
    free(*(void **)((int)param_1 + 0x10));
    free(param_1);
    return;
  }
  return;
}



----------------------------------------

// Function: strlwc @ 08998e7c

undefined1 * strlwc(char *param_1)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  char *pcVar4;
  
  if (param_1 != (char *)0x0) {
    pcVar4 = &l_2753;
    memset(&l_2753,0,0x401);
    pcVar1 = __ctype_ptr;
    iVar3 = (int)*param_1;
    if (iVar3 != 0) {
      do {
        cVar2 = (char)iVar3;
        if ((pcVar1[iVar3] & 1U) != 0) {
          cVar2 = cVar2 + ' ';
        }
        *pcVar4 = cVar2;
        iVar3 = (int)param_1[1];
        pcVar4 = pcVar4 + 1;
        param_1 = param_1 + 1;
      } while ((iVar3 != 0) && (pcVar4 != &DAT_08a1e060));
    }
    DAT_08a1e060 = 0;
    return &l_2753;
  }
  return (undefined1 *)0x0;
}



----------------------------------------

// Function: dictionary_hash @ 08998f44

int dictionary_hash(char *param_1)

{
  size_t sVar1;
  char *pcVar2;
  uint uVar3;
  size_t sVar4;
  
  sVar1 = strlen(param_1);
  if (0 < (int)sVar1) {
    uVar3 = 0;
    sVar4 = 0;
    do {
      pcVar2 = param_1 + sVar4;
      sVar4 = sVar4 + 1;
      uVar3 = ((int)*pcVar2 + uVar3) * 0x401;
      uVar3 = uVar3 ^ uVar3 >> 6;
    } while (sVar1 != sVar4);
    return (uVar3 * 9 ^ uVar3 * 9 >> 0xb) * 0x8001;
  }
  return 0;
}



----------------------------------------

// Function: iniparser_unset @ 08998fc8

void iniparser_unset(int *param_1,undefined4 param_2)

{
  char *s1;
  int iVar1;
  int iVar2;
  char *s2;
  undefined4 *puVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
  s1 = (char *)strlwc(param_2);
  iVar1 = dictionary_hash(s1);
  iVar6 = param_1[1];
  if (0 < iVar6) {
    puVar3 = (undefined4 *)param_1[3];
    iVar4 = 0;
    iVar5 = 0;
    do {
      s2 = (char *)*puVar3;
      iVar4 = iVar4 + 1;
      puVar3 = puVar3 + 1;
      if (((s2 != (char *)0x0) && (iVar1 == *(int *)(iVar5 + param_1[4]))) &&
         (iVar2 = strcmp(s1,s2), iVar2 == 0)) {
        free(s2);
        iVar1 = param_1[2];
        *(undefined4 *)(param_1[3] + iVar5) = 0;
        if (*(void **)(iVar1 + iVar5) == (void *)0x0) {
          iVar1 = param_1[4];
        }
        else {
          free(*(void **)(iVar1 + iVar5));
          *(undefined4 *)(iVar5 + param_1[2]) = 0;
          iVar1 = param_1[4];
        }
        *(undefined4 *)(iVar5 + iVar1) = 0;
        *param_1 = *param_1 + -1;
        return;
      }
      iVar5 = iVar5 + 4;
    } while (iVar6 != iVar4);
  }
  return;
}



----------------------------------------

// Function: strcrop @ 089990e4

undefined1 * strcrop(char *param_1)

{
  byte bVar1;
  undefined1 *puVar2;
  size_t sVar3;
  undefined1 *puVar4;
  
  if (param_1 != (char *)0x0) {
    memset(l_2797,0,0x401);
    strcpy(l_2797,param_1);
    sVar3 = strlen(l_2797);
    puVar4 = l_2797 + sVar3;
    if (l_2797 < puVar4) {
      bVar1 = __ctype_ptr[(char)(&DAT_08a1e063)[sVar3]];
      puVar2 = &DAT_08a1e063 + sVar3;
      while (((bVar1 & 8) != 0 && (puVar4 = puVar2, l_2797 < puVar2))) {
        bVar1 = __ctype_ptr[(char)puVar2[-1]];
        puVar2 = puVar2 + -1;
      }
    }
    *puVar4 = 0;
    return l_2797;
  }
  return (undefined1 *)0x0;
}



----------------------------------------

// Function: iniparser_getstring @ 089991c0

undefined4 iniparser_getstring(int param_1,int param_2,undefined4 param_3)

{
  char *pcVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  
  if ((param_1 != 0) && (param_2 != 0)) {
    pcVar1 = (char *)strlwc(param_2);
    pcVar1 = strdup(pcVar1);
    iVar2 = dictionary_hash(pcVar1);
    iVar7 = *(int *)(param_1 + 4);
    if (0 < iVar7) {
      iVar6 = *(int *)(param_1 + 0xc);
      iVar5 = 0;
      iVar4 = 0;
      do {
        iVar5 = iVar5 + 1;
        if (((iVar6 != 0) && (iVar2 == *(int *)(iVar4 + *(int *)(param_1 + 0x10)))) &&
           (iVar3 = strcmp(pcVar1,*(char **)(iVar6 + iVar4)), iVar3 == 0)) {
          param_3 = *(undefined4 *)(iVar4 + *(int *)(param_1 + 8));
          break;
        }
        iVar4 = iVar4 + 4;
      } while (iVar7 != iVar5);
    }
    free(pcVar1);
  }
  return param_3;
}



----------------------------------------

// Function: iniparser_find_entry @ 089992c0

bool iniparser_find_entry(undefined4 param_1,undefined4 param_2)

{
  int iVar1;
  
  iVar1 = iniparser_getstring(param_1,param_2,0xffffffff);
  return iVar1 != -1;
}



----------------------------------------

// Function: iniparser_getboolean @ 089992e4

undefined4 iniparser_getboolean(undefined4 param_1,undefined4 param_2,undefined4 param_3)

{
  char cVar1;
  char *pcVar2;
  
  pcVar2 = (char *)iniparser_getstring(param_1,param_2,0xffffffff);
  if (pcVar2 != (char *)0xffffffff) {
    cVar1 = *pcVar2;
    if ((((cVar1 == 'y') || (cVar1 == 'Y')) || (cVar1 == '1')) || ((cVar1 == 't' || (cVar1 == 'T')))
       ) {
      param_3 = 1;
    }
    else if ((((cVar1 == 'n') || ((cVar1 == 'N' || (cVar1 == '0')))) || (cVar1 == 'f')) ||
            (cVar1 == 'F')) {
      return 0;
    }
  }
  return param_3;
}



----------------------------------------

// Function: iniparser_getstr @ 08999390

undefined4 iniparser_getstr(int param_1,int param_2)

{
  char *pcVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  undefined4 uVar8;
  
  uVar8 = 0;
  if ((param_1 != 0) && (uVar8 = 0, param_2 != 0)) {
    pcVar1 = (char *)strlwc(param_2);
    pcVar1 = strdup(pcVar1);
    iVar2 = dictionary_hash(pcVar1);
    iVar7 = *(int *)(param_1 + 4);
    if (0 < iVar7) {
      iVar6 = *(int *)(param_1 + 0xc);
      iVar5 = 0;
      iVar4 = 0;
      do {
        iVar5 = iVar5 + 1;
        if (((iVar6 != 0) && (iVar2 == *(int *)(iVar4 + *(int *)(param_1 + 0x10)))) &&
           (iVar3 = strcmp(pcVar1,*(char **)(iVar6 + iVar4)), iVar3 == 0)) {
          uVar8 = *(undefined4 *)(iVar4 + *(int *)(param_1 + 8));
          goto LAB_08999284;
        }
        iVar4 = iVar4 + 4;
      } while (iVar7 != iVar5);
    }
    uVar8 = 0;
LAB_08999284:
    free(pcVar1);
  }
  return uVar8;
}



----------------------------------------

// Function: mem_double @ 08999398

void * mem_double(void *param_1,size_t param_2)

{
  void *dst0;
  
  dst0 = calloc(param_2 << 1,1);
  memcpy(dst0,param_1,param_2);
  free(param_1);
  return dst0;
}



----------------------------------------

// Function: dictionary_set @ 089993f8

void dictionary_set(int *param_1,char *param_2,char *param_3)

{
  int iVar1;
  int iVar2;
  char *pcVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int *piVar8;
  int iVar9;
  
  if ((param_1 == (int *)0x0) || (param_2 == (char *)0x0)) {
    return;
  }
  iVar1 = dictionary_hash(param_2);
  iVar9 = *param_1;
  if (iVar9 < 1) {
    iVar6 = param_1[1];
  }
  else {
    iVar6 = param_1[1];
    iVar4 = 0;
    if (0 < iVar6) {
      iVar7 = param_1[3];
      iVar5 = 0;
      do {
        iVar4 = iVar4 + 1;
        if (((*(char **)(iVar7 + iVar5) != (char *)0x0) && (iVar1 == *(int *)(param_1[4] + iVar5)))
           && (iVar2 = strcmp(param_2,*(char **)(iVar7 + iVar5)), iVar2 == 0)) {
          iVar1 = param_1[2];
          if (*(void **)(iVar5 + iVar1) != (void *)0x0) {
            free(*(void **)(iVar5 + iVar1));
            iVar1 = param_1[2];
          }
          if (param_3 != (char *)0x0) {
            pcVar3 = strdup(param_3);
            *(char **)(iVar5 + iVar1) = pcVar3;
            return;
          }
          *(undefined4 *)(iVar5 + iVar1) = 0;
          return;
        }
        iVar5 = iVar5 + 4;
      } while (iVar6 != iVar4);
    }
  }
  if (iVar9 == iVar6) {
    iVar9 = mem_double(param_1[2],iVar6 << 2);
    param_1[2] = iVar9;
    iVar9 = mem_double(param_1[3],param_1[1] << 2);
    param_1[3] = iVar9;
    iVar9 = mem_double(param_1[4],param_1[1] << 2);
    param_1[4] = iVar9;
    iVar6 = param_1[1] << 1;
    param_1[1] = iVar6;
  }
  piVar8 = (int *)param_1[3];
  if ((iVar6 < 1) || (iVar9 = 0, *piVar8 == 0)) {
    iVar4 = 0;
LAB_08999560:
    pcVar3 = strdup(param_2);
    *(char **)(iVar4 + (int)piVar8) = pcVar3;
    iVar9 = param_1[2];
  }
  else {
    iVar5 = 4;
    do {
      iVar4 = iVar5;
      iVar9 = iVar9 + 1;
      if (iVar9 == iVar6) {
        iVar4 = iVar9 * 4;
        goto LAB_08999560;
      }
      iVar5 = iVar4 + 4;
    } while (*(int *)((int)piVar8 + iVar4) != 0);
    pcVar3 = strdup(param_2);
    *(char **)(iVar4 + (int)piVar8) = pcVar3;
    iVar9 = param_1[2];
  }
  if (param_3 == (char *)0x0) {
    pcVar3 = (char *)0x0;
  }
  else {
    pcVar3 = strdup(param_3);
  }
  iVar6 = param_1[4];
  *(char **)(iVar9 + iVar4) = pcVar3;
  *(int *)(iVar6 + iVar4) = iVar1;
  *param_1 = *param_1 + 1;
  return;
}



----------------------------------------

// Function: iniparser_setstr @ 08999650

undefined4 iniparser_setstr(undefined4 param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 uVar1;
  
  uVar1 = strlwc(param_2);
  dictionary_set(param_1,uVar1,param_3);
  return 0;
}



----------------------------------------

// Function: iniparser_add_entry @ 08999698

void iniparser_add_entry(undefined4 param_1,char *param_2,int param_3,undefined4 param_4)

{
  char acStack_818 [2056];
  
  if (param_3 != 0) {
    sprintf(acStack_818,"%s:%s",param_2,param_3);
    dictionary_set(param_1,acStack_818,param_4);
    return;
  }
  strcpy(acStack_818,param_2);
  dictionary_set(param_1,acStack_818,param_4);
  return;
}



----------------------------------------

// Function: iniparser_new @ 08999720

void * iniparser_new(char *param_1)

{
  byte bVar1;
  FILE *fp;
  void *pvVar2;
  void *pvVar3;
  char *pcVar4;
  undefined4 uVar5;
  int iVar6;
  char local_1028;
  char local_1027 [1024];
  char local_c27 [1025];
  char acStack_826 [1025];
  char local_425 [1029];
  
  fp = fopen(param_1,"r");
  if (fp == (FILE *)0x0) {
    return (void *)0x0;
  }
  local_c27[0] = '\0';
  pvVar2 = calloc(1,0x14);
  *(undefined4 *)((int)pvVar2 + 4) = 0x80;
  pvVar3 = calloc(0x80,4);
  *(void **)((int)pvVar2 + 8) = pvVar3;
  pvVar3 = calloc(0x80,4);
  *(void **)((int)pvVar2 + 0xc) = pvVar3;
  pvVar3 = calloc(0x80,4);
  *(void **)((int)pvVar2 + 0x10) = pvVar3;
LAB_089997b4:
  do {
    pcVar4 = fgets(&local_1028,0x400,fp);
    while( true ) {
      if (pcVar4 == (char *)0x0) {
        fclose(fp);
        return pvVar2;
      }
      iVar6 = (int)local_1028;
      bVar1 = __ctype_ptr[iVar6];
      pcVar4 = &local_1028;
      while ((bVar1 & 8) != 0) {
        if (iVar6 == 0) goto LAB_089997b4;
        pcVar4 = pcVar4 + 1;
        iVar6 = (int)*pcVar4;
        bVar1 = __ctype_ptr[iVar6];
      }
      if (((iVar6 == 0x3b) || (iVar6 == 0x23)) || (iVar6 == 0)) goto LAB_089997b4;
      iVar6 = sscanf(pcVar4,"[%[^]]",local_c27);
      if (iVar6 == 1) break;
      iVar6 = sscanf(pcVar4,"%[^=] = \"%[^\"]\"",acStack_826,local_425);
      if (((iVar6 != 2) &&
          (iVar6 = sscanf(pcVar4,"%[^=] = \'%[^\']\'",acStack_826,local_425), iVar6 != 2)) &&
         (iVar6 = sscanf(pcVar4,"%[^=] = %[^;#]",acStack_826,local_425), iVar6 != 2))
      goto LAB_089997b4;
      uVar5 = strcrop(acStack_826);
      pcVar4 = (char *)strlwc(uVar5);
      strcpy(acStack_826,pcVar4);
      iVar6 = strcmp(local_425,"\"\"");
      if ((iVar6 == 0) || (iVar6 = strcmp(local_425,"\'\'"), iVar6 == 0)) {
        local_425[0] = '\0';
      }
      else {
        pcVar4 = (char *)strcrop(local_425);
        strcpy(local_425,pcVar4);
      }
      iniparser_add_entry(pvVar2,local_c27,acStack_826,local_425);
      pcVar4 = fgets(&local_1028,0x400,fp);
    }
    pcVar4 = (char *)strlwc(local_c27);
    strcpy(local_c27,pcVar4);
    iniparser_add_entry(pvVar2,local_c27,0,0);
  } while( true );
}



----------------------------------------

// Function: iniparser_getdouble @ 089999d4

undefined4 iniparser_getdouble(undefined4 param_1,undefined4 param_2,undefined4 param_3)

{
  char *s;
  undefined4 extraout_v0;
  
  s = (char *)iniparser_getstring(param_1,param_2,0xffffffff);
  if (s != (char *)0xffffffff) {
    atof(s);
    return extraout_v0;
  }
  return param_3;
}



----------------------------------------

// Function: iniparser_getint @ 08999a30

int iniparser_getint(undefined4 param_1,undefined4 param_2,int param_3)

{
  char *s;
  int iVar1;
  
  s = (char *)iniparser_getstring(param_1,param_2,0xffffffff);
  if (s != (char *)0xffffffff) {
    iVar1 = atoi(s);
    return iVar1;
  }
  return param_3;
}



----------------------------------------

// Function: iniparser_dump @ 08999a78

void iniparser_dump(int param_1,FILE *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  if ((param_1 != 0) && (param_2 != (FILE *)0x0)) {
    iVar2 = *(int *)(param_1 + 4);
    iVar3 = 0;
    if (0 < iVar2) {
      do {
        iVar1 = *(int *)(param_1 + 0xc);
        while( true ) {
          iVar1 = *(int *)(iVar1 + iVar3 * 4);
          if (iVar1 == 0) break;
          iVar2 = *(int *)(*(int *)(param_1 + 8) + iVar3 * 4);
          if (iVar2 != 0) {
            fprintf(param_2,"[%s]=[%s]\n",iVar1,iVar2);
            iVar2 = *(int *)(param_1 + 4);
            break;
          }
          fprintf(param_2,"[%s]=UNDEF\n",iVar1,0);
          iVar2 = *(int *)(param_1 + 4);
          iVar3 = iVar3 + 1;
          if (iVar2 <= iVar3) {
            return;
          }
          iVar1 = *(int *)(param_1 + 0xc);
        }
        iVar3 = iVar3 + 1;
      } while (iVar3 < iVar2);
    }
  }
  return;
}



----------------------------------------

// Function: iniparser_getsecname @ 08999b54

undefined4 iniparser_getsecname(int param_1,int param_2)

{
  char *pcVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  if (param_1 != 0) {
    if (param_2 < 0) {
      return 0;
    }
    iVar4 = *(int *)(param_1 + 4);
    iVar5 = 0;
    if (iVar4 < 1) {
      iVar3 = 0;
    }
    else {
      puVar2 = *(undefined4 **)(param_1 + 0xc);
      iVar3 = 0;
      do {
        pcVar1 = (char *)*puVar2;
        puVar2 = puVar2 + 1;
        if (((pcVar1 != (char *)0x0) && (pcVar1 = strchr(pcVar1,0x3a), pcVar1 == (char *)0x0)) &&
           (iVar5 = iVar5 + 1, param_2 < iVar5)) break;
        iVar3 = iVar3 + 1;
      } while (iVar3 != iVar4);
    }
    if (param_2 < iVar5) {
      return *(undefined4 *)(iVar3 * 4 + *(int *)(param_1 + 0xc));
    }
  }
  return 0;
}



----------------------------------------

// Function: iniparser_getnsec @ 08999c2c

int iniparser_getnsec(int param_1)

{
  char *pcVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  if (param_1 == 0) {
    return -1;
  }
  iVar4 = *(int *)(param_1 + 4);
  iVar3 = 0;
  if (iVar4 < 1) {
    iVar5 = 0;
  }
  else {
    puVar2 = *(undefined4 **)(param_1 + 0xc);
    iVar5 = 0;
    do {
      pcVar1 = (char *)*puVar2;
      while( true ) {
        iVar3 = iVar3 + 1;
        puVar2 = puVar2 + 1;
        if ((pcVar1 != (char *)0x0) && (pcVar1 = strchr(pcVar1,0x3a), pcVar1 == (char *)0x0)) break;
        if (iVar4 == iVar3) {
          return iVar5;
        }
        pcVar1 = (char *)*puVar2;
      }
      iVar5 = iVar5 + 1;
    } while (iVar4 != iVar3);
  }
  return iVar5;
}



----------------------------------------

// Function: iniparser_dump_ini @ 08999ce8

void iniparser_dump_ini(int param_1,FILE *param_2)

{
  char *pcVar1;
  size_t sVar2;
  int iVar3;
  char *pcVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  char acStack_438 [1032];
  int local_30;
  
  if ((param_1 != 0) && (param_2 != (FILE *)0x0)) {
    local_30 = iniparser_getnsec();
    if (local_30 < 1) {
      iVar7 = *(int *)(param_1 + 4);
      iVar8 = 0;
      if (0 < iVar7) {
        iVar3 = *(int *)(param_1 + 0xc);
        while( true ) {
          iVar6 = iVar8 * 4;
          iVar3 = *(int *)(iVar6 + iVar3);
          iVar8 = iVar8 + 1;
          if (iVar3 != 0) {
            fprintf(param_2,"%s = %s\n",iVar3,*(undefined4 *)(iVar6 + *(int *)(param_1 + 8)));
            iVar7 = *(int *)(param_1 + 4);
          }
          if (iVar7 <= iVar8) break;
          iVar3 = *(int *)(param_1 + 0xc);
        }
        return;
      }
    }
    else {
      iVar8 = 0;
      do {
        pcVar1 = (char *)iniparser_getsecname(param_1,iVar8);
        sVar2 = strlen(pcVar1);
        fprintf(param_2,"\n[%s]\n",pcVar1);
        sprintf(acStack_438,"%s:",pcVar1);
        iVar7 = *(int *)(param_1 + 4);
        if (0 < iVar7) {
          iVar6 = 0;
          iVar3 = *(int *)(param_1 + 0xc);
          while( true ) {
            iVar5 = iVar6 * 4;
            pcVar1 = *(char **)(iVar5 + iVar3);
            iVar6 = iVar6 + 1;
            if (pcVar1 != (char *)0x0) {
              iVar3 = strncmp(pcVar1,acStack_438,sVar2 + 1);
              if (iVar3 == 0) {
                pcVar4 = *(char **)(iVar5 + *(int *)(param_1 + 8));
                if (pcVar4 == (char *)0x0) {
                  pcVar4 = "";
                }
                fprintf(param_2,"%-30s = %s\n",pcVar1 + sVar2 + 1,pcVar4);
                iVar7 = *(int *)(param_1 + 4);
              }
            }
            if (iVar7 <= iVar6) break;
            iVar3 = *(int *)(param_1 + 0xc);
          }
        }
        iVar8 = iVar8 + 1;
      } while (local_30 != iVar8);
      fputc(10,param_2);
    }
  }
  return;
}



----------------------------------------

// Function: eofread @ 08999ed8

int eofread(void *cookie,char *buf,int len)

{
  return 0;
}



----------------------------------------

// Function: _sscanf_r @ 08999ee0

int _sscanf_r(_reent *ptr,char *str,char *fmt,...)

{
  int iVar1;
  undefined4 in_a3;
  FILE local_84;
  undefined4 local_14 [5];
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: va_list ap@[???]
                       Unresolved local var: FILE f@[???] */
  local_84._flags = 0x204;
  local_84._p = (uchar *)str;
  local_84._bf._base = (uchar *)str;
  local_14[0] = in_a3;
  local_84._r = strlen(str);
  local_84._read = eofread;
  local_84._file = -1;
  local_84._ub._base = (uchar *)0x0;
  local_84._lb._base = (uchar *)0x0;
  local_84._bf._size = local_84._r;
  iVar1 = __svfscanf_r(ptr,&local_84,fmt,local_14);
  return iVar1;
}



----------------------------------------

// Function: sscanf @ 08999f78

int sscanf(char *str,char *fmt,...)

{
  int iVar1;
  undefined4 in_a2;
  undefined4 in_a3;
  FILE local_7c;
  undefined4 local_18;
  undefined4 local_14;
  
                    /* Unresolved local var: int ret@[???]
                       Unresolved local var: va_list ap@[???]
                       Unresolved local var: FILE f@[???] */
  local_7c._flags = 0x204;
  local_7c._p = (uchar *)str;
  local_7c._bf._base = (uchar *)str;
  local_18 = in_a2;
  local_14 = in_a3;
  local_7c._r = strlen(str);
  local_7c._read = eofread;
  local_7c._file = -1;
  local_7c._ub._base = (uchar *)0x0;
  local_7c._lb._base = (uchar *)0x0;
  local_7c._bf._size = local_7c._r;
  iVar1 = __svfscanf_r(_impure_ptr,&local_7c,fmt,&local_18);
  return iVar1;
}



----------------------------------------

// Function: __svfscanf_r @ 0899a008

int __svfscanf_r(_reent *rptr,FILE *fp,char *fmt0,va_list ap)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  bool bVar5;
  bool bVar6;
  undefined1 *puVar7;
  undefined2 *puVar8;
  int *piVar9;
  int iVar10;
  byte *pbVar11;
  char *pcVar12;
  uint uVar13;
  int iVar14;
  u_char *puVar15;
  char acStack_2bc [632];
  code *local_44;
  undefined4 local_40;
  int local_3c;
  
                    /* Unresolved local var: char * fmt@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: size_t width@[???]
                       Unresolved local var: char * p@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int flags@[???]
                       Unresolved local var: char * p0@[???]
                       Unresolved local var: int nassigned@[???]
                       Unresolved local var: int nread@[???]
                       Unresolved local var: int base@[???]
                       Unresolved local var: int nbytes@[???]
                       Unresolved local var: wchar_t wc@[???]
                       Unresolved local var: wchar_t * wcp@[???]
                       Unresolved local var: size_t mbslen@[???]
                       Unresolved local var: mbstate_t state@[???]
                       Unresolved local var: _func_ulong_varargs * ccfn@[???]
                       Unresolved local var: char[256] ccltab@[???]
                       Unresolved local var: char[350] buf@[???]
                       Unresolved local var: char * lptr@[???]
                       Unresolved local var: char * cp@[???]
                       Unresolved local var: short * sp@[???]
                       Unresolved local var: int * ip@[???]
                       Unresolved local var: float * flp@[???]
                       Unresolved local var: longdouble * ldp@[???]
                       Unresolved local var: double * dp@[???]
                       Unresolved local var: long * lp@[???]
                       Unresolved local var: longlong * llp@[???] */
  local_3c = 0;
  iVar14 = 0;
  local_40 = 0;
  local_44 = (code *)0x0;
LAB_0899a054:
  iVar10 = (int)*fmt0;
  pcVar12 = __ctype_ptr;
joined_r0x0899a058:
  do {
    if (iVar10 == 0) {
      __ctype_ptr = pcVar12;
      return local_3c;
    }
    fmt0 = fmt0 + 1;
    __ctype_ptr = pcVar12;
    if ((pcVar12[iVar10] & 8U) != 0) {
      if (fp->_r < 1) goto LAB_0899a0c0;
      do {
        pbVar11 = fp->_p;
        while( true ) {
          if ((pcVar12[*pbVar11] & 8U) == 0) goto LAB_0899a054;
          iVar14 = iVar14 + 1;
          iVar10 = fp->_r + -1;
          fp->_p = pbVar11 + 1;
          fp->_r = iVar10;
          if (0 < iVar10) break;
LAB_0899a0c0:
          iVar10 = __srefill_r(rptr,fp);
          pcVar12 = __ctype_ptr;
          if (iVar10 != 0) {
            iVar10 = (int)*fmt0;
            goto joined_r0x0899a058;
          }
          pbVar11 = fp->_p;
        }
      } while( true );
    }
    if (iVar10 != 0x25) {
switchD_0899a1b4_caseD_25:
      if (fp->_r < 1) {
        iVar10 = __srefill_r(rptr,fp);
        if (iVar10 != 0) goto LAB_0899a174;
        pbVar11 = fp->_p;
      }
      else {
        pbVar11 = fp->_p;
      }
      if ((uint)*pbVar11 != (int)fmt0[-1]) {
        return local_3c;
      }
      fp->_p = pbVar11 + 1;
      fp->_r = fp->_r + -1;
      iVar10 = (int)*fmt0;
      iVar14 = iVar14 + 1;
      pcVar12 = __ctype_ptr;
      goto joined_r0x0899a058;
    }
    uVar13 = (uint)*fmt0;
    bVar6 = false;
    bVar5 = false;
    bVar4 = false;
    bVar3 = false;
    bVar2 = false;
    puVar15 = (u_char *)fmt0;
LAB_0899a190:
    bVar1 = false;
    fmt0 = (char *)(puVar15 + 1);
    switch(uVar13 & 0xff) {
    case 0:
      goto switchD_0899a1b4_caseD_0;
    case 0x25:
      goto switchD_0899a1b4_caseD_25;
    case 0x2a:
      uVar13 = (uint)*fmt0;
      bVar2 = true;
      puVar15 = (u_char *)fmt0;
      goto LAB_0899a190;
    case 0x30:
    case 0x31:
    case 0x32:
    case 0x33:
    case 0x34:
    case 0x35:
    case 0x36:
    case 0x37:
    case 0x38:
    case 0x39:
      uVar13 = (uint)*fmt0;
      puVar15 = (u_char *)fmt0;
      goto LAB_0899a190;
    case 0x43:
    case 99:
      bVar1 = true;
      uVar13 = 0;
      goto LAB_0899a1ec;
    case 0x44:
      goto switchD_0899a1b4_caseD_44;
    case 0x45:
    case 0x47:
    case 0x65:
    case 0x66:
    case 0x67:
      uVar13 = 4;
      goto LAB_0899a1ec;
    case 0x4c:
      uVar13 = (uint)*fmt0;
      bVar6 = true;
      puVar15 = (u_char *)fmt0;
      goto LAB_0899a190;
    case 0x4f:
      uVar13 = 3;
      local_40 = 8;
      local_44 = _strtoul_r;
      goto LAB_0899a1ec;
    case 0x53:
    case 0x73:
      uVar13 = 2;
      goto LAB_0899a1ec;
    case 0x58:
    case 0x78:
      uVar13 = 3;
      local_40 = 0x10;
      local_44 = _strtoul_r;
      goto LAB_0899a1ec;
    case 0x5b:
      fmt0 = (char *)__sccl(acStack_2bc,(u_char *)fmt0);
      bVar1 = true;
      uVar13 = 1;
      goto LAB_0899a1ec;
    case 100:
      goto switchD_0899a1b4_caseD_64;
    case 0x68:
      uVar13 = (uint)*fmt0;
      if (uVar13 == 0x68) {
        uVar13 = (uint)(char)puVar15[2];
        bVar3 = true;
        puVar15 = puVar15 + 2;
      }
      else {
        bVar4 = true;
        puVar15 = (u_char *)fmt0;
      }
      goto LAB_0899a190;
    case 0x69:
      uVar13 = 3;
      local_44 = _strtol_r;
      local_40 = 0;
      goto LAB_0899a1ec;
    case 0x6c:
      goto switchD_0899a1b4_caseD_6c;
    case 0x6e:
      if (bVar2) {
        iVar10 = (int)*fmt0;
        goto joined_r0x0899a058;
      }
      if (bVar3) {
        puVar7 = *(undefined1 **)ap;
        ap = (va_list)((int)ap + 4);
        *puVar7 = (char)iVar14;
        goto LAB_0899a054;
      }
      if (bVar4) {
        puVar8 = *(undefined2 **)ap;
        ap = (va_list)((int)ap + 4);
        *puVar8 = (short)iVar14;
        goto LAB_0899a054;
      }
      if (bVar5) {
        piVar9 = *(int **)ap;
      }
      else {
        if (bVar6) {
          piVar9 = *(int **)ap;
          ap = (va_list)((int)ap + 4);
          piVar9[1] = iVar14 >> 0x1f;
          *piVar9 = iVar14;
          goto LAB_0899a054;
        }
        piVar9 = *(int **)ap;
      }
      ap = (va_list)((int)ap + 4);
      *piVar9 = iVar14;
      goto LAB_0899a054;
    case 0x6f:
      uVar13 = 3;
      local_40 = 8;
      local_44 = _strtoul_r;
      goto LAB_0899a1ec;
    case 0x70:
      uVar13 = 3;
      local_40 = 0x10;
      local_44 = _strtoul_r;
      goto LAB_0899a1ec;
    case 0x75:
      uVar13 = 3;
      local_40 = 10;
      local_44 = _strtoul_r;
      goto LAB_0899a1ec;
    }
    if ((pcVar12[uVar13] & 1U) != 0) {
switchD_0899a1b4_caseD_44:
    }
switchD_0899a1b4_caseD_64:
    bVar1 = false;
    local_44 = _strtol_r;
    uVar13 = 3;
    local_40 = 10;
LAB_0899a1ec:
    if ((fp->_r < 1) && (iVar10 = __srefill_r(rptr,fp), iVar10 != 0)) {
LAB_0899a174:
      if (local_3c == 0) {
switchD_0899a1b4_caseD_0:
        local_3c = -1;
      }
      return local_3c;
    }
    if ((!bVar1) && (pbVar11 = fp->_p, (__ctype_ptr[*pbVar11] & 8U) != 0)) {
      iVar10 = fp->_r;
      pcVar12 = __ctype_ptr;
      while( true ) {
        fp->_r = iVar10 + -1;
        if (iVar10 + -1 < 1) {
          iVar10 = __srefill_r(rptr,fp);
          if (iVar10 != 0) goto LAB_0899a174;
          pbVar11 = fp->_p;
          pcVar12 = __ctype_ptr;
        }
        else {
          fp->_p = pbVar11 + 1;
          pbVar11 = fp->_p;
        }
        iVar14 = iVar14 + 1;
        if ((pcVar12[*pbVar11] & 8U) == 0) break;
        iVar10 = fp->_r;
      }
    }
    if (uVar13 < 5) {
                    /* WARNING: Could not recover jumptable at 0x0899a280. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      iVar14 = (*(code *)(&switchD_0899a280::switchdataD_089ef1b0)[uVar13])();
      return iVar14;
    }
    iVar10 = (int)*fmt0;
    pcVar12 = __ctype_ptr;
  } while( true );
switchD_0899a1b4_caseD_6c:
  uVar13 = (uint)*fmt0;
  if (uVar13 == 0x6c) {
    uVar13 = (uint)(char)puVar15[2];
    bVar6 = true;
    puVar15 = puVar15 + 2;
  }
  else {
    bVar5 = true;
    puVar15 = (u_char *)fmt0;
  }
  goto LAB_0899a190;
}



----------------------------------------

// Function: __svfscanf @ 0899b140

int __svfscanf(FILE *fp,char *fmt0,va_list ap)

{
  int iVar1;
  
  iVar1 = __svfscanf_r(_impure_ptr,fp,fmt0,ap);
  return iVar1;
}



----------------------------------------

// Function: _vfscanf_r @ 0899b160

int _vfscanf_r(_reent *data,FILE *fp,char *fmt,va_list ap)

{
  int iVar1;
  
  if ((data != (_reent *)0x0) && (data->__sdidinit == 0)) {
    __sinit(data);
    iVar1 = __svfscanf_r(data,fp,fmt,ap);
    return iVar1;
  }
  iVar1 = __svfscanf_r(data,fp,fmt,ap);
  return iVar1;
}



----------------------------------------

// Function: vfscanf @ 0899b1f8

int vfscanf(FILE *fp,char *fmt,va_list ap)

{
  int iVar1;
  
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
    iVar1 = __svfscanf_r(_impure_ptr,fp,fmt,ap);
    return iVar1;
  }
  iVar1 = __svfscanf_r(_impure_ptr,fp,fmt,ap);
  return iVar1;
}



----------------------------------------

// Function: iswspace @ 0899b290

int iswspace(wint_t c)

{
  uint uVar1;
  
                    /* Unresolved local var: int unicode@[???] */
  uVar1 = 0;
  if (c < 0x100) {
    uVar1 = (byte)__ctype_ptr[c] & 8;
  }
  return uVar1;
}



----------------------------------------

// Function: _mbrtowc_r @ 0899b2b8

size_t _mbrtowc_r(_reent *ptr,wchar_t *pwc,char *s,size_t n,mbstate_t *ps)

{
  size_t sVar1;
  undefined4 *in_t0;
  mbstate_t *in_stack_00000000;
  
                    /* Unresolved local var: int retval@[???] */
  if (s == (char *)0x0) {
    sVar1 = _mbtowc_r(ptr,(wchar_t *)0x0,"",1,in_stack_00000000);
  }
  else {
    sVar1 = _mbtowc_r(ptr,pwc,s,n,in_stack_00000000);
  }
  if (sVar1 == 0xffffffff) {
    *in_t0 = 0;
    ptr->_errno = 0x8a;
    sVar1 = 0xffffffff;
  }
  return sVar1;
}



----------------------------------------

// Function: mbrtowc @ 0899b334

size_t mbrtowc(wchar_t *pwc,char *s,size_t n,mbstate_t *ps)

{
  size_t sVar1;
  mbstate_t *in_stack_00000010;
  
  sVar1 = _mbrtowc_r(_impure_ptr,pwc,s,n,in_stack_00000010);
  return sVar1;
}



----------------------------------------

// Function: _mbtowc_r @ 0899b35c

int _mbtowc_r(_reent *r,wchar_t *pwc,char *s,size_t n,mbstate_t *state)

{
  int iVar1;
  uint *puVar2;
  uint auStack_8 [2];
  
                    /* Unresolved local var: wchar_t dummy@[???]
                       Unresolved local var: uchar * t@[???] */
  iVar1 = 0;
  puVar2 = auStack_8;
  if (pwc != (wchar_t *)0x0) {
    puVar2 = (uint *)pwc;
  }
  if ((s != (char *)0x0) && (iVar1 = -2, n != 0)) {
    *puVar2 = (uint)(byte)*s;
    return (uint)(*s != '\0');
  }
  return iVar1;
}



----------------------------------------

// Function: __sccl @ 0899b398

u_char * __sccl(char *tab,u_char *fmt)

{
  bool bVar1;
  char *pcVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  byte *pbVar6;
  
                    /* Unresolved local var: int c@[???]
                       Unresolved local var: int n@[???]
                       Unresolved local var: int v@[???] */
  uVar4 = (uint)*fmt;
  bVar1 = uVar4 == 0x5e;
  pbVar6 = fmt + 1;
  if (bVar1) {
    uVar4 = (uint)fmt[1];
    pbVar6 = fmt + 2;
  }
  iVar5 = 0;
  do {
    pcVar2 = tab + iVar5;
    iVar5 = iVar5 + 1;
    *pcVar2 = bVar1;
  } while (iVar5 != 0x100);
  if (uVar4 != 0) {
LAB_0899b3dc:
    do {
      tab[uVar4] = '\x01' - bVar1;
      for (pbVar6 = pbVar6 + 1; uVar3 = (uint)pbVar6[-1], uVar3 == 0x2d; pbVar6 = pbVar6 + 2) {
        uVar3 = (uint)*pbVar6;
        if (uVar3 == 0x5d) {
          uVar4 = 0x2d;
          goto LAB_0899b3dc;
        }
        if ((int)uVar3 < (int)uVar4) {
          uVar4 = 0x2d;
          goto LAB_0899b3dc;
        }
        pcVar2 = tab + uVar4;
        do {
          uVar4 = uVar4 + 1;
          pcVar2[1] = '\x01' - bVar1;
          pcVar2 = pcVar2 + 1;
        } while ((int)uVar4 < (int)uVar3);
      }
      if (uVar3 == 0x5d) {
        return pbVar6;
      }
      uVar4 = uVar3;
    } while (uVar3 != 0);
  }
  return pbVar6 + -1;
}



----------------------------------------

// Function: _strtoll_r @ 0899b468

/* WARNING: Control flow encountered bad instruction data */

longlong _strtoll_r(_reent *rptr,char *nptr,char **endptr,int base)

{
  char cVar1;
  byte bVar2;
  UDItype UVar3;
  UDItype UVar4;
  bool bVar5;
  char *pcVar6;
  uint uVar7;
  int iVar8;
  uint uVar9;
  int iVar10;
  char *pcVar11;
  char *pcVar12;
  int iVar13;
  undefined4 uVar14;
  undefined4 uVar15;
  UDItype UVar16;
  UDItype UVar17;
  
                    /* Unresolved local var: char * s@[???]
                       Unresolved local var: ulonglong acc@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: ulonglong cutoff@[???]
                       Unresolved local var: int neg@[???]
                       Unresolved local var: int any@[???]
                       Unresolved local var: int cutlim@[???] */
  pcVar6 = __ctype_ptr;
  pcVar12 = nptr;
  do {
    pcVar11 = pcVar12;
    iVar10 = (int)*pcVar11;
    pcVar12 = pcVar11 + 1;
  } while ((__ctype_ptr[iVar10] & 8U) != 0);
  if (iVar10 == 0x2d) {
    iVar10 = (int)*pcVar12;
    pcVar12 = pcVar11 + 2;
    bVar5 = true;
  }
  else if (iVar10 == 0x2b) {
    iVar10 = (int)*pcVar12;
    pcVar12 = pcVar11 + 2;
    bVar5 = false;
  }
  else {
    bVar5 = false;
  }
  if ((base == 0) || (base == 0x10)) {
    if ((iVar10 == 0x30) && ((*pcVar12 == 'x' || (*pcVar12 == 'X')))) {
      iVar10 = (int)pcVar12[1];
      base = 0x10;
      pcVar12 = pcVar12 + 2;
      iVar13 = 0;
      goto joined_r0x0899b6cc;
    }
    if (base == 0) {
      if (iVar10 == 0x30) {
        base = 8;
        iVar13 = 0;
      }
      else {
        base = 10;
        iVar13 = 0;
      }
      goto joined_r0x0899b6cc;
    }
  }
  iVar13 = base >> 0x1f;
joined_r0x0899b6cc:
  if (bVar5) {
    uVar14 = 0;
    uVar15 = 0x80000000;
  }
  else {
    uVar14 = 0xffffffff;
    uVar15 = 0x7fffffff;
  }
  UVar16 = __umoddi3(CONCAT44(uVar15,uVar14),CONCAT44(iVar13,base));
  UVar17 = __udivdi3(CONCAT44(uVar15,uVar14),CONCAT44(iVar13,base));
  uVar7 = (uint)(UVar17 >> 0x20);
  bVar2 = pcVar6[iVar10];
  iVar13 = 0;
  UVar4 = 0;
  UVar3 = 0;
  if ((bVar2 & 4) == 0) goto LAB_0899b5fc;
LAB_0899b570:
  iVar10 = iVar10 + -0x30;
  UVar3 = UVar4;
  do {
    if (base <= iVar10) goto LAB_0899b624;
    uVar9 = (uint)(UVar3 >> 0x20);
    if (iVar13 < 0) {
LAB_0899b698:
      cVar1 = *pcVar12;
    }
    else if (uVar7 < uVar9) {
      cVar1 = *pcVar12;
    }
    else {
      if ((uVar7 == uVar9) && ((uint)UVar17 < (uint)UVar3)) goto LAB_0899b698;
      if ((UVar17 != UVar3) || (iVar10 <= (int)UVar16)) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      cVar1 = *pcVar12;
      UVar3 = UVar17;
    }
    iVar10 = (int)cVar1;
    pcVar12 = pcVar12 + 1;
    iVar13 = -1;
    bVar2 = pcVar6[iVar10];
    UVar4 = UVar3;
    if ((bVar2 & 4) != 0) goto LAB_0899b570;
LAB_0899b5fc:
    if ((bVar2 & 3) == 0) {
LAB_0899b624:
      if (iVar13 < 0) {
        if (bVar5) {
          uVar14 = 0;
          uVar15 = 0x80000000;
        }
        else {
          uVar14 = 0xffffffff;
          uVar15 = 0x7fffffff;
        }
        UVar3 = CONCAT44(uVar15,uVar14);
        rptr->_errno = 0x22;
      }
      else if (bVar5) {
        UVar3 = CONCAT44(-(uint)(-(int)UVar3 != 0) - (int)(UVar3 >> 0x20),-(int)UVar3);
      }
      if (endptr != (char **)0x0) {
        if (iVar13 != 0) {
          nptr = pcVar12 + -1;
        }
        *endptr = nptr;
      }
      return UVar3;
    }
    iVar8 = 0x37;
    if ((bVar2 & 1) == 0) {
      iVar8 = 0x57;
    }
    iVar10 = iVar10 - iVar8;
  } while( true );
}



----------------------------------------

// Function: _strtoul_r @ 0899b7b4

ulong _strtoul_r(_reent *rptr,char *nptr,char **endptr,int base)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  int iVar4;
  char *pcVar5;
  char *pcVar6;
  int iVar7;
  uint uVar8;
  int iVar9;
  uint uVar10;
  uint uVar11;
  
                    /* Unresolved local var: char * s@[DW_OP_reg8(t0)]
                       Unresolved local var: ulong acc@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: ulong cutoff@[???]
                       Unresolved local var: int neg@[???]
                       Unresolved local var: int any@[???]
                       Unresolved local var: int cutlim@[???] */
  pcVar6 = nptr;
  do {
    pcVar5 = pcVar6;
    iVar7 = (int)*pcVar5;
    pcVar6 = pcVar5 + 1;
  } while ((__ctype_ptr[iVar7] & 8U) != 0);
  if (iVar7 == 0x2d) {
    iVar7 = (int)*pcVar6;
    bVar3 = true;
    pcVar6 = pcVar5 + 2;
  }
  else if (iVar7 == 0x2b) {
    iVar7 = (int)*pcVar6;
    bVar3 = false;
    pcVar6 = pcVar5 + 2;
  }
  else {
    bVar3 = false;
  }
  if ((base == 0) || (base == 0x10)) {
    if ((iVar7 == 0x30) && ((*pcVar6 == 'x' || (*pcVar6 == 'X')))) {
      iVar7 = (int)pcVar6[1];
      pcVar6 = pcVar6 + 2;
      uVar10 = 0xfffffff;
      base = 0x10;
      uVar11 = 0xf;
      goto LAB_0899b824;
    }
    if (base == 0) {
      if (iVar7 == 0x30) {
        uVar10 = 0x1fffffff;
        base = 8;
        uVar11 = 7;
      }
      else {
        uVar10 = 0x19999999;
        base = 10;
        uVar11 = 5;
      }
      goto LAB_0899b824;
    }
  }
  uVar10 = 0xffffffff / (uint)base;
  uVar11 = 0xffffffff % (uint)base;
  if (base == 0) {
    trap(7);
  }
LAB_0899b824:
  bVar2 = __ctype_ptr[iVar7];
  iVar9 = 0;
  uVar8 = 0;
  if ((bVar2 & 4) == 0) goto LAB_0899b890;
LAB_0899b840:
  iVar7 = iVar7 + -0x30;
  do {
    if (base <= iVar7) goto LAB_0899b8b8;
    if (iVar9 < 0) {
LAB_0899b91c:
      cVar1 = *pcVar6;
LAB_0899b920:
      iVar9 = -1;
    }
    else {
      if (uVar10 < uVar8) {
        cVar1 = *pcVar6;
        goto LAB_0899b920;
      }
      if ((uVar8 == uVar10) && ((int)uVar11 < iVar7)) goto LAB_0899b91c;
      cVar1 = *pcVar6;
      iVar9 = 1;
      uVar8 = uVar8 * base + iVar7;
    }
    iVar7 = (int)cVar1;
    pcVar6 = pcVar6 + 1;
    bVar2 = __ctype_ptr[iVar7];
    if ((bVar2 & 4) != 0) goto LAB_0899b840;
LAB_0899b890:
    if ((bVar2 & 3) == 0) {
LAB_0899b8b8:
      if (iVar9 < 0) {
        uVar8 = 0xffffffff;
        rptr->_errno = 0x22;
      }
      else if (bVar3) {
        uVar8 = -uVar8;
      }
      if (endptr != (char **)0x0) {
        if (iVar9 != 0) {
          nptr = pcVar6 + -1;
        }
        *endptr = nptr;
      }
      return uVar8;
    }
    iVar4 = 0x37;
    if ((bVar2 & 1) == 0) {
      iVar4 = 0x57;
    }
    iVar7 = iVar7 - iVar4;
  } while( true );
}



----------------------------------------

// Function: strtoul @ 0899b9a4

ulong strtoul(char *s,char **ptr,int base)

{
  ulong uVar1;
  
  uVar1 = _strtoul_r(_impure_ptr,s,ptr,base);
  return uVar1;
}



----------------------------------------

// Function: _strtoull_r @ 0899b9c4

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x0899bac8) */

ulonglong _strtoull_r(_reent *rptr,char *nptr,char **endptr,int base)

{
  byte bVar1;
  bool bVar2;
  char *pcVar3;
  int iVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  char *pcVar10;
  char *pcVar11;
  UDItype UVar12;
  UDItype UVar13;
  
                    /* Unresolved local var: char * s@[???]
                       Unresolved local var: ulonglong acc@[???]
                       Unresolved local var: int c@[???]
                       Unresolved local var: ulonglong cutoff@[???]
                       Unresolved local var: int neg@[???]
                       Unresolved local var: int any@[???]
                       Unresolved local var: int cutlim@[???] */
  pcVar3 = __ctype_ptr;
  pcVar11 = nptr;
  do {
    pcVar10 = pcVar11;
    iVar9 = (int)*pcVar10;
    pcVar11 = pcVar10 + 1;
  } while ((__ctype_ptr[iVar9] & 8U) != 0);
  if (iVar9 == 0x2d) {
    iVar9 = (int)*pcVar11;
    pcVar11 = pcVar10 + 2;
    bVar2 = true;
  }
  else if (iVar9 == 0x2b) {
    iVar9 = (int)*pcVar11;
    pcVar11 = pcVar10 + 2;
    bVar2 = false;
  }
  else {
    bVar2 = false;
  }
  if ((base == 0) || (base == 0x10)) {
    if ((iVar9 == 0x30) && ((*pcVar11 == 'x' || (*pcVar11 == 'X')))) {
      iVar9 = (int)pcVar11[1];
      pcVar11 = pcVar11 + 2;
      base = 0x10;
      UVar12 = 0xfffffffffffffff;
      iVar8 = 0xf;
      goto LAB_0899ba8c;
    }
    if (base == 0) {
      if (iVar9 == 0x30) {
        base = 8;
        UVar12 = 0x1fffffffffffffff;
        iVar8 = 7;
      }
      else {
        base = 10;
        UVar12 = 0x1999999999999999;
        iVar8 = 5;
      }
      goto LAB_0899ba8c;
    }
  }
  UVar12 = __udivdi3(0xffffffffffffffff,(longlong)base);
  UVar13 = __umoddi3(0xffffffffffffffff,(longlong)base);
  iVar8 = (int)UVar13;
LAB_0899ba8c:
  bVar1 = pcVar3[iVar9];
  iVar7 = 0;
  uVar5 = 0;
  uVar6 = 0;
  if ((bVar1 & 4) == 0) goto LAB_0899bb40;
  while (iVar9 = iVar9 + -0x30, iVar9 < base) {
    while( true ) {
      if ((-1 < iVar7) && ((UVar12 != 0 || (iVar9 <= iVar8)))) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      iVar7 = -1;
      iVar9 = (int)*pcVar11;
      pcVar11 = pcVar11 + 1;
      bVar1 = pcVar3[iVar9];
      if ((bVar1 & 4) != 0) break;
LAB_0899bb40:
      if ((bVar1 & 3) == 0) goto LAB_0899bb68;
      iVar4 = 0x37;
      if ((bVar1 & 1) == 0) {
        iVar4 = 0x57;
      }
      iVar9 = iVar9 - iVar4;
      if (base <= iVar9) goto LAB_0899bb68;
    }
  }
LAB_0899bb68:
  if (iVar7 < 0) {
    uVar5 = 0xffffffff;
    uVar6 = 0xffffffff;
    rptr->_errno = 0x22;
  }
  else if (bVar2) {
    uVar5 = 0;
    uVar6 = 0;
  }
  if (endptr != (char **)0x0) {
    if (iVar7 != 0) {
      nptr = pcVar11 + -1;
    }
    *endptr = nptr;
  }
  return CONCAT44(uVar6,uVar5);
}



----------------------------------------

// Function: __submore @ 0899bce8

int __submore(_reent *rptr,FILE *fp)

{
  uchar uVar1;
  uchar *puVar2;
  size_t len0;
  
                    /* Unresolved local var: int i@[???]
                       Unresolved local var: uchar * p@[???] */
  puVar2 = (fp->_ub)._base;
  if (puVar2 == fp->_ubuf) {
    puVar2 = _malloc_r(rptr,0x400);
    if (puVar2 != (uchar *)0x0) {
      uVar1 = fp->_ubuf[2];
      (fp->_ub)._size = 0x400;
      (fp->_ub)._base = puVar2;
      puVar2[0x3ff] = uVar1;
      puVar2[0x3fe] = fp->_ubuf[1];
      puVar2[0x3fd] = fp->_ubuf[0];
      fp->_p = puVar2 + 0x3fd;
      return 0;
    }
  }
  else {
    len0 = (fp->_ub)._size;
    puVar2 = _realloc_r(rptr,puVar2,len0 << 1);
    if (puVar2 != (uchar *)0x0) {
      memcpy(puVar2 + len0,puVar2,len0);
      (fp->_ub)._size = len0 << 1;
      fp->_p = puVar2 + len0;
      (fp->_ub)._base = puVar2;
      return 0;
    }
  }
  return -1;
}



----------------------------------------

// Function: _ungetc_r @ 0899be0c

int _ungetc_r(_reent *rptr,int c,FILE *fp)

{
  ushort uVar1;
  int iVar2;
  uchar *puVar3;
  uchar *puVar4;
  uint uVar5;
  
  if (c == -1) {
    return -1;
  }
  if (rptr == (_reent *)0x0) {
    uVar1 = fp->_flags;
  }
  else if (rptr->__sdidinit == 0) {
    __sinit(rptr);
    uVar1 = fp->_flags;
  }
  else {
    uVar1 = fp->_flags;
  }
  fp->_flags = uVar1 & 0xffdf;
  if ((uVar1 & 4) == 0) {
    if ((uVar1 & 0x10) != 0) {
      if ((uVar1 & 8) != 0) {
        iVar2 = fflush(fp);
        if (iVar2 != 0) {
          return -1;
        }
        fp->_w = 0;
        fp->_lbfsize = 0;
        fp->_flags = fp->_flags & 0xfff7;
      }
      fp->_flags = fp->_flags | 4;
      goto LAB_0899be64;
    }
LAB_0899bf84:
    uVar5 = 0xffffffff;
  }
  else {
LAB_0899be64:
    uVar5 = c & 0xff;
    if ((fp->_ub)._base == (uchar *)0x0) {
      puVar3 = (fp->_bf)._base;
      puVar4 = fp->_p;
      if (puVar3 != (uchar *)0x0) {
        if (puVar4 <= puVar3) {
          iVar2 = fp->_r;
          goto LAB_0899bef4;
        }
        if (uVar5 == puVar4[-1]) {
          fp->_p = puVar4 + -1;
          fp->_r = fp->_r + 1;
          return uVar5;
        }
      }
      iVar2 = fp->_r;
LAB_0899bef4:
      fp->_r = 1;
      (fp->_ub)._size = 3;
      fp->_ur = iVar2;
      fp->_up = puVar4;
      (fp->_ub)._base = fp->_ubuf;
      fp->_p = fp->_ubuf + 2;
      fp->_ubuf[2] = (uchar)c;
      return uVar5;
    }
    if (fp->_r < (fp->_ub)._size) {
      puVar3 = fp->_p;
    }
    else {
      iVar2 = __submore(rptr,fp);
      if (iVar2 != 0) goto LAB_0899bf84;
      puVar3 = fp->_p;
    }
    fp->_p = puVar3 + -1;
    puVar3[-1] = (uchar)c;
    fp->_r = fp->_r + 1;
  }
  return uVar5;
}



----------------------------------------

// Function: ungetc @ 0899bfb4

int ungetc(int c,FILE *fp)

{
  int iVar1;
  
  iVar1 = _ungetc_r(_impure_ptr,c,fp);
  return iVar1;
}



----------------------------------------

// Function: __cxa_pure_virtual @ 0899bfcc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void __cxa_pure_virtual(void)

{
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: operator_new @ 0899bfdc

/* DWARF original name: operator new */

void * operator_new(size_t len)

{
  void *pvVar1;
  
  pvVar1 = _malloc_r(_impure_ptr,len);
  return pvVar1;
}



----------------------------------------

// Function: operator_new_[] @ 0899bfe4

/* DWARF original name: operator new [] */

void * operator_new___(size_t len)

{
  void *pvVar1;
  
  pvVar1 = _malloc_r(_impure_ptr,len);
  return pvVar1;
}



----------------------------------------

// Function: operator_delete @ 0899bfec

/* DWARF original name: operator delete */

void operator_delete(void *ptr)

{
  if (ptr != (void *)0x0) {
    free(ptr);
    return;
  }
  return;
}



----------------------------------------

// Function: operator_delete_[] @ 0899c004

/* DWARF original name: operator delete [] */

void operator_delete___(void *ptr)

{
  if (ptr != (void *)0x0) {
    free(ptr);
    return;
  }
  return;
}



----------------------------------------

// Function: _Exit @ 0899c00c

void _Exit(int retval)

{
                    /* WARNING: Subroutine does not return */
  _exit(retval);
}



----------------------------------------

// Function: abort @ 0899c01c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original prototype: void abort(void) */

void abort(void)

{
  puts("Program aborted.");
                    /* WARNING: Subroutine does not return */
  _exit(1);
}



----------------------------------------

// Function: ~Init @ 0899c038

/* DWARF original prototype: void ~Init(Init * this, int __in_chrg) */

void __thiscall std::ios_base::Init::~Init(Init *this,int __in_chrg)

{
  _Atomic_word _Var1;
  
  _Var1 = __gnu_cxx::__exchange_and_add(&_S_refcount,-1);
  if (_Var1 != 2) {
    return;
  }
                    /* try { // try from 0899c068 to 0899c087 has its CatchHandler @ 0899c094 */
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)cout);
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)cerr);
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)clog);
  return;
}



----------------------------------------

// Function: ~Init @ 0899c0ac

/* DWARF original prototype: void ~Init(Init * this, int __in_chrg) */

void __thiscall std::ios_base::Init::~Init(Init *this,int __in_chrg)

{
  _Atomic_word _Var1;
  
  _Var1 = __gnu_cxx::__exchange_and_add(&_S_refcount,-1);
  if (_Var1 != 2) {
    return;
  }
                    /* try { // try from 0899c0dc to 0899c0fb has its CatchHandler @ 0899c108 */
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)cout);
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)cerr);
  basic_ostream<char,std::char_traits<char>_>::flush
            ((basic_ostream<char,std::char_traits<char>_> *)clog);
  return;
}



----------------------------------------

// Function: Init @ 0899c120

/* DWARF original prototype: void Init(Init * this) */

void __thiscall std::ios_base::Init::Init(Init *this)

{
  _Atomic_word _Var1;
  __FILE *p_Var2;
  __FILE *p_Var3;
  
  _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)PTR__S_refcount_089ef444,1);
  if (_Var1 != 0) {
    return;
  }
  p_Var2 = _impure_ptr->_stdout;
  __gnu_internal::buf_cout_sync[4] = '\0';
  __gnu_internal::buf_cout_sync[5] = '\0';
  __gnu_internal::buf_cout_sync[6] = '\0';
  __gnu_internal::buf_cout_sync[7] = '\0';
  __gnu_internal::buf_cout_sync[8] = '\0';
  __gnu_internal::buf_cout_sync[9] = '\0';
  __gnu_internal::buf_cout_sync[10] = '\0';
  __gnu_internal::buf_cout_sync[0xb] = '\0';
  __gnu_internal::buf_cout_sync[0xc] = '\0';
  __gnu_internal::buf_cout_sync[0xd] = '\0';
  __gnu_internal::buf_cout_sync[0xe] = '\0';
  __gnu_internal::buf_cout_sync[0xf] = '\0';
  __gnu_internal::buf_cout_sync[0x10] = '\0';
  __gnu_internal::buf_cout_sync[0x11] = '\0';
  __gnu_internal::buf_cout_sync[0x12] = '\0';
  __gnu_internal::buf_cout_sync[0x13] = '\0';
  __gnu_internal::buf_cout_sync[0x14] = '\0';
  __gnu_internal::buf_cout_sync[0x15] = '\0';
  __gnu_internal::buf_cout_sync[0x16] = '\0';
  __gnu_internal::buf_cout_sync[0x17] = '\0';
  __gnu_internal::buf_cout_sync[0x18] = '\0';
  __gnu_internal::buf_cout_sync[0x19] = '\0';
  __gnu_internal::buf_cout_sync[0x1a] = '\0';
  __gnu_internal::buf_cout_sync[0x1b] = '\0';
  _S_synced_with_stdio = true;
  __gnu_internal::buf_cout_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  locale::locale((locale *)(__gnu_internal::buf_cout_sync + 0x1c));
  p_Var3 = _impure_ptr->_stdin;
  __gnu_internal::buf_cout_sync[0x24] = -1;
  __gnu_internal::buf_cout_sync[0x25] = -1;
  __gnu_internal::buf_cout_sync[0x26] = -1;
  __gnu_internal::buf_cout_sync[0x27] = -1;
  __gnu_internal::buf_cin_sync[4] = '\0';
  __gnu_internal::buf_cin_sync[5] = '\0';
  __gnu_internal::buf_cin_sync[6] = '\0';
  __gnu_internal::buf_cin_sync[7] = '\0';
  __gnu_internal::buf_cin_sync[8] = '\0';
  __gnu_internal::buf_cin_sync[9] = '\0';
  __gnu_internal::buf_cin_sync[10] = '\0';
  __gnu_internal::buf_cin_sync[0xb] = '\0';
  __gnu_internal::buf_cin_sync[0xc] = '\0';
  __gnu_internal::buf_cin_sync[0xd] = '\0';
  __gnu_internal::buf_cin_sync[0xe] = '\0';
  __gnu_internal::buf_cin_sync[0xf] = '\0';
  __gnu_internal::buf_cin_sync[0x10] = '\0';
  __gnu_internal::buf_cin_sync[0x11] = '\0';
  __gnu_internal::buf_cin_sync[0x12] = '\0';
  __gnu_internal::buf_cin_sync[0x13] = '\0';
  __gnu_internal::buf_cin_sync[0x14] = '\0';
  __gnu_internal::buf_cin_sync[0x15] = '\0';
  __gnu_internal::buf_cin_sync[0x16] = '\0';
  __gnu_internal::buf_cin_sync[0x17] = '\0';
  __gnu_internal::buf_cin_sync[0x18] = '\0';
  __gnu_internal::buf_cin_sync[0x19] = '\0';
  __gnu_internal::buf_cin_sync[0x1a] = '\0';
  __gnu_internal::buf_cin_sync[0x1b] = '\0';
  __gnu_internal::buf_cout_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cin_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  __gnu_internal::buf_cout_sync._32_4_ = p_Var2;
  locale::locale((locale *)(__gnu_internal::buf_cin_sync + 0x1c));
  p_Var2 = _impure_ptr->_stderr;
  __gnu_internal::buf_cin_sync[0x24] = -1;
  __gnu_internal::buf_cin_sync[0x25] = -1;
  __gnu_internal::buf_cin_sync[0x26] = -1;
  __gnu_internal::buf_cin_sync[0x27] = -1;
  __gnu_internal::buf_cerr_sync[4] = '\0';
  __gnu_internal::buf_cerr_sync[5] = '\0';
  __gnu_internal::buf_cerr_sync[6] = '\0';
  __gnu_internal::buf_cerr_sync[7] = '\0';
  __gnu_internal::buf_cerr_sync[8] = '\0';
  __gnu_internal::buf_cerr_sync[9] = '\0';
  __gnu_internal::buf_cerr_sync[10] = '\0';
  __gnu_internal::buf_cerr_sync[0xb] = '\0';
  __gnu_internal::buf_cerr_sync[0xc] = '\0';
  __gnu_internal::buf_cerr_sync[0xd] = '\0';
  __gnu_internal::buf_cerr_sync[0xe] = '\0';
  __gnu_internal::buf_cerr_sync[0xf] = '\0';
  __gnu_internal::buf_cerr_sync[0x10] = '\0';
  __gnu_internal::buf_cerr_sync[0x11] = '\0';
  __gnu_internal::buf_cerr_sync[0x12] = '\0';
  __gnu_internal::buf_cerr_sync[0x13] = '\0';
  __gnu_internal::buf_cerr_sync[0x14] = '\0';
  __gnu_internal::buf_cerr_sync[0x15] = '\0';
  __gnu_internal::buf_cerr_sync[0x16] = '\0';
  __gnu_internal::buf_cerr_sync[0x17] = '\0';
  __gnu_internal::buf_cerr_sync[0x18] = '\0';
  __gnu_internal::buf_cerr_sync[0x19] = '\0';
  __gnu_internal::buf_cerr_sync[0x1a] = '\0';
  __gnu_internal::buf_cerr_sync[0x1b] = '\0';
  __gnu_internal::buf_cerr_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  __gnu_internal::buf_cin_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cin_sync._32_4_ = p_Var3;
  locale::locale((locale *)(__gnu_internal::buf_cerr_sync + 0x1c));
  __gnu_internal::buf_cerr_sync[0x24] = -1;
  __gnu_internal::buf_cerr_sync[0x25] = -1;
  __gnu_internal::buf_cerr_sync[0x26] = -1;
  __gnu_internal::buf_cerr_sync[0x27] = -1;
  __gnu_internal::buf_cerr_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cerr_sync._32_4_ = p_Var2;
                    /* try { // try from 0899c290 to 0899c297 has its CatchHandler @ 0899c43c */
  ios_base((ios_base *)(cout + 4));
  cout[4] = 'x';
  cout[5] = '\x03';
  cout[6] = -0x61;
  cout[7] = '\b';
  cout[0] = 'd';
  cout[1] = '\x03';
  cout[2] = -0x61;
  cout[3] = '\b';
  cout[0x74] = '\0';
  cout[0x75] = '\0';
  cout[0x76] = '\0';
  cout[0x77] = '\0';
  cout[0x78] = '\0';
  cout[0x79] = '\0';
  cout[0x7c] = '\0';
  cout[0x7d] = '\0';
  cout[0x7e] = '\0';
  cout[0x7f] = '\0';
  cout[0x80] = '\0';
  cout[0x81] = '\0';
  cout[0x82] = '\0';
  cout[0x83] = '\0';
  cout[0x84] = '\0';
  cout[0x85] = '\0';
  cout[0x86] = '\0';
  cout[0x87] = '\0';
  cout[0x88] = '\0';
  cout[0x89] = '\0';
  cout[0x8a] = '\0';
  cout[0x8b] = '\0';
                    /* try { // try from 0899c2dc to 0899c2e3 has its CatchHandler @ 0899c474 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cout + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cout_sync);
                    /* try { // try from 0899c2ec to 0899c2f3 has its CatchHandler @ 0899c46c */
  ios_base((ios_base *)(cin + 8));
  cin[0] = '\x14';
  cin[1] = -9;
  cin[2] = -0x62;
  cin[3] = '\b';
  cin[4] = '\0';
  cin[5] = '\0';
  cin[6] = '\0';
  cin[7] = '\0';
  cin[0x78] = '\0';
  cin[0x79] = '\0';
  cin[0x7a] = '\0';
  cin[0x7b] = '\0';
  cin[0x7c] = '\0';
  cin[0x7d] = '\0';
  cin[0x80] = '\0';
  cin[0x81] = '\0';
  cin[0x82] = '\0';
  cin[0x83] = '\0';
  cin[0x84] = '\0';
  cin[0x85] = '\0';
  cin[0x86] = '\0';
  cin[0x87] = '\0';
  cin[0x88] = '\0';
  cin[0x89] = '\0';
  cin[0x8a] = '\0';
  cin[0x8b] = '\0';
  cin[0x8c] = '\0';
  cin[0x8d] = '\0';
  cin[0x8e] = '\0';
  cin[0x8f] = '\0';
  cin[8] = '(';
  cin[9] = -9;
  cin[10] = -0x62;
  cin[0xb] = '\b';
                    /* try { // try from 0899c338 to 0899c33f has its CatchHandler @ 0899c490 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cin + 8),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cin_sync);
                    /* try { // try from 0899c348 to 0899c34f has its CatchHandler @ 0899c448 */
  ios_base((ios_base *)(cerr + 4));
  cerr[4] = 'x';
  cerr[5] = '\x03';
  cerr[6] = -0x61;
  cerr[7] = '\b';
  cerr[0] = 'd';
  cerr[1] = '\x03';
  cerr[2] = -0x61;
  cerr[3] = '\b';
  cerr[0x74] = '\0';
  cerr[0x75] = '\0';
  cerr[0x76] = '\0';
  cerr[0x77] = '\0';
  cerr[0x78] = '\0';
  cerr[0x79] = '\0';
  cerr[0x7c] = '\0';
  cerr[0x7d] = '\0';
  cerr[0x7e] = '\0';
  cerr[0x7f] = '\0';
  cerr[0x80] = '\0';
  cerr[0x81] = '\0';
  cerr[0x82] = '\0';
  cerr[0x83] = '\0';
  cerr[0x84] = '\0';
  cerr[0x85] = '\0';
  cerr[0x86] = '\0';
  cerr[0x87] = '\0';
  cerr[0x88] = '\0';
  cerr[0x89] = '\0';
  cerr[0x8a] = '\0';
  cerr[0x8b] = '\0';
                    /* try { // try from 0899c388 to 0899c38f has its CatchHandler @ 0899c450 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cerr + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr_sync);
                    /* try { // try from 0899c398 to 0899c39f has its CatchHandler @ 0899c43c */
  ios_base((ios_base *)(clog + 4));
  clog[0] = 'd';
  clog[1] = '\x03';
  clog[2] = -0x61;
  clog[3] = '\b';
  clog[4] = 'x';
  clog[5] = '\x03';
  clog[6] = -0x61;
  clog[7] = '\b';
  clog[0x74] = '\0';
  clog[0x75] = '\0';
  clog[0x76] = '\0';
  clog[0x77] = '\0';
  clog[0x78] = '\0';
  clog[0x79] = '\0';
  clog[0x7c] = '\0';
  clog[0x7d] = '\0';
  clog[0x7e] = '\0';
  clog[0x7f] = '\0';
  clog[0x80] = '\0';
  clog[0x81] = '\0';
  clog[0x82] = '\0';
  clog[0x83] = '\0';
  clog[0x84] = '\0';
  clog[0x85] = '\0';
  clog[0x86] = '\0';
  clog[0x87] = '\0';
  clog[0x88] = '\0';
  clog[0x89] = '\0';
  clog[0x8a] = '\0';
  clog[0x8b] = '\0';
                    /* try { // try from 0899c3d8 to 0899c3df has its CatchHandler @ 0899c450 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(clog + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr_sync);
                    /* Unresolved local var: basic_ostream<char,std::char_traits<char>_> *
                       __old@[???] */
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  cin._120_4_ = cout;
  cerr[0x10] = '\0';
  cerr[0x11] = ' ';
  cerr[0x12] = '\0';
  cerr[0x13] = '\0';
  __gnu_cxx::__atomic_add((_Atomic_word *)PTR__S_refcount_089ef444,1);
  return;
}



----------------------------------------

// Function: Init @ 0899c498

/* DWARF original prototype: void Init(Init * this) */

void __thiscall std::ios_base::Init::Init(Init *this)

{
  _Atomic_word _Var1;
  __FILE *p_Var2;
  __FILE *p_Var3;
  
  _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)PTR__S_refcount_089ef448,1);
  if (_Var1 != 0) {
    return;
  }
  p_Var2 = _impure_ptr->_stdout;
  __gnu_internal::buf_cout_sync[4] = '\0';
  __gnu_internal::buf_cout_sync[5] = '\0';
  __gnu_internal::buf_cout_sync[6] = '\0';
  __gnu_internal::buf_cout_sync[7] = '\0';
  __gnu_internal::buf_cout_sync[8] = '\0';
  __gnu_internal::buf_cout_sync[9] = '\0';
  __gnu_internal::buf_cout_sync[10] = '\0';
  __gnu_internal::buf_cout_sync[0xb] = '\0';
  __gnu_internal::buf_cout_sync[0xc] = '\0';
  __gnu_internal::buf_cout_sync[0xd] = '\0';
  __gnu_internal::buf_cout_sync[0xe] = '\0';
  __gnu_internal::buf_cout_sync[0xf] = '\0';
  __gnu_internal::buf_cout_sync[0x10] = '\0';
  __gnu_internal::buf_cout_sync[0x11] = '\0';
  __gnu_internal::buf_cout_sync[0x12] = '\0';
  __gnu_internal::buf_cout_sync[0x13] = '\0';
  __gnu_internal::buf_cout_sync[0x14] = '\0';
  __gnu_internal::buf_cout_sync[0x15] = '\0';
  __gnu_internal::buf_cout_sync[0x16] = '\0';
  __gnu_internal::buf_cout_sync[0x17] = '\0';
  __gnu_internal::buf_cout_sync[0x18] = '\0';
  __gnu_internal::buf_cout_sync[0x19] = '\0';
  __gnu_internal::buf_cout_sync[0x1a] = '\0';
  __gnu_internal::buf_cout_sync[0x1b] = '\0';
  _S_synced_with_stdio = true;
  __gnu_internal::buf_cout_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  locale::locale((locale *)(__gnu_internal::buf_cout_sync + 0x1c));
  p_Var3 = _impure_ptr->_stdin;
  __gnu_internal::buf_cout_sync[0x24] = -1;
  __gnu_internal::buf_cout_sync[0x25] = -1;
  __gnu_internal::buf_cout_sync[0x26] = -1;
  __gnu_internal::buf_cout_sync[0x27] = -1;
  __gnu_internal::buf_cin_sync[4] = '\0';
  __gnu_internal::buf_cin_sync[5] = '\0';
  __gnu_internal::buf_cin_sync[6] = '\0';
  __gnu_internal::buf_cin_sync[7] = '\0';
  __gnu_internal::buf_cin_sync[8] = '\0';
  __gnu_internal::buf_cin_sync[9] = '\0';
  __gnu_internal::buf_cin_sync[10] = '\0';
  __gnu_internal::buf_cin_sync[0xb] = '\0';
  __gnu_internal::buf_cin_sync[0xc] = '\0';
  __gnu_internal::buf_cin_sync[0xd] = '\0';
  __gnu_internal::buf_cin_sync[0xe] = '\0';
  __gnu_internal::buf_cin_sync[0xf] = '\0';
  __gnu_internal::buf_cin_sync[0x10] = '\0';
  __gnu_internal::buf_cin_sync[0x11] = '\0';
  __gnu_internal::buf_cin_sync[0x12] = '\0';
  __gnu_internal::buf_cin_sync[0x13] = '\0';
  __gnu_internal::buf_cin_sync[0x14] = '\0';
  __gnu_internal::buf_cin_sync[0x15] = '\0';
  __gnu_internal::buf_cin_sync[0x16] = '\0';
  __gnu_internal::buf_cin_sync[0x17] = '\0';
  __gnu_internal::buf_cin_sync[0x18] = '\0';
  __gnu_internal::buf_cin_sync[0x19] = '\0';
  __gnu_internal::buf_cin_sync[0x1a] = '\0';
  __gnu_internal::buf_cin_sync[0x1b] = '\0';
  __gnu_internal::buf_cout_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cin_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  __gnu_internal::buf_cout_sync._32_4_ = p_Var2;
  locale::locale((locale *)(__gnu_internal::buf_cin_sync + 0x1c));
  p_Var2 = _impure_ptr->_stderr;
  __gnu_internal::buf_cin_sync[0x24] = -1;
  __gnu_internal::buf_cin_sync[0x25] = -1;
  __gnu_internal::buf_cin_sync[0x26] = -1;
  __gnu_internal::buf_cin_sync[0x27] = -1;
  __gnu_internal::buf_cerr_sync[4] = '\0';
  __gnu_internal::buf_cerr_sync[5] = '\0';
  __gnu_internal::buf_cerr_sync[6] = '\0';
  __gnu_internal::buf_cerr_sync[7] = '\0';
  __gnu_internal::buf_cerr_sync[8] = '\0';
  __gnu_internal::buf_cerr_sync[9] = '\0';
  __gnu_internal::buf_cerr_sync[10] = '\0';
  __gnu_internal::buf_cerr_sync[0xb] = '\0';
  __gnu_internal::buf_cerr_sync[0xc] = '\0';
  __gnu_internal::buf_cerr_sync[0xd] = '\0';
  __gnu_internal::buf_cerr_sync[0xe] = '\0';
  __gnu_internal::buf_cerr_sync[0xf] = '\0';
  __gnu_internal::buf_cerr_sync[0x10] = '\0';
  __gnu_internal::buf_cerr_sync[0x11] = '\0';
  __gnu_internal::buf_cerr_sync[0x12] = '\0';
  __gnu_internal::buf_cerr_sync[0x13] = '\0';
  __gnu_internal::buf_cerr_sync[0x14] = '\0';
  __gnu_internal::buf_cerr_sync[0x15] = '\0';
  __gnu_internal::buf_cerr_sync[0x16] = '\0';
  __gnu_internal::buf_cerr_sync[0x17] = '\0';
  __gnu_internal::buf_cerr_sync[0x18] = '\0';
  __gnu_internal::buf_cerr_sync[0x19] = '\0';
  __gnu_internal::buf_cerr_sync[0x1a] = '\0';
  __gnu_internal::buf_cerr_sync[0x1b] = '\0';
  __gnu_internal::buf_cerr_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
  __gnu_internal::buf_cin_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cin_sync._32_4_ = p_Var3;
  locale::locale((locale *)(__gnu_internal::buf_cerr_sync + 0x1c));
  __gnu_internal::buf_cerr_sync[0x24] = -1;
  __gnu_internal::buf_cerr_sync[0x25] = -1;
  __gnu_internal::buf_cerr_sync[0x26] = -1;
  __gnu_internal::buf_cerr_sync[0x27] = -1;
  __gnu_internal::buf_cerr_sync._0_4_ = &PTR__stdio_sync_filebuf_089f02d8;
  __gnu_internal::buf_cerr_sync._32_4_ = p_Var2;
                    /* try { // try from 0899c608 to 0899c60f has its CatchHandler @ 0899c7b4 */
  ios_base((ios_base *)(cout + 4));
  cout[4] = 'x';
  cout[5] = '\x03';
  cout[6] = -0x61;
  cout[7] = '\b';
  cout[0] = 'd';
  cout[1] = '\x03';
  cout[2] = -0x61;
  cout[3] = '\b';
  cout[0x74] = '\0';
  cout[0x75] = '\0';
  cout[0x76] = '\0';
  cout[0x77] = '\0';
  cout[0x78] = '\0';
  cout[0x79] = '\0';
  cout[0x7c] = '\0';
  cout[0x7d] = '\0';
  cout[0x7e] = '\0';
  cout[0x7f] = '\0';
  cout[0x80] = '\0';
  cout[0x81] = '\0';
  cout[0x82] = '\0';
  cout[0x83] = '\0';
  cout[0x84] = '\0';
  cout[0x85] = '\0';
  cout[0x86] = '\0';
  cout[0x87] = '\0';
  cout[0x88] = '\0';
  cout[0x89] = '\0';
  cout[0x8a] = '\0';
  cout[0x8b] = '\0';
                    /* try { // try from 0899c654 to 0899c65b has its CatchHandler @ 0899c7ec */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cout + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cout_sync);
                    /* try { // try from 0899c664 to 0899c66b has its CatchHandler @ 0899c7e4 */
  ios_base((ios_base *)(cin + 8));
  cin[0] = '\x14';
  cin[1] = -9;
  cin[2] = -0x62;
  cin[3] = '\b';
  cin[4] = '\0';
  cin[5] = '\0';
  cin[6] = '\0';
  cin[7] = '\0';
  cin[0x78] = '\0';
  cin[0x79] = '\0';
  cin[0x7a] = '\0';
  cin[0x7b] = '\0';
  cin[0x7c] = '\0';
  cin[0x7d] = '\0';
  cin[0x80] = '\0';
  cin[0x81] = '\0';
  cin[0x82] = '\0';
  cin[0x83] = '\0';
  cin[0x84] = '\0';
  cin[0x85] = '\0';
  cin[0x86] = '\0';
  cin[0x87] = '\0';
  cin[0x88] = '\0';
  cin[0x89] = '\0';
  cin[0x8a] = '\0';
  cin[0x8b] = '\0';
  cin[0x8c] = '\0';
  cin[0x8d] = '\0';
  cin[0x8e] = '\0';
  cin[0x8f] = '\0';
  cin[8] = '(';
  cin[9] = -9;
  cin[10] = -0x62;
  cin[0xb] = '\b';
                    /* try { // try from 0899c6b0 to 0899c6b7 has its CatchHandler @ 0899c808 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cin + 8),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cin_sync);
                    /* try { // try from 0899c6c0 to 0899c6c7 has its CatchHandler @ 0899c7c0 */
  ios_base((ios_base *)(cerr + 4));
  cerr[4] = 'x';
  cerr[5] = '\x03';
  cerr[6] = -0x61;
  cerr[7] = '\b';
  cerr[0] = 'd';
  cerr[1] = '\x03';
  cerr[2] = -0x61;
  cerr[3] = '\b';
  cerr[0x74] = '\0';
  cerr[0x75] = '\0';
  cerr[0x76] = '\0';
  cerr[0x77] = '\0';
  cerr[0x78] = '\0';
  cerr[0x79] = '\0';
  cerr[0x7c] = '\0';
  cerr[0x7d] = '\0';
  cerr[0x7e] = '\0';
  cerr[0x7f] = '\0';
  cerr[0x80] = '\0';
  cerr[0x81] = '\0';
  cerr[0x82] = '\0';
  cerr[0x83] = '\0';
  cerr[0x84] = '\0';
  cerr[0x85] = '\0';
  cerr[0x86] = '\0';
  cerr[0x87] = '\0';
  cerr[0x88] = '\0';
  cerr[0x89] = '\0';
  cerr[0x8a] = '\0';
  cerr[0x8b] = '\0';
                    /* try { // try from 0899c700 to 0899c707 has its CatchHandler @ 0899c7c8 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(cerr + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr_sync);
                    /* try { // try from 0899c710 to 0899c717 has its CatchHandler @ 0899c7b4 */
  ios_base((ios_base *)(clog + 4));
  clog[0] = 'd';
  clog[1] = '\x03';
  clog[2] = -0x61;
  clog[3] = '\b';
  clog[4] = 'x';
  clog[5] = '\x03';
  clog[6] = -0x61;
  clog[7] = '\b';
  clog[0x74] = '\0';
  clog[0x75] = '\0';
  clog[0x76] = '\0';
  clog[0x77] = '\0';
  clog[0x78] = '\0';
  clog[0x79] = '\0';
  clog[0x7c] = '\0';
  clog[0x7d] = '\0';
  clog[0x7e] = '\0';
  clog[0x7f] = '\0';
  clog[0x80] = '\0';
  clog[0x81] = '\0';
  clog[0x82] = '\0';
  clog[0x83] = '\0';
  clog[0x84] = '\0';
  clog[0x85] = '\0';
  clog[0x86] = '\0';
  clog[0x87] = '\0';
  clog[0x88] = '\0';
  clog[0x89] = '\0';
  clog[0x8a] = '\0';
  clog[0x8b] = '\0';
                    /* try { // try from 0899c750 to 0899c757 has its CatchHandler @ 0899c7c8 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)(clog + 4),
             (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr_sync);
                    /* Unresolved local var: basic_ostream<char,std::char_traits<char>_> *
                       __old@[???] */
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  cin._120_4_ = cout;
  cerr[0x10] = '\0';
  cerr[0x11] = ' ';
  cerr[0x12] = '\0';
  cerr[0x13] = '\0';
  __gnu_cxx::__atomic_add((_Atomic_word *)PTR__S_refcount_089ef448,1);
  return;
}



----------------------------------------

// Function: sync_with_stdio @ 0899c810

bool __thiscall std::ios_base::sync_with_stdio(ios_base *this,bool __sync)

{
  undefined3 in_register_00000015;
  int __in_chrg;
  char *__in_chrg_00;
  Init aIStack_20 [8];
  
                    /* Unresolved local var: bool __ret@[???] */
  __in_chrg = CONCAT31(in_register_00000015,__sync);
  if ((((uint)this & 0xff) == 0) && (Init::_S_synced_with_stdio)) {
                    /* Unresolved local var: Init __init@[???] */
    Init::Init(aIStack_20);
    __gnu_internal::buf_cout_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
    Init::_S_synced_with_stdio = false;
    locale::~locale((locale *)(__gnu_internal::buf_cout_sync + 0x1c),__in_chrg);
    __gnu_internal::buf_cin_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
    locale::~locale((locale *)(__gnu_internal::buf_cin_sync + 0x1c),__in_chrg);
    __gnu_internal::buf_cerr_sync._0_4_ = &PTR__basic_streambuf_089f03b0;
    locale::~locale((locale *)(__gnu_internal::buf_cerr_sync + 0x1c),__in_chrg);
                    /* try { // try from 0899c8c4 to 0899c8cb has its CatchHandler @ 0899c970 */
    __gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
              ((stdio_filebuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cout,
               _impure_ptr->_stdout,_S_out,0x400);
                    /* try { // try from 0899c8e0 to 0899c8e7 has its CatchHandler @ 0899c98c */
    __gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
              ((stdio_filebuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cin,
               _impure_ptr->_stdin,_S_in,0x400);
                    /* try { // try from 0899c8fc to 0899c903 has its CatchHandler @ 0899c984 */
    __gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
              ((stdio_filebuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr,
               _impure_ptr->_stderr,_S_out,0x400);
                    /* try { // try from 0899c90c to 0899c947 has its CatchHandler @ 0899c970 */
    basic_ios<char,std::char_traits<char>_>::rdbuf
              ((basic_ios<char,std::char_traits<char>_> *)(cout + 4),
               (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cout);
    basic_ios<char,std::char_traits<char>_>::rdbuf
              ((basic_ios<char,std::char_traits<char>_> *)(cin + 8),
               (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cin);
    basic_ios<char,std::char_traits<char>_>::rdbuf
              ((basic_ios<char,std::char_traits<char>_> *)(cerr + 4),
               (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr);
    __in_chrg_00 = __gnu_internal::buf_cerr;
    basic_ios<char,std::char_traits<char>_>::rdbuf
              ((basic_ios<char,std::char_traits<char>_> *)(clog + 4),
               (basic_streambuf<char,std::char_traits<char>_> *)__gnu_internal::buf_cerr);
    Init::~Init(aIStack_20,(int)__in_chrg_00);
    return true;
  }
  return Init::_S_synced_with_stdio;
}



----------------------------------------

// Function: locale @ 0899c994

/* DWARF original prototype: void locale(locale * this, _Impl * __ip) */

void __thiscall std::locale::locale(locale *this,_Impl *__ip)

{
  this->_M_impl = __ip;
  return;
}



----------------------------------------

// Function: locale @ 0899c99c

/* DWARF original prototype: void locale(locale * this, _Impl * __ip) */

void __thiscall std::locale::locale(locale *this,_Impl *__ip)

{
  this->_M_impl = __ip;
  return;
}



----------------------------------------

// Function: _S_get_c_name @ 0899c9a4

char * std::locale::facet::_S_get_c_name(void)

{
  return "C";
}



----------------------------------------

// Function: _M_id @ 0899c9b0

/* DWARF original prototype: size_t _M_id(id * this) */

size_t __thiscall std::locale::id::_M_id(id *this)

{
  size_t sVar1;
  _Atomic_word _Var2;
  
  sVar1 = this->_M_index;
  if (sVar1 == 0) {
    _Var2 = __gnu_cxx::__exchange_and_add(&_S_refcount,1);
    sVar1 = _Var2 + 1;
    this->_M_index = sVar1;
  }
  return sVar1 - 1;
}



----------------------------------------

// Function: _S_normalize_category @ 0899c9f8

int std::locale::_S_normalize_category(int __cat)

{
                    /* Unresolved local var: int __ret@[???] */
  if ((__cat != 0) && (((__cat & 0x3fU) == 0 || ((__cat & 0xffffffc0U) != 0)))) {
    switch(__cat) {
    case 0:
      __cat = 0x3f;
      break;
    case 1:
      __cat = 4;
      break;
    case 2:
      __cat = 1;
      break;
    case 3:
      __cat = 0x10;
      break;
    case 4:
      __cat = 2;
      break;
    case 5:
      __cat = 8;
      break;
    default:
                    /* WARNING: Subroutine does not return */
      __throw_runtime_error("locale::_S_normalize_category category not found");
    }
  }
  return __cat;
}



----------------------------------------

// Function: ~facet @ 0899ca8c

/* DWARF original prototype: void ~facet(facet * this, int __in_chrg) */

void __thiscall std::locale::facet::~facet(facet *this,int __in_chrg)

{
  this->_vptr_facet = (_func_int_varargs **)&PTR__facet_089ef4e8;
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~facet @ 0899ca9c

/* DWARF original prototype: void ~facet(facet * this, int __in_chrg) */

void __thiscall std::locale::facet::~facet(facet *this,int __in_chrg)

{
  this->_vptr_facet = (_func_int_varargs **)&PTR__facet_089ef4e8;
  return;
}



----------------------------------------

// Function: ~facet @ 0899caac

/* DWARF original prototype: void ~facet(facet * this, int __in_chrg) */

void __thiscall std::locale::facet::~facet(facet *this,int __in_chrg)

{
  this->_vptr_facet = (_func_int_varargs **)&PTR__facet_089ef4e8;
  return;
}



----------------------------------------

// Function: _S_initialize_once @ 0899cabc

void std::locale::facet::_S_initialize_once(void)

{
  _S_create_c_locale(&_S_c_locale,"C",(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: _S_get_c_locale @ 0899cad4

__c_locale std::locale::facet::_S_get_c_locale(void)

{
  if (_S_c_locale != (__c_locale)0x0) {
    return _S_c_locale;
  }
  _S_initialize_once();
  return _S_c_locale;
}



----------------------------------------

// Function: locale @ 0899cb18

/* DWARF original prototype: void locale(locale * this, locale * __other) */

void __thiscall std::locale::locale(locale *this,locale *__other)

{
  _Impl *__mem;
  
  __mem = __other->_M_impl;
  this->_M_impl = __mem;
                    /* try { // try from 0899cb2c to 0899cb33 has its CatchHandler @ 0899cb40 */
  __gnu_cxx::__atomic_add(&__mem->_M_refcount,1);
  return;
}



----------------------------------------

// Function: locale @ 0899cb5c

/* DWARF original prototype: void locale(locale * this, locale * __other) */

void __thiscall std::locale::locale(locale *this,locale *__other)

{
  _Impl *__mem;
  
  __mem = __other->_M_impl;
  this->_M_impl = __mem;
                    /* try { // try from 0899cb70 to 0899cb77 has its CatchHandler @ 0899cb84 */
  __gnu_cxx::__atomic_add(&__mem->_M_refcount,1);
  return;
}



----------------------------------------

// Function: _M_install_cache @ 0899cba0

/* DWARF original prototype: void _M_install_cache(_Impl * this, facet * __cache, size_t __index) */

void __thiscall std::locale::_Impl::_M_install_cache(_Impl *this,facet *__cache,size_t __index)

{
                    /* Unresolved local var: lock sentry@[???] */
  if (this->_M_caches[__index] == (facet *)0x0) {
                    /* try { // try from 0899cc04 to 0899cc0b has its CatchHandler @ 0899cc1c */
    __gnu_cxx::__atomic_add(&__cache->_M_refcount,1);
    this->_M_caches[__index] = __cache;
  }
  else if (__cache != (facet *)0x0) {
                    /* try { // try from 0899cbe0 to 0899cbe7 has its CatchHandler @ 0899cc28 */
    (*__cache->_vptr_facet[1])(__cache);
  }
  return;
}



----------------------------------------

// Function: name @ 0899cc38

/* DWARF original prototype: string name(locale * this) */

string * __thiscall std::locale::name(string *__return_storage_ptr__,locale *this)

{
  int iVar1;
  size_t sVar2;
  char **ppcVar3;
  uint uVar4;
  int iVar5;
  char unaff_s2;
  char *pcVar6;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> *
                       __ret@[DW_OP_reg19(s3)]
                       Unresolved local var: string __ret@[???] */
                    /* Unresolved local var: void * __p@[???] */
  ppcVar3 = this->_M_impl->_M_names;
  (__return_storage_ptr__->_M_dataplus)._M_p = (char *)0x8a1e514;
  pcVar6 = *ppcVar3;
  if (pcVar6 == (char *)0x0) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
              (__return_storage_ptr__,0,
               basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage[0],1,unaff_s2);
  }
  else {
                    /* Unresolved local var: bool __ret@[???] */
    if (ppcVar3[1] != (char *)0x0) {
      iVar5 = 0;
      do {
        iVar1 = strcmp(*ppcVar3,ppcVar3[1]);
        iVar5 = iVar5 + 1;
        if (iVar1 != 0) {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                    (__return_storage_ptr__,0x80);
          ppcVar3 = _S_categories;
          pcVar6 = *_S_categories;
          sVar2 = strlen(pcVar6);
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (__return_storage_ptr__,pcVar6,sVar2);
                    /* Unresolved local var: size_t __len@[???] */
          pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
          uVar4 = *(int *)(pcVar6 + -0xc) + 1;
          if ((*(uint *)(pcVar6 + -8) < uVar4) || (0 < *(int *)(pcVar6 + -4))) {
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (__return_storage_ptr__,uVar4);
            pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
            iVar5 = *(int *)(pcVar6 + -0xc);
          }
          else {
            iVar5 = *(int *)(pcVar6 + -0xc);
          }
          pcVar6[iVar5] = '=';
          pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
          *(uint *)(pcVar6 + -0xc) = uVar4;
          pcVar6[-0xffffffff00000004] = '\0';
          pcVar6[-0xffffffff00000003] = '\0';
          pcVar6[-0xffffffff00000002] = '\0';
          pcVar6[-0xffffffff00000001] = '\0';
          pcVar6[uVar4] = '\0';
          pcVar6 = *this->_M_impl->_M_names;
          sVar2 = strlen(pcVar6);
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (__return_storage_ptr__,pcVar6,sVar2);
          iVar5 = 4;
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: size_t __len@[???] */
          pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
          while( true ) {
            uVar4 = *(int *)(pcVar6 + -0xc) + 1;
            if ((*(uint *)(pcVar6 + -8) < uVar4) || (0 < *(int *)(pcVar6 + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (__return_storage_ptr__,uVar4);
              pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
              iVar1 = *(int *)(pcVar6 + -0xc);
            }
            else {
              iVar1 = *(int *)(pcVar6 + -0xc);
            }
            pcVar6[iVar1] = ';';
            pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
            *(uint *)(pcVar6 + -0xc) = uVar4;
            pcVar6[-0xffffffff00000004] = '\0';
            pcVar6[-0xffffffff00000003] = '\0';
            pcVar6[-0xffffffff00000002] = '\0';
            pcVar6[-0xffffffff00000001] = '\0';
            pcVar6[uVar4] = '\0';
            pcVar6 = *(char **)((int)ppcVar3 + iVar5);
            sVar2 = strlen(pcVar6);
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (__return_storage_ptr__,pcVar6,sVar2);
                    /* Unresolved local var: size_t __len@[???] */
            pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
            uVar4 = *(int *)(pcVar6 + -0xc) + 1;
            if ((*(uint *)(pcVar6 + -8) < uVar4) || (0 < *(int *)(pcVar6 + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (__return_storage_ptr__,uVar4);
              pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
              iVar1 = *(int *)(pcVar6 + -0xc);
            }
            else {
              iVar1 = *(int *)(pcVar6 + -0xc);
            }
            pcVar6[iVar1] = '=';
            pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
            *(uint *)(pcVar6 + -0xc) = uVar4;
            pcVar6[-0xffffffff00000004] = '\0';
            pcVar6[-0xffffffff00000003] = '\0';
            pcVar6[-0xffffffff00000002] = '\0';
            pcVar6[-0xffffffff00000001] = '\0';
            pcVar6[uVar4] = '\0';
            pcVar6 = *(char **)((int)this->_M_impl->_M_names + iVar5);
            sVar2 = strlen(pcVar6);
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (__return_storage_ptr__,pcVar6,sVar2);
            iVar5 = iVar5 + 4;
            if (iVar5 == 0x18) break;
            pcVar6 = (__return_storage_ptr__->_M_dataplus)._M_p;
          }
          return __return_storage_ptr__;
        }
                    /* Unresolved local var: size_t __i@[???] */
        ppcVar3 = ppcVar3 + 1;
      } while (iVar5 != 5);
    }
    sVar2 = strlen(pcVar6);
                    /* try { // try from 0899ccc8 to 0899cf17 has its CatchHandler @ 0899cf20 */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
              (__return_storage_ptr__,pcVar6,sVar2);
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: operator== @ 0899cf6c

/* DWARF original prototype: bool operator==(locale * this, locale * __rhs) */

bool __thiscall std::locale::operator==(locale *this,locale *__rhs)

{
  int iVar1;
  _Atomic_word _Var2;
  char *s1;
  char *s2;
  size_t *psVar3;
  char **ppcVar4;
  char **ppcVar5;
  uint uVar6;
  uint uVar7;
  allocator<char> aaStack_38 [2];
  allocator<char> aaStack_36 [2];
  string local_34;
  string local_30;
  uint local_2c;
  uint local_28 [2];
  
                    /* Unresolved local var: bool __ret@[???] */
  if (this->_M_impl == __rhs->_M_impl) {
    return true;
  }
  ppcVar4 = this->_M_impl->_M_names;
  s1 = *ppcVar4;
  if (s1 != (char *)0x0) {
    ppcVar5 = __rhs->_M_impl->_M_names;
    s2 = *ppcVar5;
    if ((s2 != (char *)0x0) && (iVar1 = strcmp(s1,s2), iVar1 == 0)) {
      if ((ppcVar4[1] == (char *)0x0) && (ppcVar5[1] == (char *)0x0)) {
        return true;
      }
                    /* try { // try from 0899cfe0 to 0899cfe7 has its CatchHandler @ 0899d120 */
      name(&local_30,this);
                    /* try { // try from 0899cff0 to 0899cff7 has its CatchHandler @ 0899d180 */
      name(&local_34,__rhs);
                    /* Unresolved local var: size_t __size@[???]
                       Unresolved local var: size_t __osize@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
      uVar7 = *(uint *)((int)local_30._M_dataplus._M_p + -0xc);
      uVar6 = *(uint *)((int)local_34._M_dataplus._M_p + -0xc);
      local_2c = uVar7;
      local_28[0] = uVar6;
      if (uVar6 < uVar7) {
        psVar3 = local_28;
      }
      else {
        psVar3 = &local_2c;
      }
      iVar1 = memcmp((void *)local_30._M_dataplus._M_p,(void *)local_34._M_dataplus._M_p,*psVar3);
      if (iVar1 == 0) {
        iVar1 = uVar7 - uVar6;
      }
                    /* Unresolved local var: void * __p@[???] */
                    /* try { // try from 0899d0fc to 0899d103 has its CatchHandler @ 0899d13c */
      if (((_Rep *)((int)local_34._M_dataplus._M_p + -0xc) !=
           (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                   _S_empty_rep_storage) &&
         (_Var2 = __gnu_cxx::__exchange_and_add
                            ((_Atomic_word *)((int)local_34._M_dataplus._M_p + -4),-1), _Var2 < 1))
      {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_34._M_dataplus._M_p + -0xc),aaStack_36);
      }
                    /* try { // try from 0899d0d8 to 0899d0df has its CatchHandler @ 0899d194 */
      if (((_Rep *)((int)local_30._M_dataplus._M_p + -0xc) !=
           (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                   _S_empty_rep_storage) &&
         (_Var2 = __gnu_cxx::__exchange_and_add
                            ((_Atomic_word *)((int)local_30._M_dataplus._M_p + -4),-1), _Var2 < 1))
      {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_30._M_dataplus._M_p + -0xc),aaStack_38);
      }
      return iVar1 == 0;
    }
  }
  return false;
}



----------------------------------------

// Function: ~_Impl @ 0899d19c

/* DWARF original prototype: void ~_Impl(_Impl * this, int __in_chrg) */

void __thiscall std::locale::_Impl::~_Impl(_Impl *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char **ppcVar2;
  uint uVar3;
  char **ptr;
  facet **ppfVar4;
  int *piVar5;
  int iVar6;
  uint uVar7;
  
  ppfVar4 = this->_M_facets;
  if (ppfVar4 == (facet **)0x0) {
    ppfVar4 = this->_M_caches;
  }
  else {
                    /* Unresolved local var: void anon_var_0@[???] */
    uVar3 = this->_M_facets_size;
    if (uVar3 != 0) {
      uVar7 = 0;
      iVar6 = 0;
      do {
        piVar5 = *(int **)(iVar6 + (int)ppfVar4);
        if (piVar5 != (int *)0x0) {
                    /* try { // try from 0899d1e8 to 0899d1ef has its CatchHandler @ 0899d33c */
          _Var1 = __gnu_cxx::__exchange_and_add(piVar5 + 1,-1);
          if (_Var1 == 1) {
                    /* try { // try from 0899d2e8 to 0899d2ef has its CatchHandler @ 0899d350 */
            (**(code **)(*piVar5 + 4))(piVar5);
            ppfVar4 = this->_M_facets;
          }
          else {
            ppfVar4 = this->_M_facets;
          }
          uVar3 = this->_M_facets_size;
        }
        uVar7 = uVar7 + 1;
        iVar6 = uVar7 * 4;
      } while (uVar7 < uVar3);
      if (ppfVar4 == (facet **)0x0) {
        ppfVar4 = this->_M_caches;
        goto LAB_0899d228;
      }
    }
    operator_delete___(ppfVar4);
    ppfVar4 = this->_M_caches;
  }
LAB_0899d228:
  if (ppfVar4 == (facet **)0x0) {
    ppcVar2 = this->_M_names;
  }
  else {
                    /* Unresolved local var: void anon_var_0@[???] */
    uVar3 = this->_M_facets_size;
    uVar7 = 0;
    if (uVar3 != 0) {
      iVar6 = 0;
      do {
        piVar5 = *(int **)(iVar6 + (int)ppfVar4);
        if (piVar5 != (int *)0x0) {
                    /* try { // try from 0899d254 to 0899d25b has its CatchHandler @ 0899d33c */
          _Var1 = __gnu_cxx::__exchange_and_add(piVar5 + 1,-1);
          if (_Var1 == 1) {
                    /* try { // try from 0899d2fc to 0899d303 has its CatchHandler @ 0899d324 */
            (**(code **)(*piVar5 + 4))(piVar5);
            uVar3 = this->_M_facets_size;
          }
          else {
            uVar3 = this->_M_facets_size;
          }
          ppfVar4 = this->_M_caches;
        }
        uVar7 = uVar7 + 1;
        iVar6 = uVar7 * 4;
      } while (uVar7 < uVar3);
      if (ppfVar4 == (facet **)0x0) {
        ppcVar2 = this->_M_names;
        goto LAB_0899d294;
      }
    }
    operator_delete___(ppfVar4);
    ppcVar2 = this->_M_names;
  }
LAB_0899d294:
  iVar6 = 0;
  ptr = ppcVar2;
  if (ppcVar2 != (char **)0x0) {
    do {
      iVar6 = iVar6 + 4;
      if (*ppcVar2 != (char *)0x0) {
        operator_delete___(*ppcVar2);
        ptr = this->_M_names;
      }
      ppcVar2 = (char **)((int)ptr + iVar6);
    } while (iVar6 != 0x18);
    if (ptr != (char **)0x0) {
      operator_delete___(ptr);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: _Impl @ 0899d370

/* DWARF original prototype: void _Impl(_Impl * this, _Impl * __imp, size_t __refs) */

void __thiscall std::locale::_Impl::_Impl(_Impl *this,_Impl *__imp,size_t __refs)

{
  facet **ppfVar1;
  facet *pfVar2;
  char **ppcVar3;
  undefined4 *puVar4;
  size_t sVar5;
  void *pvVar6;
  int iVar7;
  char **ppcVar8;
  size_t sVar9;
  char **ppcVar10;
  undefined4 *puVar11;
  uint uVar12;
  uint uVar13;
  
  sVar9 = __imp->_M_facets_size;
  this->_M_refcount = __refs;
  this->_M_facets = (facet **)0x0;
  this->_M_facets_size = sVar9;
  this->_M_caches = (facet **)0x0;
  this->_M_names = (char **)0x0;
                    /* try { // try from 0899d3b0 to 0899d3b7 has its CatchHandler @ 0899d514 */
  ppfVar1 = operator_new___(sVar9 << 2);
                    /* Unresolved local var: void anon_var_0@[???] */
  sVar9 = this->_M_facets_size;
  this->_M_facets = ppfVar1;
  if (sVar9 != 0) {
    uVar12 = 0;
    ppfVar1 = __imp->_M_facets;
    while( true ) {
      pfVar2 = ppfVar1[uVar12];
      this->_M_facets[uVar12] = pfVar2;
      if (pfVar2 != (facet *)0x0) {
                    /* try { // try from 0899d3ec to 0899d3f3 has its CatchHandler @ 0899d52c */
        __gnu_cxx::__atomic_add(&pfVar2->_M_refcount,1);
        sVar9 = this->_M_facets_size;
      }
      uVar12 = uVar12 + 1;
      if (sVar9 <= uVar12) break;
      ppfVar1 = __imp->_M_facets;
    }
  }
                    /* try { // try from 0899d408 to 0899d40f has its CatchHandler @ 0899d514 */
  ppfVar1 = operator_new___(sVar9 << 2);
                    /* Unresolved local var: void anon_var_0@[???] */
  uVar12 = this->_M_facets_size;
  this->_M_caches = ppfVar1;
  if (uVar12 != 0) {
    uVar13 = 0;
    ppfVar1 = __imp->_M_caches;
    while( true ) {
      pfVar2 = ppfVar1[uVar13];
      this->_M_caches[uVar13] = pfVar2;
      if (pfVar2 != (facet *)0x0) {
                    /* try { // try from 0899d444 to 0899d44b has its CatchHandler @ 0899d52c */
        __gnu_cxx::__atomic_add(&pfVar2->_M_refcount,1);
        uVar12 = this->_M_facets_size;
      }
      uVar13 = uVar13 + 1;
      if (uVar12 <= uVar13) break;
      ppfVar1 = __imp->_M_caches;
    }
  }
                    /* try { // try from 0899d460 to 0899d4bf has its CatchHandler @ 0899d514 */
  ppcVar3 = operator_new___(0x18);
  this->_M_names = ppcVar3;
  iVar7 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    puVar4 = (undefined4 *)((int)ppcVar3 + iVar7);
    iVar7 = iVar7 + 4;
    *puVar4 = 0;
  } while (iVar7 != 0x18);
  iVar7 = 0;
                    /* Unresolved local var: void anon_var_0@[???] */
  ppcVar3 = __imp->_M_names;
  while( true ) {
    if (*(char **)((int)ppcVar3 + iVar7) == (char *)0x0) {
      return;
    }
                    /* Unresolved local var: void anon_var_0@[???] */
    sVar5 = strlen(*(char **)((int)ppcVar3 + iVar7));
    ppcVar3 = this->_M_names;
    pvVar6 = operator_new___(sVar5 + 1);
    ppcVar8 = this->_M_names;
    ppcVar10 = __imp->_M_names;
    *(void **)(iVar7 + (int)ppcVar3) = pvVar6;
    puVar4 = (undefined4 *)((int)ppcVar8 + iVar7);
    puVar11 = (undefined4 *)((int)ppcVar10 + iVar7);
    iVar7 = iVar7 + 4;
    memcpy((void *)*puVar4,(void *)*puVar11,sVar5 + 1);
    if (iVar7 == 0x18) break;
    ppcVar3 = __imp->_M_names;
  }
  return;
}



----------------------------------------

// Function: _Impl @ 0899d558

/* DWARF original prototype: void _Impl(_Impl * this, _Impl * __imp, size_t __refs) */

void __thiscall std::locale::_Impl::_Impl(_Impl *this,_Impl *__imp,size_t __refs)

{
  facet **ppfVar1;
  facet *pfVar2;
  char **ppcVar3;
  undefined4 *puVar4;
  size_t sVar5;
  void *pvVar6;
  int iVar7;
  char **ppcVar8;
  size_t sVar9;
  char **ppcVar10;
  undefined4 *puVar11;
  uint uVar12;
  uint uVar13;
  
  sVar9 = __imp->_M_facets_size;
  this->_M_refcount = __refs;
  this->_M_facets = (facet **)0x0;
  this->_M_facets_size = sVar9;
  this->_M_caches = (facet **)0x0;
  this->_M_names = (char **)0x0;
                    /* try { // try from 0899d598 to 0899d59f has its CatchHandler @ 0899d6fc */
  ppfVar1 = operator_new___(sVar9 << 2);
                    /* Unresolved local var: void anon_var_0@[???] */
  sVar9 = this->_M_facets_size;
  this->_M_facets = ppfVar1;
  if (sVar9 != 0) {
    uVar12 = 0;
    ppfVar1 = __imp->_M_facets;
    while( true ) {
      pfVar2 = ppfVar1[uVar12];
      this->_M_facets[uVar12] = pfVar2;
      if (pfVar2 != (facet *)0x0) {
                    /* try { // try from 0899d5d4 to 0899d5db has its CatchHandler @ 0899d714 */
        __gnu_cxx::__atomic_add(&pfVar2->_M_refcount,1);
        sVar9 = this->_M_facets_size;
      }
      uVar12 = uVar12 + 1;
      if (sVar9 <= uVar12) break;
      ppfVar1 = __imp->_M_facets;
    }
  }
                    /* try { // try from 0899d5f0 to 0899d5f7 has its CatchHandler @ 0899d6fc */
  ppfVar1 = operator_new___(sVar9 << 2);
                    /* Unresolved local var: void anon_var_0@[???] */
  uVar12 = this->_M_facets_size;
  this->_M_caches = ppfVar1;
  if (uVar12 != 0) {
    uVar13 = 0;
    ppfVar1 = __imp->_M_caches;
    while( true ) {
      pfVar2 = ppfVar1[uVar13];
      this->_M_caches[uVar13] = pfVar2;
      if (pfVar2 != (facet *)0x0) {
                    /* try { // try from 0899d62c to 0899d633 has its CatchHandler @ 0899d714 */
        __gnu_cxx::__atomic_add(&pfVar2->_M_refcount,1);
        uVar12 = this->_M_facets_size;
      }
      uVar13 = uVar13 + 1;
      if (uVar12 <= uVar13) break;
      ppfVar1 = __imp->_M_caches;
    }
  }
                    /* try { // try from 0899d648 to 0899d6a7 has its CatchHandler @ 0899d6fc */
  ppcVar3 = operator_new___(0x18);
  this->_M_names = ppcVar3;
  iVar7 = 0;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    puVar4 = (undefined4 *)((int)ppcVar3 + iVar7);
    iVar7 = iVar7 + 4;
    *puVar4 = 0;
  } while (iVar7 != 0x18);
  iVar7 = 0;
                    /* Unresolved local var: void anon_var_0@[???] */
  ppcVar3 = __imp->_M_names;
  while( true ) {
    if (*(char **)((int)ppcVar3 + iVar7) == (char *)0x0) {
      return;
    }
                    /* Unresolved local var: void anon_var_0@[???] */
    sVar5 = strlen(*(char **)((int)ppcVar3 + iVar7));
    ppcVar3 = this->_M_names;
    pvVar6 = operator_new___(sVar5 + 1);
    ppcVar8 = this->_M_names;
    ppcVar10 = __imp->_M_names;
    *(void **)(iVar7 + (int)ppcVar3) = pvVar6;
    puVar4 = (undefined4 *)((int)ppcVar8 + iVar7);
    puVar11 = (undefined4 *)((int)ppcVar10 + iVar7);
    iVar7 = iVar7 + 4;
    memcpy((void *)*puVar4,(void *)*puVar11,sVar5 + 1);
    if (iVar7 == 0x18) break;
    ppcVar3 = __imp->_M_names;
  }
  return;
}



----------------------------------------

// Function: ~locale @ 0899d740

/* DWARF original prototype: void ~locale(locale * this, int __in_chrg) */

void __thiscall std::locale::~locale(locale *this,int __in_chrg)

{
  _Atomic_word _Var1;
  int __in_chrg_00;
  _Impl *this_00;
  
  this_00 = this->_M_impl;
  __in_chrg_00 = -1;
                    /* try { // try from 0899d754 to 0899d75b has its CatchHandler @ 0899d798 */
  _Var1 = __gnu_cxx::__exchange_and_add(&this_00->_M_refcount,-1);
  if ((_Var1 == 1) && (this_00 != (_Impl *)0x0)) {
    _Impl::~_Impl(this_00,__in_chrg_00);
    operator_delete(this_00);
    return;
  }
  return;
}



----------------------------------------

// Function: ~locale @ 0899d7b4

/* DWARF original prototype: void ~locale(locale * this, int __in_chrg) */

void __thiscall std::locale::~locale(locale *this,int __in_chrg)

{
  _Atomic_word _Var1;
  int __in_chrg_00;
  _Impl *this_00;
  
  this_00 = this->_M_impl;
  __in_chrg_00 = -1;
                    /* try { // try from 0899d7c8 to 0899d7cf has its CatchHandler @ 0899d80c */
  _Var1 = __gnu_cxx::__exchange_and_add(&this_00->_M_refcount,-1);
  if ((_Var1 == 1) && (this_00 != (_Impl *)0x0)) {
    _Impl::~_Impl(this_00,__in_chrg_00);
    operator_delete(this_00);
    return;
  }
  return;
}



----------------------------------------

// Function: operator= @ 0899d828

/* DWARF original prototype: locale * operator=(locale * this, locale * __other) */

locale * __thiscall std::locale::operator=(locale *this,locale *__other)

{
  _Atomic_word _Var1;
  int __in_chrg;
  _Impl *p_Var2;
  
                    /* try { // try from 0899d848 to 0899d84f has its CatchHandler @ 0899d8cc */
  __gnu_cxx::__atomic_add(&__other->_M_impl->_M_refcount,1);
  p_Var2 = this->_M_impl;
  __in_chrg = -1;
                    /* try { // try from 0899d858 to 0899d85f has its CatchHandler @ 0899d8cc */
  _Var1 = __gnu_cxx::__exchange_and_add(&p_Var2->_M_refcount,-1);
  if (_Var1 == 1) {
    if (p_Var2 != (_Impl *)0x0) {
      _Impl::~_Impl(p_Var2,__in_chrg);
      operator_delete(p_Var2);
      this->_M_impl = __other->_M_impl;
      return this;
    }
    p_Var2 = __other->_M_impl;
  }
  else {
    p_Var2 = __other->_M_impl;
  }
  this->_M_impl = p_Var2;
  return this;
}



----------------------------------------

// Function: ~_Impl @ 0899d8e8

/* DWARF original prototype: void ~_Impl(_Impl * this, int __in_chrg) */

void __thiscall std::locale::_Impl::~_Impl(_Impl *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char **ppcVar2;
  uint uVar3;
  char **ptr;
  facet **ppfVar4;
  int *piVar5;
  int iVar6;
  uint uVar7;
  
  ppfVar4 = this->_M_facets;
  if (ppfVar4 == (facet **)0x0) {
    ppfVar4 = this->_M_caches;
  }
  else {
                    /* Unresolved local var: void anon_var_0@[???] */
    uVar3 = this->_M_facets_size;
    if (uVar3 != 0) {
      uVar7 = 0;
      iVar6 = 0;
      do {
        piVar5 = *(int **)(iVar6 + (int)ppfVar4);
        if (piVar5 != (int *)0x0) {
                    /* try { // try from 0899d934 to 0899d93b has its CatchHandler @ 0899da88 */
          _Var1 = __gnu_cxx::__exchange_and_add(piVar5 + 1,-1);
          if (_Var1 == 1) {
                    /* try { // try from 0899da34 to 0899da3b has its CatchHandler @ 0899da9c */
            (**(code **)(*piVar5 + 4))(piVar5);
            ppfVar4 = this->_M_facets;
          }
          else {
            ppfVar4 = this->_M_facets;
          }
          uVar3 = this->_M_facets_size;
        }
        uVar7 = uVar7 + 1;
        iVar6 = uVar7 * 4;
      } while (uVar7 < uVar3);
      if (ppfVar4 == (facet **)0x0) {
        ppfVar4 = this->_M_caches;
        goto LAB_0899d974;
      }
    }
    operator_delete___(ppfVar4);
    ppfVar4 = this->_M_caches;
  }
LAB_0899d974:
  if (ppfVar4 == (facet **)0x0) {
    ppcVar2 = this->_M_names;
  }
  else {
                    /* Unresolved local var: void anon_var_0@[???] */
    uVar3 = this->_M_facets_size;
    uVar7 = 0;
    if (uVar3 != 0) {
      iVar6 = 0;
      do {
        piVar5 = *(int **)(iVar6 + (int)ppfVar4);
        if (piVar5 != (int *)0x0) {
                    /* try { // try from 0899d9a0 to 0899d9a7 has its CatchHandler @ 0899da88 */
          _Var1 = __gnu_cxx::__exchange_and_add(piVar5 + 1,-1);
          if (_Var1 == 1) {
                    /* try { // try from 0899da48 to 0899da4f has its CatchHandler @ 0899da70 */
            (**(code **)(*piVar5 + 4))(piVar5);
            uVar3 = this->_M_facets_size;
          }
          else {
            uVar3 = this->_M_facets_size;
          }
          ppfVar4 = this->_M_caches;
        }
        uVar7 = uVar7 + 1;
        iVar6 = uVar7 * 4;
      } while (uVar7 < uVar3);
      if (ppfVar4 == (facet **)0x0) {
        ppcVar2 = this->_M_names;
        goto LAB_0899d9e0;
      }
    }
    operator_delete___(ppfVar4);
    ppcVar2 = this->_M_names;
  }
LAB_0899d9e0:
  iVar6 = 0;
  ptr = ppcVar2;
  if (ppcVar2 != (char **)0x0) {
    do {
      iVar6 = iVar6 + 4;
      if (*ppcVar2 != (char *)0x0) {
        operator_delete___(*ppcVar2);
        ptr = this->_M_names;
      }
      ppcVar2 = (char **)((int)ptr + iVar6);
    } while (iVar6 != 0x18);
    if (ptr != (char **)0x0) {
      operator_delete___(ptr);
      return;
    }
  }
  return;
}



----------------------------------------

// Function: _M_install_facet @ 0899dabc

/* DWARF original prototype: void _M_install_facet(_Impl * this, id * __idp, facet * __fp) */

void __thiscall std::locale::_Impl::_M_install_facet(_Impl *this,id *__idp,facet *__fp)

{
  size_t sVar1;
  _Atomic_word _Var2;
  facet **ppfVar3;
  facet **ppfVar4;
  facet **ppfVar5;
  facet **ppfVar6;
  facet **ppfVar7;
  uint uVar8;
  uint uVar9;
  facet *pfVar10;
  uint uVar11;
  facet **ptr;
  
  if (__fp != (facet *)0x0) {
                    /* Unresolved local var: size_t __index@[???]
                       Unresolved local var: facet * * __fpr@[???] */
    sVar1 = locale::id::_M_id(__idp);
    uVar9 = sVar1 + 4;
    if (this->_M_facets_size - 1 < sVar1) {
                    /* Unresolved local var: size_t __new_size@[???]
                       Unresolved local var: facet * * __oldf@[???]
                       Unresolved local var: facet * * __newf@[???]
                       Unresolved local var: facet * * __oldc@[???]
                       Unresolved local var: facet * * __newc@[???] */
      ptr = this->_M_facets;
      ppfVar4 = operator_new___(uVar9 * 4);
                    /* Unresolved local var: size_t __i@[???] */
      uVar11 = this->_M_facets_size;
      if (uVar11 != 0) {
        ppfVar7 = this->_M_facets;
        uVar8 = 0;
        ppfVar3 = ppfVar4;
        do {
          pfVar10 = *ppfVar7;
          uVar8 = uVar8 + 1;
          ppfVar7 = ppfVar7 + 1;
          *ppfVar3 = pfVar10;
          ppfVar3 = ppfVar3 + 1;
        } while (uVar8 != uVar11);
      }
                    /* Unresolved local var: size_t __l@[???] */
      if (uVar11 < uVar9) {
        ppfVar3 = ppfVar4 + uVar11;
        do {
          uVar11 = uVar11 + 1;
          *ppfVar3 = (facet *)0x0;
          ppfVar3 = ppfVar3 + 1;
        } while (uVar11 < uVar9);
      }
                    /* try { // try from 0899dc50 to 0899dc57 has its CatchHandler @ 0899dd44 */
      ppfVar7 = this->_M_caches;
      ppfVar3 = operator_new___(uVar9 * 4);
                    /* Unresolved local var: size_t __j@[???] */
      uVar11 = this->_M_facets_size;
      if (uVar11 != 0) {
        ppfVar5 = this->_M_caches;
        uVar8 = 0;
        ppfVar6 = ppfVar3;
        do {
          pfVar10 = *ppfVar5;
          uVar8 = uVar8 + 1;
          ppfVar5 = ppfVar5 + 1;
          *ppfVar6 = pfVar10;
          ppfVar6 = ppfVar6 + 1;
        } while (uVar8 != uVar11);
      }
                    /* Unresolved local var: size_t __k@[???] */
      if (uVar11 < uVar9) {
        ppfVar6 = ppfVar3 + uVar11;
        do {
          uVar11 = uVar11 + 1;
          *ppfVar6 = (facet *)0x0;
          ppfVar6 = ppfVar6 + 1;
        } while (uVar11 < uVar9);
      }
      this->_M_facets_size = uVar9;
      this->_M_facets = ppfVar4;
      this->_M_caches = ppfVar3;
      if (ptr != (facet **)0x0) {
        operator_delete___(ptr);
      }
      if (ppfVar7 != (facet **)0x0) {
        operator_delete___(ppfVar7);
      }
    }
                    /* try { // try from 0899db14 to 0899db1b has its CatchHandler @ 0899dd3c */
    __gnu_cxx::__atomic_add(&__fp->_M_refcount,1);
    ppfVar4 = this->_M_facets;
    pfVar10 = ppfVar4[sVar1];
                    /* try { // try from 0899db34 to 0899db3b has its CatchHandler @ 0899dd20 */
    if ((pfVar10 == (facet *)0x0) ||
       (_Var2 = __gnu_cxx::__exchange_and_add(&pfVar10->_M_refcount,-1), _Var2 != 1)) {
                    /* Unresolved local var: size_t __i@[???] */
      uVar9 = this->_M_facets_size;
    }
    else {
                    /* try { // try from 0899dce0 to 0899dce7 has its CatchHandler @ 0899dcf0 */
      (*pfVar10->_vptr_facet[1])(pfVar10);
      uVar9 = this->_M_facets_size;
    }
    ppfVar4[sVar1] = __fp;
    if (uVar9 != 0) {
      ppfVar4 = this->_M_caches;
      uVar11 = 0;
      do {
        pfVar10 = ppfVar4[uVar11];
        if (pfVar10 != (facet *)0x0) {
                    /* try { // try from 0899db94 to 0899db9b has its CatchHandler @ 0899dd20 */
          _Var2 = __gnu_cxx::__exchange_and_add(&pfVar10->_M_refcount,-1);
          if (_Var2 == 1) {
                    /* try { // try from 0899dbb0 to 0899dbb7 has its CatchHandler @ 0899dd08 */
            (*pfVar10->_vptr_facet[1])(pfVar10);
            ppfVar4 = this->_M_caches;
          }
          else {
            ppfVar4 = this->_M_caches;
          }
          uVar9 = this->_M_facets_size;
                    /* Unresolved local var: facet * __cpr@[???] */
          ppfVar4[uVar11] = (facet *)0x0;
        }
        uVar11 = uVar11 + 1;
      } while (uVar11 < uVar9);
    }
  }
  return;
}



----------------------------------------

// Function: _M_replace_facet @ 0899dd74

/* DWARF original prototype: void _M_replace_facet(_Impl * this, _Impl * __imp, id * __idp) */

void __thiscall std::locale::_Impl::_M_replace_facet(_Impl *this,_Impl *__imp,id *__idp)

{
  size_t sVar1;
  
                    /* Unresolved local var: size_t __index@[???] */
  sVar1 = locale::id::_M_id(__idp);
  if ((sVar1 <= __imp->_M_facets_size - 1) && (__imp->_M_facets[sVar1] != (facet *)0x0)) {
    _M_install_facet(this,__idp,__imp->_M_facets[sVar1]);
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_runtime_error("locale::_Impl::_M_replace_facet");
}



----------------------------------------

// Function: _M_replace_category @ 0899ddf0

/* DWARF original prototype: void _M_replace_category(_Impl * this, _Impl * __imp, id * * __idpp) */

void __thiscall std::locale::_Impl::_M_replace_category(_Impl *this,_Impl *__imp,id **__idpp)

{
  id *__idp;
  
  __idp = *__idpp;
  while (__idp != (id *)0x0) {
    __idpp = __idpp + 1;
    _M_replace_facet(this,__imp,__idp);
    __idp = *__idpp;
  }
  return;
}



----------------------------------------

// Function: _Impl @ 0899de4c

/* DWARF original prototype: void _Impl(_Impl * this, size_t __refs) */

void __thiscall std::locale::_Impl::_Impl(_Impl *this,size_t __refs)

{
  char *pcVar1;
  undefined4 *puVar2;
  size_t sVar3;
  char **ppcVar4;
  uint uVar5;
  uint uVar6;
  int iVar7;
  facet **ppfVar8;
  
                    /* Unresolved local var: void anon_var_0@[???] */
  this->_M_refcount = __refs;
  this->_M_facets_size = 0xe;
  this->_M_names = (char **)0x0;
  this->_M_facets = (facet **)__gnu_internal::facet_vec;
  this->_M_caches = (facet **)__gnu_internal::cache_vec;
                    /* Unresolved local var: void anon_var_0@[???] */
  uVar5 = 0;
  do {
    uVar6 = uVar5 + 1;
    __gnu_internal::cache_vec[uVar5] = (fake_cache_vec)0x0;
    __gnu_internal::facet_vec[uVar5] = (fake_facet_vec)0x0;
    uVar5 = uVar6;
  } while (uVar6 < 0xe);
  this->_M_names = (char **)__gnu_internal::name_vec;
                    /* try { // try from 0899dedc to 0899dee3 has its CatchHandler @ 0899e408 */
  __gnu_internal::name_vec[0] = (fake_name_vec)__gnu_internal::name_c;
  pcVar1 = facet::_S_get_c_name();
  __gnu_internal::name_c[0][0] = *pcVar1;
  iVar7 = 4;
  __gnu_internal::name_c[0][1] = pcVar1[1];
  ppcVar4 = this->_M_names;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    puVar2 = (undefined4 *)(iVar7 + (int)ppcVar4);
    iVar7 = iVar7 + 4;
    *puVar2 = 0;
  } while (iVar7 != 0x18);
                    /* try { // try from 0899df20 to 0899df27 has its CatchHandler @ 0899e408 */
  ctype<char>::ctype((ctype<char> *)__gnu_internal::ctype_c,(char *)0x0,false,1);
                    /* try { // try from 0899df34 to 0899df3b has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&ctype<char>::id,(facet *)__gnu_internal::ctype_c);
                    /* try { // try from 0899df44 to 0899df4b has its CatchHandler @ 0899e45c */
  codecvt<char,char,_mbstate_t>::codecvt
            ((codecvt<char,char,_mbstate_t> *)__gnu_internal::codecvt_c,1);
                    /* try { // try from 0899df58 to 0899df5f has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&codecvt<char,char,_mbstate_t>::id,(facet *)__gnu_internal::codecvt_c);
  __gnu_internal::numpunct_cache_c._0_4_ = &PTR____numpunct_cache_089ef908;
  __gnu_internal::numpunct_c[4] = '\x01';
  __gnu_internal::numpunct_c[5] = '\0';
  __gnu_internal::numpunct_c[6] = '\0';
  __gnu_internal::numpunct_c[7] = '\0';
  __gnu_internal::numpunct_cache_c[4] = '\x01';
  __gnu_internal::numpunct_cache_c[5] = '\0';
  __gnu_internal::numpunct_cache_c[6] = '\0';
  __gnu_internal::numpunct_cache_c[7] = '\0';
  __gnu_internal::numpunct_c._8_4_ = __gnu_internal::numpunct_cache_c;
  __gnu_internal::numpunct_cache_c[8] = '\0';
  __gnu_internal::numpunct_cache_c[9] = '\0';
  __gnu_internal::numpunct_cache_c[10] = '\0';
  __gnu_internal::numpunct_cache_c[0xb] = '\0';
  __gnu_internal::numpunct_cache_c[0xc] = '\0';
  __gnu_internal::numpunct_cache_c[0xd] = '\0';
  __gnu_internal::numpunct_cache_c[0xe] = '\0';
  __gnu_internal::numpunct_cache_c[0xf] = '\0';
  __gnu_internal::numpunct_cache_c[0x10] = '\0';
  __gnu_internal::numpunct_cache_c[0x14] = '\0';
  __gnu_internal::numpunct_cache_c[0x15] = '\0';
  __gnu_internal::numpunct_cache_c[0x16] = '\0';
  __gnu_internal::numpunct_cache_c[0x17] = '\0';
  __gnu_internal::numpunct_cache_c[0x18] = '\0';
  __gnu_internal::numpunct_cache_c[0x19] = '\0';
  __gnu_internal::numpunct_cache_c[0x1a] = '\0';
  __gnu_internal::numpunct_cache_c[0x1b] = '\0';
  __gnu_internal::numpunct_cache_c[0x1c] = '\0';
  __gnu_internal::numpunct_cache_c[0x1d] = '\0';
  __gnu_internal::numpunct_cache_c[0x1e] = '\0';
  __gnu_internal::numpunct_cache_c[0x1f] = '\0';
  __gnu_internal::numpunct_cache_c[0x20] = '\0';
  __gnu_internal::numpunct_cache_c[0x21] = '\0';
  __gnu_internal::numpunct_cache_c[0x22] = '\0';
  __gnu_internal::numpunct_cache_c[0x23] = '\0';
  __gnu_internal::numpunct_cache_c[0x24] = '\0';
  __gnu_internal::numpunct_cache_c[0x25] = '\0';
  __gnu_internal::numpunct_cache_c[100] = '\0';
  __gnu_internal::numpunct_c._0_4_ = &PTR__numpunct_089efc30;
                    /* try { // try from 0899dfc0 to 0899dfc7 has its CatchHandler @ 0899e444 */
  numpunct<char>::_M_initialize_numpunct
            ((numpunct<char> *)__gnu_internal::numpunct_c,(__c_locale)0x0);
                    /* try { // try from 0899dfd4 to 0899e02f has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&numpunct<char>::id,(facet *)__gnu_internal::numpunct_c);
  __gnu_internal::num_get_c[4] = '\x01';
  __gnu_internal::num_get_c[5] = '\0';
  __gnu_internal::num_get_c[6] = '\0';
  __gnu_internal::num_get_c[7] = '\0';
  __gnu_internal::num_get_c._0_4_ = &PTR__num_get_089efa58;
  _M_install_facet(this,&num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::id,
                   (facet *)__gnu_internal::num_get_c);
  __gnu_internal::num_put_c[4] = '\x01';
  __gnu_internal::num_put_c[5] = '\0';
  __gnu_internal::num_put_c[6] = '\0';
  __gnu_internal::num_put_c[7] = '\0';
  __gnu_internal::num_put_c._0_4_ = &PTR__num_put_089efa28;
  _M_install_facet(this,&num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::id,
                   (facet *)__gnu_internal::num_put_c);
  __gnu_internal::collate_c[4] = '\x01';
  __gnu_internal::collate_c[5] = '\0';
  __gnu_internal::collate_c[6] = '\0';
  __gnu_internal::collate_c[7] = '\0';
                    /* try { // try from 0899e044 to 0899e04b has its CatchHandler @ 0899e42c */
  __gnu_internal::collate_c._0_4_ = &PTR__collate_089efc10;
  __gnu_internal::collate_c._8_4_ = facet::_S_get_c_locale();
                    /* try { // try from 0899e05c to 0899e063 has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&collate<char>::id,(facet *)__gnu_internal::collate_c);
  __gnu_internal::moneypunct_cache_cf._0_4_ = &PTR____moneypunct_cache_089ef928;
  __gnu_internal::moneypunct_cf[4] = '\x01';
  __gnu_internal::moneypunct_cf[5] = '\0';
  __gnu_internal::moneypunct_cf[6] = '\0';
  __gnu_internal::moneypunct_cf[7] = '\0';
  __gnu_internal::moneypunct_cache_cf[4] = '\x01';
  __gnu_internal::moneypunct_cache_cf[5] = '\0';
  __gnu_internal::moneypunct_cache_cf[6] = '\0';
  __gnu_internal::moneypunct_cache_cf[7] = '\0';
  __gnu_internal::moneypunct_cf._0_4_ = &PTR__moneypunct_089efb80;
  __gnu_internal::moneypunct_cf._8_4_ = __gnu_internal::moneypunct_cache_cf;
  __gnu_internal::moneypunct_cache_cf[8] = '\0';
  __gnu_internal::moneypunct_cache_cf[9] = '\0';
  __gnu_internal::moneypunct_cache_cf[10] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xb] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xc] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xd] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xe] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xf] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x10] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x11] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x12] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x14] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x15] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x16] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x17] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x18] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x19] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1a] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1b] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1c] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1d] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1e] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1f] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x20] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x21] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x22] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x23] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x24] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x25] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x26] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x27] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x28] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x29] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2a] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2b] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2c] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2d] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2e] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2f] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x30] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x31] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x32] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x33] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x34] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x35] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x36] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x37] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x43] = '\0';
                    /* try { // try from 0899e0e0 to 0899e0e7 has its CatchHandler @ 0899e47c */
  moneypunct<char,false>::_M_initialize_moneypunct
            ((moneypunct<char,false> *)__gnu_internal::moneypunct_cf,(__c_locale)0x0,(char *)0x0);
                    /* try { // try from 0899e0f4 to 0899e0fb has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&moneypunct<char,false>::id,(facet *)__gnu_internal::moneypunct_cf);
  __gnu_internal::moneypunct_cache_ct._0_4_ = &PTR____moneypunct_cache_089ef918;
  __gnu_internal::moneypunct_ct[4] = '\x01';
  __gnu_internal::moneypunct_ct[5] = '\0';
  __gnu_internal::moneypunct_ct[6] = '\0';
  __gnu_internal::moneypunct_ct[7] = '\0';
  __gnu_internal::moneypunct_cache_ct[4] = '\x01';
  __gnu_internal::moneypunct_cache_ct[5] = '\0';
  __gnu_internal::moneypunct_cache_ct[6] = '\0';
  __gnu_internal::moneypunct_cache_ct[7] = '\0';
  __gnu_internal::moneypunct_ct._0_4_ = &PTR__moneypunct_089efbb8;
  __gnu_internal::moneypunct_ct._8_4_ = __gnu_internal::moneypunct_cache_ct;
  __gnu_internal::moneypunct_cache_ct[8] = '\0';
  __gnu_internal::moneypunct_cache_ct[9] = '\0';
  __gnu_internal::moneypunct_cache_ct[10] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xb] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xc] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xd] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xe] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xf] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x10] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x11] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x12] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x14] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x15] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x16] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x17] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x18] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x19] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1a] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1b] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1c] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1d] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1e] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1f] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x20] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x21] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x22] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x23] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x24] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x25] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x26] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x27] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x28] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x29] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2a] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2b] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2c] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2d] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2e] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2f] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x30] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x31] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x32] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x33] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x34] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x35] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x36] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x37] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x43] = '\0';
                    /* try { // try from 0899e178 to 0899e17f has its CatchHandler @ 0899e464 */
  moneypunct<char,true>::_M_initialize_moneypunct
            ((moneypunct<char,true> *)__gnu_internal::moneypunct_ct,(__c_locale)0x0,(char *)0x0);
                    /* try { // try from 0899e18c to 0899e1e7 has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&moneypunct<char,true>::id,(facet *)__gnu_internal::moneypunct_ct);
  __gnu_internal::money_get_c[4] = '\x01';
  __gnu_internal::money_get_c[5] = '\0';
  __gnu_internal::money_get_c[6] = '\0';
  __gnu_internal::money_get_c[7] = '\0';
  __gnu_internal::money_get_c._0_4_ = &PTR__money_get_089efad8;
  _M_install_facet(this,&money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
                         id,(facet *)__gnu_internal::money_get_c);
  __gnu_internal::money_put_c[4] = '\x01';
  __gnu_internal::money_put_c[5] = '\0';
  __gnu_internal::money_put_c[6] = '\0';
  __gnu_internal::money_put_c[7] = '\0';
  __gnu_internal::money_put_c._0_4_ = &PTR__money_put_089efac0;
  _M_install_facet(this,&money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
                         id,(facet *)__gnu_internal::money_put_c);
  __gnu_internal::timepunct_cache_c[4] = '\x01';
  __gnu_internal::timepunct_cache_c[5] = '\0';
  __gnu_internal::timepunct_cache_c[6] = '\0';
  __gnu_internal::timepunct_cache_c[7] = '\0';
  __gnu_internal::timepunct_cache_c._0_4_ = &PTR____timepunct_cache_089efc00;
  __gnu_internal::timepunct_cache_c[8] = '\0';
  __gnu_internal::timepunct_cache_c[9] = '\0';
  __gnu_internal::timepunct_cache_c[10] = '\0';
  __gnu_internal::timepunct_cache_c[0xb] = '\0';
  __gnu_internal::timepunct_cache_c[0xc] = '\0';
  __gnu_internal::timepunct_cache_c[0xd] = '\0';
  __gnu_internal::timepunct_cache_c[0xe] = '\0';
  __gnu_internal::timepunct_cache_c[0xf] = '\0';
  __gnu_internal::timepunct_cache_c[0x10] = '\0';
  __gnu_internal::timepunct_cache_c[0x11] = '\0';
  __gnu_internal::timepunct_cache_c[0x12] = '\0';
  __gnu_internal::timepunct_cache_c[0x13] = '\0';
  __gnu_internal::timepunct_cache_c[0x14] = '\0';
  __gnu_internal::timepunct_cache_c[0x15] = '\0';
  __gnu_internal::timepunct_cache_c[0x16] = '\0';
  __gnu_internal::timepunct_cache_c[0x17] = '\0';
  __gnu_internal::timepunct_cache_c[0x18] = '\0';
  __gnu_internal::timepunct_cache_c[0x19] = '\0';
  __gnu_internal::timepunct_cache_c[0x1a] = '\0';
  __gnu_internal::timepunct_cache_c[0x1b] = '\0';
  __gnu_internal::timepunct_cache_c[0x1c] = '\0';
  __gnu_internal::timepunct_cache_c[0x1d] = '\0';
  __gnu_internal::timepunct_cache_c[0x1e] = '\0';
  __gnu_internal::timepunct_cache_c[0x1f] = '\0';
  __gnu_internal::timepunct_cache_c[0x20] = '\0';
  __gnu_internal::timepunct_cache_c[0x21] = '\0';
  __gnu_internal::timepunct_cache_c[0x22] = '\0';
  __gnu_internal::timepunct_cache_c[0x23] = '\0';
  __gnu_internal::timepunct_cache_c[0x24] = '\0';
  __gnu_internal::timepunct_cache_c[0x25] = '\0';
  __gnu_internal::timepunct_cache_c[0x26] = '\0';
  __gnu_internal::timepunct_cache_c[0x27] = '\0';
  __gnu_internal::timepunct_cache_c[0x28] = '\0';
  __gnu_internal::timepunct_cache_c[0x29] = '\0';
  __gnu_internal::timepunct_cache_c[0x2a] = '\0';
  __gnu_internal::timepunct_cache_c[0x2b] = '\0';
  __gnu_internal::timepunct_cache_c[0x2c] = '\0';
  __gnu_internal::timepunct_cache_c[0x2d] = '\0';
  __gnu_internal::timepunct_cache_c[0x2e] = '\0';
  __gnu_internal::timepunct_cache_c[0x2f] = '\0';
  __gnu_internal::timepunct_cache_c[0x30] = '\0';
  __gnu_internal::timepunct_cache_c[0x31] = '\0';
  __gnu_internal::timepunct_cache_c[0x32] = '\0';
  __gnu_internal::timepunct_cache_c[0x33] = '\0';
  __gnu_internal::timepunct_cache_c[0x34] = '\0';
  __gnu_internal::timepunct_cache_c[0x35] = '\0';
  __gnu_internal::timepunct_cache_c[0x36] = '\0';
  __gnu_internal::timepunct_cache_c[0x37] = '\0';
  __gnu_internal::timepunct_cache_c[0x38] = '\0';
  __gnu_internal::timepunct_cache_c[0x39] = '\0';
  __gnu_internal::timepunct_cache_c[0x3a] = '\0';
  __gnu_internal::timepunct_cache_c[0x3b] = '\0';
  __gnu_internal::timepunct_cache_c[0x3c] = '\0';
  __gnu_internal::timepunct_cache_c[0x3d] = '\0';
  __gnu_internal::timepunct_cache_c[0x3e] = '\0';
  __gnu_internal::timepunct_cache_c[0x3f] = '\0';
  __gnu_internal::timepunct_cache_c[0x40] = '\0';
  __gnu_internal::timepunct_cache_c[0x41] = '\0';
  __gnu_internal::timepunct_cache_c[0x42] = '\0';
  __gnu_internal::timepunct_cache_c[0x43] = '\0';
  __gnu_internal::timepunct_cache_c[0x44] = '\0';
  __gnu_internal::timepunct_cache_c[0x45] = '\0';
  __gnu_internal::timepunct_cache_c[0x46] = '\0';
  __gnu_internal::timepunct_cache_c[0x47] = '\0';
  __gnu_internal::timepunct_cache_c[0x48] = '\0';
  __gnu_internal::timepunct_cache_c[0x49] = '\0';
  __gnu_internal::timepunct_cache_c[0x4a] = '\0';
  __gnu_internal::timepunct_cache_c[0x4b] = '\0';
  __gnu_internal::timepunct_cache_c[0x4c] = '\0';
  __gnu_internal::timepunct_cache_c[0x4d] = '\0';
  __gnu_internal::timepunct_cache_c[0x4e] = '\0';
  __gnu_internal::timepunct_cache_c[0x4f] = '\0';
  __gnu_internal::timepunct_cache_c[0x50] = '\0';
  __gnu_internal::timepunct_cache_c[0x51] = '\0';
  __gnu_internal::timepunct_cache_c[0x52] = '\0';
  __gnu_internal::timepunct_cache_c[0x53] = '\0';
  __gnu_internal::timepunct_cache_c[0x54] = '\0';
  __gnu_internal::timepunct_cache_c[0x55] = '\0';
  __gnu_internal::timepunct_cache_c[0x56] = '\0';
  __gnu_internal::timepunct_cache_c[0x57] = '\0';
  __gnu_internal::timepunct_cache_c[0x58] = '\0';
  __gnu_internal::timepunct_cache_c[0x59] = '\0';
  __gnu_internal::timepunct_cache_c[0x5a] = '\0';
  __gnu_internal::timepunct_cache_c[0x5b] = '\0';
  __gnu_internal::timepunct_cache_c[0x5c] = '\0';
  __gnu_internal::timepunct_cache_c[0x5d] = '\0';
  __gnu_internal::timepunct_cache_c[0x5e] = '\0';
  __gnu_internal::timepunct_cache_c[0x5f] = '\0';
  __gnu_internal::timepunct_cache_c[0x60] = '\0';
  __gnu_internal::timepunct_cache_c[0x61] = '\0';
  __gnu_internal::timepunct_cache_c[0x62] = '\0';
  __gnu_internal::timepunct_cache_c[99] = '\0';
  __gnu_internal::timepunct_cache_c[100] = '\0';
  __gnu_internal::timepunct_cache_c[0x65] = '\0';
  __gnu_internal::timepunct_cache_c[0x66] = '\0';
  __gnu_internal::timepunct_cache_c[0x67] = '\0';
  __gnu_internal::timepunct_cache_c[0x68] = '\0';
  __gnu_internal::timepunct_cache_c[0x69] = '\0';
  __gnu_internal::timepunct_cache_c[0x6a] = '\0';
  __gnu_internal::timepunct_cache_c[0x6b] = '\0';
  __gnu_internal::timepunct_cache_c[0x6c] = '\0';
  __gnu_internal::timepunct_cache_c[0x6d] = '\0';
  __gnu_internal::timepunct_cache_c[0x6e] = '\0';
  __gnu_internal::timepunct_cache_c[0x6f] = '\0';
  __gnu_internal::timepunct_cache_c[0x70] = '\0';
  __gnu_internal::timepunct_cache_c[0x71] = '\0';
  __gnu_internal::timepunct_cache_c[0x72] = '\0';
  __gnu_internal::timepunct_cache_c[0x73] = '\0';
  __gnu_internal::timepunct_cache_c[0x74] = '\0';
  __gnu_internal::timepunct_cache_c[0x75] = '\0';
  __gnu_internal::timepunct_cache_c[0x76] = '\0';
  __gnu_internal::timepunct_cache_c[0x77] = '\0';
  __gnu_internal::timepunct_cache_c[0x78] = '\0';
  __gnu_internal::timepunct_cache_c[0x79] = '\0';
  __gnu_internal::timepunct_cache_c[0x7a] = '\0';
  __gnu_internal::timepunct_cache_c[0x7b] = '\0';
  __gnu_internal::timepunct_cache_c[0x7c] = '\0';
  __gnu_internal::timepunct_cache_c[0x7d] = '\0';
  __gnu_internal::timepunct_cache_c[0x7e] = '\0';
  __gnu_internal::timepunct_cache_c[0x7f] = '\0';
  __gnu_internal::timepunct_cache_c[0x80] = '\0';
  __gnu_internal::timepunct_cache_c[0x81] = '\0';
  __gnu_internal::timepunct_cache_c[0x82] = '\0';
  __gnu_internal::timepunct_cache_c[0x83] = '\0';
  __gnu_internal::timepunct_cache_c[0x84] = '\0';
  __gnu_internal::timepunct_cache_c[0x85] = '\0';
  __gnu_internal::timepunct_cache_c[0x86] = '\0';
  __gnu_internal::timepunct_cache_c[0x87] = '\0';
  __gnu_internal::timepunct_cache_c[0x88] = '\0';
  __gnu_internal::timepunct_cache_c[0x89] = '\0';
  __gnu_internal::timepunct_cache_c[0x8a] = '\0';
  __gnu_internal::timepunct_cache_c[0x8b] = '\0';
  __gnu_internal::timepunct_cache_c[0x8c] = '\0';
  __gnu_internal::timepunct_cache_c[0x8d] = '\0';
  __gnu_internal::timepunct_cache_c[0x8e] = '\0';
  __gnu_internal::timepunct_cache_c[0x8f] = '\0';
  __gnu_internal::timepunct_cache_c[0x90] = '\0';
  __gnu_internal::timepunct_cache_c[0x91] = '\0';
  __gnu_internal::timepunct_cache_c[0x92] = '\0';
  __gnu_internal::timepunct_cache_c[0x93] = '\0';
  __gnu_internal::timepunct_cache_c[0x94] = '\0';
  __gnu_internal::timepunct_cache_c[0x95] = '\0';
  __gnu_internal::timepunct_cache_c[0x96] = '\0';
  __gnu_internal::timepunct_cache_c[0x97] = '\0';
  __gnu_internal::timepunct_cache_c[0x98] = '\0';
  __gnu_internal::timepunct_cache_c[0x99] = '\0';
  __gnu_internal::timepunct_cache_c[0x9a] = '\0';
  __gnu_internal::timepunct_cache_c[0x9b] = '\0';
  __gnu_internal::timepunct_cache_c[0x9c] = '\0';
  __gnu_internal::timepunct_cache_c[0x9d] = '\0';
  __gnu_internal::timepunct_cache_c[0x9e] = '\0';
  __gnu_internal::timepunct_cache_c[0x9f] = '\0';
  __gnu_internal::timepunct_cache_c[0xa0] = '\0';
  __gnu_internal::timepunct_cache_c[0xa1] = '\0';
  __gnu_internal::timepunct_cache_c[0xa2] = '\0';
  __gnu_internal::timepunct_cache_c[0xa3] = '\0';
  __gnu_internal::timepunct_cache_c[0xa4] = '\0';
  __gnu_internal::timepunct_cache_c[0xa5] = '\0';
  __gnu_internal::timepunct_cache_c[0xa6] = '\0';
  __gnu_internal::timepunct_cache_c[0xa7] = '\0';
  __gnu_internal::timepunct_cache_c[0xa8] = '\0';
  __gnu_internal::timepunct_cache_c[0xa9] = '\0';
  __gnu_internal::timepunct_cache_c[0xaa] = '\0';
  __gnu_internal::timepunct_cache_c[0xab] = '\0';
  __gnu_internal::timepunct_cache_c[0xac] = '\0';
  __gnu_internal::timepunct_cache_c[0xad] = '\0';
  __gnu_internal::timepunct_cache_c[0xae] = '\0';
  __gnu_internal::timepunct_cache_c[0xaf] = '\0';
  __gnu_internal::timepunct_cache_c[0xb0] = '\0';
  __gnu_internal::timepunct_cache_c[0xb1] = '\0';
  __gnu_internal::timepunct_cache_c[0xb2] = '\0';
  __gnu_internal::timepunct_cache_c[0xb3] = '\0';
  __gnu_internal::timepunct_cache_c[0xb4] = '\0';
  __gnu_internal::timepunct_cache_c[0xb5] = '\0';
  __gnu_internal::timepunct_cache_c[0xb6] = '\0';
  __gnu_internal::timepunct_cache_c[0xb7] = '\0';
  __gnu_internal::timepunct_cache_c[0xb8] = '\0';
  __gnu_internal::timepunct_cache_c[0xb9] = '\0';
  __gnu_internal::timepunct_cache_c[0xba] = '\0';
  __gnu_internal::timepunct_cache_c[0xbb] = '\0';
  __gnu_internal::timepunct_cache_c[0xbc] = '\0';
  __gnu_internal::timepunct_cache_c[0xbd] = '\0';
  __gnu_internal::timepunct_cache_c[0xbe] = '\0';
  __gnu_internal::timepunct_cache_c[0xbf] = '\0';
  __gnu_internal::timepunct_cache_c[0xc0] = '\0';
  __gnu_internal::timepunct_cache_c[0xc1] = '\0';
  __gnu_internal::timepunct_cache_c[0xc2] = '\0';
  __gnu_internal::timepunct_cache_c[0xc3] = '\0';
  __gnu_internal::timepunct_cache_c[0xc4] = '\0';
                    /* try { // try from 0899e2cc to 0899e2d3 has its CatchHandler @ 0899e494 */
  __timepunct<char>::__timepunct
            ((__timepunct<char> *)__gnu_internal::timepunct_c,
             (__timepunct_cache<char> *)__gnu_internal::timepunct_cache_c,1);
                    /* try { // try from 0899e2e0 to 0899e33b has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&__timepunct<char>::id,(facet *)__gnu_internal::timepunct_c);
  __gnu_internal::time_get_c[4] = '\x01';
  __gnu_internal::time_get_c[5] = '\0';
  __gnu_internal::time_get_c[6] = '\0';
  __gnu_internal::time_get_c[7] = '\0';
  __gnu_internal::time_get_c._0_4_ = &PTR__time_get_089ef9d0;
  _M_install_facet(this,&time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::id
                   ,(facet *)__gnu_internal::time_get_c);
  __gnu_internal::time_put_c[4] = '\x01';
  __gnu_internal::time_put_c[5] = '\0';
  __gnu_internal::time_put_c[6] = '\0';
  __gnu_internal::time_put_c[7] = '\0';
  __gnu_internal::time_put_c._0_4_ = &PTR__time_put_089efa10;
  _M_install_facet(this,&time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::id
                   ,(facet *)__gnu_internal::time_put_c);
                    /* try { // try from 0899e344 to 0899e34b has its CatchHandler @ 0899e424 */
  messages<char>::messages((messages<char> *)__gnu_internal::messages_c,1);
                    /* try { // try from 0899e358 to 0899e3c7 has its CatchHandler @ 0899e408 */
  _M_install_facet(this,&messages<char>::id,(facet *)__gnu_internal::messages_c);
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&numpunct<char>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::numpunct_cache_c;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&moneypunct<char,false>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::moneypunct_cache_cf;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&moneypunct<char,true>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::moneypunct_cache_ct;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&__timepunct<char>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::timepunct_cache_c;
  return;
}



----------------------------------------

// Function: _S_initialize_once @ 0899e4a4

void std::locale::_S_initialize_once(void)

{
  _Impl::_Impl((_Impl *)__gnu_internal::c_locale_impl,2);
  _S_classic = (_Impl *)__gnu_internal::c_locale_impl;
  _S_global = (_Impl *)__gnu_internal::c_locale_impl;
  locale((locale *)__gnu_internal::c_locale,(_Impl *)__gnu_internal::c_locale_impl);
  return;
}



----------------------------------------

// Function: _S_initialize @ 0899e4f0

void std::locale::_S_initialize(void)

{
  if (_S_classic != (_Impl *)0x0) {
    return;
  }
  _S_initialize_once();
  return;
}



----------------------------------------

// Function: classic @ 0899e510

locale * std::locale::classic(void)

{
  _S_initialize();
  return (locale *)__gnu_internal::c_locale;
}



----------------------------------------

// Function: global @ 0899e534

locale * std::locale::global(locale *__return_storage_ptr__,locale *__other)

{
  _Impl *__ip;
  int iVar1;
  _Atomic_word _Var2;
  allocator<char> aaStack_20 [4];
  string local_1c;
  
                    /* Unresolved local var: _Impl * __old@[???] */
                    /* Unresolved local var: lock sentry@[???]
                       Unresolved local var: string __other_name@[???] */
  _S_initialize();
  __ip = _S_global;
                    /* try { // try from 0899e568 to 0899e56f has its CatchHandler @ 0899e61c */
  __gnu_cxx::__atomic_add(&__other->_M_impl->_M_refcount,1);
  _S_global = __other->_M_impl;
                    /* try { // try from 0899e580 to 0899e587 has its CatchHandler @ 0899e630 */
  name(&local_1c,__other);
                    /* try { // try from 0899e590 to 0899e597 has its CatchHandler @ 0899e63c */
  iVar1 = basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare(&local_1c,"*");
  if (iVar1 != 0) {
    setlocale(0,(char *)local_1c._M_dataplus._M_p);
  }
                    /* try { // try from 0899e5f8 to 0899e5ff has its CatchHandler @ 0899e630 */
  if (((_Rep *)((int)local_1c._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var2 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_1c._M_dataplus._M_p + -4),-1), _Var2 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_1c._M_dataplus._M_p + -0xc),aaStack_20);
  }
  locale(__return_storage_ptr__,__ip);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: locale @ 0899e68c

/* DWARF original prototype: void locale(locale * this) */

void __thiscall std::locale::locale(locale *this)

{
                    /* Unresolved local var: void anon_var_0@[???] */
  this->_M_impl = (_Impl *)0x0;
  _S_initialize();
                    /* try { // try from 0899e6b0 to 0899e6b7 has its CatchHandler @ 0899e6d4 */
  __gnu_cxx::__atomic_add(&_S_global->_M_refcount,1);
  this->_M_impl = _S_global;
  return;
}



----------------------------------------

// Function: locale @ 0899e6f0

/* DWARF original prototype: void locale(locale * this) */

void __thiscall std::locale::locale(locale *this)

{
                    /* Unresolved local var: void anon_var_0@[???] */
  this->_M_impl = (_Impl *)0x0;
  _S_initialize();
                    /* try { // try from 0899e714 to 0899e71b has its CatchHandler @ 0899e738 */
  __gnu_cxx::__atomic_add(&_S_global->_M_refcount,1);
  this->_M_impl = _S_global;
  return;
}



----------------------------------------

// Function: _Impl @ 0899e754

/* DWARF original prototype: void _Impl(_Impl * this, size_t __refs) */

void __thiscall std::locale::_Impl::_Impl(_Impl *this,size_t __refs)

{
  char *pcVar1;
  undefined4 *puVar2;
  size_t sVar3;
  char **ppcVar4;
  uint uVar5;
  uint uVar6;
  int iVar7;
  facet **ppfVar8;
  
                    /* Unresolved local var: void anon_var_0@[???] */
  this->_M_refcount = __refs;
  this->_M_facets_size = 0xe;
  this->_M_names = (char **)0x0;
  this->_M_facets = (facet **)__gnu_internal::facet_vec;
  this->_M_caches = (facet **)__gnu_internal::cache_vec;
                    /* Unresolved local var: void anon_var_0@[???] */
  uVar5 = 0;
  do {
    uVar6 = uVar5 + 1;
    __gnu_internal::cache_vec[uVar5] = (fake_cache_vec)0x0;
    __gnu_internal::facet_vec[uVar5] = (fake_facet_vec)0x0;
    uVar5 = uVar6;
  } while (uVar6 < 0xe);
  this->_M_names = (char **)__gnu_internal::name_vec;
                    /* try { // try from 0899e7e4 to 0899e7eb has its CatchHandler @ 0899ed10 */
  __gnu_internal::name_vec[0] = (fake_name_vec)__gnu_internal::name_c;
  pcVar1 = facet::_S_get_c_name();
  __gnu_internal::name_c[0][0] = *pcVar1;
  iVar7 = 4;
  __gnu_internal::name_c[0][1] = pcVar1[1];
  ppcVar4 = this->_M_names;
  do {
                    /* Unresolved local var: void anon_var_0@[???] */
    puVar2 = (undefined4 *)(iVar7 + (int)ppcVar4);
    iVar7 = iVar7 + 4;
    *puVar2 = 0;
  } while (iVar7 != 0x18);
                    /* try { // try from 0899e828 to 0899e82f has its CatchHandler @ 0899ed10 */
  ctype<char>::ctype((ctype<char> *)__gnu_internal::ctype_c,(char *)0x0,false,1);
                    /* try { // try from 0899e83c to 0899e843 has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&ctype<char>::id,(facet *)__gnu_internal::ctype_c);
                    /* try { // try from 0899e84c to 0899e853 has its CatchHandler @ 0899ed64 */
  codecvt<char,char,_mbstate_t>::codecvt
            ((codecvt<char,char,_mbstate_t> *)__gnu_internal::codecvt_c,1);
                    /* try { // try from 0899e860 to 0899e867 has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&codecvt<char,char,_mbstate_t>::id,(facet *)__gnu_internal::codecvt_c);
  __gnu_internal::numpunct_cache_c._0_4_ = &PTR____numpunct_cache_089ef908;
  __gnu_internal::numpunct_c[4] = '\x01';
  __gnu_internal::numpunct_c[5] = '\0';
  __gnu_internal::numpunct_c[6] = '\0';
  __gnu_internal::numpunct_c[7] = '\0';
  __gnu_internal::numpunct_cache_c[4] = '\x01';
  __gnu_internal::numpunct_cache_c[5] = '\0';
  __gnu_internal::numpunct_cache_c[6] = '\0';
  __gnu_internal::numpunct_cache_c[7] = '\0';
  __gnu_internal::numpunct_c._8_4_ = __gnu_internal::numpunct_cache_c;
  __gnu_internal::numpunct_cache_c[8] = '\0';
  __gnu_internal::numpunct_cache_c[9] = '\0';
  __gnu_internal::numpunct_cache_c[10] = '\0';
  __gnu_internal::numpunct_cache_c[0xb] = '\0';
  __gnu_internal::numpunct_cache_c[0xc] = '\0';
  __gnu_internal::numpunct_cache_c[0xd] = '\0';
  __gnu_internal::numpunct_cache_c[0xe] = '\0';
  __gnu_internal::numpunct_cache_c[0xf] = '\0';
  __gnu_internal::numpunct_cache_c[0x10] = '\0';
  __gnu_internal::numpunct_cache_c[0x14] = '\0';
  __gnu_internal::numpunct_cache_c[0x15] = '\0';
  __gnu_internal::numpunct_cache_c[0x16] = '\0';
  __gnu_internal::numpunct_cache_c[0x17] = '\0';
  __gnu_internal::numpunct_cache_c[0x18] = '\0';
  __gnu_internal::numpunct_cache_c[0x19] = '\0';
  __gnu_internal::numpunct_cache_c[0x1a] = '\0';
  __gnu_internal::numpunct_cache_c[0x1b] = '\0';
  __gnu_internal::numpunct_cache_c[0x1c] = '\0';
  __gnu_internal::numpunct_cache_c[0x1d] = '\0';
  __gnu_internal::numpunct_cache_c[0x1e] = '\0';
  __gnu_internal::numpunct_cache_c[0x1f] = '\0';
  __gnu_internal::numpunct_cache_c[0x20] = '\0';
  __gnu_internal::numpunct_cache_c[0x21] = '\0';
  __gnu_internal::numpunct_cache_c[0x22] = '\0';
  __gnu_internal::numpunct_cache_c[0x23] = '\0';
  __gnu_internal::numpunct_cache_c[0x24] = '\0';
  __gnu_internal::numpunct_cache_c[0x25] = '\0';
  __gnu_internal::numpunct_cache_c[100] = '\0';
  __gnu_internal::numpunct_c._0_4_ = &PTR__numpunct_089efc30;
                    /* try { // try from 0899e8c8 to 0899e8cf has its CatchHandler @ 0899ed4c */
  numpunct<char>::_M_initialize_numpunct
            ((numpunct<char> *)__gnu_internal::numpunct_c,(__c_locale)0x0);
                    /* try { // try from 0899e8dc to 0899e937 has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&numpunct<char>::id,(facet *)__gnu_internal::numpunct_c);
  __gnu_internal::num_get_c[4] = '\x01';
  __gnu_internal::num_get_c[5] = '\0';
  __gnu_internal::num_get_c[6] = '\0';
  __gnu_internal::num_get_c[7] = '\0';
  __gnu_internal::num_get_c._0_4_ = &PTR__num_get_089efa58;
  _M_install_facet(this,&num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::id,
                   (facet *)__gnu_internal::num_get_c);
  __gnu_internal::num_put_c[4] = '\x01';
  __gnu_internal::num_put_c[5] = '\0';
  __gnu_internal::num_put_c[6] = '\0';
  __gnu_internal::num_put_c[7] = '\0';
  __gnu_internal::num_put_c._0_4_ = &PTR__num_put_089efa28;
  _M_install_facet(this,&num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::id,
                   (facet *)__gnu_internal::num_put_c);
  __gnu_internal::collate_c[4] = '\x01';
  __gnu_internal::collate_c[5] = '\0';
  __gnu_internal::collate_c[6] = '\0';
  __gnu_internal::collate_c[7] = '\0';
                    /* try { // try from 0899e94c to 0899e953 has its CatchHandler @ 0899ed34 */
  __gnu_internal::collate_c._0_4_ = &PTR__collate_089efc10;
  __gnu_internal::collate_c._8_4_ = facet::_S_get_c_locale();
                    /* try { // try from 0899e964 to 0899e96b has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&collate<char>::id,(facet *)__gnu_internal::collate_c);
  __gnu_internal::moneypunct_cache_cf._0_4_ = &PTR____moneypunct_cache_089ef928;
  __gnu_internal::moneypunct_cf[4] = '\x01';
  __gnu_internal::moneypunct_cf[5] = '\0';
  __gnu_internal::moneypunct_cf[6] = '\0';
  __gnu_internal::moneypunct_cf[7] = '\0';
  __gnu_internal::moneypunct_cache_cf[4] = '\x01';
  __gnu_internal::moneypunct_cache_cf[5] = '\0';
  __gnu_internal::moneypunct_cache_cf[6] = '\0';
  __gnu_internal::moneypunct_cache_cf[7] = '\0';
  __gnu_internal::moneypunct_cf._0_4_ = &PTR__moneypunct_089efb80;
  __gnu_internal::moneypunct_cf._8_4_ = __gnu_internal::moneypunct_cache_cf;
  __gnu_internal::moneypunct_cache_cf[8] = '\0';
  __gnu_internal::moneypunct_cache_cf[9] = '\0';
  __gnu_internal::moneypunct_cache_cf[10] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xb] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xc] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xd] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xe] = '\0';
  __gnu_internal::moneypunct_cache_cf[0xf] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x10] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x11] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x12] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x14] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x15] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x16] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x17] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x18] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x19] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1a] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1b] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1c] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1d] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1e] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x1f] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x20] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x21] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x22] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x23] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x24] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x25] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x26] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x27] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x28] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x29] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2a] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2b] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2c] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2d] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2e] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x2f] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x30] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x31] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x32] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x33] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x34] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x35] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x36] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x37] = '\0';
  __gnu_internal::moneypunct_cache_cf[0x43] = '\0';
                    /* try { // try from 0899e9e8 to 0899e9ef has its CatchHandler @ 0899ed84 */
  moneypunct<char,false>::_M_initialize_moneypunct
            ((moneypunct<char,false> *)__gnu_internal::moneypunct_cf,(__c_locale)0x0,(char *)0x0);
                    /* try { // try from 0899e9fc to 0899ea03 has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&moneypunct<char,false>::id,(facet *)__gnu_internal::moneypunct_cf);
  __gnu_internal::moneypunct_cache_ct._0_4_ = &PTR____moneypunct_cache_089ef918;
  __gnu_internal::moneypunct_ct[4] = '\x01';
  __gnu_internal::moneypunct_ct[5] = '\0';
  __gnu_internal::moneypunct_ct[6] = '\0';
  __gnu_internal::moneypunct_ct[7] = '\0';
  __gnu_internal::moneypunct_cache_ct[4] = '\x01';
  __gnu_internal::moneypunct_cache_ct[5] = '\0';
  __gnu_internal::moneypunct_cache_ct[6] = '\0';
  __gnu_internal::moneypunct_cache_ct[7] = '\0';
  __gnu_internal::moneypunct_ct._0_4_ = &PTR__moneypunct_089efbb8;
  __gnu_internal::moneypunct_ct._8_4_ = __gnu_internal::moneypunct_cache_ct;
  __gnu_internal::moneypunct_cache_ct[8] = '\0';
  __gnu_internal::moneypunct_cache_ct[9] = '\0';
  __gnu_internal::moneypunct_cache_ct[10] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xb] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xc] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xd] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xe] = '\0';
  __gnu_internal::moneypunct_cache_ct[0xf] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x10] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x11] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x12] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x14] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x15] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x16] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x17] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x18] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x19] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1a] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1b] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1c] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1d] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1e] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x1f] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x20] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x21] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x22] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x23] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x24] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x25] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x26] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x27] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x28] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x29] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2a] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2b] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2c] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2d] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2e] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x2f] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x30] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x31] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x32] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x33] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x34] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x35] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x36] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x37] = '\0';
  __gnu_internal::moneypunct_cache_ct[0x43] = '\0';
                    /* try { // try from 0899ea80 to 0899ea87 has its CatchHandler @ 0899ed6c */
  moneypunct<char,true>::_M_initialize_moneypunct
            ((moneypunct<char,true> *)__gnu_internal::moneypunct_ct,(__c_locale)0x0,(char *)0x0);
                    /* try { // try from 0899ea94 to 0899eaef has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&moneypunct<char,true>::id,(facet *)__gnu_internal::moneypunct_ct);
  __gnu_internal::money_get_c[4] = '\x01';
  __gnu_internal::money_get_c[5] = '\0';
  __gnu_internal::money_get_c[6] = '\0';
  __gnu_internal::money_get_c[7] = '\0';
  __gnu_internal::money_get_c._0_4_ = &PTR__money_get_089efad8;
  _M_install_facet(this,&money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
                         id,(facet *)__gnu_internal::money_get_c);
  __gnu_internal::money_put_c[4] = '\x01';
  __gnu_internal::money_put_c[5] = '\0';
  __gnu_internal::money_put_c[6] = '\0';
  __gnu_internal::money_put_c[7] = '\0';
  __gnu_internal::money_put_c._0_4_ = &PTR__money_put_089efac0;
  _M_install_facet(this,&money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
                         id,(facet *)__gnu_internal::money_put_c);
  __gnu_internal::timepunct_cache_c[4] = '\x01';
  __gnu_internal::timepunct_cache_c[5] = '\0';
  __gnu_internal::timepunct_cache_c[6] = '\0';
  __gnu_internal::timepunct_cache_c[7] = '\0';
  __gnu_internal::timepunct_cache_c._0_4_ = &PTR____timepunct_cache_089efc00;
  __gnu_internal::timepunct_cache_c[8] = '\0';
  __gnu_internal::timepunct_cache_c[9] = '\0';
  __gnu_internal::timepunct_cache_c[10] = '\0';
  __gnu_internal::timepunct_cache_c[0xb] = '\0';
  __gnu_internal::timepunct_cache_c[0xc] = '\0';
  __gnu_internal::timepunct_cache_c[0xd] = '\0';
  __gnu_internal::timepunct_cache_c[0xe] = '\0';
  __gnu_internal::timepunct_cache_c[0xf] = '\0';
  __gnu_internal::timepunct_cache_c[0x10] = '\0';
  __gnu_internal::timepunct_cache_c[0x11] = '\0';
  __gnu_internal::timepunct_cache_c[0x12] = '\0';
  __gnu_internal::timepunct_cache_c[0x13] = '\0';
  __gnu_internal::timepunct_cache_c[0x14] = '\0';
  __gnu_internal::timepunct_cache_c[0x15] = '\0';
  __gnu_internal::timepunct_cache_c[0x16] = '\0';
  __gnu_internal::timepunct_cache_c[0x17] = '\0';
  __gnu_internal::timepunct_cache_c[0x18] = '\0';
  __gnu_internal::timepunct_cache_c[0x19] = '\0';
  __gnu_internal::timepunct_cache_c[0x1a] = '\0';
  __gnu_internal::timepunct_cache_c[0x1b] = '\0';
  __gnu_internal::timepunct_cache_c[0x1c] = '\0';
  __gnu_internal::timepunct_cache_c[0x1d] = '\0';
  __gnu_internal::timepunct_cache_c[0x1e] = '\0';
  __gnu_internal::timepunct_cache_c[0x1f] = '\0';
  __gnu_internal::timepunct_cache_c[0x20] = '\0';
  __gnu_internal::timepunct_cache_c[0x21] = '\0';
  __gnu_internal::timepunct_cache_c[0x22] = '\0';
  __gnu_internal::timepunct_cache_c[0x23] = '\0';
  __gnu_internal::timepunct_cache_c[0x24] = '\0';
  __gnu_internal::timepunct_cache_c[0x25] = '\0';
  __gnu_internal::timepunct_cache_c[0x26] = '\0';
  __gnu_internal::timepunct_cache_c[0x27] = '\0';
  __gnu_internal::timepunct_cache_c[0x28] = '\0';
  __gnu_internal::timepunct_cache_c[0x29] = '\0';
  __gnu_internal::timepunct_cache_c[0x2a] = '\0';
  __gnu_internal::timepunct_cache_c[0x2b] = '\0';
  __gnu_internal::timepunct_cache_c[0x2c] = '\0';
  __gnu_internal::timepunct_cache_c[0x2d] = '\0';
  __gnu_internal::timepunct_cache_c[0x2e] = '\0';
  __gnu_internal::timepunct_cache_c[0x2f] = '\0';
  __gnu_internal::timepunct_cache_c[0x30] = '\0';
  __gnu_internal::timepunct_cache_c[0x31] = '\0';
  __gnu_internal::timepunct_cache_c[0x32] = '\0';
  __gnu_internal::timepunct_cache_c[0x33] = '\0';
  __gnu_internal::timepunct_cache_c[0x34] = '\0';
  __gnu_internal::timepunct_cache_c[0x35] = '\0';
  __gnu_internal::timepunct_cache_c[0x36] = '\0';
  __gnu_internal::timepunct_cache_c[0x37] = '\0';
  __gnu_internal::timepunct_cache_c[0x38] = '\0';
  __gnu_internal::timepunct_cache_c[0x39] = '\0';
  __gnu_internal::timepunct_cache_c[0x3a] = '\0';
  __gnu_internal::timepunct_cache_c[0x3b] = '\0';
  __gnu_internal::timepunct_cache_c[0x3c] = '\0';
  __gnu_internal::timepunct_cache_c[0x3d] = '\0';
  __gnu_internal::timepunct_cache_c[0x3e] = '\0';
  __gnu_internal::timepunct_cache_c[0x3f] = '\0';
  __gnu_internal::timepunct_cache_c[0x40] = '\0';
  __gnu_internal::timepunct_cache_c[0x41] = '\0';
  __gnu_internal::timepunct_cache_c[0x42] = '\0';
  __gnu_internal::timepunct_cache_c[0x43] = '\0';
  __gnu_internal::timepunct_cache_c[0x44] = '\0';
  __gnu_internal::timepunct_cache_c[0x45] = '\0';
  __gnu_internal::timepunct_cache_c[0x46] = '\0';
  __gnu_internal::timepunct_cache_c[0x47] = '\0';
  __gnu_internal::timepunct_cache_c[0x48] = '\0';
  __gnu_internal::timepunct_cache_c[0x49] = '\0';
  __gnu_internal::timepunct_cache_c[0x4a] = '\0';
  __gnu_internal::timepunct_cache_c[0x4b] = '\0';
  __gnu_internal::timepunct_cache_c[0x4c] = '\0';
  __gnu_internal::timepunct_cache_c[0x4d] = '\0';
  __gnu_internal::timepunct_cache_c[0x4e] = '\0';
  __gnu_internal::timepunct_cache_c[0x4f] = '\0';
  __gnu_internal::timepunct_cache_c[0x50] = '\0';
  __gnu_internal::timepunct_cache_c[0x51] = '\0';
  __gnu_internal::timepunct_cache_c[0x52] = '\0';
  __gnu_internal::timepunct_cache_c[0x53] = '\0';
  __gnu_internal::timepunct_cache_c[0x54] = '\0';
  __gnu_internal::timepunct_cache_c[0x55] = '\0';
  __gnu_internal::timepunct_cache_c[0x56] = '\0';
  __gnu_internal::timepunct_cache_c[0x57] = '\0';
  __gnu_internal::timepunct_cache_c[0x58] = '\0';
  __gnu_internal::timepunct_cache_c[0x59] = '\0';
  __gnu_internal::timepunct_cache_c[0x5a] = '\0';
  __gnu_internal::timepunct_cache_c[0x5b] = '\0';
  __gnu_internal::timepunct_cache_c[0x5c] = '\0';
  __gnu_internal::timepunct_cache_c[0x5d] = '\0';
  __gnu_internal::timepunct_cache_c[0x5e] = '\0';
  __gnu_internal::timepunct_cache_c[0x5f] = '\0';
  __gnu_internal::timepunct_cache_c[0x60] = '\0';
  __gnu_internal::timepunct_cache_c[0x61] = '\0';
  __gnu_internal::timepunct_cache_c[0x62] = '\0';
  __gnu_internal::timepunct_cache_c[99] = '\0';
  __gnu_internal::timepunct_cache_c[100] = '\0';
  __gnu_internal::timepunct_cache_c[0x65] = '\0';
  __gnu_internal::timepunct_cache_c[0x66] = '\0';
  __gnu_internal::timepunct_cache_c[0x67] = '\0';
  __gnu_internal::timepunct_cache_c[0x68] = '\0';
  __gnu_internal::timepunct_cache_c[0x69] = '\0';
  __gnu_internal::timepunct_cache_c[0x6a] = '\0';
  __gnu_internal::timepunct_cache_c[0x6b] = '\0';
  __gnu_internal::timepunct_cache_c[0x6c] = '\0';
  __gnu_internal::timepunct_cache_c[0x6d] = '\0';
  __gnu_internal::timepunct_cache_c[0x6e] = '\0';
  __gnu_internal::timepunct_cache_c[0x6f] = '\0';
  __gnu_internal::timepunct_cache_c[0x70] = '\0';
  __gnu_internal::timepunct_cache_c[0x71] = '\0';
  __gnu_internal::timepunct_cache_c[0x72] = '\0';
  __gnu_internal::timepunct_cache_c[0x73] = '\0';
  __gnu_internal::timepunct_cache_c[0x74] = '\0';
  __gnu_internal::timepunct_cache_c[0x75] = '\0';
  __gnu_internal::timepunct_cache_c[0x76] = '\0';
  __gnu_internal::timepunct_cache_c[0x77] = '\0';
  __gnu_internal::timepunct_cache_c[0x78] = '\0';
  __gnu_internal::timepunct_cache_c[0x79] = '\0';
  __gnu_internal::timepunct_cache_c[0x7a] = '\0';
  __gnu_internal::timepunct_cache_c[0x7b] = '\0';
  __gnu_internal::timepunct_cache_c[0x7c] = '\0';
  __gnu_internal::timepunct_cache_c[0x7d] = '\0';
  __gnu_internal::timepunct_cache_c[0x7e] = '\0';
  __gnu_internal::timepunct_cache_c[0x7f] = '\0';
  __gnu_internal::timepunct_cache_c[0x80] = '\0';
  __gnu_internal::timepunct_cache_c[0x81] = '\0';
  __gnu_internal::timepunct_cache_c[0x82] = '\0';
  __gnu_internal::timepunct_cache_c[0x83] = '\0';
  __gnu_internal::timepunct_cache_c[0x84] = '\0';
  __gnu_internal::timepunct_cache_c[0x85] = '\0';
  __gnu_internal::timepunct_cache_c[0x86] = '\0';
  __gnu_internal::timepunct_cache_c[0x87] = '\0';
  __gnu_internal::timepunct_cache_c[0x88] = '\0';
  __gnu_internal::timepunct_cache_c[0x89] = '\0';
  __gnu_internal::timepunct_cache_c[0x8a] = '\0';
  __gnu_internal::timepunct_cache_c[0x8b] = '\0';
  __gnu_internal::timepunct_cache_c[0x8c] = '\0';
  __gnu_internal::timepunct_cache_c[0x8d] = '\0';
  __gnu_internal::timepunct_cache_c[0x8e] = '\0';
  __gnu_internal::timepunct_cache_c[0x8f] = '\0';
  __gnu_internal::timepunct_cache_c[0x90] = '\0';
  __gnu_internal::timepunct_cache_c[0x91] = '\0';
  __gnu_internal::timepunct_cache_c[0x92] = '\0';
  __gnu_internal::timepunct_cache_c[0x93] = '\0';
  __gnu_internal::timepunct_cache_c[0x94] = '\0';
  __gnu_internal::timepunct_cache_c[0x95] = '\0';
  __gnu_internal::timepunct_cache_c[0x96] = '\0';
  __gnu_internal::timepunct_cache_c[0x97] = '\0';
  __gnu_internal::timepunct_cache_c[0x98] = '\0';
  __gnu_internal::timepunct_cache_c[0x99] = '\0';
  __gnu_internal::timepunct_cache_c[0x9a] = '\0';
  __gnu_internal::timepunct_cache_c[0x9b] = '\0';
  __gnu_internal::timepunct_cache_c[0x9c] = '\0';
  __gnu_internal::timepunct_cache_c[0x9d] = '\0';
  __gnu_internal::timepunct_cache_c[0x9e] = '\0';
  __gnu_internal::timepunct_cache_c[0x9f] = '\0';
  __gnu_internal::timepunct_cache_c[0xa0] = '\0';
  __gnu_internal::timepunct_cache_c[0xa1] = '\0';
  __gnu_internal::timepunct_cache_c[0xa2] = '\0';
  __gnu_internal::timepunct_cache_c[0xa3] = '\0';
  __gnu_internal::timepunct_cache_c[0xa4] = '\0';
  __gnu_internal::timepunct_cache_c[0xa5] = '\0';
  __gnu_internal::timepunct_cache_c[0xa6] = '\0';
  __gnu_internal::timepunct_cache_c[0xa7] = '\0';
  __gnu_internal::timepunct_cache_c[0xa8] = '\0';
  __gnu_internal::timepunct_cache_c[0xa9] = '\0';
  __gnu_internal::timepunct_cache_c[0xaa] = '\0';
  __gnu_internal::timepunct_cache_c[0xab] = '\0';
  __gnu_internal::timepunct_cache_c[0xac] = '\0';
  __gnu_internal::timepunct_cache_c[0xad] = '\0';
  __gnu_internal::timepunct_cache_c[0xae] = '\0';
  __gnu_internal::timepunct_cache_c[0xaf] = '\0';
  __gnu_internal::timepunct_cache_c[0xb0] = '\0';
  __gnu_internal::timepunct_cache_c[0xb1] = '\0';
  __gnu_internal::timepunct_cache_c[0xb2] = '\0';
  __gnu_internal::timepunct_cache_c[0xb3] = '\0';
  __gnu_internal::timepunct_cache_c[0xb4] = '\0';
  __gnu_internal::timepunct_cache_c[0xb5] = '\0';
  __gnu_internal::timepunct_cache_c[0xb6] = '\0';
  __gnu_internal::timepunct_cache_c[0xb7] = '\0';
  __gnu_internal::timepunct_cache_c[0xb8] = '\0';
  __gnu_internal::timepunct_cache_c[0xb9] = '\0';
  __gnu_internal::timepunct_cache_c[0xba] = '\0';
  __gnu_internal::timepunct_cache_c[0xbb] = '\0';
  __gnu_internal::timepunct_cache_c[0xbc] = '\0';
  __gnu_internal::timepunct_cache_c[0xbd] = '\0';
  __gnu_internal::timepunct_cache_c[0xbe] = '\0';
  __gnu_internal::timepunct_cache_c[0xbf] = '\0';
  __gnu_internal::timepunct_cache_c[0xc0] = '\0';
  __gnu_internal::timepunct_cache_c[0xc1] = '\0';
  __gnu_internal::timepunct_cache_c[0xc2] = '\0';
  __gnu_internal::timepunct_cache_c[0xc3] = '\0';
  __gnu_internal::timepunct_cache_c[0xc4] = '\0';
                    /* try { // try from 0899ebd4 to 0899ebdb has its CatchHandler @ 0899ed9c */
  __timepunct<char>::__timepunct
            ((__timepunct<char> *)__gnu_internal::timepunct_c,
             (__timepunct_cache<char> *)__gnu_internal::timepunct_cache_c,1);
                    /* try { // try from 0899ebe8 to 0899ec43 has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&__timepunct<char>::id,(facet *)__gnu_internal::timepunct_c);
  __gnu_internal::time_get_c[4] = '\x01';
  __gnu_internal::time_get_c[5] = '\0';
  __gnu_internal::time_get_c[6] = '\0';
  __gnu_internal::time_get_c[7] = '\0';
  __gnu_internal::time_get_c._0_4_ = &PTR__time_get_089ef9d0;
  _M_install_facet(this,&time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::id
                   ,(facet *)__gnu_internal::time_get_c);
  __gnu_internal::time_put_c[4] = '\x01';
  __gnu_internal::time_put_c[5] = '\0';
  __gnu_internal::time_put_c[6] = '\0';
  __gnu_internal::time_put_c[7] = '\0';
  __gnu_internal::time_put_c._0_4_ = &PTR__time_put_089efa10;
  _M_install_facet(this,&time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::id
                   ,(facet *)__gnu_internal::time_put_c);
                    /* try { // try from 0899ec4c to 0899ec53 has its CatchHandler @ 0899ed2c */
  messages<char>::messages((messages<char> *)__gnu_internal::messages_c,1);
                    /* try { // try from 0899ec60 to 0899eccf has its CatchHandler @ 0899ed10 */
  _M_install_facet(this,&messages<char>::id,(facet *)__gnu_internal::messages_c);
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&numpunct<char>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::numpunct_cache_c;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&moneypunct<char,false>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::moneypunct_cache_cf;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&moneypunct<char,true>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::moneypunct_cache_ct;
  ppfVar8 = this->_M_caches;
  sVar3 = locale::id::_M_id(&__timepunct<char>::id);
  ppfVar8[sVar3] = (facet *)__gnu_internal::timepunct_cache_c;
  return;
}



----------------------------------------

// Function: _S_fetch @ 0899edac

char __gnu_cxx::rope<char,std::allocator<char>_>::_S_fetch
               (_Rope_RopeRep<char,std::allocator<char>_> *__r,size_t __i)

{
  char *pcVar1;
  byte bVar2;
  uint uVar3;
  int *piVar4;
  _Rope_RopeRep<char,std::allocator<char>_> *p_Var5;
  char local_10 [8];
  
                    /* Unresolved local var: char * __cstr@[???] */
  pcVar1 = __r->_M_c_string;
  if (pcVar1 == (char *)0x0) {
    bVar2 = __r->_M_tag;
    do {
      while( true ) {
        while (bVar2 == 1) {
                    /* Unresolved local var: _Rope_RopeConcatenation<char,std::allocator<char>_> *
                       __c@[???]
                       Unresolved local var: _Rope_RopeRep<char,std::allocator<char>_> *
                       __left@[???]
                       Unresolved local var: size_t __left_len@[???] */
          p_Var5 = (_Rope_RopeRep<char,std::allocator<char>_> *)
                   __r[1].super__Rope_rep_base<char,std::allocator<char>_>._M_size;
          uVar3 = (p_Var5->super__Rope_rep_base<char,std::allocator<char>_>)._M_size;
          if (__i < uVar3) {
            bVar2 = p_Var5->_M_tag;
            __r = p_Var5;
          }
          else {
            __r = (_Rope_RopeRep<char,std::allocator<char>_> *)
                  __r[1].super__Refcount_Base._M_ref_count;
            __i = __i - uVar3;
            bVar2 = __r->_M_tag;
          }
        }
        if (bVar2 < 2) break;
        if (bVar2 < 4) {
                    /* Unresolved local var: _Rope_RopeFunction<char,std::allocator<char>_> *
                       __f@[???]
                       Unresolved local var: char __result@[???] */
          piVar4 = (int *)__r[1].super__Rope_rep_base<char,std::allocator<char>_>._M_size;
          (**(code **)(*piVar4 + 8))(piVar4,__i,1,local_10);
          return local_10[0];
        }
      }
    } while (bVar2 != 0);
    pcVar1 = (char *)__r[1].super__Rope_rep_base<char,std::allocator<char>_>._M_size;
  }
                    /* Unresolved local var: _Rope_RopeLeaf<char,std::allocator<char>_> * __l@[???]
                        */
  return pcVar1[__i];
}



----------------------------------------

// Function: file @ 0899ee54

/* DWARF original prototype: __c_file * file(stdio_filebuf<char,std::char_traits<char>_> * this) */

__c_file * __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::file
          (stdio_filebuf<char,std::char_traits<char>_> *this)

{
  return (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file._M_cfile;
}



----------------------------------------

// Function: fd @ 0899ee5c

/* DWARF original prototype: int fd(stdio_filebuf<char,std::char_traits<char>_> * this) */

int __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::fd
          (stdio_filebuf<char,std::char_traits<char>_> *this)

{
  __c_file *p_Var1;
  
  p_Var1 = (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file._M_cfile;
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
    return (int)p_Var1->_file;
  }
  return (int)p_Var1->_file;
}



----------------------------------------

// Function: stdio_filebuf @ 0899ee64

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this)
    */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this)

{
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
  return;
}



----------------------------------------

// Function: stdio_filebuf @ 0899ee94

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this)
    */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this)

{
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
  return;
}



----------------------------------------

// Function: stdio_filebuf @ 0899eec4

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   int __fd, _Ios_Openmode __mode, size_t __size) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,int __fd,_Ios_Openmode __mode,
          size_t __size)

{
  bool bVar1;
  undefined3 extraout_var;
  char *pcVar2;
  __basic_file<char> *this_00;
  
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  this_00 = &(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
                    /* try { // try from 0899ef0c to 0899ef13 has its CatchHandler @ 0899efa8 */
  std::__basic_file<char>::sys_open(this_00,__fd,__mode);
                    /* try { // try from 0899ef14 to 0899ef1b has its CatchHandler @ 0899ef94 */
  bVar1 = std::__basic_file<char>::is_open(this_00);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    return;
  }
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_mode = __mode;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf_size = __size;
                    /* try { // try from 0899ef48 to 0899ef4f has its CatchHandler @ 0899efa8 */
  std::basic_filebuf<char,std::char_traits<char>_>::_M_allocate_internal_buffer
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
  pcVar2 = (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_end = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_reading = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_end = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_writing = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_beg = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_cur = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_cur = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_beg = (char *)0x0;
  return;
}



----------------------------------------

// Function: ~stdio_filebuf @ 0899f00c

/* DWARF original prototype: void ~stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::~stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  std::basic_filebuf<char,std::char_traits<char>_>::close
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* try { // try from 0899f030 to 0899f037 has its CatchHandler @ 0899f064 */
  std::__basic_file<char>::~__basic_file
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file,__in_chrg);
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  std::locale::~locale
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>).
              super_basic_streambuf<char,std::char_traits<char>_>._M_buf_locale,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~stdio_filebuf @ 0899f084

/* DWARF original prototype: void ~stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::~stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  std::basic_filebuf<char,std::char_traits<char>_>::close
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* try { // try from 0899f0a8 to 0899f0af has its CatchHandler @ 0899f0d4 */
  std::__basic_file<char>::~__basic_file
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file,__in_chrg);
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  std::locale::~locale
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>).
              super_basic_streambuf<char,std::char_traits<char>_>._M_buf_locale,__in_chrg);
  return;
}



----------------------------------------

// Function: ~stdio_filebuf @ 0899f0f4

/* DWARF original prototype: void ~stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::~stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  std::basic_filebuf<char,std::char_traits<char>_>::close
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* try { // try from 0899f118 to 0899f11f has its CatchHandler @ 0899f144 */
  std::__basic_file<char>::~__basic_file
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file,__in_chrg);
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  std::locale::~locale
            (&(this->super_basic_filebuf<char,std::char_traits<char>_>).
              super_basic_streambuf<char,std::char_traits<char>_>._M_buf_locale,__in_chrg);
  return;
}



----------------------------------------

// Function: stdio_filebuf @ 0899f164

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   __c_file * __f, _Ios_Openmode __mode, size_t __size) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,__c_file *__f,_Ios_Openmode __mode,
          size_t __size)

{
  bool bVar1;
  undefined3 extraout_var;
  char *pcVar2;
  __basic_file<char> *this_00;
  
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  this_00 = &(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
                    /* try { // try from 0899f1ac to 0899f1b3 has its CatchHandler @ 0899f248 */
  std::__basic_file<char>::sys_open(this_00,__f,__mode);
                    /* try { // try from 0899f1b4 to 0899f1bb has its CatchHandler @ 0899f234 */
  bVar1 = std::__basic_file<char>::is_open(this_00);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    return;
  }
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_mode = __mode;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf_size = __size;
                    /* try { // try from 0899f1e8 to 0899f1ef has its CatchHandler @ 0899f248 */
  std::basic_filebuf<char,std::char_traits<char>_>::_M_allocate_internal_buffer
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
  pcVar2 = (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_end = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_reading = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_end = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_writing = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_beg = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_cur = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_cur = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_beg = (char *)0x0;
  return;
}



----------------------------------------

// Function: stdio_filebuf @ 0899f2ac

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   __c_file * __f, _Ios_Openmode __mode, size_t __size) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,__c_file *__f,_Ios_Openmode __mode,
          size_t __size)

{
  bool bVar1;
  undefined3 extraout_var;
  char *pcVar2;
  __basic_file<char> *this_00;
  
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  this_00 = &(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
                    /* try { // try from 0899f2f4 to 0899f2fb has its CatchHandler @ 0899f390 */
  std::__basic_file<char>::sys_open(this_00,__f,__mode);
                    /* try { // try from 0899f2fc to 0899f303 has its CatchHandler @ 0899f37c */
  bVar1 = std::__basic_file<char>::is_open(this_00);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    return;
  }
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_mode = __mode;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf_size = __size;
                    /* try { // try from 0899f330 to 0899f337 has its CatchHandler @ 0899f390 */
  std::basic_filebuf<char,std::char_traits<char>_>::_M_allocate_internal_buffer
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
  pcVar2 = (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_end = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_reading = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_end = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_writing = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_beg = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_cur = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_cur = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_beg = (char *)0x0;
  return;
}



----------------------------------------

// Function: stdio_filebuf @ 0899f3f4

/* DWARF original prototype: void stdio_filebuf(stdio_filebuf<char,std::char_traits<char>_> * this,
   int __fd, _Ios_Openmode __mode, size_t __size) */

void __thiscall
__gnu_cxx::stdio_filebuf<char,std::char_traits<char>_>::stdio_filebuf
          (stdio_filebuf<char,std::char_traits<char>_> *this,int __fd,_Ios_Openmode __mode,
          size_t __size)

{
  bool bVar1;
  undefined3 extraout_var;
  char *pcVar2;
  __basic_file<char> *this_00;
  
  std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
  this_00 = &(this->super_basic_filebuf<char,std::char_traits<char>_>)._M_file;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_filebuf_089ef638;
                    /* try { // try from 0899f43c to 0899f443 has its CatchHandler @ 0899f4d8 */
  std::__basic_file<char>::sys_open(this_00,__fd,__mode);
                    /* try { // try from 0899f444 to 0899f44b has its CatchHandler @ 0899f4c4 */
  bVar1 = std::__basic_file<char>::is_open(this_00);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    return;
  }
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_mode = __mode;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf_size = __size;
                    /* try { // try from 0899f478 to 0899f47f has its CatchHandler @ 0899f4d8 */
  std::basic_filebuf<char,std::char_traits<char>_>::_M_allocate_internal_buffer
            (&this->super_basic_filebuf<char,std::char_traits<char>_>);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
  pcVar2 = (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_buf;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_end = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_reading = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_end = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>)._M_writing = false;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_beg = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_in_cur = pcVar2;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_cur = (char *)0x0;
  (this->super_basic_filebuf<char,std::char_traits<char>_>).
  super_basic_streambuf<char,std::char_traits<char>_>._M_out_beg = (char *)0x0;
  return;
}



----------------------------------------

// Function: rdstate @ 0899f53c

/* DWARF original prototype: _Ios_Iostate rdstate(basic_ios<char,std::char_traits<char>_> * this) */

_Ios_Iostate __thiscall
std::basic_ios<char,std::char_traits<char>_>::rdstate(basic_ios<char,std::char_traits<char>_> *this)

{
  return (this->super_ios_base)._M_streambuf_state;
}



----------------------------------------

// Function: exceptions @ 0899f544

/* DWARF original prototype: _Ios_Iostate exceptions(basic_ios<char,std::char_traits<char>_> * this)
    */

_Ios_Iostate __thiscall
std::basic_ios<char,std::char_traits<char>_>::exceptions
          (basic_ios<char,std::char_traits<char>_> *this)

{
  return (this->super_ios_base)._M_exception;
}



----------------------------------------

// Function: tie @ 0899f54c

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   tie(basic_ios<char,std::char_traits<char>_> * this) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ios<char,std::char_traits<char>_>::tie(basic_ios<char,std::char_traits<char>_> *this)

{
  return this->_M_tie;
}



----------------------------------------

// Function: tie @ 0899f554

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   tie(basic_ios<char,std::char_traits<char>_> * this, basic_ostream<char,std::char_traits<char>_> *
   __tiestr) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ios<char,std::char_traits<char>_>::tie
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_ostream<char,std::char_traits<char>_> *__tiestr)

{
  basic_ostream<char,std::char_traits<char>_> *pbVar1;
  
                    /* Unresolved local var: basic_ostream<char,std::char_traits<char>_> *
                       __old@[???] */
  pbVar1 = this->_M_tie;
  this->_M_tie = __tiestr;
  return pbVar1;
}



----------------------------------------

// Function: rdbuf @ 0899f560

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   rdbuf(basic_ios<char,std::char_traits<char>_> * this) */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_ios<char,std::char_traits<char>_>::rdbuf(basic_ios<char,std::char_traits<char>_> *this)

{
  return this->_M_streambuf;
}



----------------------------------------

// Function: _M_cache_locale @ 0899f568

/* DWARF original prototype: void _M_cache_locale(basic_ios<char,std::char_traits<char>_> * this,
   locale * __loc) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::_M_cache_locale
          (basic_ios<char,std::char_traits<char>_> *this,locale *__loc)

{
  bool bVar1;
  undefined3 extraout_var;
  ctype<char> *pcVar2;
  undefined3 extraout_var_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar3;
  undefined3 extraout_var_01;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar4;
  
  bVar1 = has_facet<std::ctype<char>_>(__loc);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    this->_M_ctype = (ctype<char> *)0x0;
  }
  else {
    pcVar2 = use_facet<std::ctype<char>_>(__loc);
    this->_M_ctype = pcVar2;
  }
  bVar1 = has_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
                    (__loc);
  if (CONCAT31(extraout_var_00,bVar1) == 0) {
    this->_M_num_put = (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0
    ;
  }
  else {
    pnVar3 = use_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
                       (__loc);
    this->_M_num_put = pnVar3;
  }
  bVar1 = has_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
                    (__loc);
  if (CONCAT31(extraout_var_01,bVar1) == 0) {
    this->_M_num_get = (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0
    ;
  }
  else {
    pnVar4 = use_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
                       (__loc);
    this->_M_num_get = pnVar4;
  }
  return;
}



----------------------------------------

// Function: init @ 0899f600

/* DWARF original prototype: void init(basic_ios<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::init
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  ios_base::_M_init(&this->super_ios_base);
  _M_cache_locale(this,&(this->super_ios_base)._M_ios_locale);
  (this->super_ios_base)._M_streambuf_state =
       (uint)(__sb == (basic_streambuf<char,std::char_traits<char>_> *)0x0);
  this->_M_fill = '\0';
  this->_M_fill_init = false;
  this->_M_tie = (basic_ostream<char,std::char_traits<char>_> *)0x0;
  (this->super_ios_base)._M_exception = _S_goodbit;
  this->_M_streambuf = __sb;
  return;
}



----------------------------------------

// Function: basic_ios @ 0899f658

/* DWARF original prototype: void basic_ios(basic_ios<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::basic_ios
          (basic_ios<char,std::char_traits<char>_> *this)

{
  ios_base::ios_base(&this->super_ios_base);
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  this->_M_num_get = (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  this->_M_tie = (basic_ostream<char,std::char_traits<char>_> *)0x0;
  this->_M_fill = '\0';
  this->_M_fill_init = false;
  this->_M_streambuf = (basic_streambuf<char,std::char_traits<char>_> *)0x0;
  this->_M_ctype = (ctype<char> *)0x0;
  this->_M_num_put = (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  return;
}



----------------------------------------

// Function: basic_ios @ 0899f6a4

/* DWARF original prototype: void basic_ios(basic_ios<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::basic_ios
          (basic_ios<char,std::char_traits<char>_> *this)

{
  ios_base::ios_base(&this->super_ios_base);
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  this->_M_num_get = (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  this->_M_tie = (basic_ostream<char,std::char_traits<char>_> *)0x0;
  this->_M_fill = '\0';
  this->_M_fill_init = false;
  this->_M_streambuf = (basic_streambuf<char,std::char_traits<char>_> *)0x0;
  this->_M_ctype = (ctype<char> *)0x0;
  this->_M_num_put = (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  return;
}



----------------------------------------

// Function: narrow @ 0899f6f0

/* DWARF original prototype: char narrow(basic_ios<char,std::char_traits<char>_> * this, char __c,
   char __dfault) */

char __thiscall
std::basic_ios<char,std::char_traits<char>_>::narrow
          (basic_ios<char,std::char_traits<char>_> *this,char __c,char __dfault)

{
  int iVar1;
  ctype<char> *pcVar2;
  
  pcVar2 = this->_M_ctype;
  if (pcVar2 == (ctype<char> *)0x0) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
                    /* Unresolved local var: char __t@[???] */
  iVar1 = (int)pcVar2->_M_narrow[(byte)__c];
  if ((iVar1 == 0) &&
     (iVar1 = (*(pcVar2->super_facet)._vptr_facet[8])(pcVar2,(int)__c,(int)__dfault),
     __dfault != iVar1)) {
    pcVar2->_M_narrow[(byte)__c] = (char)iVar1;
    return (char)iVar1;
  }
  return (char)iVar1;
}



----------------------------------------

// Function: ~basic_ios @ 0899f77c

/* DWARF original prototype: void ~basic_ios(basic_ios<char,std::char_traits<char>_> * this, int
   __in_chrg) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::~basic_ios
          (basic_ios<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  ios_base::~ios_base(&this->super_ios_base,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~basic_ios @ 0899f7b0

/* DWARF original prototype: void ~basic_ios(basic_ios<char,std::char_traits<char>_> * this, int
   __in_chrg) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::~basic_ios
          (basic_ios<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  ios_base::~ios_base(&this->super_ios_base,__in_chrg);
  return;
}



----------------------------------------

// Function: ~basic_ios @ 0899f7c0

/* DWARF original prototype: void ~basic_ios(basic_ios<char,std::char_traits<char>_> * this, int
   __in_chrg) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::~basic_ios
          (basic_ios<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  ios_base::~ios_base(&this->super_ios_base,__in_chrg);
  return;
}



----------------------------------------

// Function: basic_ios @ 0899f7d0

/* DWARF original prototype: void basic_ios(basic_ios<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::basic_ios
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  ios_base::ios_base(&this->super_ios_base);
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  this->_M_tie = (basic_ostream<char,std::char_traits<char>_> *)0x0;
  this->_M_fill = '\0';
  this->_M_fill_init = false;
  this->_M_streambuf = (basic_streambuf<char,std::char_traits<char>_> *)0x0;
  this->_M_ctype = (ctype<char> *)0x0;
  this->_M_num_put = (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  this->_M_num_get = (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
                    /* try { // try from 0899f818 to 0899f81f has its CatchHandler @ 0899f834 */
  init(this,__sb);
  return;
}



----------------------------------------

// Function: basic_ios @ 0899f848

/* DWARF original prototype: void basic_ios(basic_ios<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::basic_ios
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  ios_base::ios_base(&this->super_ios_base);
  (this->super_ios_base)._vptr_ios_base = (_func_int_varargs **)&PTR__basic_ios_089ef6d0;
  this->_M_tie = (basic_ostream<char,std::char_traits<char>_> *)0x0;
  this->_M_fill = '\0';
  this->_M_fill_init = false;
  this->_M_streambuf = (basic_streambuf<char,std::char_traits<char>_> *)0x0;
  this->_M_ctype = (ctype<char> *)0x0;
  this->_M_num_put = (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
  this->_M_num_get = (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0;
                    /* try { // try from 0899f890 to 0899f897 has its CatchHandler @ 0899f8ac */
  init(this,__sb);
  return;
}



----------------------------------------

// Function: good @ 0899f8c0

/* DWARF original prototype: bool good(basic_ios<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ios<char,std::char_traits<char>_>::good(basic_ios<char,std::char_traits<char>_> *this)

{
  return (this->super_ios_base)._M_streambuf_state == _S_goodbit;
}



----------------------------------------

// Function: bad @ 0899f8cc

/* DWARF original prototype: bool bad(basic_ios<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ios<char,std::char_traits<char>_>::bad(basic_ios<char,std::char_traits<char>_> *this)

{
  return (bool)((byte)(this->super_ios_base)._M_streambuf_state & 1);
}



----------------------------------------

// Function: eof @ 0899f8d8

/* DWARF original prototype: bool eof(basic_ios<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ios<char,std::char_traits<char>_>::eof(basic_ios<char,std::char_traits<char>_> *this)

{
  return SUB41(((this->super_ios_base)._M_streambuf_state << 0x1e) >> 0x1f,0);
}



----------------------------------------

// Function: fail @ 0899f8e4

/* DWARF original prototype: bool fail(basic_ios<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ios<char,std::char_traits<char>_>::fail(basic_ios<char,std::char_traits<char>_> *this)

{
  return ((this->super_ios_base)._M_streambuf_state & (_S_failbit|_S_badbit)) != _S_goodbit;
}



----------------------------------------

// Function: _M_setstate @ 0899f8f4

/* DWARF original prototype: void _M_setstate(basic_ios<char,std::char_traits<char>_> * this,
   _Ios_Iostate __state) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::_M_setstate
          (basic_ios<char,std::char_traits<char>_> *this,_Ios_Iostate __state)

{
  (this->super_ios_base)._M_streambuf_state = (this->super_ios_base)._M_streambuf_state | __state;
  if ((__state & (this->super_ios_base)._M_exception) == _S_goodbit) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_rethrow();
}



----------------------------------------

// Function: clear @ 0899f928

/* DWARF original prototype: void clear(basic_ios<char,std::char_traits<char>_> * this, _Ios_Iostate
   __state) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::clear
          (basic_ios<char,std::char_traits<char>_> *this,_Ios_Iostate __state)

{
  if (this->_M_streambuf == (basic_streambuf<char,std::char_traits<char>_> *)0x0) {
    (this->super_ios_base)._M_streambuf_state = __state | _S_badbit;
  }
  else {
    (this->super_ios_base)._M_streambuf_state = __state;
  }
  if (((this->super_ios_base)._M_exception & (this->super_ios_base)._M_streambuf_state) ==
      _S_goodbit) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_ios_failure("basic_ios::clear");
}



----------------------------------------

// Function: rdbuf @ 0899f970

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   rdbuf(basic_ios<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb) */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_ios<char,std::char_traits<char>_>::rdbuf
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  basic_streambuf<char,std::char_traits<char>_> *pbVar1;
  
                    /* Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __old@[???] */
  pbVar1 = this->_M_streambuf;
  this->_M_streambuf = __sb;
  clear(this,_S_goodbit);
  return pbVar1;
}



----------------------------------------

// Function: exceptions @ 0899f9a0

/* DWARF original prototype: void exceptions(basic_ios<char,std::char_traits<char>_> * this,
   _Ios_Iostate __except) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::exceptions
          (basic_ios<char,std::char_traits<char>_> *this,_Ios_Iostate __except)

{
  (this->super_ios_base)._M_exception = __except;
  clear(this,(this->super_ios_base)._M_streambuf_state);
  return;
}



----------------------------------------

// Function: setstate @ 0899f9ac

/* DWARF original prototype: void setstate(basic_ios<char,std::char_traits<char>_> * this,
   _Ios_Iostate __state) */

void __thiscall
std::basic_ios<char,std::char_traits<char>_>::setstate
          (basic_ios<char,std::char_traits<char>_> *this,_Ios_Iostate __state)

{
  clear(this,__state | (this->super_ios_base)._M_streambuf_state);
  return;
}



----------------------------------------

// Function: operator_void* @ 0899f9b8

/* DWARF original name: operator void*
   DWARF original prototype: void * operator_void*(basic_ios<char,std::char_traits<char>_> * this)
    */

void * __thiscall
std::basic_ios<char,std::char_traits<char>_>::operator_void_
          (basic_ios<char,std::char_traits<char>_> *this)

{
  if (((this->super_ios_base)._M_streambuf_state & (_S_failbit|_S_badbit)) != _S_goodbit) {
    this = (basic_ios<char,std::char_traits<char>_> *)0x0;
  }
  return this;
}



----------------------------------------

// Function: operator! @ 0899f9cc

/* DWARF original prototype: bool operator!(basic_ios<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ios<char,std::char_traits<char>_>::operator!
          (basic_ios<char,std::char_traits<char>_> *this)

{
  return ((this->super_ios_base)._M_streambuf_state & (_S_failbit|_S_badbit)) != _S_goodbit;
}



----------------------------------------

// Function: imbue @ 0899f9dc

/* DWARF original prototype: locale imbue(basic_ios<char,std::char_traits<char>_> * this, locale *
   __loc) */

locale * __thiscall
std::basic_ios<char,std::char_traits<char>_>::imbue
          (locale *__return_storage_ptr__,basic_ios<char,std::char_traits<char>_> *this,
          locale *__loc)

{
  basic_ios<char,std::char_traits<char>_> *__in_chrg;
  basic_streambuf<char,std::char_traits<char>_> *pbVar1;
  locale lStack_20;
  locale lStack_1c;
  
                    /* Unresolved local var: locale * __old@[DW_OP_reg19(s3)]
                       Unresolved local var: locale __old@[???] */
  locale::locale(__return_storage_ptr__,&(this->super_ios_base)._M_ios_locale);
  __in_chrg = this;
                    /* try { // try from 0899fa14 to 0899fa2f has its CatchHandler @ 0899fa90 */
  ios_base::imbue(&lStack_1c,&this->super_ios_base,__loc);
  locale::~locale(&lStack_1c,(int)__in_chrg);
  _M_cache_locale(this,__loc);
  pbVar1 = this->_M_streambuf;
  if (pbVar1 != (basic_streambuf<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: locale __tmp@[???] */
    locale::locale(&lStack_20,&pbVar1->_M_buf_locale);
                    /* try { // try from 0899fa54 to 0899fa5b has its CatchHandler @ 0899faa4 */
    (*pbVar1->_vptr_basic_streambuf[2])(pbVar1,__loc);
    locale::operator=(&pbVar1->_M_buf_locale,__loc);
    locale::~locale(&lStack_20,(int)__loc);
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: widen @ 0899fab8

/* DWARF original prototype: char widen(basic_ios<char,std::char_traits<char>_> * this, char __c) */

char __thiscall
std::basic_ios<char,std::char_traits<char>_>::widen
          (basic_ios<char,std::char_traits<char>_> *this,char __c)

{
  undefined1 *puVar1;
  int iVar2;
  int iVar3;
  _func_int_varargs **pp_Var4;
  ctype<char> *pcVar5;
  undefined1 local_110 [256];
  
  puVar1 = local_110;
  pcVar5 = this->_M_ctype;
  if (pcVar5 == (ctype<char> *)0x0) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  if (pcVar5->_M_widen_ok == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
    iVar2 = 0;
    do {
      *puVar1 = (char)iVar2;
      iVar3 = iVar2 + 1;
      puVar1 = local_110 + iVar2 + 1;
      iVar2 = iVar3;
    } while (iVar3 != 0x100);
    (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,local_110,&stack0xfffffff0,pcVar5->_M_widen);
    pcVar5->_M_widen_ok = '\x01';
    iVar2 = memcmp(local_110,pcVar5->_M_widen,0x100);
    if (iVar2 == 0) {
      pp_Var4 = (pcVar5->super_facet)._vptr_facet;
    }
    else {
      pcVar5->_M_widen_ok = '\x02';
      pp_Var4 = (pcVar5->super_facet)._vptr_facet;
    }
    iVar2 = (*pp_Var4[6])(pcVar5,(int)__c);
    return (char)iVar2;
  }
  return pcVar5->_M_widen[(byte)__c];
}



----------------------------------------

// Function: fill @ 0899fba8

/* DWARF original prototype: char fill(basic_ios<char,std::char_traits<char>_> * this, char __ch) */

char __thiscall
std::basic_ios<char,std::char_traits<char>_>::fill
          (basic_ios<char,std::char_traits<char>_> *this,char __ch)

{
  char cVar1;
  
                    /* Unresolved local var: char __old@[???] */
  if (this->_M_fill_init == false) {
    cVar1 = widen(this,' ');
    this->_M_fill_init = true;
    this->_M_fill = cVar1;
  }
  cVar1 = this->_M_fill;
  this->_M_fill = __ch;
  return cVar1;
}



----------------------------------------

// Function: fill @ 0899fbfc

/* DWARF original prototype: char fill(basic_ios<char,std::char_traits<char>_> * this) */

char __thiscall
std::basic_ios<char,std::char_traits<char>_>::fill(basic_ios<char,std::char_traits<char>_> *this)

{
  char cVar1;
  
  if (this->_M_fill_init == false) {
    cVar1 = widen(this,' ');
    this->_M_fill_init = true;
    this->_M_fill = cVar1;
  }
  return this->_M_fill;
}



----------------------------------------

// Function: copyfmt @ 0899fc40

/* DWARF original prototype: basic_ios<char,std::char_traits<char>_> *
   copyfmt(basic_ios<char,std::char_traits<char>_> * this, basic_ios<char,std::char_traits<char>_> *
   __rhs) */

basic_ios<char,std::char_traits<char>_> * __thiscall
std::basic_ios<char,std::char_traits<char>_>::copyfmt
          (basic_ios<char,std::char_traits<char>_> *this,
          basic_ios<char,std::char_traits<char>_> *__rhs)

{
  bool bVar1;
  char cVar2;
  char cVar3;
  _Ios_Fmtflags _Var4;
  _Words *p_Var5;
  long lVar6;
  streamsize sVar7;
  int iVar8;
  _Words *p_Var9;
  streamsize sVar10;
  basic_ostream<char,std::char_traits<char>_> *pbVar11;
  locale *__in_chrg;
  _Words *p_Var12;
  int iVar13;
  _Callback_list *p_Var14;
  locale *this_00;
  locale alStack_20 [2];
  
  __in_chrg = alStack_20;
  if (this != __rhs) {
                    /* Unresolved local var: _Words * __words@[???]
                       Unresolved local var: _Callback_list * __cb@[???] */
    iVar8 = (__rhs->super_ios_base)._M_word_size;
    p_Var5 = (this->super_ios_base)._M_local_word;
    if (8 < iVar8) {
      p_Var5 = operator_new___(iVar8 << 3);
      iVar8 = (__rhs->super_ios_base)._M_word_size;
      if (iVar8 != 0) {
        iVar13 = 0;
        p_Var9 = p_Var5;
        do {
          iVar13 = iVar13 + 1;
          p_Var9->_M_pword = (void *)0x0;
          p_Var9->_M_iword = 0;
          p_Var9 = p_Var9 + 1;
        } while (iVar13 != iVar8);
      }
    }
    p_Var14 = (__rhs->super_ios_base)._M_callbacks;
    if (p_Var14 != (_Callback_list *)0x0) {
      __gnu_cxx::__atomic_add(&p_Var14->_M_refcount,1);
    }
    ios_base::_M_call_callbacks(&this->super_ios_base,erase_event);
    p_Var9 = (this->super_ios_base)._M_word;
    if (p_Var9 != (this->super_ios_base)._M_local_word) {
      if (p_Var9 == (_Words *)0x0) {
        (this->super_ios_base)._M_word = (_Words *)0x0;
      }
      else {
        operator_delete___(p_Var9);
        (this->super_ios_base)._M_word = (_Words *)0x0;
      }
    }
    ios_base::_M_dispose_callbacks(&this->super_ios_base);
                    /* Unresolved local var: int __i@[???] */
    iVar8 = (__rhs->super_ios_base)._M_word_size;
    (this->super_ios_base)._M_callbacks = p_Var14;
    if (0 < iVar8) {
      p_Var12 = (__rhs->super_ios_base)._M_word;
      iVar13 = 0;
      p_Var9 = p_Var5;
      do {
        lVar6 = p_Var12->_M_iword;
        iVar13 = iVar13 + 1;
        p_Var9->_M_pword = p_Var12->_M_pword;
        p_Var9->_M_iword = lVar6;
        p_Var12 = p_Var12 + 1;
        p_Var9 = p_Var9 + 1;
      } while (iVar13 < iVar8);
    }
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
    _Var4 = (__rhs->super_ios_base)._M_flags;
                    /* Unresolved local var: streamsize __old@[???] */
    sVar7 = (__rhs->super_ios_base)._M_width;
                    /* Unresolved local var: streamsize __old@[???] */
    sVar10 = (__rhs->super_ios_base)._M_precision;
                    /* Unresolved local var: basic_ostream<char,std::char_traits<char>_> *
                       __old@[???] */
    pbVar11 = __rhs->_M_tie;
    bVar1 = __rhs->_M_fill_init;
    (this->super_ios_base)._M_word = p_Var5;
    (this->super_ios_base)._M_word_size = iVar8;
    (this->super_ios_base)._M_flags = _Var4;
    (this->super_ios_base)._M_width = sVar7;
    (this->super_ios_base)._M_precision = sVar10;
    this->_M_tie = pbVar11;
    if (bVar1 == false) {
      cVar3 = widen(__rhs,' ');
      __rhs->_M_fill = cVar3;
      __rhs->_M_fill_init = true;
    }
                    /* Unresolved local var: char __old@[???] */
    cVar3 = __rhs->_M_fill;
    if (this->_M_fill_init == false) {
      cVar2 = widen(this,' ');
      this->_M_fill = cVar2;
      this->_M_fill_init = true;
    }
    this->_M_fill = cVar3;
    this_00 = &(this->super_ios_base)._M_ios_locale;
    locale::locale(alStack_20,&(__rhs->super_ios_base)._M_ios_locale);
    locale::operator=(this_00,alStack_20);
    locale::~locale(alStack_20,(int)__in_chrg);
    _M_cache_locale(this,this_00);
    ios_base::_M_call_callbacks(&this->super_ios_base,copyfmt_event);
    (this->super_ios_base)._M_exception = (__rhs->super_ios_base)._M_exception;
    clear(this,(this->super_ios_base)._M_streambuf_state);
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 0899fe2c

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this,
   _func_basic_istream<char,std::char_traits<char>_>_ptr_basic_istream<char,std::char_traits<char>_>_ptr
   * __pf) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,
          _func_basic_istream<char,std::char_traits<char>_>_ptr_basic_istream<char,std::char_traits<char>_>_ptr
          *__pf)

{
  basic_istream<char,std::char_traits<char>_> *pbVar1;
  
                    /* WARNING: Could not recover jumptable at 0x0899fe30. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  pbVar1 = (*__pf)(this);
  return pbVar1;
}



----------------------------------------

// Function: operator>> @ 0899fe38

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this,
   _func_basic_ios<char,std::char_traits<char>_>_ptr_basic_ios<char,std::char_traits<char>_>_ptr *
   __pf) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,
          _func_basic_ios<char,std::char_traits<char>_>_ptr_basic_ios<char,std::char_traits<char>_>_ptr
          *__pf)

{
  (*__pf)((basic_ios<char,std::char_traits<char>_> *)
          ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]));
  return this;
}



----------------------------------------

// Function: operator>> @ 0899fe6c

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, _func_ios_base_ptr_ios_base_ptr *
   __pf) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,_func_ios_base_ptr_ios_base_ptr *__pf)

{
  (*__pf)((ios_base *)((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]));
  return this;
}



----------------------------------------

// Function: gcount @ 0899fea0

/* DWARF original prototype: streamsize gcount(basic_istream<char,std::char_traits<char>_> * this)
    */

streamsize __thiscall
std::basic_istream<char,std::char_traits<char>_>::gcount
          (basic_istream<char,std::char_traits<char>_> *this)

{
  return this->_M_gcount;
}



----------------------------------------

// Function: basic_istream @ 0899fea8

/* DWARF original prototype: void basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_istream = *(_func_int_varargs ***)__in_chrg;
  this->_M_gcount = 0;
  *(undefined4 *)((int)&this->_vptr_basic_istream + (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: operator_bool @ 0899fec8

/* DWARF original name: operator bool
   DWARF original prototype: bool operator_bool(sentry * this) */

bool __thiscall
std::basic_istream<char,std::char_traits<char>_>::sentry::operator_bool(sentry *this)

{
  return this->_M_ok;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 0899fed0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Setprecision __f)

{
                    /* Unresolved local var: streamsize __old@[???] */
  *(int *)((int)&__is->_M_gcount + (int)__is->_vptr_basic_istream[-3]) = __f._M_n;
  return __is;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 0899fee8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Setw __f)

{
                    /* Unresolved local var: streamsize __old@[???] */
  *(int *)(&__is->field_0x8 + (int)__is->_vptr_basic_istream[-3]) = __f._M_n;
  return __is;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 0899ff00

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Setfill<char> __f)

{
  char cVar1;
  basic_ios<char,std::char_traits<char>_> *this;
  
                    /* Unresolved local var: char __old@[???] */
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__is->_vptr_basic_istream + (int)__is->_vptr_basic_istream[-3]);
  if (this->_M_fill_init == false) {
    cVar1 = basic_ios<char,std::char_traits<char>_>::widen(this,' ');
    this->_M_fill_init = true;
    this->_M_fill = cVar1;
  }
  this->_M_fill = __f._M_c;
  return __is;
}



----------------------------------------

// Function: operator>><std::char_traits<char>_> @ 0899ff6c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,char *__s)

{
  ctype<char> *pcVar1;
  _func_int_varargs **pp_Var2;
  uint uVar3;
  int iVar4;
  byte *pbVar5;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar6;
  locale *__other;
  void *src0;
  char *pcVar7;
  size_t len0;
  int *piVar8;
  int iVar9;
  int iVar10;
  _Ios_Iostate _Var11;
  sentry asStack_38 [4];
  int iStack_34;
  int iStack_30;
  locale lStack_2c;
  
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(asStack_38,__in,false);
  iVar9 = 0;
  if (asStack_38[0]._M_ok == false) {
    _Var11 = _S_failbit;
  }
  else {
    iVar10 = *(int *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]);
    if (iVar10 < 1) {
      iVar10 = 0x7fffffff;
    }
    __other = (locale *)(&__in->field_0x6c + (int)__in->_vptr_basic_istream[-3]);
    locale::locale(&lStack_2c,__other);
    pcVar1 = use_facet<std::ctype<char>_>(&lStack_2c);
    locale::~locale(&lStack_2c,(int)__other);
    piVar8 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
    if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
      uVar3 = (uint)*(byte *)piVar8[2];
    }
    else {
      uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
    }
    if (0 < iVar10 + -1) {
      do {
        if (uVar3 == 0xffffffff) {
          _Var11 = _S_eofbit;
          goto LAB_089a3a94;
        }
        pcVar7 = pcVar1->_M_table;
        if ((pcVar7[uVar3 & 0xff] & 8U) != 0) goto LAB_089a3a90;
        src0 = (void *)piVar8[2];
        iStack_34 = (iVar10 - iVar9) + -1;
        iStack_30 = piVar8[3] - (int)src0;
        if (iStack_34 < iStack_30) {
          iVar4 = iStack_34;
          if (1 < iStack_34) goto LAB_089a39ec;
          *__s = (char)uVar3;
LAB_089a3b28:
          pbVar5 = (byte *)piVar8[2];
          iVar9 = iVar9 + 1;
          uVar3 = 0xffffffff;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar6 = (uint)*pbVar5;
            piVar8[2] = (int)(pbVar5 + 1);
          }
          else {
            uVar6 = (**(code **)(*piVar8 + 0x28))(piVar8);
          }
          if (uVar6 != 0xffffffff) {
            if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
              uVar3 = (uint)*(byte *)piVar8[2];
            }
            else {
              uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
            }
          }
          __s = __s + 1;
        }
        else {
          iVar4 = iStack_30;
          if (iStack_30 < 2) {
            *__s = (char)uVar3;
            goto LAB_089a3b28;
          }
LAB_089a39ec:
          len0 = ((int)src0 + 1) - (int)src0;
          if (((byte *)((int)src0 + 1) < (byte *)((int)src0 + iVar4)) &&
             ((pcVar7[*(byte *)((int)src0 + 1)] & 8U) == 0)) {
            for (pbVar5 = (byte *)((int)src0 + 2); pbVar5 < (byte *)((int)src0 + iVar4);
                pbVar5 = pbVar5 + 1) {
              len0 = (int)pbVar5 - (int)src0;
              if ((pcVar7[*pbVar5] & 8U) != 0) goto LAB_089a3a48;
            }
            len0 = (int)pbVar5 - (int)src0;
          }
LAB_089a3a48:
          memcpy(__s,src0,len0);
          iVar9 = iVar9 + len0;
          pbVar5 = (byte *)(piVar8[2] + len0);
          piVar8[2] = (int)pbVar5;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar3 = (uint)*pbVar5;
          }
          else {
            uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
          }
          __s = __s + len0;
        }
      } while (iVar9 < iVar10 + -1);
    }
    _Var11 = _S_eofbit;
    if (uVar3 != 0xffffffff) {
LAB_089a3a90:
      _Var11 = _S_goodbit;
    }
LAB_089a3a94:
    *__s = '\0';
    *(undefined4 *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]) = 0;
    if (iVar9 != 0) {
      if (_Var11 == _S_goodbit) {
        return __in;
      }
      pp_Var2 = __in->_vptr_basic_istream;
      goto LAB_089a3ac8;
    }
    _Var11 = _Var11 | _S_failbit;
  }
  pp_Var2 = __in->_vptr_basic_istream;
LAB_089a3ac8:
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__in->_vptr_basic_istream + (int)pp_Var2[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this,_Var11 | (this->super_ios_base)._M_streambuf_state);
  return __in;
}



----------------------------------------

// Function: operator>><std::char_traits<char>_> @ 0899ff74

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,uchar *__s)

{
  ctype<char> *pcVar1;
  _func_int_varargs **pp_Var2;
  uint uVar3;
  int iVar4;
  byte *pbVar5;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar6;
  locale *__other;
  void *src0;
  char *pcVar7;
  size_t len0;
  int *piVar8;
  int iVar9;
  int iVar10;
  _Ios_Iostate _Var11;
  sentry asStack_38 [4];
  int iStack_34;
  int iStack_30;
  locale lStack_2c;
  
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(asStack_38,__in,false);
  iVar9 = 0;
  if (asStack_38[0]._M_ok == false) {
    _Var11 = _S_failbit;
  }
  else {
    iVar10 = *(int *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]);
    if (iVar10 < 1) {
      iVar10 = 0x7fffffff;
    }
    __other = (locale *)(&__in->field_0x6c + (int)__in->_vptr_basic_istream[-3]);
    locale::locale(&lStack_2c,__other);
    pcVar1 = use_facet<std::ctype<char>_>(&lStack_2c);
    locale::~locale(&lStack_2c,(int)__other);
    piVar8 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
    if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
      uVar3 = (uint)*(byte *)piVar8[2];
    }
    else {
      uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
    }
    if (0 < iVar10 + -1) {
      do {
        if (uVar3 == 0xffffffff) {
          _Var11 = _S_eofbit;
          goto LAB_089a3a94;
        }
        pcVar7 = pcVar1->_M_table;
        if ((pcVar7[uVar3 & 0xff] & 8U) != 0) goto LAB_089a3a90;
        src0 = (void *)piVar8[2];
        iStack_34 = (iVar10 - iVar9) + -1;
        iStack_30 = piVar8[3] - (int)src0;
        if (iStack_34 < iStack_30) {
          iVar4 = iStack_34;
          if (1 < iStack_34) goto LAB_089a39ec;
          *__s = (uchar)uVar3;
LAB_089a3b28:
          pbVar5 = (byte *)piVar8[2];
          iVar9 = iVar9 + 1;
          uVar3 = 0xffffffff;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar6 = (uint)*pbVar5;
            piVar8[2] = (int)(pbVar5 + 1);
          }
          else {
            uVar6 = (**(code **)(*piVar8 + 0x28))(piVar8);
          }
          if (uVar6 != 0xffffffff) {
            if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
              uVar3 = (uint)*(byte *)piVar8[2];
            }
            else {
              uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
            }
          }
          __s = __s + 1;
        }
        else {
          iVar4 = iStack_30;
          if (iStack_30 < 2) {
            *__s = (uchar)uVar3;
            goto LAB_089a3b28;
          }
LAB_089a39ec:
          len0 = ((int)src0 + 1) - (int)src0;
          if (((byte *)((int)src0 + 1) < (byte *)((int)src0 + iVar4)) &&
             ((pcVar7[*(byte *)((int)src0 + 1)] & 8U) == 0)) {
            for (pbVar5 = (byte *)((int)src0 + 2); pbVar5 < (byte *)((int)src0 + iVar4);
                pbVar5 = pbVar5 + 1) {
              len0 = (int)pbVar5 - (int)src0;
              if ((pcVar7[*pbVar5] & 8U) != 0) goto LAB_089a3a48;
            }
            len0 = (int)pbVar5 - (int)src0;
          }
LAB_089a3a48:
          memcpy(__s,src0,len0);
          iVar9 = iVar9 + len0;
          pbVar5 = (byte *)(piVar8[2] + len0);
          piVar8[2] = (int)pbVar5;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar3 = (uint)*pbVar5;
          }
          else {
            uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
          }
          __s = __s + len0;
        }
      } while (iVar9 < iVar10 + -1);
    }
    _Var11 = _S_eofbit;
    if (uVar3 != 0xffffffff) {
LAB_089a3a90:
      _Var11 = _S_goodbit;
    }
LAB_089a3a94:
    *__s = '\0';
    *(undefined4 *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]) = 0;
    if (iVar9 != 0) {
      if (_Var11 == _S_goodbit) {
        return __in;
      }
      pp_Var2 = __in->_vptr_basic_istream;
      goto LAB_089a3ac8;
    }
    _Var11 = _Var11 | _S_failbit;
  }
  pp_Var2 = __in->_vptr_basic_istream;
LAB_089a3ac8:
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__in->_vptr_basic_istream + (int)pp_Var2[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this,_Var11 | (this->super_ios_base)._M_streambuf_state);
  return __in;
}



----------------------------------------

// Function: getline @ 0899ff7c

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   getline(basic_istream<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::getline
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  char __delim;
  basic_istream<char,std::char_traits<char>_> *pbVar1;
  
  __delim = basic_ios<char,std::char_traits<char>_>::widen
                      ((basic_ios<char,std::char_traits<char>_> *)
                       ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]),'\n');
  pbVar1 = getline(this,__s,__n,__delim);
  return pbVar1;
}



----------------------------------------

// Function: ~istream @ 0899ffd8

/* virtual thunk to std::istream::~istream() */

void __thiscall std::istream::~istream(istream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_istream<char,std::char_traits<char>_>::~basic_istream
            ((basic_istream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_istream @ 0899ffec

/* DWARF original prototype: void ~basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::~basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  this->_vptr_basic_istream = (_func_int_varargs **)0x89ef714;
  *(undefined ***)&this->field_0x8 = &PTR__basic_ios_089ef6d0;
  this->_M_gcount = 0;
  ios_base::~ios_base((ios_base *)&this->field_0x8,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: basic_istream @ 089a0034

/* DWARF original prototype: void basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_istream = *(_func_int_varargs ***)__in_chrg;
  this->_M_gcount = 0;
  *(undefined4 *)((int)&this->_vptr_basic_istream + (int)p_Var1) = uVar2;
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]),
             (basic_streambuf<char,std::char_traits<char>_> *)__vtt_parm);
  return;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 089a0068

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Resetiosflags __f)

{
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(_Ios_Fmtflags *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) =
       *(uint *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) & ~__f._M_mask;
  return __is;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 089a008c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Setiosflags __f)

{
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(_Ios_Fmtflags *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) =
       *(_Ios_Fmtflags *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) | __f._M_mask;
  return __is;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 089a00ac

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__is,_Setbase __f)

{
  uint uVar1;
  
  uVar1 = 0x40;
  if (((__f._M_base != 8) && (uVar1 = 2, __f._M_base != 10)) && (uVar1 = 8, __f._M_base != 0x10)) {
    uVar1 = 0;
  }
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(uint *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) =
       uVar1 | *(uint *)(&__is->field_0xc + (int)__is->_vptr_basic_istream[-3]) & 0xffffffb5;
  return __is;
}



----------------------------------------

// Function: basic_istream @ 089a00f8

/* DWARF original prototype: void basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  ios_base::ios_base((ios_base *)&this->field_0x8);
  *(undefined4 *)&this->field_0x8 = 0x89ef728;
  this->field_0x7c = 0;
  *(undefined4 *)&this->field_0x8c = 0;
  this->_vptr_basic_istream = (_func_int_varargs **)0x89ef714;
  this->_M_gcount = 0;
  *(undefined4 *)&this->field_0x78 = 0;
  this->field_0x7d = 0;
  *(undefined4 *)&this->field_0x80 = 0;
  *(undefined4 *)&this->field_0x84 = 0;
  *(undefined4 *)&this->field_0x88 = 0;
  return;
}



----------------------------------------

// Function: basic_istream @ 089a0164

/* DWARF original prototype: void basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  ios_base::ios_base((ios_base *)&this->field_0x8);
  *(undefined4 *)&this->field_0x8 = 0x89ef728;
  this->field_0x7c = 0;
  *(undefined4 *)&this->field_0x78 = 0;
  this->_vptr_basic_istream = (_func_int_varargs **)0x89ef714;
  this->_M_gcount = 0;
  this->field_0x7d = 0;
  *(undefined4 *)&this->field_0x80 = 0;
  *(undefined4 *)&this->field_0x84 = 0;
  *(undefined4 *)&this->field_0x88 = 0;
  *(undefined4 *)&this->field_0x8c = 0;
                    /* try { // try from 089a01c8 to 089a01cf has its CatchHandler @ 089a01e8 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)&this->field_0x8,
             (basic_streambuf<char,std::char_traits<char>_> *)__in_chrg);
  return;
}



----------------------------------------

// Function: ~istream @ 089a0208

/* virtual thunk to std::istream::~istream() */

void __thiscall std::istream::~istream(istream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_istream<char,std::char_traits<char>_>::~basic_istream
            ((basic_istream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_istream @ 089a021c

/* DWARF original prototype: void ~basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::~basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  this->_vptr_basic_istream = (_func_int_varargs **)0x89ef714;
  *(undefined ***)&this->field_0x8 = &PTR__basic_ios_089ef6d0;
  this->_M_gcount = 0;
  ios_base::~ios_base((ios_base *)&this->field_0x8,__in_chrg);
  return;
}



----------------------------------------

// Function: ~basic_istream @ 089a0240

/* DWARF original prototype: void ~basic_istream(basic_istream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::~basic_istream
          (basic_istream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_istream = *(_func_int_varargs ***)__in_chrg;
  this->_M_gcount = 0;
  *(undefined4 *)((int)&this->_vptr_basic_istream + (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: tellg @ 089a0260

/* DWARF original prototype: streampos tellg(basic_istream<char,std::char_traits<char>_> * this) */

streampos * __thiscall
std::basic_istream<char,std::char_traits<char>_>::tellg
          (streampos *__return_storage_ptr__,basic_istream<char,std::char_traits<char>_> *this)

{
  _func_int_varargs *p_Var1;
  
                    /* Unresolved local var: streampos __ret@[???] */
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  p_Var1 = this->_vptr_basic_istream[-3];
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  if ((*(uint *)(&this->field_0x14 + (int)p_Var1) & 5) != 0) {
    return __return_storage_ptr__;
  }
                    /* try { // try from 089a02e0 to 089a02e7 has its CatchHandler @ 089a0300 */
  (**(code **)(**(int **)(&this->field_0x78 + (int)p_Var1) + 0x10))
            (__return_storage_ptr__,*(int **)(&this->field_0x78 + (int)p_Var1),0,0);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: seekg @ 089a0354

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   seekg(basic_istream<char,std::char_traits<char>_> * this, streampos __pos) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::seekg
          (basic_istream<char,std::char_traits<char>_> *this,streampos __pos)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  undefined4 *in_a1;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  int local_28;
  int local_24;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
  local_4c = in_a1[3];
  local_58 = *in_a1;
  local_54 = in_a1[1];
  local_50 = in_a1[2];
                    /* Unresolved local var: streampos __p@[???] */
                    /* try { // try from 089a0404 to 089a040b has its CatchHandler @ 089a0448 */
  if ((((*(uint *)(&this->field_0x14 + (int)this->_vptr_basic_istream[-3]) & 5) == 0) &&
      (local_48 = local_58, local_44 = local_54, local_40 = local_50, local_3c = local_4c,
      local_38 = local_58, local_34 = local_54, local_30 = local_50, local_2c = local_4c,
      local_18 = local_58, local_14 = local_54, local_10 = local_50, local_c = local_4c,
      (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) + 0x14))
                (&local_28,*(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]),
                 &local_58,8), local_28 == -1)) && (local_24 == -1)) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  }
  return this;
}



----------------------------------------

// Function: seekg @ 089a049c

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   seekg(basic_istream<char,std::char_traits<char>_> * this, streamoff __off, _Ios_Seekdir __dir) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::seekg
          (basic_istream<char,std::char_traits<char>_> *this,streamoff __off,_Ios_Seekdir __dir)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int local_18;
  int local_14;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
                    /* Unresolved local var: streampos __p@[???] */
                    /* try { // try from 089a04e8 to 089a04ef has its CatchHandler @ 089a052c */
  if ((((*(uint *)(&this->field_0x14 + (int)this->_vptr_basic_istream[-3]) & 5) == 0) &&
      ((**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) + 0x10))
                 (&local_18,*(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]),
                  (int)__off,(int)((ulonglong)__off >> 0x20)), local_18 == -1)) && (local_14 == -1))
  {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  }
  return this;
}



----------------------------------------

// Function: sentry @ 089a0580

/* DWARF original prototype: void sentry(sentry * this, basic_istream<char,std::char_traits<char>_>
   * __in, bool __noskip) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::sentry::sentry
          (sentry *this,basic_istream<char,std::char_traits<char>_> *__in,bool __noskip)

{
  uint uVar1;
  _Ios_Iostate _Var2;
  byte *pbVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  _Ios_Iostate _Var4;
  _func_int_varargs **pp_Var5;
  int *piVar6;
  int iVar7;
  
                    /* Unresolved local var: void anon_var_0@[???] */
  pp_Var5 = __in->_vptr_basic_istream;
  this->_M_ok = false;
  if (*(int *)(&__in->field_0x14 + (int)pp_Var5[-3]) == 0) {
    if (*(basic_ostream<char,std::char_traits<char>_> **)(&__in->field_0x70 + (int)pp_Var5[-3]) !=
        (basic_ostream<char,std::char_traits<char>_> *)0x0) {
      basic_ostream<char,std::char_traits<char>_>::flush
                (*(basic_ostream<char,std::char_traits<char>_> **)
                  (&__in->field_0x70 + (int)pp_Var5[-3]));
      pp_Var5 = __in->_vptr_basic_istream;
    }
    if (!__noskip) {
      _Var4 = _S_goodbit;
      if ((*(uint *)(&__in->field_0xc + (int)pp_Var5[-3]) & 0x1000) == 0) goto LAB_089a05e0;
      piVar6 = *(int **)(&__in->field_0x78 + (int)pp_Var5[-3]);
                    /* Unresolved local var: int __ret@[???] */
      if ((byte *)piVar6[2] < (byte *)piVar6[3]) {
        uVar1 = (uint)*(byte *)piVar6[2];
      }
      else {
        uVar1 = (**(code **)(*piVar6 + 0x24))(piVar6);
        pp_Var5 = __in->_vptr_basic_istream;
      }
      iVar7 = *(int *)(&__in->field_0x7c + (int)pp_Var5[-3]);
      if (iVar7 == 0) {
                    /* WARNING: Subroutine does not return */
        __throw_bad_cast();
      }
      if (uVar1 == 0xffffffff) {
LAB_089a0714:
        _Var4 = _S_eofbit;
        goto LAB_089a05e0;
      }
      _Var4 = _S_goodbit;
      if ((*(byte *)(*(int *)(iVar7 + 0x18) + (uVar1 & 0xff)) & 8) == 0) goto LAB_089a05e0;
      pbVar3 = (byte *)piVar6[2];
      while( true ) {
        if (pbVar3 < (byte *)piVar6[3]) {
          uVar1 = (uint)*pbVar3;
          piVar6[2] = (int)(pbVar3 + 1);
        }
        else {
          uVar1 = (**(code **)(*piVar6 + 0x28))(piVar6);
        }
        if (uVar1 == 0xffffffff) {
          pp_Var5 = __in->_vptr_basic_istream;
          goto LAB_089a0714;
        }
                    /* Unresolved local var: int __ret@[???] */
        if ((byte *)piVar6[2] < (byte *)piVar6[3]) {
          uVar1 = (uint)*(byte *)piVar6[2];
        }
        else {
          uVar1 = (**(code **)(*piVar6 + 0x24))(piVar6);
        }
        if (uVar1 == 0xffffffff) {
          pp_Var5 = __in->_vptr_basic_istream;
          goto LAB_089a0714;
        }
        if ((*(byte *)(*(int *)(iVar7 + 0x18) + (uVar1 & 0xff)) & 8) == 0) break;
        pbVar3 = (byte *)piVar6[2];
      }
      pp_Var5 = __in->_vptr_basic_istream;
    }
  }
                    /* Unresolved local var: void anon_var_0@[???]
                       Unresolved local var: int __ret@[???] */
  _Var4 = _S_goodbit;
LAB_089a05e0:
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&__in->_vptr_basic_istream + (int)pp_Var5[-3]);
  _Var2 = (this_00->super_ios_base)._M_streambuf_state;
  if ((_Var2 == _S_goodbit) && (_Var4 == _S_goodbit)) {
    this->_M_ok = true;
    return;
  }
  basic_ios<char,std::char_traits<char>_>::clear(this_00,_Var2 | _Var4 | _S_failbit);
  return;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 089a0768

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,char *__c)

{
  byte *pbVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar3;
  sentry local_18 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(local_18,__in,false);
  if (local_18[0]._M_ok == false) {
    return __in;
  }
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __cb@[???] */
  piVar2 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
  pbVar1 = (byte *)piVar2[2];
  if (pbVar1 < (byte *)piVar2[3]) {
    uVar3 = (uint)*pbVar1;
    piVar2[2] = (int)(pbVar1 + 1);
  }
  else {
                    /* try { // try from 089a0838 to 089a083f has its CatchHandler @ 089a0848 */
    uVar3 = (**(code **)(*piVar2 + 0x28))();
  }
  if (uVar3 == 0xffffffff) {
    this = (basic_ios<char,std::char_traits<char>_> *)
           ((int)&__in->_vptr_basic_istream + (int)__in->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this,(this->super_ios_base)._M_streambuf_state | (_S_failbit|_S_eofbit));
    return __in;
  }
  *__c = (char)uVar3;
  return __in;
}



----------------------------------------

// Function: operator>><std::char_traits<char>_> @ 089a089c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,char *__c)

{
  byte *pbVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar3;
  sentry asStack_18 [8];
  
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(asStack_18,__in,false);
  if (asStack_18[0]._M_ok == false) {
    return __in;
  }
  piVar2 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
  pbVar1 = (byte *)piVar2[2];
  if (pbVar1 < (byte *)piVar2[3]) {
    uVar3 = (uint)*pbVar1;
    piVar2[2] = (int)(pbVar1 + 1);
  }
  else {
    uVar3 = (**(code **)(*piVar2 + 0x28))();
  }
  if (uVar3 == 0xffffffff) {
    this = (basic_ios<char,std::char_traits<char>_> *)
           ((int)&__in->_vptr_basic_istream + (int)__in->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this,(this->super_ios_base)._M_streambuf_state | (_S_failbit|_S_eofbit));
    return __in;
  }
  *__c = (char)uVar3;
  return __in;
}



----------------------------------------

// Function: operator>><std::char_traits<char>_> @ 089a08a4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,uchar *__c)

{
  byte *pbVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar3;
  sentry asStack_18 [8];
  
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(asStack_18,__in,false);
  if (asStack_18[0]._M_ok == false) {
    return __in;
  }
  piVar2 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
  pbVar1 = (byte *)piVar2[2];
  if (pbVar1 < (byte *)piVar2[3]) {
    uVar3 = (uint)*pbVar1;
    piVar2[2] = (int)(pbVar1 + 1);
  }
  else {
    uVar3 = (**(code **)(*piVar2 + 0x28))();
  }
  if (uVar3 == 0xffffffff) {
    this = (basic_ios<char,std::char_traits<char>_> *)
           ((int)&__in->_vptr_basic_istream + (int)__in->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this,(this->super_ios_base)._M_streambuf_state | (_S_failbit|_S_eofbit));
    return __in;
  }
  *__c = (uchar)uVar3;
  return __in;
}



----------------------------------------

// Function: sync @ 089a08ac

/* DWARF original prototype: int sync(basic_istream<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_istream<char,std::char_traits<char>_>::sync
          (basic_istream<char,std::char_traits<char>_> *this)

{
  int iVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_10 [8];
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_10,this,true);
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???] */
  if ((local_10[0]._M_ok != false) &&
     (*(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) != (int *)0x0)) {
                    /* try { // try from 089a08f8 to 089a08ff has its CatchHandler @ 089a0958 */
    iVar1 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) + 0x18))
                      ();
    if (iVar1 != -1) {
      return 0;
    }
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
    return -1;
  }
  return -1;
}



----------------------------------------

// Function: unget @ 089a09ac

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   unget(basic_istream<char,std::char_traits<char>_> * this) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::unget
          (basic_istream<char,std::char_traits<char>_> *this)

{
  uint uVar1;
  int *piVar2;
  _func_int_varargs *p_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_10 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_10,this,true);
  if (local_10[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???] */
    piVar2 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    if (piVar2 == (int *)0x0) {
      p_Var3 = this->_vptr_basic_istream[-3];
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      uVar1 = piVar2[2];
      if ((uint)piVar2[1] < uVar1) {
        piVar2[2] = uVar1 - 1;
        uVar1 = (uint)*(byte *)(uVar1 - 1);
      }
      else {
                    /* try { // try from 089a0a50 to 089a0a57 has its CatchHandler @ 089a0a60 */
        uVar1 = (**(code **)(*piVar2 + 0x2c))(piVar2,0xffffffff);
      }
      if (uVar1 != 0xffffffff) {
        return this;
      }
      p_Var3 = this->_vptr_basic_istream[-3];
    }
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)p_Var3);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: putback @ 089a0ab4

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   putback(basic_istream<char,std::char_traits<char>_> * this, char __c) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::putback
          (basic_istream<char,std::char_traits<char>_> *this,char __c)

{
  uint uVar1;
  int *piVar2;
  _func_int_varargs *p_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_18 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_18,this,true);
  if (local_18[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???] */
    piVar2 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    if (piVar2 == (int *)0x0) {
      p_Var3 = this->_vptr_basic_istream[-3];
    }
    else {
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: bool __testpos@[???] */
      uVar1 = piVar2[2];
      if (((uint)piVar2[1] < uVar1) && (*(char *)(uVar1 - 1) == __c)) {
        piVar2[2] = uVar1 - 1;
        uVar1 = (uint)*(byte *)(uVar1 - 1);
      }
      else {
                    /* try { // try from 089a0b20 to 089a0b27 has its CatchHandler @ 089a0b80 */
        uVar1 = (**(code **)(*piVar2 + 0x2c))(piVar2,__c);
      }
      if (uVar1 != 0xffffffff) {
        return this;
      }
      p_Var3 = this->_vptr_basic_istream[-3];
    }
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)p_Var3);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: readsome @ 089a0bd4

/* DWARF original prototype: streamsize readsome(basic_istream<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_istream<char,std::char_traits<char>_>::readsome
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  streamsize sVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_20 [4];
  int local_1c;
  int local_18 [2];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  local_18[0] = __n;
  sentry::sentry(local_20,this,true);
  if (local_20[0]._M_ok == false) {
    sVar1 = this->_M_gcount;
  }
  else {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: streamsize __num@[???] */
    piVar2 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: streamsize __ret@[???] */
    local_1c = piVar2[3] - piVar2[2];
    if (local_1c == 0) {
      local_1c = (**(code **)(*piVar2 + 0x1c))();
    }
    else {
    }
    if (local_1c < 1) {
      if (local_1c == -1) {
        this_00 = (basic_ios<char,std::char_traits<char>_> *)
                  ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
        basic_ios<char,std::char_traits<char>_>::clear
                  (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_eofbit);
        sVar1 = this->_M_gcount;
      }
      else {
        sVar1 = this->_M_gcount;
      }
    }
    else {
      if (local_18[0] < local_1c) {
        piVar2 = local_18;
      }
      else {
        piVar2 = &local_1c;
      }
                    /* try { // try from 089a0c6c to 089a0ca3 has its CatchHandler @ 089a0cdc */
      sVar1 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) + 0x20
                          ))(*(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]),__s,
                             *piVar2);
      this->_M_gcount = sVar1;
      sVar1 = this->_M_gcount;
    }
  }
  return sVar1;
}



----------------------------------------

// Function: read @ 089a0d30

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   read(basic_istream<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::read
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_18 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_18,this,true);
  if (local_18[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
                    /* try { // try from 089a0da4 to 089a0dab has its CatchHandler @ 089a0de8 */
    iVar1 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]) + 0x20))
                      (*(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]),__s,__n);
    this->_M_gcount = iVar1;
    if (__n != iVar1) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,(this_00->super_ios_base)._M_streambuf_state | (_S_failbit|_S_eofbit));
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: peek @ 089a0e3c

/* DWARF original prototype: int peek(basic_istream<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_istream<char,std::char_traits<char>_>::peek
          (basic_istream<char,std::char_traits<char>_> *this)

{
  uint uVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_18 [8];
  
                    /* Unresolved local var: int __c@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_18,this,true);
  if (local_18[0]._M_ok == false) {
    uVar1 = 0xffffffff;
  }
  else {
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
    piVar2 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar2[2] < (byte *)piVar2[3]) {
      uVar1 = (uint)*(byte *)piVar2[2];
    }
    else {
                    /* try { // try from 089a0ef0 to 089a0ef7 has its CatchHandler @ 089a0f00 */
      uVar1 = (**(code **)(*piVar2 + 0x24))();
    }
    if (uVar1 == 0xffffffff) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_eofbit);
      return -1;
    }
  }
  return uVar1;
}



----------------------------------------

// Function: ignore @ 089a0f54

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   ignore(basic_istream<char,std::char_traits<char>_> * this) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::ignore
          (basic_istream<char,std::char_traits<char>_> *this)

{
  byte *pbVar1;
  int *piVar2;
  basic_ios<char,std::char_traits<char>_> *this_00;
  uint uVar3;
  sentry local_10 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_10,this,true);
  if (local_10[0]._M_ok == false) {
    return this;
  }
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???] */
  piVar2 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
  pbVar1 = (byte *)piVar2[2];
  if (pbVar1 < (byte *)piVar2[3]) {
    uVar3 = (uint)*pbVar1;
    piVar2[2] = (int)(pbVar1 + 1);
  }
  else {
                    /* try { // try from 089a1018 to 089a101f has its CatchHandler @ 089a1028 */
    uVar3 = (**(code **)(*piVar2 + 0x28))();
  }
  if (uVar3 == 0xffffffff) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_eofbit);
    return this;
  }
  this->_M_gcount = 1;
  return this;
}



----------------------------------------

// Function: get @ 089a107c

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   get(basic_istream<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb, char __delim) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb,char __delim)

{
  _func_int_varargs **pp_Var1;
  uint uVar2;
  byte *pbVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  byte *pbVar4;
  uint uVar5;
  byte bVar6;
  int *piVar7;
  _Ios_Iostate _Var8;
  sentry local_28 [8];
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_28,this,true);
  _Var8 = _S_goodbit;
  if (local_28[0]._M_ok != false) {
                    /* Unresolved local var: int __idelim@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __this_sb@[???]
                       Unresolved local var: int __c@[???]
                       Unresolved local var: char __c2@[???] */
    piVar7 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar7[2] < (byte *)piVar7[3]) {
      uVar2 = (uint)*(byte *)piVar7[2];
    }
    else {
      uVar2 = (**(code **)(*piVar7 + 0x24))(piVar7);
    }
    if (uVar2 == 0xffffffff) {
      _Var8 = _S_eofbit;
    }
    else {
      bVar6 = (byte)uVar2;
      if (uVar2 == (byte)__delim) {
LAB_089a123c:
        _Var8 = _S_goodbit;
      }
      else {
                    /* Unresolved local var: int __ret@[???] */
        pbVar3 = (byte *)__sb->_M_out_cur;
        while( true ) {
          if (pbVar3 < __sb->_M_out_end) {
            *pbVar3 = bVar6;
            uVar5 = (uint)bVar6;
            __sb->_M_out_cur = __sb->_M_out_cur + 1;
          }
          else {
                    /* try { // try from 089a1258 to 089a129f has its CatchHandler @ 089a12a8 */
            uVar5 = (*__sb->_vptr_basic_streambuf[0xd])(__sb,(uint)bVar6);
          }
          if (uVar5 == 0xffffffff) break;
                    /* Unresolved local var: int __ret@[???] */
          pbVar4 = (byte *)piVar7[2];
          pbVar3 = (byte *)piVar7[3];
          this->_M_gcount = this->_M_gcount + 1;
          uVar2 = 0xffffffff;
          if (pbVar4 < pbVar3) {
            uVar5 = (uint)*pbVar4;
            piVar7[2] = (int)(pbVar4 + 1);
          }
          else {
            uVar5 = (**(code **)(*piVar7 + 0x28))(piVar7);
          }
          if (uVar5 != 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if ((byte *)piVar7[2] < (byte *)piVar7[3]) {
              uVar2 = (uint)*(byte *)piVar7[2];
            }
            else {
              uVar2 = (**(code **)(*piVar7 + 0x24))(piVar7);
            }
          }
          _Var8 = _S_goodbit;
          if (uVar2 == 0xffffffff) break;
          bVar6 = (byte)uVar2;
          if ((byte)__delim == uVar2) goto LAB_089a10cc;
          pbVar3 = (byte *)__sb->_M_out_cur;
        }
        if (uVar2 != 0xffffffff) goto LAB_089a123c;
        _Var8 = _S_eofbit;
      }
    }
  }
LAB_089a10cc:
  if (this->_M_gcount == 0) {
    _Var8 = _Var8 | _S_failbit;
    pp_Var1 = this->_vptr_basic_istream;
  }
  else {
    if (_Var8 == _S_goodbit) {
      return this;
    }
    pp_Var1 = this->_vptr_basic_istream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,_Var8 | (this_00->super_ios_base)._M_streambuf_state);
  return this;
}



----------------------------------------

// Function: get @ 089a12fc

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   get(basic_istream<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sb) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  char __delim;
  basic_istream<char,std::char_traits<char>_> *pbVar1;
  
  __delim = basic_ios<char,std::char_traits<char>_>::widen
                      ((basic_ios<char,std::char_traits<char>_> *)
                       ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]),'\n');
  pbVar1 = get(this,__sb,__delim);
  return pbVar1;
}



----------------------------------------

// Function: get @ 089a1348

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   get(basic_istream<char,std::char_traits<char>_> * this, char * __s, streamsize __n, char __delim)
    */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n,char __delim)

{
  _func_int_varargs **pp_Var1;
  int iVar2;
  uint uVar3;
  byte *pbVar4;
  uint uVar5;
  basic_ios<char,std::char_traits<char>_> *this_00;
  byte *pbVar6;
  int *piVar7;
  _Ios_Iostate _Var8;
  sentry local_30 [8];
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_30,this,true);
  _Var8 = _S_goodbit;
  if (local_30[0]._M_ok != false) {
                    /* Unresolved local var: int __idelim@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???]
                       Unresolved local var: int __c@[???] */
    piVar7 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar7[2] < (byte *)piVar7[3]) {
      uVar3 = (uint)*(byte *)piVar7[2];
    }
    else {
      uVar3 = (**(code **)(*piVar7 + 0x24))(piVar7);
    }
    if (this->_M_gcount + 1 < __n) {
      if (uVar3 == 0xffffffff) {
        _Var8 = _S_eofbit;
      }
      else {
        _Var8 = _S_goodbit;
        if (uVar3 != (byte)__delim) {
          do {
            *__s = (char)uVar3;
                    /* Unresolved local var: int __ret@[???] */
            pbVar6 = (byte *)piVar7[2];
            pbVar4 = (byte *)piVar7[3];
            this->_M_gcount = this->_M_gcount + 1;
            __s = __s + 1;
            uVar3 = 0xffffffff;
            if (pbVar6 < pbVar4) {
              uVar5 = (uint)*pbVar6;
              piVar7[2] = (int)(pbVar6 + 1);
            }
            else {
                    /* try { // try from 089a1530 to 089a155f has its CatchHandler @ 089a1568 */
              uVar5 = (**(code **)(*piVar7 + 0x28))(piVar7);
            }
            if (uVar5 == 0xffffffff) {
              iVar2 = this->_M_gcount;
            }
            else {
                    /* Unresolved local var: int __ret@[???] */
              if ((byte *)piVar7[2] < (byte *)piVar7[3]) {
                uVar3 = (uint)*(byte *)piVar7[2];
              }
              else {
                uVar3 = (**(code **)(*piVar7 + 0x24))(piVar7);
              }
              iVar2 = this->_M_gcount;
            }
            if ((__n <= iVar2 + 1) || (uVar3 == 0xffffffff)) goto LAB_089a1510;
          } while ((byte)__delim != uVar3);
          _Var8 = _S_goodbit;
        }
      }
    }
    else {
LAB_089a1510:
      if (uVar3 == 0xffffffff) {
        _Var8 = _S_eofbit;
      }
      else {
        _Var8 = _S_goodbit;
      }
    }
  }
  if (0 < __n) {
    *__s = '\0';
  }
  if (this->_M_gcount == 0) {
    _Var8 = _Var8 | _S_failbit;
    pp_Var1 = this->_vptr_basic_istream;
  }
  else {
    if (_Var8 == _S_goodbit) {
      return this;
    }
    pp_Var1 = this->_vptr_basic_istream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,_Var8 | (this_00->super_ios_base)._M_streambuf_state);
  return this;
}



----------------------------------------

// Function: get @ 089a15bc

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   get(basic_istream<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  char __delim;
  basic_istream<char,std::char_traits<char>_> *pbVar1;
  
  __delim = basic_ios<char,std::char_traits<char>_>::widen
                      ((basic_ios<char,std::char_traits<char>_> *)
                       ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]),'\n');
  pbVar1 = get(this,__s,__n,__delim);
  return pbVar1;
}



----------------------------------------

// Function: get @ 089a1618

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   get(basic_istream<char,std::char_traits<char>_> * this, char * __c) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this,char *__c)

{
  _func_int_varargs **pp_Var1;
  _Ios_Iostate _Var2;
  byte *pbVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar4;
  uint uVar5;
  sentry local_18 [8];
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_18,this,true);
  _Var2 = _S_goodbit;
  if (local_18[0]._M_ok != false) {
                    /* Unresolved local var: int __cb@[???] */
    piVar4 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    pbVar3 = (byte *)piVar4[2];
    if (pbVar3 < (byte *)piVar4[3]) {
      uVar5 = (uint)*pbVar3;
      piVar4[2] = (int)(pbVar3 + 1);
    }
    else {
                    /* try { // try from 089a1704 to 089a170b has its CatchHandler @ 089a1714 */
      uVar5 = (**(code **)(*piVar4 + 0x28))();
    }
    if (uVar5 == 0xffffffff) {
      _Var2 = _S_eofbit;
    }
    else {
      _Var2 = _S_goodbit;
      this->_M_gcount = 1;
      *__c = (char)uVar5;
    }
  }
  if (this->_M_gcount == 0) {
    _Var2 = _Var2 | _S_failbit;
    pp_Var1 = this->_vptr_basic_istream;
  }
  else {
    if (_Var2 == _S_goodbit) {
      return this;
    }
    pp_Var1 = this->_vptr_basic_istream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,_Var2 | (this_00->super_ios_base)._M_streambuf_state);
  return this;
}



----------------------------------------

// Function: get @ 089a1768

/* DWARF original prototype: int get(basic_istream<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_istream<char,std::char_traits<char>_>::get
          (basic_istream<char,std::char_traits<char>_> *this)

{
  _func_int_varargs **pp_Var1;
  _Ios_Iostate _Var2;
  byte *pbVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar4;
  uint uVar5;
  sentry local_18 [8];
  
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __c@[???]
                       Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_18,this,true);
  uVar5 = 0xffffffff;
  if (local_18[0]._M_ok == false) {
    _Var2 = _S_goodbit;
  }
  else {
    piVar4 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    pbVar3 = (byte *)piVar4[2];
    if (pbVar3 < (byte *)piVar4[3]) {
      uVar5 = (uint)*pbVar3;
      piVar4[2] = (int)(pbVar3 + 1);
    }
    else {
                    /* try { // try from 089a1850 to 089a1857 has its CatchHandler @ 089a1860 */
      uVar5 = (**(code **)(*piVar4 + 0x28))();
    }
    _Var2 = _S_eofbit;
    if (uVar5 != 0xffffffff) {
      this->_M_gcount = 1;
      return uVar5;
    }
  }
  if (this->_M_gcount == 0) {
    _Var2 = _Var2 | _S_failbit;
    pp_Var1 = this->_vptr_basic_istream;
  }
  else {
    if (_Var2 == _S_goodbit) {
      return uVar5;
    }
    pp_Var1 = this->_vptr_basic_istream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,_Var2 | (this_00->super_ios_base)._M_streambuf_state);
  return uVar5;
}



----------------------------------------

// Function: operator>> @ 089a18b4

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sbout) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sbout)

{
  _func_int_varargs **pp_Var1;
  streamsize sVar2;
  basic_ios<char,std::char_traits<char>_> *this_00;
  sentry local_18 [8];
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_18,this,false);
  if (local_18[0]._M_ok == false) {
    if (__sbout != (basic_streambuf<char,std::char_traits<char>_> *)0x0) {
      return this;
    }
  }
  else {
    if (__sbout == (basic_streambuf<char,std::char_traits<char>_> *)0x0) {
      pp_Var1 = this->_vptr_basic_istream;
      goto LAB_089a1914;
    }
                    /* try { // try from 089a1900 to 089a1907 has its CatchHandler @ 089a195c */
    sVar2 = __copy_streambufs<char,_std::char_traits<char>_>
                      (*(basic_streambuf<char,std::char_traits<char>_> **)
                        (&this->field_0x78 + (int)this->_vptr_basic_istream[-3]),__sbout);
    if (sVar2 != 0) {
      return this;
    }
  }
  pp_Var1 = this->_vptr_basic_istream;
LAB_089a1914:
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return this;
}



----------------------------------------

// Function: operator>> @ 089a19b0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, void * * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,void **__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a1a94 to 089a1a9b has its CatchHandler @ 089a1a9c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a1a2c to 089a1a33 has its CatchHandler @ 089a1a9c */
    local_30 = (**(code **)(*piVar1 + 0x30))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a1af0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, longdouble * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,longdouble *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a1bd4 to 089a1bdb has its CatchHandler @ 089a1bdc */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a1b6c to 089a1b73 has its CatchHandler @ 089a1bdc */
    local_30 = (**(code **)(*piVar1 + 0x2c))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a1c30

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, double * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,double *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a1d14 to 089a1d1b has its CatchHandler @ 089a1d1c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a1cac to 089a1cb3 has its CatchHandler @ 089a1d1c */
    local_30 = (**(code **)(*piVar1 + 0x28))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a1d70

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, float * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,float *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a1e54 to 089a1e5b has its CatchHandler @ 089a1e5c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a1dec to 089a1df3 has its CatchHandler @ 089a1e5c */
    local_30 = (**(code **)(*piVar1 + 0x24))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a1eb0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, ulonglong * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,ulonglong *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a1f94 to 089a1f9b has its CatchHandler @ 089a1f9c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a1f2c to 089a1f33 has its CatchHandler @ 089a1f9c */
    local_30 = (**(code **)(*piVar1 + 0x20))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a1ff0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, longlong * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,longlong *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a20d4 to 089a20db has its CatchHandler @ 089a20dc */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a206c to 089a2073 has its CatchHandler @ 089a20dc */
    local_30 = (**(code **)(*piVar1 + 0x1c))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a2130

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, ulong * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,ulong *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a2214 to 089a221b has its CatchHandler @ 089a221c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a21ac to 089a21b3 has its CatchHandler @ 089a221c */
    local_30 = (**(code **)(*piVar1 + 0x18))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a2270

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, long * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,long *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a2354 to 089a235b has its CatchHandler @ 089a235c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a22ec to 089a22f3 has its CatchHandler @ 089a235c */
    local_30 = (**(code **)(*piVar1 + 0xc))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a23b0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, uint * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,uint *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a2494 to 089a249b has its CatchHandler @ 089a249c */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a242c to 089a2433 has its CatchHandler @ 089a249c */
    local_30 = (**(code **)(*piVar1 + 0x14))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a24f0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, int * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,int *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_40 [4];
  _Ios_Iostate local_3c;
  int local_38;
  undefined8 local_34;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_40,this,false);
  if (local_40[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: long __l@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_3c = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a25dc to 089a25e3 has its CatchHandler @ 089a25e4 */
      __throw_bad_cast();
    }
    local_2c = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_20 = 0xffffffff;
    local_28 = 0xffffffff;
    local_24 = 0;
                    /* try { // try from 089a256c to 089a2573 has its CatchHandler @ 089a25e4 */
    local_34 = (**(code **)(*piVar1 + 0xc))(piVar1,&local_2c,&local_24);
    if ((local_3c & _S_failbit) == _S_goodbit) {
      *__n = local_38;
      if (local_3c == _S_goodbit) {
        return this;
      }
    }
    else {
      local_3c = local_3c | _S_failbit;
    }
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    local_18 = local_34;
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,local_3c | (this_00->super_ios_base)._M_streambuf_state);
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a2638

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, ushort * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,ushort *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a271c to 089a2723 has its CatchHandler @ 089a2724 */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a26b4 to 089a26bb has its CatchHandler @ 089a2724 */
    local_30 = (**(code **)(*piVar1 + 0x10))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a2778

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, short * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,short *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_40 [4];
  _Ios_Iostate local_3c;
  int local_38;
  undefined8 local_34;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_40,this,false);
  if (local_40[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: long __l@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_3c = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a2884 to 089a288b has its CatchHandler @ 089a288c */
      __throw_bad_cast();
    }
    local_2c = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_20 = 0xffffffff;
    local_28 = 0xffffffff;
    local_24 = 0;
                    /* try { // try from 089a27f4 to 089a27fb has its CatchHandler @ 089a288c */
    local_34 = (**(code **)(*piVar1 + 0xc))(piVar1,&local_2c,&local_24);
    if ((((local_3c & _S_failbit) == _S_goodbit) && (-0x8001 < local_38)) && (local_38 < 0x8000)) {
      *__n = (short)local_38;
      if (local_3c == _S_goodbit) {
        return this;
      }
    }
    else {
      local_3c = local_3c | _S_failbit;
    }
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
    local_18 = local_34;
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,local_3c | (this_00->super_ios_base)._M_streambuf_state);
  }
  return this;
}



----------------------------------------

// Function: operator>> @ 089a28e0

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   operator>>(basic_istream<char,std::char_traits<char>_> * this, bool * __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::operator>>
          (basic_istream<char,std::char_traits<char>_> *this,bool *__n)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int *piVar1;
  sentry local_38 [4];
  _Ios_Iostate local_34;
  undefined8 local_30;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined8 local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(local_38,this,false);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __ng@[???] */
    local_34 = _S_goodbit;
    piVar1 = *(int **)(&this->field_0x84 + (int)this->_vptr_basic_istream[-3]);
    if (piVar1 == (int *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089a29c4 to 089a29cb has its CatchHandler @ 089a29cc */
      __throw_bad_cast();
    }
    local_28 = *(undefined4 *)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
    local_1c = 0xffffffff;
    local_24 = 0xffffffff;
    local_20 = 0;
                    /* try { // try from 089a295c to 089a2963 has its CatchHandler @ 089a29cc */
    local_30 = (**(code **)(*piVar1 + 8))(piVar1,&local_28,&local_20);
    if (local_34 != _S_goodbit) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      local_18 = local_30;
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,local_34 | (this_00->super_ios_base)._M_streambuf_state);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: ws<char,_std::char_traits<char>_> @ 089a2a20

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: ws<char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::ws<char,_std::char_traits<char>_>(basic_istream<char,std::char_traits<char>_> *__in)

{
  byte bVar1;
  ctype<char> *pcVar2;
  _func_int_varargs **pp_Var3;
  uint uVar4;
  char *pcVar5;
  int iVar6;
  byte *pbVar7;
  basic_ios<char,std::char_traits<char>_> *this;
  locale *__other;
  int *piVar8;
  locale alStack_18 [2];
  
                    /* Unresolved local var: ctype<char> * __ct@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???]
                       Unresolved local var: int __c@[DW_OP_reg4(a0)] */
  __other = (locale *)(&__in->field_0x6c + (int)__in->_vptr_basic_istream[-3]);
  locale::locale(alStack_18,__other);
                    /* try { // try from 089a2a50 to 089a2a57 has its CatchHandler @ 089a2b5c */
  pcVar2 = use_facet<std::ctype<char>_>(alStack_18);
  locale::~locale(alStack_18,(int)__other);
  piVar8 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
  if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
                    /* Unresolved local var: int __ret@[???] */
    bVar1 = *(byte *)piVar8[2];
    goto LAB_089a2a8c;
  }
  iVar6 = *piVar8;
  do {
    uVar4 = (**(code **)(iVar6 + 0x24))(piVar8);
    if (uVar4 == 0xffffffff) {
      pp_Var3 = __in->_vptr_basic_istream;
LAB_089a2b14:
      this = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__in->_vptr_basic_istream + (int)pp_Var3[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (this,(this->super_ios_base)._M_streambuf_state | _S_eofbit);
      return __in;
    }
    pcVar5 = pcVar2->_M_table;
    while( true ) {
      if ((pcVar5[uVar4 & 0xff] & 8U) == 0) {
        return __in;
      }
                    /* Unresolved local var: int __ret@[???] */
      pbVar7 = (byte *)piVar8[2];
      if (pbVar7 < (byte *)piVar8[3]) {
        uVar4 = (uint)*pbVar7;
        piVar8[2] = (int)(pbVar7 + 1);
      }
      else {
        uVar4 = (**(code **)(*piVar8 + 0x28))(piVar8);
      }
      if (uVar4 == 0xffffffff) {
        pp_Var3 = __in->_vptr_basic_istream;
        goto LAB_089a2b14;
      }
      if ((byte *)piVar8[3] <= (byte *)piVar8[2]) break;
      bVar1 = *(byte *)piVar8[2];
LAB_089a2a8c:
      uVar4 = (uint)bVar1;
      if (uVar4 == 0xffffffff) {
        pp_Var3 = __in->_vptr_basic_istream;
        goto LAB_089a2b14;
      }
      pcVar5 = pcVar2->_M_table;
    }
    iVar6 = *piVar8;
  } while( true );
}



----------------------------------------

// Function: sentry @ 089a2b70

/* DWARF original prototype: void sentry(sentry * this, basic_istream<char,std::char_traits<char>_>
   * __in, bool __noskip) */

void __thiscall
std::basic_istream<char,std::char_traits<char>_>::sentry::sentry
          (sentry *this,basic_istream<char,std::char_traits<char>_> *__in,bool __noskip)

{
  uint uVar1;
  _Ios_Iostate _Var2;
  byte *pbVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  _Ios_Iostate _Var4;
  _func_int_varargs **pp_Var5;
  int *piVar6;
  int iVar7;
  
                    /* Unresolved local var: void anon_var_0@[???] */
  pp_Var5 = __in->_vptr_basic_istream;
  this->_M_ok = false;
  if (*(int *)(&__in->field_0x14 + (int)pp_Var5[-3]) == 0) {
    if (*(basic_ostream<char,std::char_traits<char>_> **)(&__in->field_0x70 + (int)pp_Var5[-3]) !=
        (basic_ostream<char,std::char_traits<char>_> *)0x0) {
      basic_ostream<char,std::char_traits<char>_>::flush
                (*(basic_ostream<char,std::char_traits<char>_> **)
                  (&__in->field_0x70 + (int)pp_Var5[-3]));
      pp_Var5 = __in->_vptr_basic_istream;
    }
    if (!__noskip) {
      _Var4 = _S_goodbit;
      if ((*(uint *)(&__in->field_0xc + (int)pp_Var5[-3]) & 0x1000) == 0) goto LAB_089a2bd0;
      piVar6 = *(int **)(&__in->field_0x78 + (int)pp_Var5[-3]);
                    /* Unresolved local var: int __ret@[???] */
      if ((byte *)piVar6[2] < (byte *)piVar6[3]) {
        uVar1 = (uint)*(byte *)piVar6[2];
      }
      else {
        uVar1 = (**(code **)(*piVar6 + 0x24))(piVar6);
        pp_Var5 = __in->_vptr_basic_istream;
      }
      iVar7 = *(int *)(&__in->field_0x7c + (int)pp_Var5[-3]);
      if (iVar7 == 0) {
                    /* WARNING: Subroutine does not return */
        __throw_bad_cast();
      }
      if (uVar1 == 0xffffffff) {
LAB_089a2d04:
        _Var4 = _S_eofbit;
        goto LAB_089a2bd0;
      }
      _Var4 = _S_goodbit;
      if ((*(byte *)(*(int *)(iVar7 + 0x18) + (uVar1 & 0xff)) & 8) == 0) goto LAB_089a2bd0;
      pbVar3 = (byte *)piVar6[2];
      while( true ) {
        if (pbVar3 < (byte *)piVar6[3]) {
          uVar1 = (uint)*pbVar3;
          piVar6[2] = (int)(pbVar3 + 1);
        }
        else {
          uVar1 = (**(code **)(*piVar6 + 0x28))(piVar6);
        }
        if (uVar1 == 0xffffffff) {
          pp_Var5 = __in->_vptr_basic_istream;
          goto LAB_089a2d04;
        }
                    /* Unresolved local var: int __ret@[???] */
        if ((byte *)piVar6[2] < (byte *)piVar6[3]) {
          uVar1 = (uint)*(byte *)piVar6[2];
        }
        else {
          uVar1 = (**(code **)(*piVar6 + 0x24))(piVar6);
        }
        if (uVar1 == 0xffffffff) {
          pp_Var5 = __in->_vptr_basic_istream;
          goto LAB_089a2d04;
        }
        if ((*(byte *)(*(int *)(iVar7 + 0x18) + (uVar1 & 0xff)) & 8) == 0) break;
        pbVar3 = (byte *)piVar6[2];
      }
      pp_Var5 = __in->_vptr_basic_istream;
    }
  }
                    /* Unresolved local var: void anon_var_0@[???]
                       Unresolved local var: int __ret@[???] */
  _Var4 = _S_goodbit;
LAB_089a2bd0:
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&__in->_vptr_basic_istream + (int)pp_Var5[-3]);
  _Var2 = (this_00->super_ios_base)._M_streambuf_state;
  if ((_Var2 == _S_goodbit) && (_Var4 == _S_goodbit)) {
    this->_M_ok = true;
    return;
  }
  basic_ios<char,std::char_traits<char>_>::clear(this_00,_Var2 | _Var4 | _S_failbit);
  return;
}



----------------------------------------

// Function: getline @ 089a2d58

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   getline(basic_istream<char,std::char_traits<char>_> * this, char * __s, streamsize __n, char
   __delim) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::getline
          (basic_istream<char,std::char_traits<char>_> *this,char *__s,streamsize __n,char __delim)

{
  _func_int_varargs **pp_Var1;
  void *pvVar2;
  byte *pbVar3;
  uint uVar4;
  byte *pbVar5;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int iVar6;
  uint uVar7;
  size_t length;
  int *piVar8;
  _Ios_Iostate _Var9;
  sentry local_38 [4];
  size_t local_34;
  size_t local_30;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  this->_M_gcount = 0;
  sentry::sentry(local_38,this,true);
  _Var9 = _S_goodbit;
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: int __idelim@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???]
                       Unresolved local var: int __c@[???]
                       Unresolved local var: int __ret@[???] */
    piVar8 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
      uVar7 = (uint)*(byte *)piVar8[2];
    }
    else {
      uVar7 = (**(code **)(*piVar8 + 0x24))(piVar8);
    }
    iVar6 = this->_M_gcount;
    while (iVar6 + 1 < __n) {
      if (uVar7 == 0xffffffff) {
        _Var9 = _S_eofbit;
        goto LAB_089a2db0;
      }
      if ((byte)__delim == uVar7) goto LAB_089a2f44;
                    /* Unresolved local var: streamsize __size@[???] */
      local_34 = (__n - iVar6) - 1;
      local_30 = piVar8[3] - piVar8[2];
      if ((int)local_34 < (int)local_30) {
        length = local_34;
        if ((int)local_34 < 2) {
          *__s = (char)uVar7;
          goto LAB_089a2f6c;
        }
LAB_089a2ed4:
        pvVar2 = memchr((void *)piVar8[2],(int)__delim,length);
        if (pvVar2 != (void *)0x0) {
          length = (int)pvVar2 - piVar8[2];
        }
        memcpy(__s,(void *)piVar8[2],length);
                    /* Unresolved local var: int __ret@[???] */
        pbVar3 = (byte *)piVar8[3];
        pbVar5 = (byte *)(piVar8[2] + length);
        iVar6 = this->_M_gcount + length;
        __s = __s + length;
        piVar8[2] = (int)pbVar5;
        this->_M_gcount = iVar6;
        if (pbVar5 < pbVar3) {
          uVar7 = (uint)*pbVar5;
                    /* Unresolved local var: int __ret@[???] */
        }
        else {
                    /* try { // try from 089a2ff8 to 089a306b has its CatchHandler @ 089a3074 */
          uVar7 = (**(code **)(*piVar8 + 0x24))(piVar8);
          iVar6 = this->_M_gcount;
        }
      }
      else {
        length = local_30;
        if (1 < (int)local_30) goto LAB_089a2ed4;
        *__s = (char)uVar7;
LAB_089a2f6c:
                    /* Unresolved local var: int __ret@[???] */
        pbVar5 = (byte *)piVar8[2];
        pbVar3 = (byte *)piVar8[3];
        this->_M_gcount = this->_M_gcount + 1;
        __s = __s + 1;
        uVar7 = 0xffffffff;
        if (pbVar5 < pbVar3) {
          uVar4 = (uint)*pbVar5;
          piVar8[2] = (int)(pbVar5 + 1);
        }
        else {
          uVar4 = (**(code **)(*piVar8 + 0x28))(piVar8);
        }
        if (uVar4 == 0xffffffff) {
          iVar6 = this->_M_gcount;
        }
        else if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
          uVar7 = (uint)*(byte *)piVar8[2];
          iVar6 = this->_M_gcount;
        }
        else {
          uVar7 = (**(code **)(*piVar8 + 0x24))(piVar8);
          iVar6 = this->_M_gcount;
        }
      }
    }
    _Var9 = _S_eofbit;
    if (uVar7 != 0xffffffff) {
LAB_089a2f44:
      _Var9 = _S_goodbit;
      if (uVar7 == (byte)__delim) {
                    /* Unresolved local var: int __ret@[???] */
        uVar4 = piVar8[2];
        uVar7 = piVar8[3];
        this->_M_gcount = iVar6 + 1;
        if (uVar4 < uVar7) {
          piVar8[2] = uVar4 + 1;
        }
        else {
          (**(code **)(*piVar8 + 0x28))(piVar8);
        }
      }
      else {
        _Var9 = _S_failbit;
      }
    }
  }
LAB_089a2db0:
  if (0 < __n) {
    *__s = '\0';
  }
  if (this->_M_gcount == 0) {
    _Var9 = _Var9 | _S_failbit;
    pp_Var1 = this->_vptr_basic_istream;
  }
  else {
    if (_Var9 == _S_goodbit) {
      return this;
    }
    pp_Var1 = this->_vptr_basic_istream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&this->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,_Var9 | (this_00->super_ios_base)._M_streambuf_state);
  return this;
}



----------------------------------------

// Function: getline<char,_std::char_traits<char>,_std::allocator<char>_> @ 089a30c8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: getline<char, std::char_traits<char>, std::allocator<char> > */

basic_istream<char,std::char_traits<char>_> *
std::getline<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,char __delim)

{
  _func_int_varargs **pp_Var1;
  void *pvVar2;
  int iVar3;
  basic_ios<char,std::char_traits<char>_> *this;
  char *pcVar4;
  uint uVar5;
  byte *pbVar6;
  size_t length;
  uint uVar7;
  int *piVar8;
  uint uVar9;
  sentry local_40 [4];
  size_t local_3c;
  size_t local_38;
  _Ios_Iostate local_30;
  
                    /* Unresolved local var: __size_type __extracted@[???]
                       Unresolved local var: __size_type __n@[???]
                       Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(local_40,__in,true);
  local_30 = 0;
  if (local_40[0]._M_ok == false) {
    local_30 = _S_goodbit;
  }
  else {
                    /* Unresolved local var: __int_type __idelim@[???]
                       Unresolved local var: __int_type __eof@[???]
                       Unresolved local var: __streambuf_type * __sb@[???]
                       Unresolved local var: __int_type __c@[???] */
                    /* try { // try from 089a318c to 089a340f has its CatchHandler @ 089a3418 */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
              (__str,0,*(size_t *)((__str->_M_dataplus)._M_p + -0xc),0);
    piVar8 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
      uVar5 = (uint)*(byte *)piVar8[2];
    }
    else {
      uVar5 = (**(code **)(*piVar8 + 0x24))(piVar8);
    }
    uVar9 = 0;
    do {
      while( true ) {
        local_30 = 0;
        if (uVar5 == 0xffffffff) goto LAB_089a3378;
        if ((byte)__delim == uVar5) goto LAB_089a334c;
        local_3c = 0x3ffffffc - uVar9;
        local_38 = piVar8[3] - piVar8[2];
        if ((int)local_3c < (int)local_38) break;
                    /* Unresolved local var: streamsize __size@[???] */
        length = local_38;
        if ((int)local_38 < 2) {
          pcVar4 = (__str->_M_dataplus)._M_p;
          goto LAB_089a3284;
        }
LAB_089a31e0:
        pvVar2 = memchr((void *)piVar8[2],(int)__delim,length);
        if (pvVar2 != (void *)0x0) {
          length = (int)pvVar2 - piVar8[2];
        }
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                  (__str,(char *)piVar8[2],length);
                    /* Unresolved local var: int __ret@[???] */
        uVar9 = uVar9 + length;
        pbVar6 = (byte *)(piVar8[2] + length);
        piVar8[2] = (int)pbVar6;
        if (pbVar6 < (byte *)piVar8[3]) {
          uVar5 = (uint)*pbVar6;
        }
        else {
          uVar5 = (**(code **)(*piVar8 + 0x24))(piVar8);
        }
        if (0x3ffffffb < uVar9) goto LAB_089a3340;
      }
      length = local_3c;
      if (1 < (int)local_3c) goto LAB_089a31e0;
                    /* Unresolved local var: size_t __len@[???] */
      pcVar4 = (__str->_M_dataplus)._M_p;
LAB_089a3284:
      uVar7 = *(int *)(pcVar4 + -0xc) + 1;
      if ((*(uint *)(pcVar4 + -8) < uVar7) || (0 < *(int *)(pcVar4 + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(__str,uVar7);
        pcVar4 = (__str->_M_dataplus)._M_p;
        iVar3 = *(int *)(pcVar4 + -0xc);
      }
      else {
        iVar3 = *(int *)(pcVar4 + -0xc);
      }
      uVar9 = uVar9 + 1;
      pcVar4[iVar3] = (char)uVar5;
      pcVar4 = (__str->_M_dataplus)._M_p;
      *(uint *)(pcVar4 + -0xc) = uVar7;
      pcVar4[-0xffffffff00000004] = '\0';
      pcVar4[-0xffffffff00000003] = '\0';
      pcVar4[-0xffffffff00000002] = '\0';
      pcVar4[-0xffffffff00000001] = '\0';
      pcVar4[uVar7] = '\0';
                    /* Unresolved local var: int __ret@[???] */
      pbVar6 = (byte *)piVar8[2];
      if (pbVar6 < (byte *)piVar8[3]) {
        uVar7 = (uint)*pbVar6;
        piVar8[2] = (int)(pbVar6 + 1);
      }
      else {
        uVar7 = (**(code **)(*piVar8 + 0x28))(piVar8);
      }
      uVar5 = 0xffffffff;
      if (uVar7 != 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
          uVar5 = (uint)*(byte *)piVar8[2];
        }
        else {
          uVar5 = (**(code **)(*piVar8 + 0x24))(piVar8);
        }
      }
    } while (uVar9 < 0x3ffffffc);
LAB_089a3340:
    if (uVar5 == 0xffffffff) {
LAB_089a3378:
      local_30 = _S_eofbit;
    }
    else {
LAB_089a334c:
      local_30 = _S_goodbit;
      if ((byte)__delim == uVar5) {
                    /* Unresolved local var: int __ret@[???] */
        uVar9 = uVar9 + 1;
        if ((uint)piVar8[2] < (uint)piVar8[3]) {
          piVar8[2] = piVar8[2] + 1;
        }
        else {
          (**(code **)(*piVar8 + 0x28))(piVar8);
        }
      }
      else {
        local_30 = _S_failbit;
      }
    }
    if (uVar9 != 0) {
      if (local_30 == _S_goodbit) {
        return __in;
      }
      pp_Var1 = __in->_vptr_basic_istream;
      goto LAB_089a3130;
    }
  }
  local_30 = local_30 | _S_failbit;
  pp_Var1 = __in->_vptr_basic_istream;
LAB_089a3130:
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__in->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this,local_30 | (this->super_ios_base)._M_streambuf_state);
  return __in;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>,_std::allocator<char>_> @ 089a346c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char>, std::allocator<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  _func_int_varargs **pp_Var1;
  uint uVar2;
  ctype<char> *pcVar3;
  int iVar4;
  uint uVar5;
  char cVar6;
  byte *pbVar7;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar8;
  locale *__other;
  char *__s;
  char *pcVar9;
  size_t __n;
  int *piVar10;
  uint uVar11;
  sentry local_40 [4];
  int local_3c;
  int local_38;
  locale lStack_34;
  _Ios_Iostate local_30;
  
                    /* Unresolved local var: __size_type __extracted@[???]
                       Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(local_40,__in,false);
  local_30 = _S_goodbit;
  if (local_40[0]._M_ok != false) {
                    /* Unresolved local var: streamsize __w@[???]
                       Unresolved local var: __size_type __n@[???]
                       Unresolved local var: __ctype_type * __ct@[???]
                       Unresolved local var: __int_type __eof@[???]
                       Unresolved local var: __streambuf_type * __sb@[???]
                       Unresolved local var: __int_type __c@[???] */
                    /* try { // try from 089a352c to 089a3533 has its CatchHandler @ 089a384c */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
              (__str,0,*(size_t *)((__str->_M_dataplus)._M_p + -0xc),0);
    uVar2 = *(uint *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]);
    if ((int)uVar2 < 1) {
      uVar2 = 0x3ffffffc;
    }
    __other = (locale *)(&__in->field_0x6c + (int)__in->_vptr_basic_istream[-3]);
    locale::locale(&lStack_34,__other);
                    /* try { // try from 089a3560 to 089a3567 has its CatchHandler @ 089a3894 */
    pcVar3 = use_facet<std::ctype<char>_>(&lStack_34);
    locale::~locale(&lStack_34,(int)__other);
    piVar10 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar10[2] < (byte *)piVar10[3]) {
      uVar5 = (uint)*(byte *)piVar10[2];
    }
    else {
      uVar5 = (**(code **)(*piVar10 + 0x24))(piVar10);
    }
    if (uVar2 == 0) {
      uVar11 = 0;
LAB_089a37c0:
      if (uVar5 == 0xffffffff) {
        local_30 = _S_eofbit;
      }
      else {
        local_30 = _S_goodbit;
      }
    }
    else if (uVar5 == 0xffffffff) {
      uVar11 = 0;
      local_30 = _S_eofbit;
    }
    else {
      pcVar9 = pcVar3->_M_table;
      cVar6 = (char)uVar5;
      uVar11 = 0;
      if ((pcVar9[uVar5 & 0xff] & 8U) == 0) {
                    /* Unresolved local var: streamsize __size@[???] */
        __s = (char *)piVar10[2];
        do {
          local_30 = 0;
          local_3c = uVar2 - uVar11;
          local_38 = piVar10[3] - (int)__s;
          if (local_3c < local_38) {
            iVar4 = local_3c;
            if (local_3c < 2) {
                    /* Unresolved local var: size_t __len@[???] */
              pcVar9 = (__str->_M_dataplus)._M_p;
              goto LAB_089a3704;
            }
LAB_089a3608:
            __n = (int)(__s + 1) - (int)__s;
            if ((__s + 1 < __s + iVar4) && ((pcVar9[(byte)__s[1]] & 8U) == 0)) {
              for (pbVar7 = (byte *)(__s + 2); pbVar7 < __s + iVar4; pbVar7 = pbVar7 + 1) {
                __n = (int)pbVar7 - (int)__s;
                if ((pcVar9[*pbVar7] & 8U) != 0) goto LAB_089a3664;
              }
              __n = (int)pbVar7 - (int)__s;
            }
LAB_089a3664:
                    /* try { // try from 089a3664 to 089a382f has its CatchHandler @ 089a384c */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append(__str,__s,__n);
                    /* Unresolved local var: int __ret@[???] */
            uVar11 = uVar11 + __n;
            pbVar7 = (byte *)(piVar10[2] + __n);
            piVar10[2] = (int)pbVar7;
            if (pbVar7 < (byte *)piVar10[3]) {
              uVar5 = (uint)*pbVar7;
            }
            else {
              uVar5 = (**(code **)(*piVar10 + 0x24))(piVar10);
            }
          }
          else {
            iVar4 = local_38;
            if (1 < local_38) goto LAB_089a3608;
            pcVar9 = (__str->_M_dataplus)._M_p;
LAB_089a3704:
            uVar5 = *(int *)(pcVar9 + -0xc) + 1;
            if ((*(uint *)(pcVar9 + -8) < uVar5) || (0 < *(int *)(pcVar9 + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(__str,uVar5);
              pcVar9 = (__str->_M_dataplus)._M_p;
              iVar4 = *(int *)(pcVar9 + -0xc);
            }
            else {
              iVar4 = *(int *)(pcVar9 + -0xc);
            }
            uVar11 = uVar11 + 1;
            pcVar9[iVar4] = cVar6;
            pcVar9 = (__str->_M_dataplus)._M_p;
            *(uint *)(pcVar9 + -0xc) = uVar5;
            pcVar9[-0xffffffff00000004] = '\0';
            pcVar9[-0xffffffff00000003] = '\0';
            pcVar9[-0xffffffff00000002] = '\0';
            pcVar9[-0xffffffff00000001] = '\0';
            pcVar9[uVar5] = '\0';
                    /* Unresolved local var: int __ret@[???] */
            pbVar7 = (byte *)piVar10[2];
            if (pbVar7 < (byte *)piVar10[3]) {
              uVar8 = (uint)*pbVar7;
              piVar10[2] = (int)(pbVar7 + 1);
            }
            else {
              uVar8 = (**(code **)(*piVar10 + 0x28))(piVar10);
            }
            uVar5 = 0xffffffff;
            if (uVar8 != 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if ((byte *)piVar10[2] < (byte *)piVar10[3]) {
                uVar5 = (uint)*(byte *)piVar10[2];
              }
              else {
                uVar5 = (**(code **)(*piVar10 + 0x24))(piVar10);
              }
            }
          }
          if ((uVar2 <= uVar11) || (cVar6 = (char)uVar5, uVar5 == 0xffffffff)) goto LAB_089a37c0;
          pcVar9 = pcVar3->_M_table;
          if ((pcVar9[uVar5 & 0xff] & 8U) != 0) break;
          __s = (char *)piVar10[2];
        } while( true );
      }
      local_30 = _S_goodbit;
    }
                    /* Unresolved local var: streamsize __old@[???] */
    *(undefined4 *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]) = 0;
    if (uVar11 != 0) {
      if (local_30 == _S_goodbit) {
        return __in;
      }
      pp_Var1 = __in->_vptr_basic_istream;
      goto LAB_089a34d0;
    }
  }
  local_30 = local_30 | _S_failbit;
  pp_Var1 = __in->_vptr_basic_istream;
LAB_089a34d0:
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__in->_vptr_basic_istream + (int)pp_Var1[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this,local_30 | (this->super_ios_base)._M_streambuf_state);
  return __in;
}



----------------------------------------

// Function: operator>><char,_std::char_traits<char>_> @ 089a38c0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator>><char, std::char_traits<char> > */

basic_istream<char,std::char_traits<char>_> *
std::operator>><char,_std::char_traits<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,char *__s)

{
  ctype<char> *pcVar1;
  _func_int_varargs **pp_Var2;
  uint uVar3;
  int iVar4;
  byte *pbVar5;
  basic_ios<char,std::char_traits<char>_> *this;
  uint uVar6;
  locale *__other;
  void *src0;
  char *pcVar7;
  size_t len0;
  int *piVar8;
  int iVar9;
  int iVar10;
  _Ios_Iostate _Var11;
  sentry local_38 [4];
  int local_34;
  int local_30;
  locale lStack_2c;
  
                    /* Unresolved local var: streamsize __extracted@[???]
                       Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  basic_istream<char,std::char_traits<char>_>::sentry::sentry(local_38,__in,false);
  iVar9 = 0;
  if (local_38[0]._M_ok == false) {
    _Var11 = _S_failbit;
  }
  else {
                    /* Unresolved local var: streamsize __num@[???]
                       Unresolved local var: __ctype_type * __ct@[???]
                       Unresolved local var: __int_type __eof@[???]
                       Unresolved local var: __streambuf_type * __sb@[???]
                       Unresolved local var: __int_type __c@[???] */
    iVar10 = *(int *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]);
    if (iVar10 < 1) {
      iVar10 = 0x7fffffff;
    }
    __other = (locale *)(&__in->field_0x6c + (int)__in->_vptr_basic_istream[-3]);
    locale::locale(&lStack_2c,__other);
                    /* try { // try from 089a393c to 089a3943 has its CatchHandler @ 089a3bec */
    pcVar1 = use_facet<std::ctype<char>_>(&lStack_2c);
    locale::~locale(&lStack_2c,(int)__other);
    piVar8 = *(int **)(&__in->field_0x78 + (int)__in->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
      uVar3 = (uint)*(byte *)piVar8[2];
    }
    else {
      uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
    }
    if (0 < iVar10 + -1) {
      do {
        if (uVar3 == 0xffffffff) {
          _Var11 = _S_eofbit;
          goto LAB_089a3a94;
        }
        pcVar7 = pcVar1->_M_table;
        if ((pcVar7[uVar3 & 0xff] & 8U) != 0) goto LAB_089a3a90;
                    /* Unresolved local var: streamsize __size@[???] */
        src0 = (void *)piVar8[2];
        local_34 = (iVar10 - iVar9) + -1;
        local_30 = piVar8[3] - (int)src0;
        if (local_34 < local_30) {
          iVar4 = local_34;
          if (1 < local_34) goto LAB_089a39ec;
          *__s = (char)uVar3;
LAB_089a3b28:
                    /* Unresolved local var: int __ret@[???] */
          pbVar5 = (byte *)piVar8[2];
          iVar9 = iVar9 + 1;
          uVar3 = 0xffffffff;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar6 = (uint)*pbVar5;
            piVar8[2] = (int)(pbVar5 + 1);
          }
          else {
            uVar6 = (**(code **)(*piVar8 + 0x28))(piVar8);
          }
          if (uVar6 != 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if ((byte *)piVar8[2] < (byte *)piVar8[3]) {
              uVar3 = (uint)*(byte *)piVar8[2];
            }
            else {
              uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
            }
          }
          __s = __s + 1;
        }
        else {
          iVar4 = local_30;
          if (local_30 < 2) {
            *__s = (char)uVar3;
            goto LAB_089a3b28;
          }
LAB_089a39ec:
          len0 = ((int)src0 + 1) - (int)src0;
          if (((byte *)((int)src0 + 1) < (byte *)((int)src0 + iVar4)) &&
             ((pcVar7[*(byte *)((int)src0 + 1)] & 8U) == 0)) {
            for (pbVar5 = (byte *)((int)src0 + 2); pbVar5 < (byte *)((int)src0 + iVar4);
                pbVar5 = pbVar5 + 1) {
              len0 = (int)pbVar5 - (int)src0;
              if ((pcVar7[*pbVar5] & 8U) != 0) goto LAB_089a3a48;
            }
            len0 = (int)pbVar5 - (int)src0;
          }
LAB_089a3a48:
          memcpy(__s,src0,len0);
                    /* Unresolved local var: int __ret@[???] */
          iVar9 = iVar9 + len0;
          pbVar5 = (byte *)(piVar8[2] + len0);
          piVar8[2] = (int)pbVar5;
          if (pbVar5 < (byte *)piVar8[3]) {
            uVar3 = (uint)*pbVar5;
          }
          else {
                    /* try { // try from 089a3b90 to 089a3bdb has its CatchHandler @ 089a3c34 */
            uVar3 = (**(code **)(*piVar8 + 0x24))(piVar8);
          }
          __s = __s + len0;
        }
      } while (iVar9 < iVar10 + -1);
    }
    _Var11 = _S_eofbit;
    if (uVar3 != 0xffffffff) {
LAB_089a3a90:
      _Var11 = _S_goodbit;
    }
LAB_089a3a94:
    *__s = '\0';
                    /* Unresolved local var: streamsize __old@[???] */
    *(undefined4 *)(&__in->field_0x8 + (int)__in->_vptr_basic_istream[-3]) = 0;
    if (iVar9 != 0) {
      if (_Var11 == _S_goodbit) {
        return __in;
      }
      pp_Var2 = __in->_vptr_basic_istream;
      goto LAB_089a3ac8;
    }
    _Var11 = _Var11 | _S_failbit;
  }
  pp_Var2 = __in->_vptr_basic_istream;
LAB_089a3ac8:
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__in->_vptr_basic_istream + (int)pp_Var2[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this,_Var11 | (this->super_ios_base)._M_streambuf_state);
  return __in;
}



----------------------------------------

// Function: ignore @ 089a3c54

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   ignore(basic_istream<char,std::char_traits<char>_> * this, streamsize __n, int __delim) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::ignore
          (basic_istream<char,std::char_traits<char>_> *this,streamsize __n,int __delim)

{
  bool bVar1;
  size_t *psVar2;
  void *pvVar3;
  uint uVar4;
  uint uVar5;
  byte *pbVar6;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int iVar7;
  byte *pbVar8;
  size_t length;
  int *piVar9;
  sentry local_30 [4];
  size_t local_2c;
  size_t local_28 [2];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  if (__delim == -1) {
    this = ignore(this,__n);
  }
  else {
    this->_M_gcount = 0;
    sentry::sentry(local_30,this,true);
    if ((local_30[0]._M_ok != false) && (0 < __n)) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: char __cdelim@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???]
                       Unresolved local var: int __c@[???]
                       Unresolved local var: bool __large_ignore@[???] */
      piVar9 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
      if ((byte *)piVar9[2] < (byte *)piVar9[3]) {
        uVar5 = (uint)*(byte *)piVar9[2];
      }
      else {
        uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
      }
      iVar7 = this->_M_gcount;
      bVar1 = false;
      while( true ) {
        while (((iVar7 < __n && (uVar5 != 0xffffffff)) && (uVar5 != __delim))) {
                    /* Unresolved local var: streamsize __size@[???] */
          pbVar8 = (byte *)piVar9[3];
          pbVar6 = (byte *)piVar9[2];
          local_2c = __n - iVar7;
          local_28[0] = (int)pbVar8 - (int)pbVar6;
          if (__n - iVar7 < (int)local_28[0]) {
            psVar2 = &local_2c;
          }
          else {
            psVar2 = local_28;
          }
          length = *psVar2;
          if ((int)length < 2) {
                    /* Unresolved local var: int __ret@[???] */
            uVar5 = 0xffffffff;
            this->_M_gcount = this->_M_gcount + 1;
            if (pbVar6 < pbVar8) {
              uVar4 = (uint)*pbVar6;
              piVar9[2] = (int)(pbVar6 + 1);
            }
            else {
              uVar4 = (**(code **)(*piVar9 + 0x28))(piVar9);
            }
            if (uVar4 == 0xffffffff) {
              iVar7 = this->_M_gcount;
            }
            else {
                    /* Unresolved local var: int __ret@[???] */
              if ((byte *)piVar9[2] < (byte *)piVar9[3]) {
                uVar5 = (uint)*(byte *)piVar9[2];
                iVar7 = this->_M_gcount;
              }
              else {
                uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
                iVar7 = this->_M_gcount;
              }
            }
          }
          else {
                    /* Unresolved local var: char * __p@[???] */
            pvVar3 = memchr(pbVar6,(int)(char)__delim,length);
            if (pvVar3 != (void *)0x0) {
              length = (int)pvVar3 - piVar9[2];
            }
                    /* Unresolved local var: int __ret@[???] */
            pbVar6 = (byte *)piVar9[3];
            pbVar8 = (byte *)(piVar9[2] + length);
            iVar7 = this->_M_gcount + length;
            piVar9[2] = (int)pbVar8;
            this->_M_gcount = iVar7;
            if (pbVar8 < pbVar6) {
              uVar5 = (uint)*pbVar8;
            }
            else {
                    /* try { // try from 089a3eb8 to 089a3f27 has its CatchHandler @ 089a3f30 */
              uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
              iVar7 = this->_M_gcount;
            }
          }
        }
        if (((__n != 0x7fffffff) || (uVar5 == 0xffffffff)) ||
           (iVar7 = -0x80000000, uVar5 == __delim)) break;
        bVar1 = true;
        this->_M_gcount = -0x80000000;
      }
      if (bVar1) {
        this->_M_gcount = 0x7fffffff;
      }
      if (uVar5 == 0xffffffff) {
        this_00 = (basic_ios<char,std::char_traits<char>_> *)
                  ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
        basic_ios<char,std::char_traits<char>_>::clear
                  (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_eofbit);
      }
      else if (uVar5 == __delim) {
        if (this->_M_gcount != 0x7fffffff) {
          this->_M_gcount = this->_M_gcount + 1;
        }
                    /* Unresolved local var: int __ret@[???] */
        if ((uint)piVar9[2] < (uint)piVar9[3]) {
          piVar9[2] = piVar9[2] + 1;
        }
        else {
          (**(code **)(*piVar9 + 0x28))(piVar9);
        }
      }
    }
  }
  return this;
}



----------------------------------------

// Function: __static_initialization_and_destruction_0 @ 089a3f84

void __static_initialization_and_destruction_0(int __initialize_p,int __priority)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  bool bVar5;
  bool bVar6;
  bool bVar7;
  bool bVar8;
  bool bVar9;
  bool bVar10;
  bool bVar11;
  bool bVar12;
  
  if ((__initialize_p == 1) && (__priority == 0xffff)) {
    bVar1 = std::moneypunct<char,false>::id + 1 < std::moneypunct<char,false>::id;
    bVar2 = std::money_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::money_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar3 = std::moneypunct<char,true>::id + 1 < std::moneypunct<char,true>::id;
    bVar4 = std::numpunct<char>::id + 1 < std::numpunct<char>::id;
    bVar5 = std::money_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::money_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar6 = std::num_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::num_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar7 = std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar8 = std::time_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::time_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar9 = std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1 <
            std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id;
    bVar10 = std::__timepunct<char>::id + 1 < std::__timepunct<char>::id;
    bVar11 = std::messages<char>::id + 1 < std::messages<char>::id;
    bVar12 = std::collate<char>::id + 1 < std::collate<char>::id;
    std::moneypunct<char,false>::id = std::moneypunct<char,false>::id + 1;
    DAT_08a1e4ac = (uint)bVar1 + DAT_08a1e4ac;
    std::moneypunct<char,true>::id = std::moneypunct<char,true>::id + 1;
    DAT_08a1e4b4 = (uint)bVar3 + DAT_08a1e4b4;
    std::money_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id =
         std::money_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4bc = (uint)bVar2 + DAT_08a1e4bc;
    std::money_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id =
         std::money_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4c4 = (uint)bVar5 + DAT_08a1e4c4;
    std::numpunct<char>::id = std::numpunct<char>::id + 1;
    DAT_08a1e4cc = (uint)bVar4 + DAT_08a1e4cc;
    std::num_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id =
         std::num_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4d4 = (uint)bVar6 + DAT_08a1e4d4;
    std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id =
         std::num_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4dc = (uint)bVar7 + DAT_08a1e4dc;
    std::__timepunct<char>::id = std::__timepunct<char>::id + 1;
    DAT_08a1e4e4 = (uint)bVar10 + DAT_08a1e4e4;
    std::time_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id =
         std::time_put<char,std::ostreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4ec = (uint)bVar8 + DAT_08a1e4ec;
    std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id =
         std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char>>>::id + 1;
    DAT_08a1e4f4 = (uint)bVar9 + DAT_08a1e4f4;
    std::messages<char>::id = std::messages<char>::id + 1;
    DAT_08a1e4fc = (uint)bVar11 + DAT_08a1e4fc;
    std::collate<char>::id = std::collate<char>::id + 1;
    DAT_08a1e504 = (uint)bVar12 + DAT_08a1e504;
    return;
  }
  return;
}



----------------------------------------

// Function: _GLOBAL__I_.._.._.._.._libstdc___v3_src_locale_inst.cc_6FCA3617_5181B7A5 @ 089a4310

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__I_____________libstdc___v3_src_locale_inst_cc_6FCA3617_5181B7A5(void)

{
  __static_initialization_and_destruction_0(1,0xffff);
  return;
}



----------------------------------------

// Function: __verify_grouping @ 089a431c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

bool std::__verify_grouping(char *__grouping,size_t __grouping_size,string *__grouping_tmp)

{
  char cVar1;
  bool bVar2;
  uint *puVar3;
  char *pcVar4;
  char cVar5;
  char *pcVar6;
  char *pcVar7;
  uint uVar8;
  uint uVar9;
  uint local_8;
  uint local_4;
  
                    /* Unresolved local var: size_t __n@[???]
                       Unresolved local var: size_t __min@[???]
                       Unresolved local var: size_t __i@[DW_OP_reg7(a3)]
                       Unresolved local var: bool __test@[???] */
  pcVar7 = (__grouping_tmp->_M_dataplus)._M_p;
  puVar3 = &local_8;
  local_8 = __grouping_size - 1;
  local_4 = *(int *)(pcVar7 + -0xc) - 1;
  if (local_4 <= __grouping_size - 1) {
    puVar3 = &local_4;
  }
  uVar9 = *puVar3;
                    /* Unresolved local var: size_t __j@[???] */
  if (uVar9 == 0) {
    bVar2 = true;
  }
  else {
    pcVar6 = pcVar7 + *(int *)(pcVar7 + -0xc);
    uVar8 = 0;
    do {
      pcVar4 = __grouping + uVar8;
      uVar8 = uVar8 + 1;
      local_4 = local_4 - 1;
      bVar2 = pcVar6[-1] == *pcVar4;
      if (uVar9 == uVar8) break;
      pcVar6 = pcVar6 + -1;
    } while (bVar2);
  }
  if (local_4 == 0) {
    cVar5 = __grouping[uVar9];
  }
  else {
    cVar5 = __grouping[uVar9];
    if (bVar2) {
      pcVar6 = pcVar7 + local_4;
      do {
        cVar1 = *pcVar6;
        local_4 = local_4 - 1;
        pcVar6 = pcVar6 + -1;
        bVar2 = cVar1 == cVar5;
        if (local_4 == 0) break;
      } while (bVar2);
    }
  }
  if ('\0' < cVar5) {
    bVar2 = (bool)(bVar2 & *pcVar7 <= cVar5);
  }
  return bVar2;
}



----------------------------------------

// Function: do_widen @ 089a43f4

/* DWARF original prototype: char do_widen(ctype<char> * this, char __c) */

char __thiscall std::ctype<char>::do_widen(ctype<char> *this,char __c)

{
  return __c;
}



----------------------------------------

// Function: do_narrow @ 089a43fc

/* DWARF original prototype: char do_narrow(ctype<char> * this, char __c, char param_2) */

char __thiscall std::ctype<char>::do_narrow(ctype<char> *this,char __c,char param_2)

{
  return __c;
}



----------------------------------------

// Function: decimal_point @ 089a4404

/* DWARF original prototype: char decimal_point(moneypunct<char,false> * this) */

char __thiscall std::moneypunct<char,false>::decimal_point(moneypunct<char,false> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return (char)iVar1;
}



----------------------------------------

// Function: thousands_sep @ 089a4428

/* DWARF original prototype: char thousands_sep(moneypunct<char,false> * this) */

char __thiscall std::moneypunct<char,false>::thousands_sep(moneypunct<char,false> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[3])();
  return (char)iVar1;
}



----------------------------------------

// Function: grouping @ 089a444c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   grouping(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  (*(this->super_facet)._vptr_facet[4])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: curr_symbol @ 089a447c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   curr_symbol(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::curr_symbol
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  (*(this->super_facet)._vptr_facet[5])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: positive_sign @ 089a44ac

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   positive_sign(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::positive_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  (*(this->super_facet)._vptr_facet[6])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: negative_sign @ 089a44dc

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   negative_sign(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::negative_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  (*(this->super_facet)._vptr_facet[7])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: frac_digits @ 089a450c

/* DWARF original prototype: int frac_digits(moneypunct<char,false> * this) */

int __thiscall std::moneypunct<char,false>::frac_digits(moneypunct<char,false> *this)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a4514. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[8])();
  return iVar1;
}



----------------------------------------

// Function: pos_format @ 089a451c

/* DWARF original prototype: pattern pos_format(moneypunct<char,false> * this) */

pattern * __thiscall
std::moneypunct<char,false>::pos_format
          (pattern *__return_storage_ptr__,moneypunct<char,false> *this)

{
  pattern *ppVar1;
  
  ppVar1 = (pattern *)(**(code **)(*(int *)__return_storage_ptr__->field + 0x24))();
  return ppVar1;
}



----------------------------------------

// Function: neg_format @ 089a45c0

/* DWARF original prototype: pattern neg_format(moneypunct<char,false> * this) */

pattern * __thiscall
std::moneypunct<char,false>::neg_format
          (pattern *__return_storage_ptr__,moneypunct<char,false> *this)

{
  pattern *ppVar1;
  
  ppVar1 = (pattern *)(**(code **)(*(int *)__return_storage_ptr__->field + 0x28))();
  return ppVar1;
}



----------------------------------------

// Function: do_decimal_point @ 089a4664

/* DWARF original prototype: char do_decimal_point(moneypunct<char,false> * this) */

char __thiscall std::moneypunct<char,false>::do_decimal_point(moneypunct<char,false> *this)

{
  return this->_M_data->_M_decimal_point;
}



----------------------------------------

// Function: do_thousands_sep @ 089a4670

/* DWARF original prototype: char do_thousands_sep(moneypunct<char,false> * this) */

char __thiscall std::moneypunct<char,false>::do_thousands_sep(moneypunct<char,false> *this)

{
  return this->_M_data->_M_thousands_sep;
}



----------------------------------------

// Function: do_frac_digits @ 089a467c

/* DWARF original prototype: int do_frac_digits(moneypunct<char,false> * this) */

int __thiscall std::moneypunct<char,false>::do_frac_digits(moneypunct<char,false> *this)

{
  return this->_M_data->_M_frac_digits;
}



----------------------------------------

// Function: do_pos_format @ 089a4688

/* DWARF original prototype: pattern do_pos_format(moneypunct<char,false> * this) */

pattern * __thiscall
std::moneypunct<char,false>::do_pos_format
          (pattern *__return_storage_ptr__,moneypunct<char,false> *this)

{
  return *(pattern **)(*(int *)__return_storage_ptr__[2].field + 0x30);
}



----------------------------------------

// Function: do_neg_format @ 089a46c4

/* DWARF original prototype: pattern do_neg_format(moneypunct<char,false> * this) */

pattern * __thiscall
std::moneypunct<char,false>::do_neg_format
          (pattern *__return_storage_ptr__,moneypunct<char,false> *this)

{
  return *(pattern **)(*(int *)__return_storage_ptr__[2].field + 0x34);
}



----------------------------------------

// Function: decimal_point @ 089a4700

/* DWARF original prototype: char decimal_point(moneypunct<char,true> * this) */

char __thiscall std::moneypunct<char,true>::decimal_point(moneypunct<char,true> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return (char)iVar1;
}



----------------------------------------

// Function: thousands_sep @ 089a4724

/* DWARF original prototype: char thousands_sep(moneypunct<char,true> * this) */

char __thiscall std::moneypunct<char,true>::thousands_sep(moneypunct<char,true> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[3])();
  return (char)iVar1;
}



----------------------------------------

// Function: grouping @ 089a4748

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   grouping(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  (*(this->super_facet)._vptr_facet[4])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: curr_symbol @ 089a4778

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   curr_symbol(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::curr_symbol
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  (*(this->super_facet)._vptr_facet[5])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: positive_sign @ 089a47a8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   positive_sign(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::positive_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  (*(this->super_facet)._vptr_facet[6])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: negative_sign @ 089a47d8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   negative_sign(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::negative_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  (*(this->super_facet)._vptr_facet[7])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: frac_digits @ 089a4808

/* DWARF original prototype: int frac_digits(moneypunct<char,true> * this) */

int __thiscall std::moneypunct<char,true>::frac_digits(moneypunct<char,true> *this)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a4810. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[8])();
  return iVar1;
}



----------------------------------------

// Function: pos_format @ 089a4818

/* DWARF original prototype: pattern pos_format(moneypunct<char,true> * this) */

pattern * __thiscall
std::moneypunct<char,true>::pos_format(pattern *__return_storage_ptr__,moneypunct<char,true> *this)

{
  pattern *ppVar1;
  
  ppVar1 = (pattern *)(**(code **)(*(int *)__return_storage_ptr__->field + 0x24))();
  return ppVar1;
}



----------------------------------------

// Function: neg_format @ 089a48bc

/* DWARF original prototype: pattern neg_format(moneypunct<char,true> * this) */

pattern * __thiscall
std::moneypunct<char,true>::neg_format(pattern *__return_storage_ptr__,moneypunct<char,true> *this)

{
  pattern *ppVar1;
  
  ppVar1 = (pattern *)(**(code **)(*(int *)__return_storage_ptr__->field + 0x28))();
  return ppVar1;
}



----------------------------------------

// Function: do_decimal_point @ 089a4960

/* DWARF original prototype: char do_decimal_point(moneypunct<char,true> * this) */

char __thiscall std::moneypunct<char,true>::do_decimal_point(moneypunct<char,true> *this)

{
  return this->_M_data->_M_decimal_point;
}



----------------------------------------

// Function: do_thousands_sep @ 089a496c

/* DWARF original prototype: char do_thousands_sep(moneypunct<char,true> * this) */

char __thiscall std::moneypunct<char,true>::do_thousands_sep(moneypunct<char,true> *this)

{
  return this->_M_data->_M_thousands_sep;
}



----------------------------------------

// Function: do_frac_digits @ 089a4978

/* DWARF original prototype: int do_frac_digits(moneypunct<char,true> * this) */

int __thiscall std::moneypunct<char,true>::do_frac_digits(moneypunct<char,true> *this)

{
  return this->_M_data->_M_frac_digits;
}



----------------------------------------

// Function: do_pos_format @ 089a4984

/* DWARF original prototype: pattern do_pos_format(moneypunct<char,true> * this) */

pattern * __thiscall
std::moneypunct<char,true>::do_pos_format
          (pattern *__return_storage_ptr__,moneypunct<char,true> *this)

{
  return *(pattern **)(*(int *)__return_storage_ptr__[2].field + 0x30);
}



----------------------------------------

// Function: do_neg_format @ 089a49c0

/* DWARF original prototype: pattern do_neg_format(moneypunct<char,true> * this) */

pattern * __thiscall
std::moneypunct<char,true>::do_neg_format
          (pattern *__return_storage_ptr__,moneypunct<char,true> *this)

{
  return *(pattern **)(*(int *)__return_storage_ptr__[2].field + 0x34);
}



----------------------------------------

// Function: __moneypunct_cache @ 089a49fc

/* DWARF original prototype: void __moneypunct_cache(__moneypunct_cache<char,false> * this, size_t
   __refs) */

void __thiscall
std::__moneypunct_cache<char,false>::__moneypunct_cache
          (__moneypunct_cache<char,false> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  this->_M_curr_symbol = (char *)0x0;
  this->_M_curr_symbol_size = 0;
  this->_M_positive_sign = (char *)0x0;
  this->_M_positive_sign_size = 0;
  this->_M_negative_sign = (char *)0x0;
  this->_M_negative_sign_size = 0;
  this->_M_frac_digits = 0;
  *(undefined4 *)(this->_M_pos_format).field = 0;
  *(undefined4 *)(this->_M_neg_format).field = 0;
  return;
}



----------------------------------------

// Function: get @ 089a4a58

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __s,
   istreambuf_iterator<char,std::char_traits<char>_> __end, bool __intl, ios_base * __io,
   _Ios_Iostate * __err, longdouble * __units) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __s,
          istreambuf_iterator<char,std::char_traits<char>_> __end,bool __intl,ios_base *__io,
          _Ios_Iostate *__err,longdouble *__units)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__s._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__s._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                     (__return_storage_ptr__,&local_20,&local_28,__s._M_c & 0xff);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4aac

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __s,
   istreambuf_iterator<char,std::char_traits<char>_> __end, bool __intl, ios_base * __io,
   _Ios_Iostate * __err, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __digits)
    */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __s,
          istreambuf_iterator<char,std::char_traits<char>_> __end,bool __intl,ios_base *__io,
          _Ios_Iostate *__err,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__digits)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__s._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__s._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_end)
                     (__return_storage_ptr__,&local_20,&local_28,__s._M_c & 0xff);
  return piVar1;
}



----------------------------------------

// Function: put @ 089a4b00

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, bool __intl, ios_base * __io, char __fill,
   longdouble __units) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,bool __intl,ios_base *__io,
          char __fill,longdouble __units)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                     (__return_storage_ptr__,&local_20,(uint)__s._M_sbuf & 0xff,__s._4_4_);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a4b4c

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, bool __intl, ios_base * __io, char __fill,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __digits) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,bool __intl,ios_base *__io,
          char __fill,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__digits)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_end)
                     (__return_storage_ptr__,&local_20,(uint)__s._M_sbuf & 0xff,__s._4_4_);
  return poVar1;
}



----------------------------------------

// Function: decimal_point @ 089a4b98

/* DWARF original prototype: char decimal_point(numpunct<char> * this) */

char __thiscall std::numpunct<char>::decimal_point(numpunct<char> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return (char)iVar1;
}



----------------------------------------

// Function: thousands_sep @ 089a4bbc

/* DWARF original prototype: char thousands_sep(numpunct<char> * this) */

char __thiscall std::numpunct<char>::thousands_sep(numpunct<char> *this)

{
  int iVar1;
  
  iVar1 = (*(this->super_facet)._vptr_facet[3])();
  return (char)iVar1;
}



----------------------------------------

// Function: grouping @ 089a4be0

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   grouping(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  (*(this->super_facet)._vptr_facet[4])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: truename @ 089a4c10

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   truename(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::truename
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  (*(this->super_facet)._vptr_facet[5])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: falsename @ 089a4c40

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   falsename(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::falsename
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  (*(this->super_facet)._vptr_facet[6])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_decimal_point @ 089a4c70

/* DWARF original prototype: char do_decimal_point(numpunct<char> * this) */

char __thiscall std::numpunct<char>::do_decimal_point(numpunct<char> *this)

{
  return this->_M_data->_M_decimal_point;
}



----------------------------------------

// Function: do_thousands_sep @ 089a4c7c

/* DWARF original prototype: char do_thousands_sep(numpunct<char> * this) */

char __thiscall std::numpunct<char>::do_thousands_sep(numpunct<char> *this)

{
  return this->_M_data->_M_thousands_sep;
}



----------------------------------------

// Function: get @ 089a4c88

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   bool * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,bool *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4cd8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   long * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,long *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_end)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4d28

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ushort * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ushort *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_beg)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4d78

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   uint * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,uint *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_cur)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4dc8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_end)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4e18

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   longlong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,longlong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)(__return_storage_ptr__->_M_sbuf->_M_buf_locale)._M_impl)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4e68

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulonglong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulonglong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._vptr_basic_streambuf)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4eb8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   float * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,float *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._M_in_beg)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4f08

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   double * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,double *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._M_in_cur)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4f58

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   longdouble * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,longdouble *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._M_in_end)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: get @ 089a4fa8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __in,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   void * * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __in,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,void **__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__in._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__in._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._M_out_beg)
                     (__return_storage_ptr__,&local_20,&local_28,__in._M_c);
  return piVar1;
}



----------------------------------------

// Function: put @ 089a4ff8

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, bool __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,bool __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a5044

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, long __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,long __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_end)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a508c

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, ulong __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,ulong __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_beg)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a50d4

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, longlong __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,
          longlong __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_cur)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a511c

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, ulonglong
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,
          ulonglong __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_end)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a5164

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, double __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,double __v
          )

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)(__return_storage_ptr__->_M_sbuf->_M_buf_locale)._M_impl)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a51ac

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, longdouble
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,
          longdouble __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._vptr_basic_streambuf)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: put @ 089a51f4

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __f, char __fill, void * __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__f,char __fill,void *__v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf[1]._M_in_beg)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: _M_date_formats @ 089a523c

/* DWARF original prototype: void _M_date_formats(__timepunct<char> * this, char * * __date) */

void __thiscall std::__timepunct<char>::_M_date_formats(__timepunct<char> *this,char **__date)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__date = p_Var1->_M_date_format;
  __date[1] = p_Var1->_M_date_era_format;
  return;
}



----------------------------------------

// Function: _M_time_formats @ 089a5254

/* DWARF original prototype: void _M_time_formats(__timepunct<char> * this, char * * __time) */

void __thiscall std::__timepunct<char>::_M_time_formats(__timepunct<char> *this,char **__time)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__time = p_Var1->_M_time_format;
  __time[1] = p_Var1->_M_time_era_format;
  return;
}



----------------------------------------

// Function: _M_date_time_formats @ 089a526c

/* DWARF original prototype: void _M_date_time_formats(__timepunct<char> * this, char * * __dt) */

void __thiscall std::__timepunct<char>::_M_date_time_formats(__timepunct<char> *this,char **__dt)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__dt = p_Var1->_M_date_time_format;
  __dt[1] = p_Var1->_M_date_time_era_format;
  return;
}



----------------------------------------

// Function: _M_am_pm_format @ 089a5284

/* DWARF original prototype: void _M_am_pm_format(__timepunct<char> * this, char * __ampm) */

void __thiscall std::__timepunct<char>::_M_am_pm_format(__timepunct<char> *this,char *__ampm)

{
  return;
}



----------------------------------------

// Function: _M_am_pm @ 089a528c

/* DWARF original prototype: void _M_am_pm(__timepunct<char> * this, char * * __ampm) */

void __thiscall std::__timepunct<char>::_M_am_pm(__timepunct<char> *this,char **__ampm)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__ampm = p_Var1->_M_am;
  __ampm[1] = p_Var1->_M_pm;
  return;
}



----------------------------------------

// Function: _M_days @ 089a52a4

/* DWARF original prototype: void _M_days(__timepunct<char> * this, char * * __days) */

void __thiscall std::__timepunct<char>::_M_days(__timepunct<char> *this,char **__days)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__days = p_Var1->_M_day1;
  __days[1] = p_Var1->_M_day2;
  __days[2] = p_Var1->_M_day3;
  __days[3] = p_Var1->_M_day4;
  __days[4] = p_Var1->_M_day5;
  __days[5] = p_Var1->_M_day6;
  __days[6] = p_Var1->_M_day7;
  return;
}



----------------------------------------

// Function: _M_days_abbreviated @ 089a52e4

/* DWARF original prototype: void _M_days_abbreviated(__timepunct<char> * this, char * * __days) */

void __thiscall std::__timepunct<char>::_M_days_abbreviated(__timepunct<char> *this,char **__days)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__days = p_Var1->_M_aday1;
  __days[1] = p_Var1->_M_aday2;
  __days[2] = p_Var1->_M_aday3;
  __days[3] = p_Var1->_M_aday4;
  __days[4] = p_Var1->_M_aday5;
  __days[5] = p_Var1->_M_aday6;
  __days[6] = p_Var1->_M_aday7;
  return;
}



----------------------------------------

// Function: _M_months @ 089a5324

/* DWARF original prototype: void _M_months(__timepunct<char> * this, char * * __months) */

void __thiscall std::__timepunct<char>::_M_months(__timepunct<char> *this,char **__months)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__months = p_Var1->_M_month01;
  __months[1] = p_Var1->_M_month02;
  __months[2] = p_Var1->_M_month03;
  __months[3] = p_Var1->_M_month04;
  __months[4] = p_Var1->_M_month05;
  __months[5] = p_Var1->_M_month06;
  __months[6] = p_Var1->_M_month07;
  __months[7] = p_Var1->_M_month08;
  __months[8] = p_Var1->_M_month09;
  __months[9] = p_Var1->_M_month10;
  __months[10] = p_Var1->_M_month11;
  __months[0xb] = p_Var1->_M_month12;
  return;
}



----------------------------------------

// Function: _M_months_abbreviated @ 089a538c

/* DWARF original prototype: void _M_months_abbreviated(__timepunct<char> * this, char * * __months)
    */

void __thiscall
std::__timepunct<char>::_M_months_abbreviated(__timepunct<char> *this,char **__months)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  *__months = p_Var1->_M_amonth01;
  __months[1] = p_Var1->_M_amonth02;
  __months[2] = p_Var1->_M_amonth03;
  __months[3] = p_Var1->_M_amonth04;
  __months[4] = p_Var1->_M_amonth05;
  __months[5] = p_Var1->_M_amonth06;
  __months[6] = p_Var1->_M_amonth07;
  __months[7] = p_Var1->_M_amonth08;
  __months[8] = p_Var1->_M_amonth09;
  __months[9] = p_Var1->_M_amonth10;
  __months[10] = p_Var1->_M_amonth11;
  __months[0xb] = p_Var1->_M_amonth12;
  return;
}



----------------------------------------

// Function: put @ 089a53f4

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, tm * __tm,
   char __format, char __mod) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,tm *__tm,
          char __format,char __mod)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  _func_int_varargs **local_20;
  undefined1 local_1c;
  
  local_1c = (undefined1)(this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  poVar1 = (ostreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                     (__return_storage_ptr__,&local_20,__s._M_sbuf,(int)__s._M_failed);
  return poVar1;
}



----------------------------------------

// Function: date_order @ 089a5444

/* DWARF original prototype: dateorder
   date_order(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this) */

dateorder __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::date_order
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this)

{
  dateorder dVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a544c. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  dVar1 = (*(this->super_facet)._vptr_facet[2])();
  return dVar1;
}



----------------------------------------

// Function: get_time @ 089a5454

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get_time(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get_time
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_end)
                     (__return_storage_ptr__,&local_20,&local_28,__beg._M_c);
  return piVar1;
}



----------------------------------------

// Function: get_date @ 089a54a4

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get_date(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get_date
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_beg)
                     (__return_storage_ptr__,&local_20,&local_28,__beg._M_c);
  return piVar1;
}



----------------------------------------

// Function: get_weekday @ 089a54f4

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get_weekday(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get_weekday
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_cur)
                     (__return_storage_ptr__,&local_20,&local_28,__beg._M_c);
  return piVar1;
}



----------------------------------------

// Function: get_monthname @ 089a5544

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get_monthname(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get_monthname
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)__return_storage_ptr__->_M_sbuf->_M_out_end)
                     (__return_storage_ptr__,&local_20,&local_28,__beg._M_c);
  return piVar1;
}



----------------------------------------

// Function: get_year @ 089a5594

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   get_year(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::get_year
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _func_int_varargs **local_28;
  char *local_24;
  _func_int_varargs **local_20;
  _Atomic_word local_1c;
  
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_1c = (this->super_facet)._M_refcount;
  local_20 = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  piVar1 = (istreambuf_iterator<char,std::char_traits<char>_> *)
           (*(code *)(__return_storage_ptr__->_M_sbuf->_M_buf_locale)._M_impl)
                     (__return_storage_ptr__,&local_20,&local_28,__beg._M_c);
  return piVar1;
}



----------------------------------------

// Function: do_date_order @ 089a55e4

/* DWARF original prototype: dateorder
   do_date_order(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this) */

dateorder __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_date_order
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this)

{
  return no_order;
}



----------------------------------------

// Function: open @ 089a55ec

/* DWARF original prototype: int open(messages<char> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __s, locale * __loc) */

int __thiscall
std::messages<char>::open
          (messages<char> *this,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__s
          ,locale *__loc)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a55f4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return iVar1;
}



----------------------------------------

// Function: open @ 089a55fc

/* DWARF original prototype: int open(messages<char> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __s, locale * __loc, char *
   param_3) */

int __thiscall
std::messages<char>::open
          (messages<char> *this,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__s
          ,locale *__loc,char *param_3)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a5604. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return iVar1;
}



----------------------------------------

// Function: get @ 089a560c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   get(messages<char> * this, int __c, int __set, int __msgid,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::messages<char>::get
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          messages<char> *this,int __c,int __set,int __msgid,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__s)

{
  (*(this->super_facet)._vptr_facet[3])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: close @ 089a563c

/* DWARF original prototype: void close(messages<char> * this, int __c) */

void __thiscall std::messages<char>::close(messages<char> *this,int __c)

{
                    /* WARNING: Could not recover jumptable at 0x089a5644. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(this->super_facet)._vptr_facet[4])();
  return;
}



----------------------------------------

// Function: do_open @ 089a564c

/* DWARF original prototype: int do_open(messages<char> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * param_1, locale * param_2) */

int __thiscall
std::messages<char>::do_open
          (messages<char> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *param_1,locale *param_2)

{
  return 0;
}



----------------------------------------

// Function: do_close @ 089a5654

/* DWARF original prototype: void do_close(messages<char> * this, int param_1) */

void __thiscall std::messages<char>::do_close(messages<char> *this,int param_1)

{
  return;
}



----------------------------------------

// Function: compare @ 089a565c

/* DWARF original prototype: int compare(collate<char> * this, char * __lo1, char * __hi1, char *
   __lo2, char * __hi2) */

int __thiscall
std::collate<char>::compare(collate<char> *this,char *__lo1,char *__hi1,char *__lo2,char *__hi2)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a5664. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[2])();
  return iVar1;
}



----------------------------------------

// Function: transform @ 089a566c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   transform(collate<char> * this, char * __lo, char * __hi) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::collate<char>::transform
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          collate<char> *this,char *__lo,char *__hi)

{
  (*(this->super_facet)._vptr_facet[3])();
  return __return_storage_ptr__;
}



----------------------------------------

// Function: hash @ 089a569c

/* DWARF original prototype: long hash(collate<char> * this, char * __lo, char * __hi) */

long __thiscall std::collate<char>::hash(collate<char> *this,char *__lo,char *__hi)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089a56a4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*(this->super_facet)._vptr_facet[4])();
  return iVar1;
}



----------------------------------------

// Function: do_hash @ 089a56ac

/* DWARF original prototype: long do_hash(collate<char> * this, char * __lo, char * __hi) */

long __thiscall std::collate<char>::do_hash(collate<char> *this,char *__lo,char *__hi)

{
  char cVar1;
  uint uVar2;
  
                    /* Unresolved local var: ulong __val@[???] */
  if (__lo < __hi) {
    uVar2 = 0;
    do {
      cVar1 = *__lo;
      __lo = __lo + 1;
      uVar2 = (int)cVar1 + (uVar2 >> 0x19) + uVar2 * 0x80;
    } while (__lo != __hi);
    return uVar2;
  }
  return 0;
}



----------------------------------------

// Function: __add_grouping<char> @ 089a56e0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

char * std::__add_grouping<char>
                 (char *__s,char __sep,char *__gbeg,size_t __gsize,char *__first,char *__last)

{
  char cVar1;
  int iVar2;
  char *pcVar3;
  char *in_t0;
  int in_t1;
  char *in_stack_00000000;
  char *in_stack_00000004;
  
  iVar2 = in_t1 - (int)in_t0;
  if ((*__gbeg < iVar2) && (0 < *__gbeg)) {
                    /* Unresolved local var: bool __bump@[???] */
    pcVar3 = __add_grouping<char>
                       (__s,__sep,__gbeg + (__gsize != 1),__gsize - (__gsize != 1),in_stack_00000000
                        ,in_stack_00000004);
    cVar1 = *__gbeg;
    __s = pcVar3 + 1;
    *pcVar3 = __sep;
    in_t0 = (char *)(in_t1 - cVar1);
    iVar2 = in_t1 - (int)in_t0;
  }
  pcVar3 = in_t0 + iVar2;
  do {
    cVar1 = *in_t0;
    in_t0 = in_t0 + 1;
    *__s = cVar1;
    __s = __s + 1;
  } while (in_t0 != pcVar3);
  return __s;
}



----------------------------------------

// Function: _M_group_int @ 089a5788

/* DWARF original prototype: void
   _M_group_int(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, char
   * __grouping, size_t __grouping_size, char __sep, ios_base * param_4, char * __new, char * __cs,
   int * __len) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_group_int
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *__grouping,size_t __grouping_size,char __sep,ios_base *param_4,char *__new,
          char *__cs,int *__len)

{
  char *pcVar1;
  char *in_t1;
  int *in_t3;
  char *in_stack_00000000;
  char *in_stack_00000004;
  
                    /* Unresolved local var: char * __p@[???] */
  pcVar1 = __add_grouping<char>
                     (in_t1,__sep,__grouping,__grouping_size,in_stack_00000000,in_stack_00000004);
  *in_t3 = (int)pcVar1 - (int)in_t1;
  return;
}



----------------------------------------

// Function: do_narrow @ 089a57e4

/* DWARF original prototype: char * do_narrow(ctype<char> * this, char * __lo, char * __hi, char
   param_3, char * __dest) */

char * __thiscall
std::ctype<char>::do_narrow(ctype<char> *this,char *__lo,char *__hi,char param_3,char *__dest)

{
  void *in_t0;
  
  memcpy(in_t0,__lo,(int)__hi - (int)__lo);
  return __hi;
}



----------------------------------------

// Function: do_widen @ 089a5814

/* DWARF original prototype: char * do_widen(ctype<char> * this, char * __lo, char * __hi, char *
   __dest) */

char * __thiscall std::ctype<char>::do_widen(ctype<char> *this,char *__lo,char *__hi,char *__dest)

{
  memcpy(__dest,__lo,(int)__hi - (int)__lo);
  return __hi;
}



----------------------------------------

// Function: ~__codecvt_abstract_base @ 089a5844

/* DWARF original prototype: void
   ~__codecvt_abstract_base(__codecvt_abstract_base<char,char,_mbstate_t> * this, int __in_chrg) */

void __thiscall
std::__codecvt_abstract_base<char,char,_mbstate_t>::~__codecvt_abstract_base
          (__codecvt_abstract_base<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____codecvt_abstract_base_089efc58;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__codecvt_abstract_base @ 089a5878

/* DWARF original prototype: void
   ~__codecvt_abstract_base(__codecvt_abstract_base<char,char,_mbstate_t> * this, int __in_chrg) */

void __thiscall
std::__codecvt_abstract_base<char,char,_mbstate_t>::~__codecvt_abstract_base
          (__codecvt_abstract_base<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____codecvt_abstract_base_089efc58;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__ctype_abstract_base @ 089a5888

/* DWARF original prototype: void ~__ctype_abstract_base(__ctype_abstract_base<char> * this, int
   __in_chrg) */

void __thiscall
std::__ctype_abstract_base<char>::~__ctype_abstract_base
          (__ctype_abstract_base<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____ctype_abstract_base_089ef8c8;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__ctype_abstract_base @ 089a58bc

/* DWARF original prototype: void ~__ctype_abstract_base(__ctype_abstract_base<char> * this, int
   __in_chrg) */

void __thiscall
std::__ctype_abstract_base<char>::~__ctype_abstract_base
          (__ctype_abstract_base<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____ctype_abstract_base_089ef8c8;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_get @ 089a58cc

/* DWARF original prototype: void
   ~time_get(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~time_get
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~time_get @ 089a5900

/* DWARF original prototype: void
   ~time_get(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~time_get
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_get @ 089a5910

/* DWARF original prototype: void
   ~time_get(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~time_get
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_put @ 089a5920

/* DWARF original prototype: void
   ~time_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~time_put
          (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~time_put @ 089a5954

/* DWARF original prototype: void
   ~time_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~time_put
          (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_put @ 089a5964

/* DWARF original prototype: void
   ~time_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~time_put
          (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__timepunct_cache @ 089a5974

/* DWARF original prototype: void ~__timepunct_cache(__timepunct_cache<char> * this, int __in_chrg)
    */

void __thiscall
std::__timepunct_cache<char>::~__timepunct_cache(__timepunct_cache<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__timepunct_cache @ 089a59a8

/* DWARF original prototype: void ~__timepunct_cache(__timepunct_cache<char> * this, int __in_chrg)
    */

void __thiscall
std::__timepunct_cache<char>::~__timepunct_cache(__timepunct_cache<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__timepunct_cache @ 089a59b8

/* DWARF original prototype: void ~__timepunct_cache(__timepunct_cache<char> * this, int __in_chrg)
    */

void __thiscall
std::__timepunct_cache<char>::~__timepunct_cache(__timepunct_cache<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~num_put @ 089a59c8

/* DWARF original prototype: void
   ~num_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~num_put
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_put_089efa28;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~num_put @ 089a59fc

/* DWARF original prototype: void
   ~num_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~num_put
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_put_089efa28;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~num_put @ 089a5a0c

/* DWARF original prototype: void
   ~num_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~num_put
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_put_089efa28;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~num_get @ 089a5a1c

/* DWARF original prototype: void
   ~num_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~num_get
          (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_get_089efa58;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~num_get @ 089a5a50

/* DWARF original prototype: void
   ~num_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~num_get
          (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_get_089efa58;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~num_get @ 089a5a60

/* DWARF original prototype: void
   ~num_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~num_get
          (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_get_089efa58;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~money_put @ 089a5a70

/* DWARF original prototype: void
   ~money_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~money_put
          (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_put_089efac0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~money_put @ 089a5aa4

/* DWARF original prototype: void
   ~money_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~money_put
          (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_put_089efac0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~money_put @ 089a5ab4

/* DWARF original prototype: void
   ~money_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::~money_put
          (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_put_089efac0;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~money_get @ 089a5ac4

/* DWARF original prototype: void
   ~money_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~money_get
          (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_get_089efad8;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~money_get @ 089a5af8

/* DWARF original prototype: void
   ~money_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~money_get
          (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_get_089efad8;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~money_get @ 089a5b08

/* DWARF original prototype: void
   ~money_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, int
   __in_chrg) */

void __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::~money_get
          (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_get_089efad8;
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: has_facet<std::messages<char>_> @ 089a5b18

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::messages<char> > */

bool std::has_facet<std::messages<char>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5b2c to 089a5b33 has its CatchHandler @ 089a5b6c */
  sVar2 = locale::id::_M_id(&messages<char>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::time_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5b88

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::time_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::time_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5b9c to 089a5ba3 has its CatchHandler @ 089a5bdc */
  sVar2 = locale::id::_M_id(&time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::time_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5bf8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::time_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::time_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5c0c to 089a5c13 has its CatchHandler @ 089a5c4c */
  sVar2 = locale::id::_M_id(&time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::__timepunct<char>_> @ 089a5c68

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::__timepunct<char> > */

bool std::has_facet<std::__timepunct<char>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5c7c to 089a5c83 has its CatchHandler @ 089a5cbc */
  sVar2 = locale::id::_M_id(&__timepunct<char>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::money_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5cd8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::money_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::money_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5cec to 089a5cf3 has its CatchHandler @ 089a5d2c */
  sVar2 = locale::id::_M_id(&money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::money_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5d48

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::money_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::money_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5d5c to 089a5d63 has its CatchHandler @ 089a5d9c */
  sVar2 = locale::id::_M_id(&money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::moneypunct<char,_false>_> @ 089a5db8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::moneypunct<char, false> > */

bool std::has_facet<std::moneypunct<char,_false>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5dcc to 089a5dd3 has its CatchHandler @ 089a5e0c */
  sVar2 = locale::id::_M_id(&moneypunct<char,false>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5e28

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::num_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5e3c to 089a5e43 has its CatchHandler @ 089a5e7c */
  sVar2 = locale::id::_M_id(&num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a5e98

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::num_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

bool std::has_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
               (locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5eac to 089a5eb3 has its CatchHandler @ 089a5eec */
  sVar2 = locale::id::_M_id(&num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::numpunct<char>_> @ 089a5f08

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::numpunct<char> > */

bool std::has_facet<std::numpunct<char>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5f1c to 089a5f23 has its CatchHandler @ 089a5f5c */
  sVar2 = locale::id::_M_id(&numpunct<char>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::collate<char>_> @ 089a5f78

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::collate<char> > */

bool std::has_facet<std::collate<char>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5f8c to 089a5f93 has its CatchHandler @ 089a5fcc */
  sVar2 = locale::id::_M_id(&collate<char>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::codecvt<char,_char,__mbstate_t>_> @ 089a5fe8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::codecvt<char, char, _mbstate_t> > */

bool std::has_facet<std::codecvt<char,_char,__mbstate_t>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a5ffc to 089a6003 has its CatchHandler @ 089a603c */
  sVar2 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: has_facet<std::ctype<char>_> @ 089a6058

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: has_facet<std::ctype<char> > */

bool std::has_facet<std::ctype<char>_>(locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089a606c to 089a6073 has its CatchHandler @ 089a60ac */
  sVar2 = locale::id::_M_id(&ctype<char>::id);
  bVar1 = false;
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    bVar1 = __loc->_M_impl->_M_facets[sVar2] != (facet *)0x0;
  }
  return bVar1;
}



----------------------------------------

// Function: use_facet<std::messages<char>_> @ 089a60c8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::messages<char> > */

messages<char> * std::use_facet<std::messages<char>_>(locale *__loc)

{
  size_t sVar1;
  messages<char> *pmVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&messages<char>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pmVar2 = (messages<char> *)__loc->_M_impl->_M_facets[sVar1], pmVar2 != (messages<char> *)0x0))
  {
    return pmVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::time_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a6124

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::time_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::time_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::time_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a6180

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::time_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::time_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::__timepunct<char>_> @ 089a61dc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::__timepunct<char> > */

__timepunct<char> * std::use_facet<std::__timepunct<char>_>(locale *__loc)

{
  size_t sVar1;
  __timepunct<char> *p_Var2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&__timepunct<char>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (p_Var2 = (__timepunct<char> *)__loc->_M_impl->_M_facets[sVar1],
     p_Var2 != (__timepunct<char> *)0x0)) {
    return p_Var2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::money_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a6238

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::money_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::money_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::money_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a6294

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::money_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::money_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::moneypunct<char,_false>_> @ 089a62f0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::moneypunct<char, false> > */

moneypunct<char,false> * std::use_facet<std::moneypunct<char,_false>_>(locale *__loc)

{
  size_t sVar1;
  moneypunct<char,false> *pmVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&moneypunct<char,false>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pmVar2 = (moneypunct<char,false> *)__loc->_M_impl->_M_facets[sVar1],
     pmVar2 != (moneypunct<char,false> *)0x0)) {
    return pmVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::moneypunct<char,_true>_> @ 089a634c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::moneypunct<char, true> > */

moneypunct<char,true> * std::use_facet<std::moneypunct<char,_true>_>(locale *__loc)

{
  size_t sVar1;
  moneypunct<char,true> *pmVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&moneypunct<char,true>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pmVar2 = (moneypunct<char,true> *)__loc->_M_impl->_M_facets[sVar1],
     pmVar2 != (moneypunct<char,true> *)0x0)) {
    return pmVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a63a8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::num_get<char, std::istreambuf_iterator<char,
   std::char_traits<char> > > > */

num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::num_get<char,_std::istreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_> @ 089a6404

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::num_put<char, std::ostreambuf_iterator<char,
   std::char_traits<char> > > > */

num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
std::use_facet<std::num_put<char,_std::ostreambuf_iterator<char,_std::char_traits<char>_>_>_>
          (locale *__loc)

{
  size_t sVar1;
  facet *pfVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                             ::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pfVar2 = __loc->_M_impl->_M_facets[sVar1], pfVar2 != (facet *)0x0)) {
    return (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)pfVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::numpunct<char>_> @ 089a6460

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::numpunct<char> > */

numpunct<char> * std::use_facet<std::numpunct<char>_>(locale *__loc)

{
  size_t sVar1;
  numpunct<char> *pnVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&numpunct<char>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pnVar2 = (numpunct<char> *)__loc->_M_impl->_M_facets[sVar1], pnVar2 != (numpunct<char> *)0x0))
  {
    return pnVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::collate<char>_> @ 089a64bc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::collate<char> > */

collate<char> * std::use_facet<std::collate<char>_>(locale *__loc)

{
  size_t sVar1;
  collate<char> *pcVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&collate<char>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pcVar2 = (collate<char> *)__loc->_M_impl->_M_facets[sVar1], pcVar2 != (collate<char> *)0x0)) {
    return pcVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: use_facet<std::codecvt<char,_char,__mbstate_t>_> @ 089a6518

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::codecvt<char, char, _mbstate_t> > */

codecvt<char,char,_mbstate_t> * std::use_facet<std::codecvt<char,_char,__mbstate_t>_>(locale *__loc)

{
  size_t sVar1;
  codecvt<char,char,_mbstate_t> *pcVar2;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar1 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
  if ((sVar1 < __loc->_M_impl->_M_facets_size) &&
     (pcVar2 = (codecvt<char,char,_mbstate_t> *)__loc->_M_impl->_M_facets[sVar1],
     pcVar2 != (codecvt<char,char,_mbstate_t> *)0x0)) {
    return pcVar2;
  }
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: ~collate @ 089a6574

/* DWARF original prototype: void ~collate(collate<char> * this, int __in_chrg) */

void __thiscall std::collate<char>::~collate(collate<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
                    /* try { // try from 089a6594 to 089a659b has its CatchHandler @ 089a65bc */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_collate);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~collate @ 089a65d0

/* DWARF original prototype: void ~collate(collate<char> * this, int __in_chrg) */

void __thiscall std::collate<char>::~collate(collate<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
                    /* try { // try from 089a65f0 to 089a65f7 has its CatchHandler @ 089a6610 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_collate);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~collate @ 089a6624

/* DWARF original prototype: void ~collate(collate<char> * this, int __in_chrg) */

void __thiscall std::collate<char>::~collate(collate<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
                    /* try { // try from 089a6644 to 089a664b has its CatchHandler @ 089a6664 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_collate);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~messages @ 089a6678

/* DWARF original prototype: void ~messages(messages<char> * this, int __in_chrg) */

void __thiscall std::messages<char>::~messages(messages<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a6698 to 089a669f has its CatchHandler @ 089a66c0 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_messages);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~messages @ 089a66d4

/* DWARF original prototype: void ~messages(messages<char> * this, int __in_chrg) */

void __thiscall std::messages<char>::~messages(messages<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a66f4 to 089a66fb has its CatchHandler @ 089a6714 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_messages);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~messages @ 089a6728

/* DWARF original prototype: void ~messages(messages<char> * this, int __in_chrg) */

void __thiscall std::messages<char>::~messages(messages<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a6748 to 089a674f has its CatchHandler @ 089a6768 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_messages);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~messages_byname @ 089a677c

/* DWARF original prototype: void ~messages_byname(messages_byname<char> * this, int __in_chrg) */

void __thiscall
std::messages_byname<char>::~messages_byname(messages_byname<char> *this,int __in_chrg)

{
  (this->super_messages<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__messages_byname_089ef988;
  messages<char>::~messages(&this->super_messages<char>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~messages_byname @ 089a67b0

/* DWARF original prototype: void ~messages_byname(messages_byname<char> * this, int __in_chrg) */

void __thiscall
std::messages_byname<char>::~messages_byname(messages_byname<char> *this,int __in_chrg)

{
  (this->super_messages<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__messages_byname_089ef988;
  messages<char>::~messages(&this->super_messages<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~messages_byname @ 089a67c0

/* DWARF original prototype: void ~messages_byname(messages_byname<char> * this, int __in_chrg) */

void __thiscall
std::messages_byname<char>::~messages_byname(messages_byname<char> *this,int __in_chrg)

{
  (this->super_messages<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__messages_byname_089ef988;
  messages<char>::~messages(&this->super_messages<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~codecvt_byname @ 089a67d0

/* DWARF original prototype: void ~codecvt_byname(codecvt_byname<char,char,_mbstate_t> * this, int
   __in_chrg) */

void __thiscall
std::codecvt_byname<char,char,_mbstate_t>::~codecvt_byname
          (codecvt_byname<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super_codecvt<char,char,_mbstate_t>).super___codecvt_abstract_base<char,char,_mbstate_t>.
  super_facet._vptr_facet = (_func_int_varargs **)&PTR__codecvt_byname_089ef958;
  codecvt<char,char,_mbstate_t>::~codecvt(&this->super_codecvt<char,char,_mbstate_t>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~codecvt_byname @ 089a6804

/* DWARF original prototype: void ~codecvt_byname(codecvt_byname<char,char,_mbstate_t> * this, int
   __in_chrg) */

void __thiscall
std::codecvt_byname<char,char,_mbstate_t>::~codecvt_byname
          (codecvt_byname<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super_codecvt<char,char,_mbstate_t>).super___codecvt_abstract_base<char,char,_mbstate_t>.
  super_facet._vptr_facet = (_func_int_varargs **)&PTR__codecvt_byname_089ef958;
  codecvt<char,char,_mbstate_t>::~codecvt(&this->super_codecvt<char,char,_mbstate_t>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~codecvt_byname @ 089a6814

/* DWARF original prototype: void ~codecvt_byname(codecvt_byname<char,char,_mbstate_t> * this, int
   __in_chrg) */

void __thiscall
std::codecvt_byname<char,char,_mbstate_t>::~codecvt_byname
          (codecvt_byname<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super_codecvt<char,char,_mbstate_t>).super___codecvt_abstract_base<char,char,_mbstate_t>.
  super_facet._vptr_facet = (_func_int_varargs **)&PTR__codecvt_byname_089ef958;
  codecvt<char,char,_mbstate_t>::~codecvt(&this->super_codecvt<char,char,_mbstate_t>,__in_chrg);
  return;
}



----------------------------------------

// Function: codecvt_byname @ 089a6824

/* DWARF original prototype: void codecvt_byname(codecvt_byname<char,char,_mbstate_t> * this, char *
   __s, size_t __refs) */

void __thiscall
std::codecvt_byname<char,char,_mbstate_t>::codecvt_byname
          (codecvt_byname<char,char,_mbstate_t> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale *__cloc;
  
  codecvt<char,char,_mbstate_t>::codecvt(&this->super_codecvt<char,char,_mbstate_t>,__refs);
  (this->super_codecvt<char,char,_mbstate_t>).super___codecvt_abstract_base<char,char,_mbstate_t>.
  super_facet._vptr_facet = (_func_int_varargs **)&PTR__codecvt_byname_089ef958;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
    __cloc = &(this->super_codecvt<char,char,_mbstate_t>)._M_c_locale_codecvt;
                    /* try { // try from 089a689c to 089a68b3 has its CatchHandler @ 089a68cc */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: codecvt_byname @ 089a68e0

/* DWARF original prototype: void codecvt_byname(codecvt_byname<char,char,_mbstate_t> * this, char *
   __s, size_t __refs) */

void __thiscall
std::codecvt_byname<char,char,_mbstate_t>::codecvt_byname
          (codecvt_byname<char,char,_mbstate_t> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale *__cloc;
  
  codecvt<char,char,_mbstate_t>::codecvt(&this->super_codecvt<char,char,_mbstate_t>,__refs);
  (this->super_codecvt<char,char,_mbstate_t>).super___codecvt_abstract_base<char,char,_mbstate_t>.
  super_facet._vptr_facet = (_func_int_varargs **)&PTR__codecvt_byname_089ef958;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
    __cloc = &(this->super_codecvt<char,char,_mbstate_t>)._M_c_locale_codecvt;
                    /* try { // try from 089a6958 to 089a696f has its CatchHandler @ 089a6988 */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: ~ctype_byname @ 089a699c

/* DWARF original prototype: void ~ctype_byname(ctype_byname<char> * this, int __in_chrg) */

void __thiscall std::ctype_byname<char>::~ctype_byname(ctype_byname<char> *this,int __in_chrg)

{
  (this->super_ctype<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__ctype_byname_089efc88;
  ctype<char>::~ctype(&this->super_ctype<char>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~ctype_byname @ 089a69d0

/* DWARF original prototype: void ~ctype_byname(ctype_byname<char> * this, int __in_chrg) */

void __thiscall std::ctype_byname<char>::~ctype_byname(ctype_byname<char> *this,int __in_chrg)

{
  (this->super_ctype<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__ctype_byname_089efc88;
  ctype<char>::~ctype(&this->super_ctype<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~ctype_byname @ 089a69e0

/* DWARF original prototype: void ~ctype_byname(ctype_byname<char> * this, int __in_chrg) */

void __thiscall std::ctype_byname<char>::~ctype_byname(ctype_byname<char> *this,int __in_chrg)

{
  (this->super_ctype<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__ctype_byname_089efc88;
  ctype<char>::~ctype(&this->super_ctype<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__timepunct @ 089a69f0

/* DWARF original prototype: void ~__timepunct(__timepunct<char> * this, int __in_chrg) */

void __thiscall std::__timepunct<char>::~__timepunct(__timepunct<char> *this,int __in_chrg)

{
  char *pcVar1;
  __timepunct_cache<char> *p_Var2;
  char *pcVar3;
  
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
                    /* try { // try from 089a6a10 to 089a6a57 has its CatchHandler @ 089a6a78 */
  pcVar3 = this->_M_name_timepunct;
  pcVar1 = locale::facet::_S_get_c_name();
  if (pcVar3 == pcVar1) {
    p_Var2 = this->_M_data;
  }
  else if (this->_M_name_timepunct == (char *)0x0) {
    p_Var2 = this->_M_data;
  }
  else {
    operator_delete___(this->_M_name_timepunct);
    p_Var2 = this->_M_data;
  }
  if (p_Var2 != (__timepunct_cache<char> *)0x0) {
    (*(p_Var2->super_facet)._vptr_facet[1])();
  }
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_timepunct);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__timepunct @ 089a6a8c

/* DWARF original prototype: void ~__timepunct(__timepunct<char> * this, int __in_chrg) */

void __thiscall std::__timepunct<char>::~__timepunct(__timepunct<char> *this,int __in_chrg)

{
  char *pcVar1;
  __timepunct_cache<char> *p_Var2;
  char *pcVar3;
  
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
                    /* try { // try from 089a6aac to 089a6af3 has its CatchHandler @ 089a6b0c */
  pcVar3 = this->_M_name_timepunct;
  pcVar1 = locale::facet::_S_get_c_name();
  if (pcVar3 == pcVar1) {
    p_Var2 = this->_M_data;
  }
  else if (this->_M_name_timepunct == (char *)0x0) {
    p_Var2 = this->_M_data;
  }
  else {
    operator_delete___(this->_M_name_timepunct);
    p_Var2 = this->_M_data;
  }
  if (p_Var2 != (__timepunct_cache<char> *)0x0) {
    (*(p_Var2->super_facet)._vptr_facet[1])();
  }
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_timepunct);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__timepunct @ 089a6b20

/* DWARF original prototype: void ~__timepunct(__timepunct<char> * this, int __in_chrg) */

void __thiscall std::__timepunct<char>::~__timepunct(__timepunct<char> *this,int __in_chrg)

{
  char *pcVar1;
  __timepunct_cache<char> *p_Var2;
  char *pcVar3;
  
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
                    /* try { // try from 089a6b40 to 089a6b87 has its CatchHandler @ 089a6ba0 */
  pcVar3 = this->_M_name_timepunct;
  pcVar1 = locale::facet::_S_get_c_name();
  if (pcVar3 == pcVar1) {
    p_Var2 = this->_M_data;
  }
  else if (this->_M_name_timepunct == (char *)0x0) {
    p_Var2 = this->_M_data;
  }
  else {
    operator_delete___(this->_M_name_timepunct);
    p_Var2 = this->_M_data;
  }
  if (p_Var2 != (__timepunct_cache<char> *)0x0) {
    (*(p_Var2->super_facet)._vptr_facet[1])();
  }
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_timepunct);
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__numpunct_cache @ 089a6bb4

/* DWARF original prototype: void ~__numpunct_cache(__numpunct_cache<char> * this, int __in_chrg) */

void __thiscall
std::__numpunct_cache<char>::~__numpunct_cache(__numpunct_cache<char> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_truename != (char *)0x0) {
      operator_delete___(this->_M_truename);
    }
    if (this->_M_falsename != (char *)0x0) {
      operator_delete___(this->_M_falsename);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__numpunct_cache @ 089a6c30

/* DWARF original prototype: void ~__numpunct_cache(__numpunct_cache<char> * this, int __in_chrg) */

void __thiscall
std::__numpunct_cache<char>::~__numpunct_cache(__numpunct_cache<char> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_truename != (char *)0x0) {
      operator_delete___(this->_M_truename);
    }
    if (this->_M_falsename != (char *)0x0) {
      operator_delete___(this->_M_falsename);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__numpunct_cache @ 089a6ca4

/* DWARF original prototype: void ~__numpunct_cache(__numpunct_cache<char> * this, int __in_chrg) */

void __thiscall
std::__numpunct_cache<char>::~__numpunct_cache(__numpunct_cache<char> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_truename != (char *)0x0) {
      operator_delete___(this->_M_truename);
    }
    if (this->_M_falsename != (char *)0x0) {
      operator_delete___(this->_M_falsename);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6d18

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,true> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,true>::~__moneypunct_cache
          (__moneypunct_cache<char,true> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6da8

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,true> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,true>::~__moneypunct_cache
          (__moneypunct_cache<char,true> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6e30

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,true> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,true>::~__moneypunct_cache
          (__moneypunct_cache<char,true> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6eb8

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,false> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,false>::~__moneypunct_cache
          (__moneypunct_cache<char,false> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6f48

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,false> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,false>::~__moneypunct_cache
          (__moneypunct_cache<char,false> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__moneypunct_cache @ 089a6fd0

/* DWARF original prototype: void ~__moneypunct_cache(__moneypunct_cache<char,false> * this, int
   __in_chrg) */

void __thiscall
std::__moneypunct_cache<char,false>::~__moneypunct_cache
          (__moneypunct_cache<char,false> *this,int __in_chrg)

{
  bool bVar1;
  
  bVar1 = this->_M_allocated;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
  if (bVar1 != false) {
    if (this->_M_grouping != (char *)0x0) {
      operator_delete___(this->_M_grouping);
    }
    if (this->_M_curr_symbol != (char *)0x0) {
      operator_delete___(this->_M_curr_symbol);
    }
    if (this->_M_positive_sign != (char *)0x0) {
      operator_delete___(this->_M_positive_sign);
    }
    if (this->_M_negative_sign != (char *)0x0) {
      operator_delete___(this->_M_negative_sign);
    }
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~numpunct_byname @ 089a7058

/* DWARF original prototype: void ~numpunct_byname(numpunct_byname<char> * this, int __in_chrg) */

void __thiscall
std::numpunct_byname<char>::~numpunct_byname(numpunct_byname<char> *this,int __in_chrg)

{
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_byname_089efa98;
  numpunct<char>::~numpunct(&this->super_numpunct<char>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~numpunct_byname @ 089a708c

/* DWARF original prototype: void ~numpunct_byname(numpunct_byname<char> * this, int __in_chrg) */

void __thiscall
std::numpunct_byname<char>::~numpunct_byname(numpunct_byname<char> *this,int __in_chrg)

{
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_byname_089efa98;
  numpunct<char>::~numpunct(&this->super_numpunct<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~numpunct_byname @ 089a709c

/* DWARF original prototype: void ~numpunct_byname(numpunct_byname<char> * this, int __in_chrg) */

void __thiscall
std::numpunct_byname<char>::~numpunct_byname(numpunct_byname<char> *this,int __in_chrg)

{
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_byname_089efa98;
  numpunct<char>::~numpunct(&this->super_numpunct<char>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a70ac

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,true> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,true>::~moneypunct_byname
          (moneypunct_byname<char,true> *this,int __in_chrg)

{
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efaf0;
  moneypunct<char,true>::~moneypunct(&this->super_moneypunct<char,true>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a70e0

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,true> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,true>::~moneypunct_byname
          (moneypunct_byname<char,true> *this,int __in_chrg)

{
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efaf0;
  moneypunct<char,true>::~moneypunct(&this->super_moneypunct<char,true>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a70f0

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,true> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,true>::~moneypunct_byname
          (moneypunct_byname<char,true> *this,int __in_chrg)

{
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efaf0;
  moneypunct<char,true>::~moneypunct(&this->super_moneypunct<char,true>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a7100

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,false> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,false>::~moneypunct_byname
          (moneypunct_byname<char,false> *this,int __in_chrg)

{
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efb28;
  moneypunct<char,false>::~moneypunct(&this->super_moneypunct<char,false>,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a7134

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,false> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,false>::~moneypunct_byname
          (moneypunct_byname<char,false> *this,int __in_chrg)

{
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efb28;
  moneypunct<char,false>::~moneypunct(&this->super_moneypunct<char,false>,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct_byname @ 089a7144

/* DWARF original prototype: void ~moneypunct_byname(moneypunct_byname<char,false> * this, int
   __in_chrg) */

void __thiscall
std::moneypunct_byname<char,false>::~moneypunct_byname
          (moneypunct_byname<char,false> *this,int __in_chrg)

{
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efb28;
  moneypunct<char,false>::~moneypunct(&this->super_moneypunct<char,false>,__in_chrg);
  return;
}



----------------------------------------

// Function: __int_to_char<char,_long_long_unsigned_int> @ 089a7154

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: __int_to_char<char, long long unsigned int> */

int std::__int_to_char<char,_long_long_unsigned_int>
              (char *__bufend,ulonglong __v,char *__lit,_Ios_Fmtflags __flags,bool param_5)

{
  ulonglong uVar1;
  ulonglong uVar2;
  uint uVar3;
  int iVar4;
  int in_t0;
  uint in_t1;
  char *pcVar5;
  UDItype UVar6;
  
                    /* Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: char * __buf@[???] */
  uVar3 = in_t1 & 0x4a;
  pcVar5 = __bufend;
  if ((uVar3 == 0x40) || (uVar3 == 8)) {
    if (uVar3 != 0x40) {
                    /* Unresolved local var: bool __uppercase@[???]
                       Unresolved local var: int __case_offset@[???] */
      iVar4 = 0x14;
      if ((in_t1 & 0x4000) == 0) {
        iVar4 = 4;
      }
      do {
        uVar3 = (uint)__v;
        __v = __v >> 4;
        pcVar5 = pcVar5 + -1;
        *pcVar5 = *(char *)(iVar4 + in_t0 + (uVar3 & 0xf));
      } while (__v != 0);
      return (int)__bufend - (int)pcVar5;
    }
    do {
      uVar3 = (uint)__v;
      uVar2 = __v & 0x700000007;
      uVar1 = __v >> 3;
      __v = __v >> 3;
      pcVar5 = pcVar5 + -1;
      *pcVar5 = *(char *)(in_t0 + (int)uVar2 + 4);
    } while (((int)(uVar2 >> 0x20) != 0 || uVar3 >> 3 != 0) || (int)(uVar1 >> 0x20) != 0);
  }
  else {
    do {
      UVar6 = __umoddi3(__v,10);
      pcVar5 = pcVar5 + -1;
      *pcVar5 = *(char *)(in_t0 + (int)UVar6 + 4);
      __v = __udivdi3(__v,10);
    } while (__v != 0);
  }
  return (int)__bufend - (int)pcVar5;
}



----------------------------------------

// Function: __int_to_char<char,_long_unsigned_int> @ 089a72bc

/* WARNING: Removing unreachable block (ram,0x089a72e4) */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: __int_to_char<char, long unsigned int> */

int std::__int_to_char<char,_long_unsigned_int>
              (char *__bufend,ulong __v,char *__lit,_Ios_Fmtflags __flags,bool param_5)

{
  _Ios_Fmtflags _Var1;
  int iVar2;
  char *pcVar3;
  uint uVar4;
  
                    /* Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: char * __buf@[???] */
  _Var1 = __flags & _S_basefield;
  pcVar3 = __bufend;
  if ((_Var1 == _S_oct) || (_Var1 == _S_hex)) {
    if (_Var1 != _S_oct) {
                    /* Unresolved local var: bool __uppercase@[???]
                       Unresolved local var: int __case_offset@[???] */
      iVar2 = 0x14;
      if ((__flags & _S_uppercase) == 0) {
        iVar2 = 4;
      }
      do {
        uVar4 = __v & 0xf;
        pcVar3 = pcVar3 + -1;
        __v = __v >> 4;
        *pcVar3 = __lit[uVar4 + iVar2];
      } while (__v != 0);
      return (int)__bufend - (int)pcVar3;
    }
    do {
      uVar4 = __v & 7;
      pcVar3 = pcVar3 + -1;
      __v = __v >> 3;
      *pcVar3 = __lit[uVar4 + 4];
    } while (__v != 0);
  }
  else {
    do {
      uVar4 = __v / 10;
      pcVar3 = pcVar3 + -1;
      *pcVar3 = __lit[__v % 10 + 4];
      __v = uVar4;
    } while (uVar4 != 0);
  }
  return (int)__bufend - (int)pcVar3;
}



----------------------------------------

// Function: moneypunct @ 089a737c

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this, size_t __refs) */

void __thiscall std::moneypunct<char,false>::moneypunct(moneypunct<char,false> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  this->_M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a73ac to 089a73b3 has its CatchHandler @ 089a73c8 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: collate @ 089a73dc

/* DWARF original prototype: void collate(collate<char> * this, __c_locale __cloc, size_t __refs) */

void __thiscall std::collate<char>::collate(collate<char> *this,__c_locale __cloc,size_t __refs)

{
  __c_locale piVar1;
  __c_locale local_18 [2];
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
  local_18[0] = __cloc;
                    /* try { // try from 089a7408 to 089a740f has its CatchHandler @ 089a7428 */
  piVar1 = locale::facet::_S_clone_c_locale(local_18);
  this->_M_c_locale_collate = piVar1;
  return;
}



----------------------------------------

// Function: collate @ 089a743c

/* DWARF original prototype: void collate(collate<char> * this, __c_locale __cloc, size_t __refs) */

void __thiscall std::collate<char>::collate(collate<char> *this,__c_locale __cloc,size_t __refs)

{
  __c_locale piVar1;
  __c_locale local_18 [2];
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
  local_18[0] = __cloc;
                    /* try { // try from 089a7468 to 089a746f has its CatchHandler @ 089a7488 */
  piVar1 = locale::facet::_S_clone_c_locale(local_18);
  this->_M_c_locale_collate = piVar1;
  return;
}



----------------------------------------

// Function: collate @ 089a749c

/* DWARF original prototype: void collate(collate<char> * this, size_t __refs) */

void __thiscall std::collate<char>::collate(collate<char> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
                    /* try { // try from 089a74c0 to 089a74c7 has its CatchHandler @ 089a74e0 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_collate = piVar1;
  return;
}



----------------------------------------

// Function: collate @ 089a74f4

/* DWARF original prototype: void collate(collate<char> * this, size_t __refs) */

void __thiscall std::collate<char>::collate(collate<char> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10;
                    /* try { // try from 089a7518 to 089a751f has its CatchHandler @ 089a7538 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_collate = piVar1;
  return;
}



----------------------------------------

// Function: messages @ 089a754c

/* DWARF original prototype: void messages(messages<char> * this, size_t __refs) */

void __thiscall std::messages<char>::messages(messages<char> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a7570 to 089a7577 has its CatchHandler @ 089a7590 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_messages = piVar1;
  return;
}



----------------------------------------

// Function: messages_byname @ 089a75a4

/* DWARF original prototype: void messages_byname(messages_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::messages_byname<char>::messages_byname(messages_byname<char> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale *__cloc;
  
  messages<char>::messages(&this->super_messages<char>,__refs);
  (this->super_messages<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__messages_byname_089ef988;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
    __cloc = &(this->super_messages<char>)._M_c_locale_messages;
                    /* try { // try from 089a761c to 089a7633 has its CatchHandler @ 089a764c */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: messages_byname @ 089a7660

/* DWARF original prototype: void messages_byname(messages_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::messages_byname<char>::messages_byname(messages_byname<char> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale *__cloc;
  
  messages<char>::messages(&this->super_messages<char>,__refs);
  (this->super_messages<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__messages_byname_089ef988;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
    __cloc = &(this->super_messages<char>)._M_c_locale_messages;
                    /* try { // try from 089a76d8 to 089a76ef has its CatchHandler @ 089a7708 */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: time_get @ 089a771c

/* DWARF original prototype: void
   time_get(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::time_get
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: time_put @ 089a7734

/* DWARF original prototype: void
   time_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::time_put
          (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: time_put @ 089a774c

/* DWARF original prototype: void
   time_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::time_put
          (time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: __timepunct_cache @ 089a7764

/* DWARF original prototype: void __timepunct_cache(__timepunct_cache<char> * this, size_t __refs)
    */

void __thiscall
std::__timepunct_cache<char>::__timepunct_cache(__timepunct_cache<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
  this->_M_date_format = (char *)0x0;
  this->_M_date_era_format = (char *)0x0;
  this->_M_time_format = (char *)0x0;
  this->_M_time_era_format = (char *)0x0;
  this->_M_date_time_format = (char *)0x0;
  this->_M_date_time_era_format = (char *)0x0;
  this->_M_am = (char *)0x0;
  this->_M_pm = (char *)0x0;
  this->_M_am_pm_format = (char *)0x0;
  this->_M_day1 = (char *)0x0;
  this->_M_day2 = (char *)0x0;
  this->_M_day3 = (char *)0x0;
  this->_M_day4 = (char *)0x0;
  this->_M_day5 = (char *)0x0;
  this->_M_day6 = (char *)0x0;
  this->_M_day7 = (char *)0x0;
  this->_M_aday1 = (char *)0x0;
  this->_M_aday2 = (char *)0x0;
  this->_M_aday3 = (char *)0x0;
  this->_M_aday4 = (char *)0x0;
  this->_M_aday5 = (char *)0x0;
  this->_M_aday6 = (char *)0x0;
  this->_M_aday7 = (char *)0x0;
  this->_M_month01 = (char *)0x0;
  this->_M_month02 = (char *)0x0;
  this->_M_month03 = (char *)0x0;
  this->_M_month04 = (char *)0x0;
  this->_M_month05 = (char *)0x0;
  this->_M_month06 = (char *)0x0;
  this->_M_month07 = (char *)0x0;
  this->_M_month08 = (char *)0x0;
  this->_M_month09 = (char *)0x0;
  this->_M_allocated = false;
  this->_M_month10 = (char *)0x0;
  this->_M_month11 = (char *)0x0;
  this->_M_month12 = (char *)0x0;
  this->_M_amonth01 = (char *)0x0;
  this->_M_amonth02 = (char *)0x0;
  this->_M_amonth03 = (char *)0x0;
  this->_M_amonth04 = (char *)0x0;
  this->_M_amonth05 = (char *)0x0;
  this->_M_amonth06 = (char *)0x0;
  this->_M_amonth07 = (char *)0x0;
  this->_M_amonth08 = (char *)0x0;
  this->_M_amonth09 = (char *)0x0;
  this->_M_amonth10 = (char *)0x0;
  this->_M_amonth11 = (char *)0x0;
  this->_M_amonth12 = (char *)0x0;
  return;
}



----------------------------------------

// Function: __timepunct_cache @ 089a783c

/* DWARF original prototype: void __timepunct_cache(__timepunct_cache<char> * this, size_t __refs)
    */

void __thiscall
std::__timepunct_cache<char>::__timepunct_cache(__timepunct_cache<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
  this->_M_date_format = (char *)0x0;
  this->_M_date_era_format = (char *)0x0;
  this->_M_time_format = (char *)0x0;
  this->_M_time_era_format = (char *)0x0;
  this->_M_date_time_format = (char *)0x0;
  this->_M_date_time_era_format = (char *)0x0;
  this->_M_am = (char *)0x0;
  this->_M_pm = (char *)0x0;
  this->_M_am_pm_format = (char *)0x0;
  this->_M_day1 = (char *)0x0;
  this->_M_day2 = (char *)0x0;
  this->_M_day3 = (char *)0x0;
  this->_M_day4 = (char *)0x0;
  this->_M_day5 = (char *)0x0;
  this->_M_day6 = (char *)0x0;
  this->_M_day7 = (char *)0x0;
  this->_M_aday1 = (char *)0x0;
  this->_M_aday2 = (char *)0x0;
  this->_M_aday3 = (char *)0x0;
  this->_M_aday4 = (char *)0x0;
  this->_M_aday5 = (char *)0x0;
  this->_M_aday6 = (char *)0x0;
  this->_M_aday7 = (char *)0x0;
  this->_M_month01 = (char *)0x0;
  this->_M_month02 = (char *)0x0;
  this->_M_month03 = (char *)0x0;
  this->_M_month04 = (char *)0x0;
  this->_M_month05 = (char *)0x0;
  this->_M_month06 = (char *)0x0;
  this->_M_month07 = (char *)0x0;
  this->_M_month08 = (char *)0x0;
  this->_M_month09 = (char *)0x0;
  this->_M_allocated = false;
  this->_M_month10 = (char *)0x0;
  this->_M_month11 = (char *)0x0;
  this->_M_month12 = (char *)0x0;
  this->_M_amonth01 = (char *)0x0;
  this->_M_amonth02 = (char *)0x0;
  this->_M_amonth03 = (char *)0x0;
  this->_M_amonth04 = (char *)0x0;
  this->_M_amonth05 = (char *)0x0;
  this->_M_amonth06 = (char *)0x0;
  this->_M_amonth07 = (char *)0x0;
  this->_M_amonth08 = (char *)0x0;
  this->_M_amonth09 = (char *)0x0;
  this->_M_amonth10 = (char *)0x0;
  this->_M_amonth11 = (char *)0x0;
  this->_M_amonth12 = (char *)0x0;
  return;
}



----------------------------------------

// Function: __timepunct @ 089a7914

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, __c_locale __cloc, char *
   __s, size_t __refs) */

void __thiscall
std::__timepunct<char>::__timepunct
          (__timepunct<char> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  size_t sVar1;
  char *dst0;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = (__timepunct_cache<char> *)0x0;
                    /* Unresolved local var: void anon_var_0@[???] */
  sVar1 = strlen(__s);
                    /* try { // try from 089a7960 to 089a7967 has its CatchHandler @ 089a79ac */
  dst0 = operator_new___(sVar1 + 1);
  memcpy(dst0,__s,sVar1 + 1);
  this->_M_name_timepunct = dst0;
                    /* try { // try from 089a7984 to 089a798b has its CatchHandler @ 089a79c0 */
  _M_initialize_timepunct(this,__cloc);
  return;
}



----------------------------------------

// Function: __timepunct @ 089a79f4

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, __c_locale __cloc, char *
   __s, size_t __refs) */

void __thiscall
std::__timepunct<char>::__timepunct
          (__timepunct<char> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  size_t sVar1;
  char *dst0;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = (__timepunct_cache<char> *)0x0;
                    /* Unresolved local var: void anon_var_0@[???] */
  sVar1 = strlen(__s);
                    /* try { // try from 089a7a40 to 089a7a47 has its CatchHandler @ 089a7a8c */
  dst0 = operator_new___(sVar1 + 1);
  memcpy(dst0,__s,sVar1 + 1);
  this->_M_name_timepunct = dst0;
                    /* try { // try from 089a7a64 to 089a7a6b has its CatchHandler @ 089a7aa0 */
  _M_initialize_timepunct(this,__cloc);
  return;
}



----------------------------------------

// Function: numpunct @ 089a7ad4

/* DWARF original prototype: void numpunct(numpunct<char> * this, __numpunct_cache<char> * __cache,
   size_t __refs) */

void __thiscall
std::numpunct<char>::numpunct(numpunct<char> *this,__numpunct_cache<char> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
                    /* try { // try from 089a7b00 to 089a7b07 has its CatchHandler @ 089a7b1c */
  _M_initialize_numpunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: numpunct @ 089a7b30

/* DWARF original prototype: void numpunct(numpunct<char> * this, __numpunct_cache<char> * __cache,
   size_t __refs) */

void __thiscall
std::numpunct<char>::numpunct(numpunct<char> *this,__numpunct_cache<char> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
                    /* try { // try from 089a7b5c to 089a7b63 has its CatchHandler @ 089a7b78 */
  _M_initialize_numpunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: numpunct @ 089a7b8c

/* DWARF original prototype: void numpunct(numpunct<char> * this, size_t __refs) */

void __thiscall std::numpunct<char>::numpunct(numpunct<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  this->_M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a7bb8 to 089a7bbf has its CatchHandler @ 089a7bd4 */
  _M_initialize_numpunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: numpunct @ 089a7be8

/* DWARF original prototype: void numpunct(numpunct<char> * this, size_t __refs) */

void __thiscall std::numpunct<char>::numpunct(numpunct<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  this->_M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a7c14 to 089a7c1b has its CatchHandler @ 089a7c30 */
  _M_initialize_numpunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: money_put @ 089a7c44

/* DWARF original prototype: void
   money_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::money_put
          (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_put_089efac0;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: num_put @ 089a7c5c

/* DWARF original prototype: void
   num_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::num_put
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_put_089efa28;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: num_put @ 089a7c74

/* DWARF original prototype: void
   num_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::num_put
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_put_089efa28;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: num_get @ 089a7c8c

/* DWARF original prototype: void
   num_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::num_get
          (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_get_089efa58;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: num_get @ 089a7ca4

/* DWARF original prototype: void
   num_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::num_get
          (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__num_get_089efa58;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: __numpunct_cache @ 089a7cbc

/* DWARF original prototype: void __numpunct_cache(__numpunct_cache<char> * this, size_t __refs) */

void __thiscall
std::__numpunct_cache<char>::__numpunct_cache(__numpunct_cache<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_truename = (char *)0x0;
  this->_M_truename_size = 0;
  this->_M_falsename = (char *)0x0;
  this->_M_falsename_size = 0;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  return;
}



----------------------------------------

// Function: __numpunct_cache @ 089a7cfc

/* DWARF original prototype: void __numpunct_cache(__numpunct_cache<char> * this, size_t __refs) */

void __thiscall
std::__numpunct_cache<char>::__numpunct_cache(__numpunct_cache<char> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_truename = (char *)0x0;
  this->_M_truename_size = 0;
  this->_M_falsename = (char *)0x0;
  this->_M_falsename_size = 0;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  return;
}



----------------------------------------

// Function: numpunct @ 089a7d3c

/* DWARF original prototype: void numpunct(numpunct<char> * this, __c_locale __cloc, size_t __refs)
    */

void __thiscall std::numpunct<char>::numpunct(numpunct<char> *this,__c_locale __cloc,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  this->_M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a7d64 to 089a7d6b has its CatchHandler @ 089a7d80 */
  _M_initialize_numpunct(this,__cloc);
  return;
}



----------------------------------------

// Function: numpunct @ 089a7d94

/* DWARF original prototype: void numpunct(numpunct<char> * this, __c_locale __cloc, size_t __refs)
    */

void __thiscall std::numpunct<char>::numpunct(numpunct<char> *this,__c_locale __cloc,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  this->_M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a7dbc to 089a7dc3 has its CatchHandler @ 089a7dd8 */
  _M_initialize_numpunct(this,__cloc);
  return;
}



----------------------------------------

// Function: __timepunct @ 089a7dec

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, __timepunct_cache<char> *
   __cache, size_t __refs) */

void __thiscall
std::__timepunct<char>::__timepunct
          (__timepunct<char> *this,__timepunct_cache<char> *__cache,size_t __refs)

{
  char *pcVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = __cache;
                    /* try { // try from 089a7e14 to 089a7e2b has its CatchHandler @ 089a7e40 */
  pcVar1 = locale::facet::_S_get_c_name();
  this->_M_name_timepunct = pcVar1;
  _M_initialize_timepunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: __timepunct @ 089a7e54

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, __timepunct_cache<char> *
   __cache, size_t __refs) */

void __thiscall
std::__timepunct<char>::__timepunct
          (__timepunct<char> *this,__timepunct_cache<char> *__cache,size_t __refs)

{
  char *pcVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = __cache;
                    /* try { // try from 089a7e7c to 089a7e93 has its CatchHandler @ 089a7ea8 */
  pcVar1 = locale::facet::_S_get_c_name();
  this->_M_name_timepunct = pcVar1;
  _M_initialize_timepunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: __timepunct @ 089a7ebc

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, size_t __refs) */

void __thiscall std::__timepunct<char>::__timepunct(__timepunct<char> *this,size_t __refs)

{
  char *pcVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = (__timepunct_cache<char> *)0x0;
                    /* try { // try from 089a7ee4 to 089a7efb has its CatchHandler @ 089a7f10 */
  pcVar1 = locale::facet::_S_get_c_name();
  this->_M_name_timepunct = pcVar1;
  _M_initialize_timepunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: __timepunct @ 089a7f24

/* DWARF original prototype: void __timepunct(__timepunct<char> * this, size_t __refs) */

void __thiscall std::__timepunct<char>::__timepunct(__timepunct<char> *this,size_t __refs)

{
  char *pcVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_089efbf0;
  this->_M_data = (__timepunct_cache<char> *)0x0;
                    /* try { // try from 089a7f4c to 089a7f63 has its CatchHandler @ 089a7f78 */
  pcVar1 = locale::facet::_S_get_c_name();
  this->_M_name_timepunct = pcVar1;
  _M_initialize_timepunct(this,(__c_locale)0x0);
  return;
}



----------------------------------------

// Function: __moneypunct_cache @ 089a7f8c

/* DWARF original prototype: void __moneypunct_cache(__moneypunct_cache<char,true> * this, size_t
   __refs) */

void __thiscall
std::__moneypunct_cache<char,true>::__moneypunct_cache
          (__moneypunct_cache<char,true> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  this->_M_curr_symbol = (char *)0x0;
  this->_M_curr_symbol_size = 0;
  this->_M_positive_sign = (char *)0x0;
  this->_M_positive_sign_size = 0;
  this->_M_negative_sign = (char *)0x0;
  this->_M_negative_sign_size = 0;
  this->_M_frac_digits = 0;
  *(undefined4 *)(this->_M_pos_format).field = 0;
  *(undefined4 *)(this->_M_neg_format).field = 0;
  return;
}



----------------------------------------

// Function: __moneypunct_cache @ 089a7fe8

/* DWARF original prototype: void __moneypunct_cache(__moneypunct_cache<char,true> * this, size_t
   __refs) */

void __thiscall
std::__moneypunct_cache<char,true>::__moneypunct_cache
          (__moneypunct_cache<char,true> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  this->_M_curr_symbol = (char *)0x0;
  this->_M_curr_symbol_size = 0;
  this->_M_positive_sign = (char *)0x0;
  this->_M_positive_sign_size = 0;
  this->_M_negative_sign = (char *)0x0;
  this->_M_negative_sign_size = 0;
  this->_M_frac_digits = 0;
  *(undefined4 *)(this->_M_pos_format).field = 0;
  *(undefined4 *)(this->_M_neg_format).field = 0;
  return;
}



----------------------------------------

// Function: money_get @ 089a8044

/* DWARF original prototype: void
   money_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::money_get
          (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_get_089efad8;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: money_get @ 089a805c

/* DWARF original prototype: void
   money_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::money_get
          (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_get_089efad8;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: money_put @ 089a8074

/* DWARF original prototype: void
   money_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::money_put
          (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__money_put_089efac0;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: __moneypunct_cache @ 089a808c

/* DWARF original prototype: void __moneypunct_cache(__moneypunct_cache<char,false> * this, size_t
   __refs) */

void __thiscall
std::__moneypunct_cache<char,false>::__moneypunct_cache
          (__moneypunct_cache<char,false> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
  this->_M_allocated = false;
  this->_M_grouping = (char *)0x0;
  this->_M_grouping_size = 0;
  this->_M_use_grouping = false;
  this->_M_decimal_point = '\0';
  this->_M_thousands_sep = '\0';
  this->_M_curr_symbol = (char *)0x0;
  this->_M_curr_symbol_size = 0;
  this->_M_positive_sign = (char *)0x0;
  this->_M_positive_sign_size = 0;
  this->_M_negative_sign = (char *)0x0;
  this->_M_negative_sign_size = 0;
  this->_M_frac_digits = 0;
  *(undefined4 *)(this->_M_pos_format).field = 0;
  *(undefined4 *)(this->_M_neg_format).field = 0;
  return;
}



----------------------------------------

// Function: do_positive_sign @ 089a80e8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_positive_sign(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::do_positive_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a8100 to 089a8107 has its CatchHandler @ 089a811c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_positive_sign,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_curr_symbol @ 089a8124

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_curr_symbol(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::do_curr_symbol
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a813c to 089a8143 has its CatchHandler @ 089a8158 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_curr_symbol,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_grouping @ 089a8160

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_grouping(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::do_grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a8178 to 089a817f has its CatchHandler @ 089a8194 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_grouping,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_negative_sign @ 089a819c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_negative_sign(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::do_negative_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a81b4 to 089a81bb has its CatchHandler @ 089a81d0 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_negative_sign,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_positive_sign @ 089a81d8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_positive_sign(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::do_positive_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a81f0 to 089a81f7 has its CatchHandler @ 089a820c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_positive_sign,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_curr_symbol @ 089a8214

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_curr_symbol(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::do_curr_symbol
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a822c to 089a8233 has its CatchHandler @ 089a8248 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_curr_symbol,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_grouping @ 089a8250

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_grouping(moneypunct<char,false> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,false>::do_grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,false> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a8268 to 089a826f has its CatchHandler @ 089a8284 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_grouping,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_falsename @ 089a828c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_falsename(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::do_falsename
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a82a4 to 089a82ab has its CatchHandler @ 089a82c0 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_falsename,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_truename @ 089a82c8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_truename(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::do_truename
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a82e0 to 089a82e7 has its CatchHandler @ 089a82fc */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_truename,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_grouping @ 089a8304

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_grouping(numpunct<char> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::numpunct<char>::do_grouping
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          numpunct<char> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a831c to 089a8323 has its CatchHandler @ 089a8338 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_grouping,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_negative_sign @ 089a8340

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_negative_sign(moneypunct<char,true> * this) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::moneypunct<char,true>::do_negative_sign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          moneypunct<char,true> *this)

{
  allocator<char> aaStack_10 [8];
  
                    /* try { // try from 089a8358 to 089a835f has its CatchHandler @ 089a8374 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,this->_M_data->_M_negative_sign,aaStack_10);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: moneypunct @ 089a837c

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this, __c_locale __cloc, char *
   __s, size_t __refs) */

void __thiscall
std::moneypunct<char,true>::moneypunct
          (moneypunct<char,true> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  this->_M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a83a4 to 089a83ab has its CatchHandler @ 089a83c0 */
  _M_initialize_moneypunct(this,__cloc,__s);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a83d4

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this, __c_locale __cloc, char *
   __s, size_t __refs) */

void __thiscall
std::moneypunct<char,true>::moneypunct
          (moneypunct<char,true> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  this->_M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a83fc to 089a8403 has its CatchHandler @ 089a8418 */
  _M_initialize_moneypunct(this,__cloc,__s);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a842c

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this,
   __moneypunct_cache<char,true> * __cache, size_t __refs) */

void __thiscall
std::moneypunct<char,true>::moneypunct
          (moneypunct<char,true> *this,__moneypunct_cache<char,true> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
                    /* try { // try from 089a845c to 089a8463 has its CatchHandler @ 089a8478 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a848c

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this,
   __moneypunct_cache<char,true> * __cache, size_t __refs) */

void __thiscall
std::moneypunct<char,true>::moneypunct
          (moneypunct<char,true> *this,__moneypunct_cache<char,true> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
                    /* try { // try from 089a84bc to 089a84c3 has its CatchHandler @ 089a84d8 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a84ec

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this, size_t __refs) */

void __thiscall std::moneypunct<char,true>::moneypunct(moneypunct<char,true> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  this->_M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a851c to 089a8523 has its CatchHandler @ 089a8538 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a854c

/* DWARF original prototype: void moneypunct(moneypunct<char,true> * this, size_t __refs) */

void __thiscall std::moneypunct<char,true>::moneypunct(moneypunct<char,true> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  this->_M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a857c to 089a8583 has its CatchHandler @ 089a8598 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a85ac

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this, __c_locale __cloc, char
   * __s, size_t __refs) */

void __thiscall
std::moneypunct<char,false>::moneypunct
          (moneypunct<char,false> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  this->_M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a85d4 to 089a85db has its CatchHandler @ 089a85f0 */
  _M_initialize_moneypunct(this,__cloc,__s);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a8604

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this, __c_locale __cloc, char
   * __s, size_t __refs) */

void __thiscall
std::moneypunct<char,false>::moneypunct
          (moneypunct<char,false> *this,__c_locale __cloc,char *__s,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  this->_M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a862c to 089a8633 has its CatchHandler @ 089a8648 */
  _M_initialize_moneypunct(this,__cloc,__s);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a865c

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this,
   __moneypunct_cache<char,false> * __cache, size_t __refs) */

void __thiscall
std::moneypunct<char,false>::moneypunct
          (moneypunct<char,false> *this,__moneypunct_cache<char,false> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
                    /* try { // try from 089a868c to 089a8693 has its CatchHandler @ 089a86a8 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a86bc

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this,
   __moneypunct_cache<char,false> * __cache, size_t __refs) */

void __thiscall
std::moneypunct<char,false>::moneypunct
          (moneypunct<char,false> *this,__moneypunct_cache<char,false> *__cache,size_t __refs)

{
  this->_M_data = __cache;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
                    /* try { // try from 089a86ec to 089a86f3 has its CatchHandler @ 089a8708 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: moneypunct @ 089a871c

/* DWARF original prototype: void moneypunct(moneypunct<char,false> * this, size_t __refs) */

void __thiscall std::moneypunct<char,false>::moneypunct(moneypunct<char,false> *this,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  this->_M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a874c to 089a8753 has its CatchHandler @ 089a8768 */
  _M_initialize_moneypunct(this,(__c_locale)0x0,(char *)0x0);
  return;
}



----------------------------------------

// Function: _M_convert_to_char @ 089a877c

/* DWARF original prototype: char * _M_convert_to_char(messages<char> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __msg) */

char * __thiscall
std::messages<char>::_M_convert_to_char
          (messages<char> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__msg)

{
  return (__msg->_M_dataplus)._M_p;
}



----------------------------------------

// Function: messages @ 089a8784

/* DWARF original prototype: void messages(messages<char> * this, __c_locale param_1, char *
   param_2, size_t __refs) */

void __thiscall
std::messages<char>::messages(messages<char> *this,__c_locale param_1,char *param_2,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a87a8 to 089a87af has its CatchHandler @ 089a87c8 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_messages = piVar1;
  return;
}



----------------------------------------

// Function: messages @ 089a87dc

/* DWARF original prototype: void messages(messages<char> * this, __c_locale param_1, char *
   param_2, size_t __refs) */

void __thiscall
std::messages<char>::messages(messages<char> *this,__c_locale param_1,char *param_2,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a8800 to 089a8807 has its CatchHandler @ 089a8820 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_messages = piVar1;
  return;
}



----------------------------------------

// Function: messages @ 089a8834

/* DWARF original prototype: void messages(messages<char> * this, size_t __refs) */

void __thiscall std::messages<char>::messages(messages<char> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__messages_089efb60;
                    /* try { // try from 089a8858 to 089a885f has its CatchHandler @ 089a8878 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_messages = piVar1;
  return;
}



----------------------------------------

// Function: time_get @ 089a888c

/* DWARF original prototype: void
   time_get(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this, size_t
   __refs) */

void __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::time_get
          (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          size_t __refs)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: _M_convert_from_char @ 089a88a4

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   _M_convert_from_char(messages<char> * this, char * param_1) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::messages<char>::_M_convert_from_char
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          messages<char> *this,char *param_1)

{
  (__return_storage_ptr__->_M_dataplus)._M_p = (char *)0x8a1e514;
  return __return_storage_ptr__;
}



----------------------------------------

// Function: time_get_byname @ 089a88bc

/* DWARF original prototype: void
   time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, char * param_1, size_t __refs) */

void __thiscall
std::time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::time_get_byname
          (time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *param_1,size_t __refs)

{
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_get_byname_089ef9a8;
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: time_put_byname @ 089a88d4

/* DWARF original prototype: void
   time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, char * param_1, size_t __refs) */

void __thiscall
std::time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::time_put_byname
          (time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *param_1,size_t __refs)

{
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_put_byname_089ef9f8;
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: time_get_byname @ 089a88ec

/* DWARF original prototype: void
   time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, char * param_1, size_t __refs) */

void __thiscall
std::time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::time_get_byname
          (time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *param_1,size_t __refs)

{
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_get_byname_089ef9a8;
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: time_put_byname @ 089a8904

/* DWARF original prototype: void
   time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, char * param_1, size_t __refs) */

void __thiscall
std::time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::time_put_byname
          (time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *param_1,size_t __refs)

{
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_put_byname_089ef9f8;
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _M_refcount = (uint)(__refs != 0);
  return;
}



----------------------------------------

// Function: _M_group_float @ 089a891c

/* DWARF original prototype: void
   _M_group_float(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   char * __grouping, size_t __grouping_size, char __sep, char * __p, char * __new, char * __cs, int
   * __len) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_group_float
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          char *__grouping,size_t __grouping_size,char __sep,char *__p,char *__new,char *__cs,
          int *__len)

{
  char *pcVar1;
  void *in_t0;
  char *in_t1;
  int in_t2;
  int *in_t3;
  char *unaff_s4;
  char *unaff_retaddr;
  
                    /* Unresolved local var: int __declen@[???]
                       Unresolved local var: char * __p2@[???]
                       Unresolved local var: int __newlen@[???] */
  if (in_t0 != (void *)0x0) {
    pcVar1 = __add_grouping<char>(in_t1,__sep,__grouping,__grouping_size,unaff_s4,unaff_retaddr);
    memcpy(pcVar1,in_t0,*in_t3 - ((int)in_t0 - in_t2));
    *in_t3 = (int)(pcVar1 + ((*in_t3 - ((int)in_t0 - in_t2)) - (int)in_t1));
    return;
  }
  pcVar1 = __add_grouping<char>(in_t1,__sep,__grouping,__grouping_size,unaff_s4,unaff_retaddr);
  *in_t3 = (int)pcVar1 - (int)in_t1;
  return;
}



----------------------------------------

// Function: put @ 089a8a04

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, tm * __tm,
   char * __beg, char * __end) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,tm *__tm,
          char *__beg,char *__end)

{
  byte bVar1;
  char cVar2;
  ctype<char> *pcVar3;
  int iVar4;
  uint uVar5;
  byte *in_t1;
  byte *in_t2;
  byte *pbVar6;
  undefined8 uVar7;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_50;
  char local_4c;
  undefined4 local_48;
  char local_44;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_40;
  char local_3c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_38;
  undefined4 local_34;
  int local_30;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???] */
  local_3c = (char)(this->super_facet)._M_refcount;
  local_40 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_30 = (int)__s._M_failed;
  pcVar3 = use_facet<std::ctype<char>_>((locale *)&__s._M_sbuf[3]._M_in_end);
  uVar7 = CONCAT44(local_34,local_48);
  do {
    while( true ) {
      if (in_t1 == in_t2) {
        return local_40;
      }
      local_34 = (undefined4)((ulonglong)uVar7 >> 0x20);
      local_48 = (undefined4)uVar7;
      bVar1 = *in_t1;
                    /* Unresolved local var: char __t@[???] */
      cVar2 = pcVar3->_M_narrow[bVar1];
      if (cVar2 == '\0') {
        iVar4 = (*(pcVar3->super_facet)._vptr_facet[8])(pcVar3,(int)(char)bVar1,0);
        uVar7 = CONCAT44(local_34,local_48);
        cVar2 = (char)iVar4;
        if (iVar4 != 0) {
          pcVar3->_M_narrow[bVar1] = cVar2;
        }
      }
      local_48 = (undefined4)uVar7;
      local_34 = (undefined4)((ulonglong)uVar7 >> 0x20);
      if (cVar2 == '%') break;
      bVar1 = *in_t1;
      if (local_3c == '\0') {
                    /* Unresolved local var: int __ret@[???] */
        if (*(basic_streambuf<char,std::char_traits<char>_> **)&local_40[2]._M_failed <
            local_40[3]._M_sbuf) {
          *(byte *)&(*(basic_streambuf<char,std::char_traits<char>_> **)&local_40[2]._M_failed)->
                    _vptr_basic_streambuf = bVar1;
          uVar5 = (uint)bVar1;
          *(int *)&local_40[2]._M_failed = *(int *)&local_40[2]._M_failed + 1;
        }
        else {
          uVar5 = (*(code *)local_40->_M_sbuf[1]._M_out_cur)(local_40,bVar1);
          uVar7 = CONCAT44(local_34,local_48);
        }
        if (uVar5 == 0xffffffff) {
          local_3c = '\x01';
        }
      }
      in_t1 = in_t1 + 1;
    }
    pbVar6 = in_t1 + 1;
    if (in_t2 == pbVar6) {
      return local_40;
    }
    bVar1 = *pbVar6;
                    /* Unresolved local var: char __format@[???]
                       Unresolved local var: char __mod@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: char __t@[???] */
    iVar4 = (int)pcVar3->_M_narrow[bVar1];
    if (iVar4 == 0) {
      iVar4 = (*(pcVar3->super_facet)._vptr_facet[8])(pcVar3,(int)(char)bVar1,0);
      uVar7 = CONCAT44(local_34,local_48);
      if (iVar4 != 0) {
        pcVar3->_M_narrow[bVar1] = (char)iVar4;
        goto LAB_089a8b00;
      }
      cVar2 = '\0';
    }
    else {
LAB_089a8b00:
      cVar2 = (char)iVar4;
    }
    local_34 = (undefined4)((ulonglong)uVar7 >> 0x20);
    local_48 = (undefined4)uVar7;
    if ((cVar2 == 'E') || (cVar2 == 'O')) {
      pbVar6 = in_t1 + 2;
      if (in_t2 == pbVar6) {
        return local_40;
      }
      bVar1 = *pbVar6;
                    /* Unresolved local var: char __t@[???] */
      if (pcVar3->_M_narrow[bVar1] == '\0') {
        iVar4 = (*(pcVar3->super_facet)._vptr_facet[8])(pcVar3,(int)(char)bVar1,0);
        uVar7 = CONCAT44(local_34,local_48);
        if (iVar4 != 0) {
          pcVar3->_M_narrow[bVar1] = (char)iVar4;
          uVar7 = CONCAT44(local_34,local_48);
        }
      }
    }
    local_34 = (undefined4)((ulonglong)uVar7 >> 0x20);
    local_48 = (undefined4)uVar7;
    local_50 = local_40;
    local_4c = local_3c;
    uVar7 = (*(code *)__return_storage_ptr__->_M_sbuf->_M_in_cur)
                      (__return_storage_ptr__,&local_50,__s._M_sbuf,local_30);
    local_40 = (ostreambuf_iterator<char,std::char_traits<char>_> *)uVar7;
    local_34._0_1_ = (char)((ulonglong)uVar7 >> 0x20);
    in_t1 = pbVar6 + 1;
    local_44 = (char)local_34;
    local_3c = (char)local_34;
    local_38 = local_40;
  } while( true );
}



----------------------------------------

// Function: ~time_put_byname @ 089a8c84

/* DWARF original prototype: void
   ~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_put_byname @ 089a8c94

/* DWARF original prototype: void
   ~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_get_byname @ 089a8ca4

/* DWARF original prototype: void
   ~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_get_byname @ 089a8cb4

/* DWARF original prototype: void
   ~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet((facet *)this,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~time_get_byname @ 089a8ce8

/* DWARF original prototype: void
   ~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_get_byname(time_get_byname<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_get_089ef9d0;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ~time_put_byname @ 089a8cf8

/* DWARF original prototype: void
   ~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, int __in_chrg) */

void __thiscall
std::time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
~time_put_byname(time_put_byname<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
                 *this,int __in_chrg)

{
  (this->super_time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>).super_facet.
  _vptr_facet = (_func_int_varargs **)&PTR__time_put_089efa10;
  locale::facet::~facet((facet *)this,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: numpunct_byname @ 089a8d2c

/* DWARF original prototype: void numpunct_byname(numpunct_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::numpunct_byname<char>::numpunct_byname(numpunct_byname<char> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_numpunct<char>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_089efc30;
  (this->super_numpunct<char>)._M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a8d5c to 089a8d63 has its CatchHandler @ 089a8dfc */
  numpunct<char>::_M_initialize_numpunct(&this->super_numpunct<char>,(__c_locale)0x0);
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_byname_089efa98;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a8db8 to 089a8dd3 has its CatchHandler @ 089a8de8 */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    numpunct<char>::_M_initialize_numpunct(&this->super_numpunct<char>,local_18[0]);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: numpunct_byname @ 089a8e10

/* DWARF original prototype: void numpunct_byname(numpunct_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::numpunct_byname<char>::numpunct_byname(numpunct_byname<char> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_numpunct<char>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_089efc30;
  (this->super_numpunct<char>)._M_data = (__numpunct_cache<char> *)0x0;
                    /* try { // try from 089a8e40 to 089a8e47 has its CatchHandler @ 089a8ee0 */
  numpunct<char>::_M_initialize_numpunct(&this->super_numpunct<char>,(__c_locale)0x0);
  (this->super_numpunct<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__numpunct_byname_089efa98;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a8e9c to 089a8eb7 has its CatchHandler @ 089a8ecc */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    numpunct<char>::_M_initialize_numpunct(&this->super_numpunct<char>,local_18[0]);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: moneypunct_byname @ 089a8ef4

/* DWARF original prototype: void moneypunct_byname(moneypunct_byname<char,false> * this, char *
   __s, size_t __refs) */

void __thiscall
std::moneypunct_byname<char,false>::moneypunct_byname
          (moneypunct_byname<char,false> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_moneypunct<char,false>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_089efb80;
  (this->super_moneypunct<char,false>)._M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a8f28 to 089a8f2f has its CatchHandler @ 089a8fcc */
  moneypunct<char,false>::_M_initialize_moneypunct
            (&this->super_moneypunct<char,false>,(__c_locale)0x0,(char *)0x0);
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efb28;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a8f84 to 089a8fa3 has its CatchHandler @ 089a8fb8 */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    moneypunct<char,false>::_M_initialize_moneypunct
              (&this->super_moneypunct<char,false>,local_18[0],(char *)0x0);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: moneypunct_byname @ 089a8fe0

/* DWARF original prototype: void moneypunct_byname(moneypunct_byname<char,false> * this, char *
   __s, size_t __refs) */

void __thiscall
std::moneypunct_byname<char,false>::moneypunct_byname
          (moneypunct_byname<char,false> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_moneypunct<char,false>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_089efb80;
  (this->super_moneypunct<char,false>)._M_data = (__moneypunct_cache<char,false> *)0x0;
                    /* try { // try from 089a9014 to 089a901b has its CatchHandler @ 089a90b8 */
  moneypunct<char,false>::_M_initialize_moneypunct
            (&this->super_moneypunct<char,false>,(__c_locale)0x0,(char *)0x0);
  (this->super_moneypunct<char,false>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efb28;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a9070 to 089a908f has its CatchHandler @ 089a90a4 */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    moneypunct<char,false>::_M_initialize_moneypunct
              (&this->super_moneypunct<char,false>,local_18[0],(char *)0x0);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: moneypunct_byname @ 089a90cc

/* DWARF original prototype: void moneypunct_byname(moneypunct_byname<char,true> * this, char * __s,
   size_t __refs) */

void __thiscall
std::moneypunct_byname<char,true>::moneypunct_byname
          (moneypunct_byname<char,true> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_moneypunct<char,true>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  (this->super_moneypunct<char,true>)._M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a9100 to 089a9107 has its CatchHandler @ 089a91a4 */
  moneypunct<char,true>::_M_initialize_moneypunct
            (&this->super_moneypunct<char,true>,(__c_locale)0x0,(char *)0x0);
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efaf0;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a915c to 089a917b has its CatchHandler @ 089a9190 */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    moneypunct<char,true>::_M_initialize_moneypunct
              (&this->super_moneypunct<char,true>,local_18[0],(char *)0x0);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: moneypunct_byname @ 089a91b8

/* DWARF original prototype: void moneypunct_byname(moneypunct_byname<char,true> * this, char * __s,
   size_t __refs) */

void __thiscall
std::moneypunct_byname<char,true>::moneypunct_byname
          (moneypunct_byname<char,true> *this,char *__s,size_t __refs)

{
  int iVar1;
  __c_locale local_18 [2];
  
  (this->super_moneypunct<char,true>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  (this->super_moneypunct<char,true>)._M_data = (__moneypunct_cache<char,true> *)0x0;
                    /* try { // try from 089a91ec to 089a91f3 has its CatchHandler @ 089a9290 */
  moneypunct<char,true>::_M_initialize_moneypunct
            (&this->super_moneypunct<char,true>,(__c_locale)0x0,(char *)0x0);
  (this->super_moneypunct<char,true>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__moneypunct_byname_089efaf0;
  iVar1 = strcmp(__s,"C");
  if ((iVar1 != 0) && (iVar1 = strcmp(__s,"POSIX"), iVar1 != 0)) {
                    /* Unresolved local var: void anon_var_0@[???] */
                    /* try { // try from 089a9248 to 089a9267 has its CatchHandler @ 089a927c */
    locale::facet::_S_create_c_locale(local_18,__s,(__c_locale)0x0);
    moneypunct<char,true>::_M_initialize_moneypunct
              (&this->super_moneypunct<char,true>,local_18[0],(char *)0x0);
    locale::facet::_S_destroy_c_locale(local_18);
    return;
  }
  return;
}



----------------------------------------

// Function: _M_extract_num @ 089a92a4

/* WARNING: Removing unreachable block (ram,0x089a9438) */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_num(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, int * __member, int __min, int __max,
   size_t __len, ios_base * __io, _Ios_Iostate * __err) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract_num
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,int *__member,int __min,int __max,
          size_t __len,ios_base *__io,_Ios_Iostate *__err)

{
  bool bVar1;
  ctype<char> *pcVar2;
  uint uVar3;
  int iVar4;
  char cVar5;
  _func_int_varargs **pp_Var6;
  int iVar7;
  int in_t0;
  int in_t1;
  int in_t2;
  int in_t3;
  uint uVar8;
  uint uVar9;
  char *pcVar10;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar11;
  byte bVar12;
  _func_int_varargs **pp_Var13;
  int iVar14;
  char *pcVar15;
  uint *local_res0;
  int local_44;
  int local_40;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: int __mult@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: int __value@[???] */
  piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  uVar8 = (this->super_facet)._M_refcount;
  pcVar15 = (__beg._M_sbuf)->_M_in_beg;
  pcVar2 = use_facet<std::ctype<char>_>((locale *)(in_t3 + 0x6c));
  if (in_t2 == 2) {
    iVar14 = 10;
  }
  else {
    iVar14 = 1000;
    if (in_t2 != 4) {
      iVar14 = 1;
    }
  }
  local_40 = 0;
  local_44 = 0;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089a9454;
LAB_089a934c:
  uVar3 = uVar8;
  if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
      uVar8 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar8 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
    }
    uVar3 = uVar8;
    if (uVar8 == 0xffffffff) {
      piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      uVar3 = 0xffffffff;
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  uVar9 = uVar8;
  uVar8 = uVar3;
  if (pp_Var13 == (_func_int_varargs **)0x0) goto LAB_089a9464;
LAB_089a9360:
  if (pcVar15 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var13[2] < pp_Var13[3]) {
      pcVar15 = (char *)(uint)(byte)*pp_Var13[2];
    }
    else {
      pcVar15 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
    }
    if (pcVar15 == (char *)0xffffffff) {
      pp_Var13 = (_func_int_varargs **)0x0;
      goto LAB_089a9464;
    }
  }
  bVar1 = pcVar15 == (char *)0xffffffff;
  if (uVar9 != 0xffffffff) goto LAB_089a946c;
LAB_089a9374:
  if (bVar1) {
LAB_089a9478:
    if (local_40 == in_t2) {
LAB_089a958c:
      *(int *)__beg._M_c = local_44;
    }
    else {
LAB_089a9488:
      *local_res0 = *local_res0 | 4;
    }
    return piVar11;
  }
  do {
    if (local_40 == in_t2) goto LAB_089a958c;
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar7 = -1;
    if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar3 = 0xff;
LAB_089a93a4:
                    /* Unresolved local var: char __t@[???] */
      pcVar10 = pcVar2->_M_widen + (uVar3 - 0x1d);
      iVar4 = (int)pcVar10[0x11d];
      if (iVar4 != 0) goto LAB_089a93b8;
      pp_Var6 = (pcVar2->super_facet)._vptr_facet;
LAB_089a955c:
      iVar4 = (*pp_Var6[8])(pcVar2,iVar7,0x2a);
      if (iVar4 != 0x2a) {
        pcVar10[0x11d] = (char)iVar4;
        goto LAB_089a93b8;
      }
      cVar5 = '*';
    }
    else {
      if (uVar8 != 0xffffffff) {
        bVar12 = (byte)uVar8;
LAB_089a93a0:
        iVar7 = (int)(char)bVar12;
        uVar3 = (uint)bVar12;
        goto LAB_089a93a4;
      }
                    /* Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
        uVar8 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar8 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11,0xffffffff);
      }
      bVar12 = (byte)uVar8;
      if (uVar8 != 0xffffffff) goto LAB_089a93a0;
      pcVar10 = pcVar2->_M_widen + 0xe2;
      iVar4 = (int)pcVar2->_M_narrow[0xff];
      piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      iVar7 = -1;
      if (iVar4 == 0) {
        pp_Var6 = (pcVar2->super_facet)._vptr_facet;
        goto LAB_089a955c;
      }
LAB_089a93b8:
      cVar5 = (char)iVar4;
    }
    if (9 < ((int)cVar5 - 0x30U & 0xff)) goto LAB_089a9488;
                    /* Unresolved local var: int __valuec@[???] */
    local_44 = local_44 * 10 + (int)cVar5 + -0x30;
    if ((in_t1 < iVar14 * local_44) || (iVar14 + iVar14 * local_44 < in_t0 + 1)) goto LAB_089a9488;
    if (piVar11 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
        piVar11[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        uVar8 = 0xffffffff;
      }
      else {
        (*(code *)piVar11->_M_sbuf[1]._M_in_cur)(piVar11);
        uVar8 = 0xffffffff;
      }
    }
    iVar14 = iVar14 / 10;
    local_40 = local_40 + 1;
    if (piVar11 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089a934c;
LAB_089a9454:
    uVar9 = 0xffffffff;
    if (pp_Var13 != (_func_int_varargs **)0x0) goto LAB_089a9360;
LAB_089a9464:
    bVar1 = true;
    if (uVar9 == 0xffffffff) goto LAB_089a9374;
LAB_089a946c:
    if (!bVar1) goto LAB_089a9478;
  } while( true );
}



----------------------------------------

// Function: _M_extract_name @ 089a95f4

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_name(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, int * __member, char * * __names, size_t
   __indexlen, ios_base * __io, _Ios_Iostate * __err) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract_name
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,int *__member,char **__names,
          size_t __indexlen,ios_base *__io,_Ios_Iostate *__err)

{
  bool bVar1;
  char cVar2;
  int iVar3;
  size_t sVar4;
  uint uVar5;
  char *pcVar6;
  size_t *psVar7;
  undefined4 *in_t0;
  int in_t1;
  int in_t2;
  uint *in_t3;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar8;
  undefined4 *puVar9;
  int *piVar10;
  _func_int_varargs **pp_Var11;
  uint uVar12;
  int *piVar13;
  char cVar14;
  int iVar15;
  int iVar16;
  char *pcVar17;
  uint uVar18;
  size_t sVar19;
  size_t local_78 [4];
  int *local_68;
  _func_int_varargs **local_64;
  char *local_60;
  char *local_5c;
  uint local_58;
  ctype<char> *local_54;
  int *local_50;
  int local_4c;
  uint *local_48;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: int * __matches@[???]
                       Unresolved local var: size_t __nmatches@[???]
                       Unresolved local var: size_t __pos@[???]
                       Unresolved local var: bool __testvalid@[???]
                       Unresolved local var: char * __name@[???] */
  local_50 = (int *)__beg._M_c;
  pp_Var11 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_5c = (__beg._M_sbuf)->_M_in_beg;
  piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar18 = (this->super_facet)._M_refcount;
  local_4c = in_t1;
  local_48 = in_t3;
  local_54 = use_facet<std::ctype<char>_>((locale *)(in_t2 + 0x6c));
  iVar16 = -(local_4c * 4 + 0xeU & 0xfffffff8);
  local_68 = (int *)((int)local_78 + iVar16);
  local_40 = 0;
  local_3c = 0;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  uVar5 = uVar18;
  if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar12 = 0xffffffff;
    piVar10 = (int *)((int)local_78 + iVar16);
  }
  else {
    uVar12 = uVar18;
    piVar10 = (int *)((int)local_78 + iVar16);
    if (uVar18 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
        uVar12 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
        local_68 = (int *)((int)local_78 + iVar16);
      }
      else {
        uVar12 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
      }
      uVar5 = uVar12;
      piVar10 = local_68;
      if (uVar12 == 0xffffffff) {
        piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar5 = uVar18;
      }
    }
  }
  local_68 = piVar10;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[DW_OP_breg30(s8): +28] */
  if (pp_Var11 == (_func_int_varargs **)0x0) {
LAB_089a9b6c:
    bVar1 = true;
    local_64 = (_func_int_varargs **)0x0;
  }
  else {
    if (local_5c == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var11[2] < pp_Var11[3]) {
        local_5c = (char *)(uint)(byte)*pp_Var11[2];
      }
      else {
        local_5c = (char *)(**(code **)(*pp_Var11 + 0x24))(pp_Var11);
      }
      if (local_5c == (char *)0xffffffff) goto LAB_089a9b6c;
    }
    bVar1 = local_5c == (char *)0xffffffff;
    local_64 = pp_Var11;
  }
  if (uVar12 == 0xffffffff) {
    if (bVar1) goto LAB_089a96d0;
  }
  else if (!bVar1) goto LAB_089a96d0;
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089a9bc8:
    iVar16 = -1;
  }
  else if (uVar5 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
      uVar5 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar5 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
    }
    if (uVar5 == 0xffffffff) {
      piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      goto LAB_089a9bc8;
    }
    iVar16 = (int)(char)uVar5;
  }
  else {
    iVar16 = (int)(char)uVar5;
  }
                    /* Unresolved local var: size_t __i1@[???] */
  if (local_4c != 0) {
    uVar18 = 0;
    iVar15 = 0;
    puVar9 = in_t0;
    piVar10 = local_68;
    do {
      while( true ) {
        pcVar6 = (char *)*puVar9;
        puVar9 = puVar9 + 1;
        if ((iVar16 != *pcVar6) &&
           (iVar3 = (*(local_54->super_facet)._vptr_facet[2])(local_54,(int)*pcVar6),
           iVar16 != (char)iVar3)) break;
        *piVar10 = iVar15;
        iVar15 = iVar15 + 1;
        uVar18 = uVar18 + 1;
        piVar10 = piVar10 + 1;
        if (local_4c == iVar15) goto LAB_089a97b4;
      }
      iVar15 = iVar15 + 1;
    } while (local_4c != iVar15);
LAB_089a97b4:
    if (1 < uVar18) {
      local_58 = 0;
      local_60 = local_5c;
                    /* Unresolved local var: size_t __minlen@[???] */
LAB_089a97d0:
      piVar10 = local_68;
      uVar12 = 1;
      local_78[1] = strlen((char *)in_t0[*local_68]);
      do {
                    /* Unresolved local var: size_t __i2@[???] */
        local_78[0] = strlen((char *)in_t0[piVar10[1]]);
        psVar7 = local_78;
        if (local_78[1] <= local_78[0]) {
          psVar7 = local_78 + 1;
        }
        local_78[1] = *psVar7;
        uVar12 = uVar12 + 1;
        piVar10 = piVar10 + 1;
      } while (uVar12 < uVar18);
      if (piVar8 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
          piVar8[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        }
        else {
          (*(code *)piVar8->_M_sbuf[1]._M_in_cur)(piVar8);
        }
        uVar5 = 0xffffffff;
      }
      local_58 = local_58 + 1;
      if (local_58 < local_78[1]) {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          uVar12 = 0xffffffff;
LAB_089a988c:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (local_64 == (_func_int_varargs **)0x0) goto LAB_089a9a90;
LAB_089a9898:
          if (local_60 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (local_64[2] < local_64[3]) {
              local_60 = (char *)(uint)(byte)*local_64[2];
            }
            else {
              local_60 = (char *)(**(code **)(*local_64 + 0x24))(local_64);
            }
            if (local_60 == (char *)0xffffffff) {
              local_64 = (_func_int_varargs **)0x0;
              goto LAB_089a9a90;
            }
          }
          bVar1 = local_60 == (char *)0xffffffff;
          piVar10 = local_68;
        }
        else {
          uVar12 = uVar5;
          if (uVar5 != 0xffffffff) goto LAB_089a988c;
                    /* Unresolved local var: int __ret@[???] */
          if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
            uVar5 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar5 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
          }
          uVar12 = uVar5;
          if (uVar5 != 0xffffffff) goto LAB_089a988c;
          uVar12 = 0xffffffff;
          piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          if (local_64 != (_func_int_varargs **)0x0) goto LAB_089a9898;
LAB_089a9a90:
          bVar1 = true;
          piVar10 = local_68;
        }
        if (uVar12 == 0xffffffff) {
          if (bVar1) goto LAB_089a96d0;
        }
        else if (!bVar1) goto LAB_089a96d0;
        uVar12 = 0;
        piVar13 = piVar10 + uVar18;
                    /* Unresolved local var: size_t __i3@[???] */
        iVar16 = *piVar10;
        local_68 = piVar10;
        do {
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          cVar14 = *(char *)(local_58 + in_t0[iVar16]);
          if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089a9ad4:
            if (cVar14 == -1) goto LAB_089a9ae4;
LAB_089a990c:
            piVar13 = piVar13 + -1;
            uVar18 = uVar18 - 1;
            *piVar10 = *piVar13;
          }
          else {
            cVar2 = (char)uVar5;
            if (uVar5 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar8[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
                uVar5 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                uVar5 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
              }
              if (uVar5 == 0xffffffff) {
                uVar5 = 0xffffffff;
                piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                goto LAB_089a9ad4;
              }
              cVar2 = (char)uVar5;
            }
            if (cVar14 != cVar2) goto LAB_089a990c;
LAB_089a9ae4:
            uVar12 = uVar12 + 1;
            piVar10 = piVar10 + 1;
          }
          if (uVar18 <= uVar12) goto code_r0x089a9924;
          iVar16 = *piVar10;
        } while( true );
      }
      goto LAB_089a96d0;
    }
    local_60 = local_5c;
    local_58 = 0;
LAB_089a9930:
    if (uVar18 == 1) {
      if (piVar8 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
          piVar8[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        }
        else {
          (*(code *)piVar8->_M_sbuf[1]._M_in_cur)(piVar8);
        }
        uVar5 = 0xffffffff;
      }
      sVar19 = local_58 + 1;
      pcVar6 = (char *)in_t0[*local_68];
      sVar4 = strlen(pcVar6);
      if (sVar19 < sVar4) {
        pcVar6 = pcVar6 + local_58;
        pcVar17 = local_60;
        do {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            uVar18 = 0xffffffff;
          }
          else {
            uVar18 = uVar5;
            if (uVar5 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar8[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
                uVar18 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                uVar18 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
              }
              uVar5 = uVar18;
              if (uVar18 == 0xffffffff) {
                piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                uVar5 = 0xffffffff;
              }
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (local_64 == (_func_int_varargs **)0x0) {
LAB_089a9c00:
            bVar1 = true;
            if (uVar18 == 0xffffffff) goto LAB_089a99dc;
LAB_089a9c0c:
            if (!bVar1) break;
            cVar14 = pcVar6[1];
            if (piVar8 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089a99ec;
LAB_089a9c1c:
            cVar2 = -1;
          }
          else {
            if (pcVar17 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (local_64[2] < local_64[3]) {
                pcVar17 = (char *)(uint)(byte)*local_64[2];
              }
              else {
                pcVar17 = (char *)(**(code **)(*local_64 + 0x24))(local_64);
              }
              if (pcVar17 == (char *)0xffffffff) {
                local_64 = (_func_int_varargs **)0x0;
                goto LAB_089a9c00;
              }
            }
            bVar1 = pcVar17 == (char *)0xffffffff;
            if (uVar18 != 0xffffffff) goto LAB_089a9c0c;
LAB_089a99dc:
            if (bVar1) break;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            cVar14 = pcVar6[1];
            if (piVar8 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089a9c1c;
LAB_089a99ec:
            if (uVar5 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar8[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c) {
                uVar5 = (uint)*(byte *)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                uVar5 = (*(code *)piVar8->_M_sbuf[1]._M_in_beg)(piVar8);
              }
              cVar2 = -1;
              if (uVar5 == 0xffffffff) {
                uVar5 = 0xffffffff;
                piVar8 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              }
              else {
                cVar2 = (char)uVar5;
              }
            }
            else {
              cVar2 = (char)uVar5;
            }
          }
          if (cVar14 != cVar2) break;
          if (piVar8 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar8[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar8[1]._M_c)
            {
              piVar8[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar8[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar8->_M_sbuf[1]._M_in_cur)(piVar8);
            }
            uVar5 = 0xffffffff;
          }
          sVar19 = sVar19 + 1;
          pcVar6 = pcVar6 + 1;
        } while (sVar19 < sVar4);
      }
      if (sVar4 == sVar19) {
        *local_50 = *local_68;
        return piVar8;
      }
    }
  }
LAB_089a96d0:
  *local_48 = *local_48 | 4;
                    /* Unresolved local var: size_t __len@[???] */
  return piVar8;
code_r0x089a9924:
  if (uVar18 < 2) goto LAB_089a9930;
  goto LAB_089a97d0;
}



----------------------------------------

// Function: do_get_year @ 089a9dc8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get_year(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get_year
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  bool bVar1;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar2;
  ctype<char> *pcVar3;
  uint uVar4;
  int iVar5;
  char cVar6;
  _func_int_varargs **pp_Var7;
  _func_int_varargs **pp_Var8;
  int iVar9;
  uint *in_t0;
  int in_t1;
  uint uVar10;
  uint uVar11;
  char *pcVar12;
  char *pcVar13;
  byte bVar14;
  int iVar15;
  int local_40;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: int __value@[???] */
  pp_Var7 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  piVar2 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar10 = (this->super_facet)._M_refcount;
  pcVar13 = (__beg._M_sbuf)->_M_in_beg;
  pcVar3 = use_facet<std::ctype<char>_>((locale *)(__beg._M_c + 0x6c));
  iVar15 = 0;
  local_40 = 0;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (piVar2 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089a9f0c;
LAB_089a9e40:
  uVar4 = uVar10;
  if (uVar10 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar2[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar2[1]._M_c) {
      uVar10 = (uint)*(byte *)&(piVar2[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar10 = (*(code *)piVar2->_M_sbuf[1]._M_in_beg)(piVar2);
    }
    uVar4 = uVar10;
    if (uVar10 == 0xffffffff) {
      piVar2 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      uVar4 = 0xffffffff;
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  uVar11 = uVar10;
  uVar10 = uVar4;
  if (pp_Var7 == (_func_int_varargs **)0x0) goto LAB_089a9f1c;
LAB_089a9e54:
  if (pcVar13 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var7[2] < pp_Var7[3]) {
      pcVar13 = (char *)(uint)(byte)*pp_Var7[2];
    }
    else {
      pcVar13 = (char *)(**(code **)(*pp_Var7 + 0x24))(pp_Var7);
    }
    if (pcVar13 == (char *)0xffffffff) {
      pcVar13 = (char *)0xffffffff;
      pp_Var7 = (_func_int_varargs **)0x0;
      goto LAB_089a9f1c;
    }
  }
  bVar1 = pcVar13 == (char *)0xffffffff;
  if (uVar11 != 0xffffffff) goto LAB_089a9f24;
LAB_089a9e68:
  if (!bVar1) {
    do {
      if (iVar15 == 4) goto LAB_089aa08c;
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      iVar9 = -1;
      if (piVar2 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar4 = 0xff;
LAB_089a9e94:
                    /* Unresolved local var: char __t@[???] */
        pcVar12 = pcVar3->_M_widen + (uVar4 - 0x1d);
        iVar5 = (int)pcVar12[0x11d];
        if (iVar5 != 0) goto LAB_089a9ea8;
        pp_Var8 = (pcVar3->super_facet)._vptr_facet;
LAB_089aa030:
        iVar5 = (*pp_Var8[8])(pcVar3,iVar9,0x2a);
        if (iVar5 != 0x2a) {
          pcVar12[0x11d] = (char)iVar5;
          goto LAB_089a9ea8;
        }
        cVar6 = '*';
      }
      else {
        if (uVar10 != 0xffffffff) {
          bVar14 = (byte)uVar10;
LAB_089a9e90:
          iVar9 = (int)(char)bVar14;
          uVar4 = (uint)bVar14;
          goto LAB_089a9e94;
        }
                    /* Unresolved local var: int __ret@[???] */
        if (piVar2[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar2[1]._M_c) {
          bVar14 = *(byte *)&(piVar2[1]._M_sbuf)->_vptr_basic_streambuf;
          uVar10 = (uint)bVar14;
        }
        else {
          uVar10 = (*(code *)piVar2->_M_sbuf[1]._M_in_beg)(piVar2,0xffffffff);
          bVar14 = (byte)uVar10;
        }
        if (uVar10 != 0xffffffff) goto LAB_089a9e90;
        pcVar12 = pcVar3->_M_widen + 0xe2;
        iVar5 = (int)pcVar3->_M_narrow[0xff];
        piVar2 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        iVar9 = -1;
        if (iVar5 == 0) {
          pp_Var8 = (pcVar3->super_facet)._vptr_facet;
          goto LAB_089aa030;
        }
LAB_089a9ea8:
        cVar6 = (char)iVar5;
      }
      if (9 < ((int)cVar6 - 0x30U & 0xff)) break;
      if (piVar2 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar2[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar2[1]._M_c) {
          piVar2[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar2[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        }
        else {
          (*(code *)piVar2->_M_sbuf[1]._M_in_cur)(piVar2);
        }
        uVar10 = 0xffffffff;
      }
      iVar15 = iVar15 + 1;
      local_40 = local_40 * 10 + (int)cVar6 + -0x30;
      if (piVar2 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089a9e40;
LAB_089a9f0c:
      uVar11 = 0xffffffff;
      if (pp_Var7 != (_func_int_varargs **)0x0) goto LAB_089a9e54;
LAB_089a9f1c:
      bVar1 = true;
      if (uVar11 == 0xffffffff) goto LAB_089a9e68;
LAB_089a9f24:
      if (!bVar1) break;
    } while( true );
  }
  if (iVar15 != 2) {
    if (iVar15 != 4) {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      *in_t0 = *in_t0 | 4;
      goto joined_r0x089aa0a0;
    }
LAB_089aa08c:
    local_40 = local_40 + -0x76c;
  }
  *(int *)(in_t1 + 0x14) = local_40;
joined_r0x089aa0a0:
  if (piVar2 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    uVar10 = 0xffffffff;
  }
  else if (uVar10 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar2[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar2[1]._M_c) {
      uVar10 = (uint)*(byte *)&(piVar2[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar10 = (*(code *)piVar2->_M_sbuf[1]._M_in_beg)(piVar2);
    }
    if (uVar10 == 0xffffffff) {
      piVar2 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var7 == (_func_int_varargs **)0x0) {
    bVar1 = true;
  }
  else if (pcVar13 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var7[2] < pp_Var7[3]) {
      bVar1 = (byte)*pp_Var7[2] == 0xffffffff;
    }
    else {
      iVar15 = (**(code **)(*pp_Var7 + 0x24))(pp_Var7);
      bVar1 = iVar15 == -1;
    }
  }
  else {
    bVar1 = pcVar13 == (char *)0xffffffff;
  }
  if (uVar10 == 0xffffffff) {
    if (bVar1) {
      *in_t0 = *in_t0 | 2;
    }
  }
  else if (!bVar1) {
    *in_t0 = *in_t0 | 2;
  }
  return piVar2;
}



----------------------------------------

// Function: do_get_monthname @ 089aa1cc

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get_monthname(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get_monthname
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  char cVar1;
  bool bVar2;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  size_t sVar3;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar4;
  size_t sVar5;
  size_t sVar6;
  uint uVar7;
  char cVar8;
  int iVar9;
  uint extraout_v1;
  uint uVar10;
  uint *in_t0;
  int in_t1;
  char *__s;
  int *__member;
  char *pcVar11;
  _func_int_varargs **pp_Var12;
  basic_streambuf<char,std::char_traits<char>_> *pbVar13;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  int local_a0 [3];
  _func_int_varargs **local_94;
  char **in_stack_ffffff7c;
  char *in_stack_ffffff80;
  _func_int_varargs **local_40;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: char *[12] __months@[???]
                       Unresolved local var: int __tmpmon@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  pp_Var12 = (this->super_facet)._vptr_facet;
  local_40 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __member = (int *)(this->super_facet)._M_refcount;
  pbVar13 = (basic_streambuf<char,std::char_traits<char>_> *)(__beg._M_sbuf)->_M_in_beg;
  sVar3 = locale::id::_M_id(&__timepunct<char>::id);
  iVar9 = *(int *)(__beg._M_c + 0x6c);
  if ((*(uint *)(iVar9 + 8) <= sVar3) ||
     (iVar9 = *(int *)(sVar3 * 4 + *(int *)(iVar9 + 4)), iVar9 == 0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  use_facet<std::ctype<char>_>((locale *)(__beg._M_c + 0x6c));
  iVar9 = *(int *)(iVar9 + 8);
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_94;
  __end_00._M_c = (int)pp_Var12;
  __end_00._M_sbuf = pbVar13;
  __beg_00._M_c = (int)local_a0;
  local_94 = local_40;
  piVar4 = _M_extract_name(__return_storage_ptr__,
                           (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                            *)&stack0xffffff74,__beg_00,__end_00,__member,in_stack_ffffff7c,
                           (size_t)in_stack_ffffff80,*(ios_base **)(iVar9 + 0x94),
                           *(_Ios_Iostate **)(iVar9 + 0x98));
  uVar10 = *in_t0;
  uVar7 = extraout_v1;
  if (uVar10 == 0) {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar10 = 0xffffffff;
      uVar7 = extraout_v1;
    }
    else {
      uVar10 = extraout_v1;
      uVar7 = extraout_v1;
      if (extraout_v1 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
          uVar10 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar10 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
        }
        uVar7 = uVar10;
        if (uVar10 == 0xffffffff) {
          piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar7 = 0xffffffff;
        }
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_40 == (_func_int_varargs **)0x0) {
LAB_089aa5a4:
      bVar2 = true;
      local_40 = (_func_int_varargs **)0x0;
    }
    else {
      if (pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_40[2] < local_40[3]) {
          pbVar13 = (basic_streambuf<char,std::char_traits<char>_> *)(uint)(byte)*local_40[2];
        }
        else {
          pbVar13 = (basic_streambuf<char,std::char_traits<char>_> *)
                    (**(code **)(*local_40 + 0x24))(local_40);
        }
        if (pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff)
        goto LAB_089aa5a4;
      }
      bVar2 = pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
    }
    if (uVar10 == 0xffffffff) {
      if (bVar2) {
        uVar10 = *in_t0;
      }
      else {
LAB_089aa374:
        iVar9 = local_a0[0] * 4;
        sVar5 = strlen(*(char **)(&stack0xffffff84 + iVar9));
        __s = *(char **)(&stack0xffffff84 + iVar9);
        pcVar11 = __s + sVar5;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        cVar1 = *pcVar11;
        if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          if (cVar1 != -1) {
            uVar10 = *in_t0;
            goto joined_r0x089aa4c4;
          }
LAB_089aa60c:
                    /* Unresolved local var: size_t __len@[???] */
          sVar6 = strlen(__s);
          if (sVar5 < sVar6) {
            do {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                uVar10 = 0xffffffff;
              }
              else {
                uVar10 = uVar7;
                if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                  if (piVar4[1]._M_sbuf <
                      (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                    uVar10 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
                  }
                  else {
                    uVar10 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
                  }
                  uVar7 = uVar10;
                  if (uVar10 == 0xffffffff) {
                    piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                    uVar7 = 0xffffffff;
                  }
                }
              }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              if (local_40 == (_func_int_varargs **)0x0) {
LAB_089aa71c:
                bVar2 = true;
              }
              else {
                if (pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                  if (local_40[2] < local_40[3]) {
                    pbVar13 = (basic_streambuf<char,std::char_traits<char>_> *)
                              (uint)(byte)*local_40[2];
                  }
                  else {
                    pbVar13 = (basic_streambuf<char,std::char_traits<char>_> *)
                              (**(code **)(*local_40 + 0x24))(local_40);
                  }
                  if (pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    local_40 = (_func_int_varargs **)0x0;
                    goto LAB_089aa71c;
                  }
                }
                bVar2 = pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
              }
              if (uVar10 == 0xffffffff) {
                if (bVar2) {
                  uVar10 = *in_t0;
                  goto LAB_089aa6e0;
                }
              }
              else if (!bVar2) {
                uVar10 = *in_t0;
                goto LAB_089aa6e0;
              }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              cVar1 = *pcVar11;
              if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                cVar8 = -1;
              }
              else if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (piVar4[1]._M_sbuf <
                    (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                  uVar7 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
                }
                else {
                  uVar7 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
                }
                cVar8 = -1;
                if (uVar7 == 0xffffffff) {
                  uVar7 = 0xffffffff;
                  piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                }
                else {
                  cVar8 = (char)uVar7;
                }
              }
              else {
                cVar8 = (char)uVar7;
              }
              if (cVar1 != cVar8) break;
              if (piVar4 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
                if (piVar4[1]._M_sbuf <
                    (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                  piVar4[1]._M_sbuf =
                       (basic_streambuf<char,std::char_traits<char>_> *)
                       ((int)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf + 1);
                }
                else {
                  (*(code *)piVar4->_M_sbuf[1]._M_in_cur)(piVar4);
                }
                uVar7 = 0xffffffff;
              }
              sVar5 = sVar5 + 1;
              pcVar11 = pcVar11 + 1;
            } while (sVar6 != sVar5);
          }
          if (sVar6 != sVar5) {
            uVar10 = *in_t0;
LAB_089aa6e0:
            *in_t0 = uVar10 | 4;
            goto joined_r0x089aa4dc;
          }
          uVar10 = *in_t0;
        }
        else {
          if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c)
            {
              uVar7 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar7 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
            }
            if (uVar7 != 0xffffffff) {
              cVar8 = (char)uVar7;
              goto LAB_089aa410;
            }
            piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            if (cVar1 == -1) goto LAB_089aa60c;
          }
          else {
            cVar8 = (char)uVar7;
LAB_089aa410:
            if (cVar1 == cVar8) goto LAB_089aa60c;
          }
          uVar10 = *in_t0;
        }
      }
    }
    else {
      if (bVar2) goto LAB_089aa374;
      uVar10 = *in_t0;
    }
  }
joined_r0x089aa4c4:
  if (uVar10 == 0) {
    *(int *)(in_t1 + 0x10) = local_a0[0];
  }
joined_r0x089aa4dc:
  if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    uVar7 = 0xffffffff;
  }
  else if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
      uVar7 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar7 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
    }
    if (uVar7 == 0xffffffff) {
      uVar7 = 0xffffffff;
      piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    }
  }
  if (local_40 == (_func_int_varargs **)0x0) {
    bVar2 = true;
  }
  else if (pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (local_40[2] < local_40[3]) {
      bVar2 = (byte)*local_40[2] == 0xffffffff;
    }
    else {
      iVar9 = (**(code **)(*local_40 + 0x24))(local_40);
      bVar2 = iVar9 == -1;
    }
  }
  else {
    bVar2 = pbVar13 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
  }
  if (uVar7 == 0xffffffff) {
    if (bVar2) {
      *in_t0 = *in_t0 | 2;
    }
  }
  else if (!bVar2) {
    *in_t0 = *in_t0 | 2;
  }
  return piVar4;
}



----------------------------------------

// Function: do_get_weekday @ 089aa8a8

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get_weekday(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get_weekday
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  char cVar1;
  bool bVar2;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  size_t sVar3;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar4;
  size_t sVar5;
  uint uVar6;
  char cVar7;
  int iVar8;
  uint extraout_v1;
  uint uVar9;
  uint *in_t0;
  int in_t1;
  _func_int_varargs **pp_Var10;
  char *__s;
  char *pcVar11;
  basic_streambuf<char,std::char_traits<char>_> *pbVar12;
  int *__member;
  _func_int_varargs **pp_Var13;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  int local_88 [3];
  _func_int_varargs **local_7c;
  char **in_stack_ffffff94;
  char *in_stack_ffffff98;
  size_t local_38;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: char *[7] __days@[???]
                       Unresolved local var: int __tmpwday@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  pp_Var13 = (this->super_facet)._vptr_facet;
  pp_Var10 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __member = (int *)(this->super_facet)._M_refcount;
  pbVar12 = (basic_streambuf<char,std::char_traits<char>_> *)(__beg._M_sbuf)->_M_in_beg;
  sVar3 = locale::id::_M_id(&__timepunct<char>::id);
  iVar8 = *(int *)(__beg._M_c + 0x6c);
  if ((*(uint *)(iVar8 + 8) <= sVar3) ||
     (iVar8 = *(int *)(sVar3 * 4 + *(int *)(iVar8 + 4)), iVar8 == 0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  use_facet<std::ctype<char>_>((locale *)(__beg._M_c + 0x6c));
  iVar8 = *(int *)(iVar8 + 8);
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_7c;
  __end_00._M_c = (int)pp_Var13;
  __end_00._M_sbuf = pbVar12;
  __beg_00._M_c = (int)local_88;
  local_7c = pp_Var10;
  piVar4 = _M_extract_name(__return_storage_ptr__,
                           (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                            *)&stack0xffffff8c,__beg_00,__end_00,__member,in_stack_ffffff94,
                           (size_t)in_stack_ffffff98,*(ios_base **)(iVar8 + 0x48),
                           *(_Ios_Iostate **)(iVar8 + 0x4c));
  uVar9 = *in_t0;
  uVar6 = extraout_v1;
  if (uVar9 == 0) {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar9 = 0xffffffff;
      uVar6 = extraout_v1;
    }
    else {
      uVar9 = extraout_v1;
      uVar6 = extraout_v1;
      if (extraout_v1 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
          uVar9 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar9 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
        }
        uVar6 = uVar9;
        if (uVar9 == 0xffffffff) {
          piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar6 = 0xffffffff;
        }
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (pp_Var10 == (_func_int_varargs **)0x0) {
LAB_089aabcc:
      pp_Var10 = (_func_int_varargs **)0x0;
      bVar2 = true;
    }
    else {
      if (pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var10[2] < pp_Var10[3]) {
          pbVar12 = (basic_streambuf<char,std::char_traits<char>_> *)(uint)(byte)*pp_Var10[2];
        }
        else {
          pbVar12 = (basic_streambuf<char,std::char_traits<char>_> *)
                    (**(code **)(*pp_Var10 + 0x24))(pp_Var10);
        }
        if (pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff)
        goto LAB_089aabcc;
      }
      bVar2 = pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
    }
    if (uVar9 == 0xffffffff) {
      if (bVar2) {
        uVar9 = *in_t0;
      }
      else {
LAB_089aaa28:
        iVar8 = local_88[0] * 4;
        local_38 = strlen(*(char **)(&stack0xffffff9c + iVar8));
        __s = *(char **)(&stack0xffffff9c + iVar8);
        pcVar11 = __s + local_38;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        cVar1 = *pcVar11;
        if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          if (cVar1 != -1) {
            uVar9 = *in_t0;
            goto joined_r0x089aab48;
          }
LAB_089aac90:
                    /* Unresolved local var: size_t __len@[???] */
          sVar5 = strlen(__s);
          if (local_38 < sVar5) {
            do {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                uVar9 = 0xffffffff;
              }
              else {
                uVar9 = uVar6;
                if (uVar6 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                  if (piVar4[1]._M_sbuf <
                      (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                    uVar9 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
                  }
                  else {
                    uVar9 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
                  }
                  uVar6 = uVar9;
                  if (uVar9 == 0xffffffff) {
                    piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                    uVar6 = 0xffffffff;
                  }
                }
              }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              if (pp_Var10 == (_func_int_varargs **)0x0) {
LAB_089aada4:
                bVar2 = true;
              }
              else {
                if (pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                  if (pp_Var10[2] < pp_Var10[3]) {
                    pbVar12 = (basic_streambuf<char,std::char_traits<char>_> *)
                              (uint)(byte)*pp_Var10[2];
                  }
                  else {
                    pbVar12 = (basic_streambuf<char,std::char_traits<char>_> *)
                              (**(code **)(*pp_Var10 + 0x24))(pp_Var10);
                  }
                  if (pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    pp_Var10 = (_func_int_varargs **)0x0;
                    goto LAB_089aada4;
                  }
                }
                bVar2 = pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
              }
              if (uVar9 == 0xffffffff) {
                if (bVar2) {
                  uVar9 = *in_t0;
                  goto LAB_089aad6c;
                }
              }
              else if (!bVar2) {
                uVar9 = *in_t0;
                goto LAB_089aad6c;
              }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
              cVar1 = *pcVar11;
              if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                cVar7 = -1;
              }
              else if (uVar6 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (piVar4[1]._M_sbuf <
                    (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                  uVar6 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
                }
                else {
                  uVar6 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
                }
                cVar7 = -1;
                if (uVar6 == 0xffffffff) {
                  uVar6 = 0xffffffff;
                  piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                }
                else {
                  cVar7 = (char)uVar6;
                }
              }
              else {
                cVar7 = (char)uVar6;
              }
              if (cVar1 != cVar7) break;
              if (piVar4 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
                if (piVar4[1]._M_sbuf <
                    (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
                  piVar4[1]._M_sbuf =
                       (basic_streambuf<char,std::char_traits<char>_> *)
                       ((int)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf + 1);
                }
                else {
                  (*(code *)piVar4->_M_sbuf[1]._M_in_cur)(piVar4);
                }
                uVar6 = 0xffffffff;
              }
              pcVar11 = pcVar11 + 1;
              local_38 = local_38 + 1;
            } while (local_38 != sVar5);
          }
          if (local_38 != sVar5) {
            uVar9 = *in_t0;
LAB_089aad6c:
            *in_t0 = uVar9 | 4;
            goto joined_r0x089aab60;
          }
          uVar9 = *in_t0;
        }
        else {
          if (uVar6 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c)
            {
              uVar6 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar6 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
            }
            if (uVar6 != 0xffffffff) {
              cVar7 = (char)uVar6;
              goto LAB_089aaa9c;
            }
            piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            if (cVar1 == -1) goto LAB_089aac90;
          }
          else {
            cVar7 = (char)uVar6;
LAB_089aaa9c:
            if (cVar1 == cVar7) goto LAB_089aac90;
          }
          uVar9 = *in_t0;
        }
      }
    }
    else {
      if (bVar2) goto LAB_089aaa28;
      uVar9 = *in_t0;
    }
  }
joined_r0x089aab48:
  if (uVar9 == 0) {
    *(int *)(in_t1 + 0x18) = local_88[0];
  }
joined_r0x089aab60:
  if (piVar4 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    uVar6 = 0xffffffff;
  }
  else if (uVar6 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar4[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar4[1]._M_c) {
      uVar6 = (uint)*(byte *)&(piVar4[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar6 = (*(code *)piVar4->_M_sbuf[1]._M_in_beg)(piVar4);
    }
    if (uVar6 == 0xffffffff) {
      piVar4 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var10 == (_func_int_varargs **)0x0) {
    bVar2 = true;
  }
  else if (pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var10[2] < pp_Var10[3]) {
      bVar2 = (byte)*pp_Var10[2] == 0xffffffff;
    }
    else {
      iVar8 = (**(code **)(*pp_Var10 + 0x24))(pp_Var10);
      bVar2 = iVar8 == -1;
    }
  }
  else {
    bVar2 = pbVar12 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
  }
  if (uVar6 == 0xffffffff) {
    if (bVar2) {
      *in_t0 = *in_t0 | 2;
    }
  }
  else if (!bVar2) {
    *in_t0 = *in_t0 | 2;
  }
  return piVar4;
}



----------------------------------------

// Function: do_put @ 089aaf1c

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char param_3, tm * __tm,
   char __format, char __mod) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char param_3,tm *__tm
          ,char __format,char __mod)

{
  ctype<char> *pcVar1;
  size_t sVar2;
  size_t sVar3;
  undefined1 *puVar4;
  char *pcVar5;
  int iVar6;
  _func_int_varargs **pp_Var7;
  char in_t1;
  char in_t2;
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar8;
  __timepunct<char> *this_00;
  char acStackY_1e0 [16];
  tm *in_stack_fffffe30;
  char local_158;
  undefined1 local_157;
  undefined1 local_156;
  undefined1 local_155;
  undefined1 local_14c [260];
  uint local_48;
  int local_40;
  int local_3c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: size_t __maxlen@[???]
                       Unresolved local var: char * __res@[???]
                       Unresolved local var: char[4] __fmt@[???] */
  poVar8 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_48 = (uint)(byte)(this->super_facet)._M_refcount;
  local_40 = (int)in_t1;
  local_3c = (int)in_t2;
  pcVar1 = use_facet<std::ctype<char>_>((locale *)&__s._M_sbuf[3]._M_in_end);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  sVar2 = locale::id::_M_id(&__timepunct<char>::id);
  pcVar5 = __s._M_sbuf[3]._M_in_end;
  if ((*(uint *)(pcVar5 + 8) <= sVar2) ||
     (this_00 = *(__timepunct<char> **)(sVar2 * 4 + *(int *)(pcVar5 + 4)),
     this_00 == (__timepunct<char> *)0x0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  if (pcVar1->_M_widen_ok == '\0') {
    iVar6 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
    puVar4 = local_14c;
    do {
      *puVar4 = (char)iVar6;
      iVar6 = iVar6 + 1;
      puVar4 = local_14c + iVar6;
    } while (iVar6 != 0x100);
    (*(pcVar1->super_facet)._vptr_facet[7])(pcVar1,local_14c,local_14c + 0x100,pcVar1->_M_widen);
    pcVar1->_M_widen_ok = '\x01';
    iVar6 = memcmp(local_14c,pcVar1->_M_widen,0x100);
    pp_Var7 = (pcVar1->super_facet)._vptr_facet;
    if (iVar6 == 0) {
      iVar6 = (*pp_Var7[6])(pcVar1,0x25);
      local_158 = (char)iVar6;
    }
    else {
      pcVar1->_M_widen_ok = '\x02';
      iVar6 = (*pp_Var7[6])(pcVar1,0x25);
      local_158 = (char)iVar6;
    }
    local_157 = (undefined1)local_40;
    if (local_3c == 0) goto LAB_089aafdc;
  }
  else {
    local_158 = pcVar1->_M_widen[0x25];
    if (local_3c == 0) {
      local_157 = (undefined1)local_40;
LAB_089aafdc:
      local_156 = 0;
      goto LAB_089aafe4;
    }
  }
  local_155 = 0;
  local_157 = (undefined1)local_3c;
  local_156 = (undefined1)local_40;
LAB_089aafe4:
  __timepunct<char>::_M_put(this_00,acStackY_1e0,0x80,&local_158,in_stack_fffffe30);
  sVar3 = strlen(acStackY_1e0);
  if (local_48 == 0) {
    (*(code *)poVar8->_M_sbuf[1]._M_out_beg)(poVar8,acStackY_1e0,sVar3);
  }
  return poVar8;
}



----------------------------------------

// Function: _S_pad @ 089ab138

void std::__pad<char,std::char_traits<char>_>::_S_pad
               (ios_base *__io,char __fill,char *__news,char *__olds,streamsize __newlen,
               streamsize __oldlen,bool __num)

{
  bool bVar1;
  char cVar2;
  ctype<char> *pcVar3;
  undefined1 *puVar4;
  undefined1 *puVar5;
  undefined1 *puVar6;
  undefined1 *puVar7;
  undefined1 *puVar8;
  char cVar9;
  _Ios_Fmtflags _Var10;
  int iVar11;
  _func_int_varargs **pp_Var12;
  char cVar13;
  int in_t0;
  size_t in_t1;
  char in_t2;
  int iVar14;
  size_t n;
  char *pcVar15;
  undefined1 local_128 [256];
  
                    /* Unresolved local var: size_t __plen@[???]
                       Unresolved local var: _Ios_Fmtflags __adjust@[???]
                       Unresolved local var: size_t __mod@[???] */
  puVar4 = local_128;
  puVar5 = local_128;
  puVar6 = local_128;
  puVar7 = local_128;
  puVar8 = local_128;
  _Var10 = __io->_M_flags & _S_adjustfield;
  n = in_t0 - in_t1;
  if (_Var10 == _S_left) {
    memcpy(__news,__olds,in_t1);
    memset(__news + in_t1,(int)__fill,n);
    return;
  }
  if ((_Var10 == _S_internal) && (in_t2 != '\0')) {
    pcVar3 = use_facet<std::ctype<char>_>(&__io->_M_ios_locale);
    cVar13 = pcVar3->_M_widen_ok;
    if (cVar13 == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      iVar14 = 0;
      do {
        *puVar4 = (char)iVar14;
        iVar11 = iVar14 + 1;
        puVar4 = local_128 + iVar14 + 1;
        iVar14 = iVar11;
      } while (iVar11 != 0x100);
      (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,local_128,&stack0xffffffd8,pcVar3->_M_widen);
      pcVar3->_M_widen_ok = '\x01';
      iVar14 = memcmp(local_128,pcVar3->_M_widen,0x100);
      if (iVar14 == 0) {
        pp_Var12 = (pcVar3->super_facet)._vptr_facet;
      }
      else {
        pcVar3->_M_widen_ok = '\x02';
        pp_Var12 = (pcVar3->super_facet)._vptr_facet;
      }
      iVar14 = (*pp_Var12[6])(pcVar3,0x2d);
      cVar2 = (char)iVar14;
      cVar13 = pcVar3->_M_widen_ok;
    }
    else {
      cVar2 = pcVar3->_M_widen[0x2d];
    }
    cVar9 = *__olds;
    bVar1 = true;
    if (cVar2 != cVar9) {
      if (cVar13 == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
        iVar14 = 0;
        do {
          *puVar6 = (char)iVar14;
          iVar11 = iVar14 + 1;
          puVar6 = local_128 + iVar14 + 1;
          iVar14 = iVar11;
        } while (iVar11 != 0x100);
        (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,local_128,&stack0xffffffd8,pcVar3->_M_widen);
        pcVar3->_M_widen_ok = '\x01';
        iVar14 = memcmp(local_128,pcVar3->_M_widen,0x100);
        if (iVar14 == 0) {
          pp_Var12 = (pcVar3->super_facet)._vptr_facet;
        }
        else {
          pcVar3->_M_widen_ok = '\x02';
          pp_Var12 = (pcVar3->super_facet)._vptr_facet;
        }
        iVar14 = (*pp_Var12[6])(pcVar3,0x2b);
        cVar2 = (char)iVar14;
        cVar13 = pcVar3->_M_widen_ok;
        cVar9 = *__olds;
      }
      else {
        cVar2 = pcVar3->_M_widen[0x2b];
      }
      bVar1 = true;
      if (cVar2 != cVar9) {
        bVar1 = false;
      }
    }
    if (cVar13 == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      iVar14 = 0;
      do {
        *puVar5 = (char)iVar14;
        iVar11 = iVar14 + 1;
        puVar5 = local_128 + iVar14 + 1;
        iVar14 = iVar11;
      } while (iVar11 != 0x100);
      (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,local_128,&stack0xffffffd8,pcVar3->_M_widen);
      pcVar3->_M_widen_ok = '\x01';
      iVar14 = memcmp(local_128,pcVar3->_M_widen,0x100);
      if (iVar14 == 0) {
        pp_Var12 = (pcVar3->super_facet)._vptr_facet;
      }
      else {
        pcVar3->_M_widen_ok = '\x02';
        pp_Var12 = (pcVar3->super_facet)._vptr_facet;
      }
      iVar14 = (*pp_Var12[6])(pcVar3,0x30);
      cVar13 = (char)iVar14;
      cVar9 = *__olds;
    }
    else {
      cVar13 = pcVar3->_M_widen[0x30];
    }
    if ((cVar13 == cVar9) && (1 < (int)in_t1)) {
      iVar14 = 0;
      if (pcVar3->_M_widen_ok == '\0') {
        do {
          *puVar7 = (char)iVar14;
          iVar11 = iVar14 + 1;
          puVar7 = local_128 + iVar14 + 1;
          iVar14 = iVar11;
        } while (iVar11 != 0x100);
        (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,local_128,&stack0xffffffd8,pcVar3->_M_widen);
        pcVar3->_M_widen_ok = '\x01';
        iVar14 = memcmp(local_128,pcVar3->_M_widen,0x100);
        if (iVar14 == 0) {
          pp_Var12 = (pcVar3->super_facet)._vptr_facet;
        }
        else {
          pcVar3->_M_widen_ok = '\x02';
          pp_Var12 = (pcVar3->super_facet)._vptr_facet;
        }
        iVar14 = (*pp_Var12[6])(pcVar3,0x78);
        cVar13 = (char)iVar14;
        cVar2 = __olds[1];
      }
      else {
        cVar13 = pcVar3->_M_widen[0x78];
        cVar2 = __olds[1];
      }
      pcVar15 = __olds + 1;
      if (cVar13 != cVar2) {
        iVar14 = 0;
        if (pcVar3->_M_widen_ok == '\0') {
          do {
            *puVar8 = (char)iVar14;
            iVar11 = iVar14 + 1;
            puVar8 = local_128 + iVar14 + 1;
            iVar14 = iVar11;
          } while (iVar11 != 0x100);
          (*(pcVar3->super_facet)._vptr_facet[7])
                    (pcVar3,local_128,&stack0xffffffd8,pcVar3->_M_widen);
          pcVar3->_M_widen_ok = '\x01';
          iVar14 = memcmp(local_128,pcVar3->_M_widen,0x100);
          if (iVar14 == 0) {
            pp_Var12 = (pcVar3->super_facet)._vptr_facet;
          }
          else {
            pcVar3->_M_widen_ok = '\x02';
            pp_Var12 = (pcVar3->super_facet)._vptr_facet;
          }
          iVar14 = (*pp_Var12[6])(pcVar3,0x58);
          cVar13 = (char)iVar14;
          cVar2 = *pcVar15;
        }
        else {
          cVar13 = pcVar3->_M_widen[0x58];
          cVar2 = *pcVar15;
        }
        if (cVar13 != cVar2) goto LAB_089ab250;
      }
      iVar11 = 2;
      iVar14 = 2;
      *__news = *__olds;
      __news[1] = *pcVar15;
      __news = __news + 2;
      goto LAB_089ab19c;
    }
LAB_089ab250:
    if (bVar1) {
      iVar11 = 1;
      iVar14 = 1;
      *__news = *__olds;
      __news = __news + 1;
      goto LAB_089ab19c;
    }
  }
  iVar11 = 0;
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: bool __testsign@[???]
                       Unresolved local var: bool __testhex@[???] */
  iVar14 = 0;
LAB_089ab19c:
  memset(__news,(int)__fill,n);
  memcpy(__news + n,__olds + iVar14,in_t1 - iVar11);
  return;
}



----------------------------------------

// Function: _M_pad @ 089ab59c

/* DWARF original prototype: void
   _M_pad(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this, char
   __fill, streamsize __w, ios_base * __io, char * __new, char * __cs, int * __len) */

void __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_pad
          (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,char __fill,
          streamsize __w,ios_base *__io,char *__new,char *__cs,int *__len)

{
  char *in_t0;
  char *in_t1;
  streamsize *in_t2;
  streamsize in_stack_00000000;
  streamsize in_stack_00000004;
  bool in_stack_00000008;
  
  __pad<char,std::char_traits<char>_>::_S_pad
            (__io,__fill,in_t0,in_t1,in_stack_00000000,in_stack_00000004,in_stack_00000008);
  *in_t2 = __w;
  return;
}



----------------------------------------

// Function: ~collate_byname @ 089ab5ec

/* DWARF original prototype: void ~collate_byname(collate_byname<char> * this, int __in_chrg) */

void __thiscall std::collate_byname<char>::~collate_byname(collate_byname<char> *this,int __in_chrg)

{
  (this->super_collate<char>).super_facet._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10
  ;
                    /* try { // try from 089ab60c to 089ab613 has its CatchHandler @ 089ab634 */
  locale::facet::_S_destroy_c_locale(&(this->super_collate<char>)._M_c_locale_collate);
  locale::facet::~facet((facet *)this,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~collate_byname @ 089ab648

/* DWARF original prototype: void ~collate_byname(collate_byname<char> * this, int __in_chrg) */

void __thiscall std::collate_byname<char>::~collate_byname(collate_byname<char> *this,int __in_chrg)

{
  (this->super_collate<char>).super_facet._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10
  ;
                    /* try { // try from 089ab668 to 089ab66f has its CatchHandler @ 089ab688 */
  locale::facet::_S_destroy_c_locale(&(this->super_collate<char>)._M_c_locale_collate);
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ~collate_byname @ 089ab69c

/* DWARF original prototype: void ~collate_byname(collate_byname<char> * this, int __in_chrg) */

void __thiscall std::collate_byname<char>::~collate_byname(collate_byname<char> *this,int __in_chrg)

{
  (this->super_collate<char>).super_facet._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10
  ;
                    /* try { // try from 089ab6bc to 089ab6c3 has its CatchHandler @ 089ab6dc */
  locale::facet::_S_destroy_c_locale(&(this->super_collate<char>)._M_c_locale_collate);
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: collate_byname @ 089ab6f0

/* DWARF original prototype: void collate_byname(collate_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::collate_byname<char>::collate_byname(collate_byname<char> *this,char *__s,size_t __refs)

{
  __c_locale piVar1;
  int iVar2;
  __c_locale *__cloc;
  
  (this->super_collate<char>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_collate<char>).super_facet._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10
  ;
                    /* try { // try from 089ab720 to 089ab727 has its CatchHandler @ 089ab7dc */
  piVar1 = locale::facet::_S_get_c_locale();
  (this->super_collate<char>)._M_c_locale_collate = piVar1;
  (this->super_collate<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__collate_byname_089ef938;
  iVar2 = strcmp(__s,"C");
  if ((iVar2 != 0) && (iVar2 = strcmp(__s,"POSIX"), iVar2 != 0)) {
    __cloc = &(this->super_collate<char>)._M_c_locale_collate;
                    /* try { // try from 089ab784 to 089ab79b has its CatchHandler @ 089ab7b8 */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: collate_byname @ 089ab7f0

/* DWARF original prototype: void collate_byname(collate_byname<char> * this, char * __s, size_t
   __refs) */

void __thiscall
std::collate_byname<char>::collate_byname(collate_byname<char> *this,char *__s,size_t __refs)

{
  __c_locale piVar1;
  int iVar2;
  __c_locale *__cloc;
  
  (this->super_collate<char>).super_facet._M_refcount = (uint)(__refs != 0);
  (this->super_collate<char>).super_facet._vptr_facet = (_func_int_varargs **)&PTR__collate_089efc10
  ;
                    /* try { // try from 089ab820 to 089ab827 has its CatchHandler @ 089ab8dc */
  piVar1 = locale::facet::_S_get_c_locale();
  (this->super_collate<char>)._M_c_locale_collate = piVar1;
  (this->super_collate<char>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__collate_byname_089ef938;
  iVar2 = strcmp(__s,"C");
  if ((iVar2 != 0) && (iVar2 = strcmp(__s,"POSIX"), iVar2 != 0)) {
    __cloc = &(this->super_collate<char>)._M_c_locale_collate;
                    /* try { // try from 089ab884 to 089ab89b has its CatchHandler @ 089ab8b8 */
    locale::facet::_S_destroy_c_locale(__cloc);
    locale::facet::_S_create_c_locale(__cloc,__s,(__c_locale)0x0);
    return;
  }
  return;
}



----------------------------------------

// Function: _M_extract_via_format @ 089ab8f0

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_via_format(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm, char * __format) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract_via_format
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm,char *__format)

{
  byte bVar1;
  bool bVar2;
  char cVar3;
  size_t sVar4;
  ctype<char> *pcVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  _Impl *p_Var9;
  undefined1 *puVar10;
  byte bVar11;
  _Impl *extraout_v1;
  _Impl *extraout_v1_00;
  _Impl *extraout_v1_01;
  _Impl *extraout_v1_02;
  _Impl *extraout_v1_03;
  _Impl *extraout_v1_04;
  _Impl *extraout_v1_05;
  _Impl *extraout_v1_06;
  _Impl *extraout_v1_07;
  ios_base *__len;
  _Impl *extraout_v1_08;
  _Impl *extraout_v1_09;
  _Impl *extraout_v1_10;
  _Impl *extraout_v1_11;
  _Impl *extraout_v1_12;
  _Impl *extraout_v1_13;
  _Impl *extraout_v1_14;
  _Impl *extraout_v1_15;
  _Impl *extraout_v1_16;
  _Impl *extraout_v1_17;
  _Impl *extraout_v1_18;
  _Impl *extraout_v1_19;
  _Impl *extraout_v1_20;
  _func_int_varargs **pp_Var12;
  uint *in_t0;
  int in_t1;
  char *in_t2;
  _Impl *p_Var13;
  _Impl *p_Var14;
  char **__err_00;
  byte *pbVar15;
  ios_base *__io_00;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar16;
  uint uVar17;
  uint uVar18;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_01;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_02;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_03;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_04;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_05;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_06;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_07;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_08;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_09;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_10;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_11;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_12;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_13;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_14;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_15;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_16;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_17;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_18;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_19;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_20;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_21;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_22;
  int local_388;
  int local_384;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_fffffc80;
  ios_base *in_stack_fffffc88;
  char **in_stack_fffffc8c;
  tm *in_stack_fffffc90;
  ios_base *in_stack_fffffc94;
  ios_base *in_stack_fffffc98;
  char **in_stack_fffffc9c;
  time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_360;
  undefined1 local_358 [12];
  locale local_34c;
  undefined1 local_348 [12];
  locale local_33c;
  undefined1 local_338 [12];
  locale local_32c;
  undefined1 local_328 [12];
  locale local_31c;
  undefined1 local_318 [12];
  locale local_30c;
  undefined1 local_308 [12];
  locale local_2fc;
  undefined1 local_2f8 [12];
  locale local_2ec;
  undefined1 local_2e8 [12];
  locale local_2dc;
  undefined1 local_2d8 [12];
  locale local_2cc;
  undefined1 local_2c8 [12];
  locale local_2bc;
  undefined1 local_2b8 [12];
  locale local_2ac;
  undefined1 local_2a8 [12];
  locale local_29c;
  undefined1 local_298 [12];
  locale local_28c;
  undefined1 local_288 [12];
  locale local_27c;
  undefined1 local_278 [12];
  locale local_26c;
  undefined1 local_268 [12];
  locale local_25c;
  undefined1 local_258 [12];
  locale local_24c;
  undefined1 local_248 [12];
  locale local_23c;
  undefined1 local_238 [12];
  locale local_22c;
  undefined1 local_228 [12];
  locale local_21c;
  undefined1 local_218 [12];
  locale local_20c;
  tm *local_208;
  undefined1 auStack_200 [12];
  undefined4 local_1f4;
  undefined4 local_1f0;
  undefined4 local_1ec;
  undefined4 local_1e8;
  undefined4 local_1e4;
  undefined4 local_1e0;
  undefined4 local_1dc;
  undefined4 local_1d8;
  undefined4 local_1d4;
  undefined4 local_1d0;
  undefined4 local_1cc;
  undefined4 local_1c8;
  undefined4 local_1c4;
  undefined4 local_1c0;
  undefined4 local_1bc;
  undefined4 local_1b8;
  undefined4 local_1b4;
  undefined4 local_1b0;
  undefined4 local_1ac;
  undefined4 local_1a8;
  undefined4 local_1a4;
  undefined4 local_1a0;
  undefined4 local_19c;
  undefined4 local_198;
  undefined4 local_194;
  undefined4 local_190;
  undefined4 local_18c;
  undefined4 local_188;
  undefined4 local_184;
  undefined4 local_180;
  undefined4 local_17c;
  undefined4 local_178;
  undefined4 local_174;
  undefined4 local_170;
  undefined4 local_16c;
  undefined4 local_168;
  undefined4 local_164;
  undefined4 local_160;
  undefined1 local_15c [260];
  tm *local_58;
  int local_50;
  int local_4c;
  int local_48;
  size_t local_44;
  istreambuf_iterator<char,std::char_traits<char>_> *local_40;
  int local_3c;
  int local_38;
  char *local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  local_3c = __beg._M_c;
  piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  __io_00 = (ios_base *)(__beg._M_sbuf)->_vptr_basic_streambuf;
  p_Var13 = (_Impl *)(this->super_facet)._M_refcount;
  __err_00 = (char **)(__beg._M_sbuf)->_M_in_beg;
  local_40 = __return_storage_ptr__;
  local_38 = in_t1;
  local_34 = in_t2;
  sVar4 = locale::id::_M_id(&__timepunct<char>::id);
  local_30 = 0;
  local_2c = 0;
  if ((*(uint *)(*(int *)(local_3c + 0x6c) + 8) <= sVar4) ||
     (local_48 = *(int *)(sVar4 * 4 + *(int *)(*(int *)(local_3c + 0x6c) + 4)), local_48 == 0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  pcVar5 = use_facet<std::ctype<char>_>((locale *)(local_3c + 0x6c));
  local_44 = strlen(local_34);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  uVar17 = 0;
  if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089aba70;
LAB_089ab9b0:
  p_Var9 = p_Var13;
  if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
      p_Var13 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      p_Var13 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
    }
    p_Var9 = p_Var13;
    if (p_Var13 == (_Impl *)0xffffffff) {
      piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      p_Var9 = (_Impl *)0xffffffff;
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  p_Var14 = p_Var13;
  p_Var13 = p_Var9;
  if (__io_00 == (ios_base *)0x0) goto LAB_089aba80;
LAB_089ab9c8:
  if (__err_00 == (char **)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)__io_00->_M_width < (byte *)__io_00->_M_flags) {
      __err_00 = (char **)(uint)*(byte *)__io_00->_M_width;
    }
    else {
      __err_00 = (char **)(*__io_00->_vptr_ios_base[9])(__io_00);
    }
    if (__err_00 == (char **)0xffffffff) {
      __err_00 = (char **)0xffffffff;
      __io_00 = (ios_base *)0x0;
      bVar2 = true;
    }
    else {
      bVar2 = __err_00 == (char **)0xffffffff;
    }
  }
  else {
    bVar2 = __err_00 == (char **)0xffffffff;
  }
  if (p_Var14 != (_Impl *)0xffffffff) goto LAB_089aba8c;
LAB_089ab9e8:
  if (bVar2) {
    return piVar16;
  }
  do {
    if (local_44 <= uVar17) {
      return piVar16;
    }
    if (*in_t0 != 0) {
      return piVar16;
    }
    pbVar15 = (byte *)(local_34 + uVar17);
    bVar1 = *pbVar15;
                    /* Unresolved local var: char __t@[???] */
    cVar3 = pcVar5->_M_narrow[bVar1];
    bVar11 = (byte)p_Var13;
    if (cVar3 != '\0') {
LAB_089aba2c:
      if (cVar3 == '%') goto LAB_089abb28;
LAB_089aba38:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar1 = *pbVar15;
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        bVar11 = 0xff;
      }
      else if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
          p_Var9 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          p_Var9 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
        }
        bVar11 = 0xff;
        if (p_Var9 == (_Impl *)0xffffffff) {
          piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        }
        else {
          bVar11 = (byte)p_Var9;
          p_Var13 = p_Var9;
        }
      }
      uVar18 = uVar17;
      if (bVar1 != bVar11) goto switchD_089abb8c_caseD_4;
LAB_089abc00:
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar17 = uVar18 + 1;
      }
      else {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
          p_Var13 = (_Impl *)0xffffffff;
          piVar16[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf + 1);
          goto LAB_089aba60;
        }
        p_Var13 = (_Impl *)0xffffffff;
        (*(code *)piVar16->_M_sbuf[1]._M_in_cur)(piVar16);
        uVar17 = uVar18 + 1;
      }
      goto LAB_089aba64;
    }
    iVar6 = (*(pcVar5->super_facet)._vptr_facet[8])(pcVar5,(int)(char)bVar1,0);
    cVar3 = (char)iVar6;
    if (iVar6 == 0) goto LAB_089aba2c;
    pcVar5->_M_narrow[bVar1] = cVar3;
    if (cVar3 != '%') goto LAB_089aba38;
LAB_089abb28:
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: int __mem@[???] */
    uVar18 = uVar17 + 1;
    bVar1 = local_34[uVar18];
                    /* Unresolved local var: char __t@[???] */
    iVar6 = (int)pcVar5->_M_narrow[bVar1];
    if (iVar6 == 0) {
      iVar6 = (*(pcVar5->super_facet)._vptr_facet[8])(pcVar5,(int)(char)bVar1,0);
      if (iVar6 != 0) {
        pcVar5->_M_narrow[bVar1] = (char)iVar6;
        goto LAB_089abb48;
      }
      cVar3 = '\0';
    }
    else {
LAB_089abb48:
      cVar3 = (char)iVar6;
    }
    iVar6 = (int)cVar3;
    local_388 = 0;
    if ((iVar6 == 0x45) || (iVar6 == 0x4f)) {
      uVar18 = uVar17 + 2;
      bVar1 = local_34[uVar18];
                    /* Unresolved local var: char __t@[???] */
      if (pcVar5->_M_narrow[bVar1] == '\0') {
        iVar8 = (*(pcVar5->super_facet)._vptr_facet[8])(pcVar5,(int)(char)bVar1,0);
        iVar6 = (int)(char)iVar8;
        if (iVar8 != 0) {
          pcVar5->_M_narrow[bVar1] = (char)iVar8;
        }
      }
      else {
        iVar6 = (int)pcVar5->_M_narrow[bVar1];
      }
    }
    uVar17 = uVar18;
    switch(iVar6 - 0x41U & 0xff) {
    case 0:
      iVar6 = *(int *)(local_48 + 8);
      __beg_21._M_c = local_38 + 0x18;
      local_1d8 = *(undefined4 *)(iVar6 + 0x2c);
      __beg_21._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_228;
      local_1d4 = *(undefined4 *)(iVar6 + 0x30);
      local_1d0 = *(undefined4 *)(iVar6 + 0x34);
      local_1cc = *(undefined4 *)(iVar6 + 0x38);
      local_1c8 = *(undefined4 *)(iVar6 + 0x3c);
      local_1c4 = *(undefined4 *)(iVar6 + 0x40);
      local_1c0 = *(undefined4 *)(iVar6 + 0x44);
      local_228._0_4_ = __io_00;
      local_228._4_4_ = __err_00;
      local_228._8_4_ = piVar16;
      local_21c._M_impl = p_Var13;
      piVar16 = _M_extract_name(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                          *)(local_228 + 8),__beg_21,in_stack_fffffc80,
                                (int *)in_stack_fffffc88,in_stack_fffffc8c,(size_t)in_stack_fffffc90
                                ,in_stack_fffffc94,(_Ios_Iostate *)in_stack_fffffc98);
      p_Var13 = extraout_v1_19;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 1:
      iVar6 = *(int *)(local_48 + 8);
      __beg_20._M_c = local_38 + 0x10;
      local_18c = *(undefined4 *)(iVar6 + 100);
      __beg_20._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_248;
      local_188 = *(undefined4 *)(iVar6 + 0x68);
      local_184 = *(undefined4 *)(iVar6 + 0x6c);
      local_180 = *(undefined4 *)(iVar6 + 0x70);
      local_17c = *(undefined4 *)(iVar6 + 0x74);
      local_178 = *(undefined4 *)(iVar6 + 0x78);
      local_174 = *(undefined4 *)(iVar6 + 0x7c);
      local_170 = *(undefined4 *)(iVar6 + 0x80);
      local_16c = *(undefined4 *)(iVar6 + 0x84);
      local_168 = *(undefined4 *)(iVar6 + 0x88);
      local_164 = *(undefined4 *)(iVar6 + 0x8c);
      local_160 = *(undefined4 *)(iVar6 + 0x90);
      local_248._0_4_ = __io_00;
      local_248._4_4_ = __err_00;
      local_248._8_4_ = piVar16;
      local_23c._M_impl = p_Var13;
      piVar16 = _M_extract_name(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                          *)(local_248 + 8),__beg_20,in_stack_fffffc80,
                                (int *)in_stack_fffffc88,in_stack_fffffc8c,(size_t)in_stack_fffffc90
                                ,in_stack_fffffc94,(_Ios_Iostate *)in_stack_fffffc98);
      p_Var13 = extraout_v1_18;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 2:
    case 0x38:
      __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_338;
      __beg_00._M_c = local_38 + 0x14;
      local_338._0_4_ = __io_00;
      local_338._4_4_ = __err_00;
      local_338._8_4_ = piVar16;
      local_32c._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_338 + 8),__beg_00,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 3:
      if (pcVar5->_M_widen_ok == '\x01') {
        memcpy(auStack_200,"%m/%d/%y",9);
      }
      else {
        if (pcVar5->_M_widen_ok == '\0') {
          iVar6 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
          do {
            local_15c[iVar6] = (char)iVar6;
            iVar6 = iVar6 + 1;
          } while (iVar6 != 0x100);
          (*(pcVar5->super_facet)._vptr_facet[7])
                    (pcVar5,local_15c,local_15c + 0x100,pcVar5->_M_widen);
          pcVar5->_M_widen_ok = '\x01';
          iVar6 = memcmp(local_15c,pcVar5->_M_widen,0x100);
          if (iVar6 == 0) {
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
          else {
            pcVar5->_M_widen_ok = '\x02';
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
        }
        else {
          pp_Var12 = (pcVar5->super_facet)._vptr_facet;
        }
        (*pp_Var12[7])(pcVar5,"%m/%d/%y",&UNK_089ef765,auStack_200);
      }
      __beg_19._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_298;
      __beg_19._M_c = local_3c;
      local_298._0_4_ = __io_00;
      local_298._4_4_ = __err_00;
      local_298._8_4_ = piVar16;
      local_28c._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_298 + 8),__beg_19,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_17;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 4:
    case 5:
    case 6:
    case 9:
    case 10:
    case 0xb:
    case 0xd:
    case 0xe:
    case 0xf:
    case 0x10:
    case 0x14:
    case 0x15:
    case 0x16:
    case 0x1a:
    case 0x1b:
    case 0x1c:
    case 0x1d:
    case 0x1e:
    case 0x1f:
    case 0x25:
    case 0x26:
    case 0x28:
    case 0x29:
    case 0x2a:
    case 0x2b:
    case 0x2e:
    case 0x2f:
    case 0x30:
    case 0x31:
    case 0x32:
    case 0x34:
    case 0x35:
    case 0x36:
switchD_089abb8c_caseD_4:
      uVar7 = *in_t0;
      uVar18 = uVar17;
      goto LAB_089aba58;
    case 7:
      __beg_18._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2a8;
      __beg_18._M_c = local_38 + 8;
      local_2a8._0_4_ = __io_00;
      local_2a8._4_4_ = __err_00;
      local_2a8._8_4_ = piVar16;
      local_29c._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_2a8 + 8),__beg_18,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_16;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 8:
      __beg_17._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2b8;
      __beg_17._M_c = local_38 + 8;
      local_2b8._0_4_ = __io_00;
      local_2b8._4_4_ = __err_00;
      local_2b8._8_4_ = piVar16;
      local_2ac._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_2b8 + 8),__beg_17,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_15;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0xc:
      __beg_16._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2d8;
      __beg_16._M_c = local_38 + 4;
      local_2d8._0_4_ = __io_00;
      local_2d8._4_4_ = __err_00;
      local_2d8._8_4_ = piVar16;
      local_2cc._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_2d8 + 8),__beg_16,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_14;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x11:
      if (pcVar5->_M_widen_ok == '\x01') {
        memcpy(auStack_200,"%H:%M",6);
      }
      else {
        if (pcVar5->_M_widen_ok == '\0') {
          iVar6 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
          do {
            local_15c[iVar6] = (char)iVar6;
            iVar6 = iVar6 + 1;
          } while (iVar6 != 0x100);
          (*(pcVar5->super_facet)._vptr_facet[7])
                    (pcVar5,local_15c,local_15c + 0x100,pcVar5->_M_widen);
          pcVar5->_M_widen_ok = '\x01';
          iVar6 = memcmp(local_15c,pcVar5->_M_widen,0x100);
          if (iVar6 == 0) {
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
          else {
            pcVar5->_M_widen_ok = '\x02';
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
        }
        else {
          pp_Var12 = (pcVar5->super_facet)._vptr_facet;
        }
        (*pp_Var12[7])(pcVar5,"%H:%M",&UNK_089ef76e,auStack_200);
      }
      __beg_15._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2e8;
      __beg_15._M_c = local_3c;
      local_2e8._0_4_ = __io_00;
      local_2e8._4_4_ = __err_00;
      local_2e8._8_4_ = piVar16;
      local_2dc._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_2e8 + 8),__beg_15,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_13;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x12:
      __beg_14._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2f8;
      __beg_14._M_c = local_38;
      local_2f8._0_4_ = __io_00;
      local_2f8._4_4_ = __err_00;
      local_2f8._8_4_ = piVar16;
      local_2ec._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_2f8 + 8),__beg_14,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_12;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x13:
      if (pcVar5->_M_widen_ok == '\x01') {
        memcpy(auStack_200,"%H:%M:%S",9);
      }
      else {
        if (pcVar5->_M_widen_ok == '\0') {
          iVar6 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
          do {
            local_15c[iVar6] = (char)iVar6;
            iVar6 = iVar6 + 1;
          } while (iVar6 != 0x100);
          (*(pcVar5->super_facet)._vptr_facet[7])
                    (pcVar5,local_15c,local_15c + 0x100,pcVar5->_M_widen);
          pcVar5->_M_widen_ok = '\x01';
          iVar6 = memcmp(local_15c,pcVar5->_M_widen,0x100);
          if (iVar6 == 0) {
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
          else {
            pcVar5->_M_widen_ok = '\x02';
            pp_Var12 = (pcVar5->super_facet)._vptr_facet;
          }
        }
        else {
          pp_Var12 = (pcVar5->super_facet)._vptr_facet;
        }
        (*pp_Var12[7])(pcVar5,"%H:%M:%S",&UNK_089ef779,auStack_200);
      }
      __beg_13._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_308;
      __beg_13._M_c = local_3c;
      local_308._0_4_ = __io_00;
      local_308._4_4_ = __err_00;
      local_308._8_4_ = piVar16;
      local_2fc._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_308 + 8),__beg_13,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_11;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x17:
      __beg_12._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_328;
      __beg_12._M_c = local_3c;
      local_328._0_4_ = __io_00;
      local_328._4_4_ = __err_00;
      local_328._8_4_ = piVar16;
      local_31c._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_328 + 8),__beg_12,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_10;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x18:
      __beg_11._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_348;
      __beg_11._M_c = &local_388;
      local_348._0_4_ = __io_00;
      local_348._4_4_ = __err_00;
      local_348._8_4_ = piVar16;
      local_33c._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_348 + 8),__beg_11,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_09;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      if (*in_t0 == 0) {
        *(int *)(local_38 + 0x14) = local_388 + -0x76c;
      }
      break;
    case 0x19:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ac800:
        uVar17 = 0xff;
      }
      else {
        uVar17 = (uint)p_Var13 & 0xff;
        if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c)
          {
            p_Var9 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            p_Var9 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
          }
          if (p_Var9 == (_Impl *)0xffffffff) {
            piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089ac800;
          }
          uVar17 = (uint)p_Var9 & 0xff;
          p_Var13 = p_Var9;
        }
      }
      if ((pcVar5->_M_table[uVar17] & 1U) != 0) {
        __beg_08._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_358;
        __beg_08._M_c = &local_384;
        local_358._0_4_ = __io_00;
        local_358._4_4_ = __err_00;
        local_358._8_4_ = piVar16;
        local_34c._M_impl = p_Var13;
        piVar16 = _M_extract_name(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                            *)(local_358 + 8),__beg_08,in_stack_fffffc80,
                                  (int *)in_stack_fffffc88,in_stack_fffffc8c,
                                  (size_t)in_stack_fffffc90,in_stack_fffffc94,
                                  (_Ios_Iostate *)in_stack_fffffc98);
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        local_208 = (tm *)piVar16;
        local_58 = (tm *)piVar16;
        if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          p_Var9 = (_Impl *)0xffffffff;
          p_Var13 = extraout_v1_07;
        }
        else {
          p_Var9 = extraout_v1_07;
          p_Var13 = extraout_v1_07;
          if (extraout_v1_07 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar16[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
              p_Var9 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              p_Var9 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
            }
            p_Var13 = p_Var9;
            if (p_Var9 == (_Impl *)0xffffffff) {
              piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              p_Var13 = (_Impl *)0xffffffff;
            }
          }
        }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (__io_00 == (ios_base *)0x0) {
LAB_089ac914:
          bVar2 = true;
        }
        else {
          if (__err_00 == (char **)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if ((byte *)__io_00->_M_width < (byte *)__io_00->_M_flags) {
              __err_00 = (char **)(uint)*(byte *)__io_00->_M_width;
            }
            else {
              __err_00 = (char **)(*__io_00->_vptr_ios_base[9])(__io_00);
            }
            if (__err_00 == (char **)0xffffffff) {
              __io_00 = (ios_base *)0x0;
              goto LAB_089ac914;
            }
          }
          bVar2 = __err_00 == (char **)0xffffffff;
        }
        if (p_Var9 != (_Impl *)0xffffffff) {
          if (bVar2) {
            uVar17 = *in_t0;
            goto LAB_089ac134;
          }
          break;
        }
        if (bVar2) break;
        uVar17 = *in_t0;
LAB_089ac134:
        if (uVar17 != 0) break;
        if (local_384 == 0) {
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            local_4c = -1;
            iVar6 = local_4c;
          }
          else {
            iVar6 = (int)(char)p_Var13;
            if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar16[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
                p_Var13 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                p_Var13 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
              }
              if (p_Var13 == (_Impl *)0xffffffff) {
                p_Var13 = (_Impl *)0xffffffff;
                piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                local_4c = -1;
                iVar6 = local_4c;
              }
              else {
                iVar6 = (int)(char)p_Var13;
              }
            }
          }
          local_4c = iVar6;
          iVar6 = 0;
          if (pcVar5->_M_widen_ok == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
            puVar10 = local_15c;
            do {
              *puVar10 = (char)iVar6;
              iVar6 = iVar6 + 1;
              puVar10 = local_15c + iVar6;
            } while (iVar6 != 0x100);
            (*(pcVar5->super_facet)._vptr_facet[7])
                      (pcVar5,local_15c,local_15c + 0x100,pcVar5->_M_widen);
            pcVar5->_M_widen_ok = '\x01';
            iVar6 = memcmp(local_15c,pcVar5->_M_widen,0x100);
            if (iVar6 == 0) {
              pp_Var12 = (pcVar5->super_facet)._vptr_facet;
            }
            else {
              pcVar5->_M_widen_ok = '\x02';
              pp_Var12 = (pcVar5->super_facet)._vptr_facet;
            }
            iVar6 = (*pp_Var12[6])(pcVar5,0x2d);
            cVar3 = (char)iVar6;
          }
          else {
            cVar3 = pcVar5->_M_widen[0x2d];
          }
          if (cVar3 != local_4c) {
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
              local_50 = -1;
              iVar6 = local_50;
            }
            else {
              iVar6 = (int)(char)p_Var13;
              if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (piVar16[1]._M_sbuf <
                    (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
                  p_Var13 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
                }
                else {
                  p_Var13 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
                }
                iVar6 = (int)(char)p_Var13;
                if (p_Var13 == (_Impl *)0xffffffff) {
                  piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                  local_50 = -1;
                  iVar6 = local_50;
                }
              }
            }
            local_50 = iVar6;
            iVar6 = 0;
            if (pcVar5->_M_widen_ok == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
              puVar10 = local_15c;
              do {
                *puVar10 = (char)iVar6;
                iVar6 = iVar6 + 1;
                puVar10 = local_15c + iVar6;
              } while (iVar6 != 0x100);
              (*(pcVar5->super_facet)._vptr_facet[7])
                        (pcVar5,local_15c,local_15c + 0x100,pcVar5->_M_widen);
              pcVar5->_M_widen_ok = '\x01';
              iVar6 = memcmp(local_15c,pcVar5->_M_widen,0x100);
              if (iVar6 == 0) {
                pp_Var12 = (pcVar5->super_facet)._vptr_facet;
              }
              else {
                pcVar5->_M_widen_ok = '\x02';
                pp_Var12 = (pcVar5->super_facet)._vptr_facet;
              }
              iVar6 = (*pp_Var12[6])(pcVar5,0x2b);
              cVar3 = (char)iVar6;
            }
            else {
              cVar3 = pcVar5->_M_widen[0x2b];
            }
            if (cVar3 != local_50) {
              uVar17 = uVar18 + 1;
              goto LAB_089aba64;
            }
          }
          __beg_09._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xfffffc98;
          __beg_09._M_c = &local_384;
          in_stack_fffffc98 = __io_00;
          in_stack_fffffc9c = __err_00;
          local_360.super_facet._vptr_facet = (_func_int_varargs **)piVar16;
          local_360.super_facet._M_refcount = (_Atomic_word)p_Var13;
          in_stack_fffffc90 =
               (tm *)_M_extract_num(local_40,&local_360,__beg_09,in_stack_fffffc80,
                                    (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                                    (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,__io_00,
                                    (_Ios_Iostate *)__err_00);
          __beg_10._M_c = &local_384;
          __beg_10._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xfffffc88;
          in_stack_fffffc88 = __io_00;
          in_stack_fffffc8c = __err_00;
          in_stack_fffffc94 = __len;
          local_208 = in_stack_fffffc90;
          local_58 = in_stack_fffffc90;
          piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                             *)&stack0xfffffc90,__beg_10,in_stack_fffffc80,
                                   (int *)__io_00,(int)__err_00,(int)in_stack_fffffc90,(size_t)__len
                                   ,in_stack_fffffc98,(_Ios_Iostate *)in_stack_fffffc9c);
          p_Var13 = extraout_v1_08;
          local_208 = (tm *)piVar16;
          local_58 = (tm *)piVar16;
          break;
        }
        uVar17 = uVar18 + 1;
        goto LAB_089aba64;
      }
      uVar7 = *in_t0;
      goto LAB_089aba58;
    case 0x20:
      iVar6 = *(int *)(local_48 + 8);
      __beg_07._M_c = local_38 + 0x18;
      local_1f4 = *(undefined4 *)(iVar6 + 0x48);
      __beg_07._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_218;
      local_1f0 = *(undefined4 *)(iVar6 + 0x4c);
      local_1ec = *(undefined4 *)(iVar6 + 0x50);
      local_1e8 = *(undefined4 *)(iVar6 + 0x54);
      local_1e4 = *(undefined4 *)(iVar6 + 0x58);
      local_1e0 = *(undefined4 *)(iVar6 + 0x5c);
      local_1dc = *(undefined4 *)(iVar6 + 0x60);
      local_218._0_4_ = __io_00;
      local_218._4_4_ = __err_00;
      local_218._8_4_ = piVar16;
      local_20c._M_impl = p_Var13;
      piVar16 = _M_extract_name(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                          *)(local_218 + 8),__beg_07,in_stack_fffffc80,
                                (int *)in_stack_fffffc88,in_stack_fffffc8c,(size_t)in_stack_fffffc90
                                ,in_stack_fffffc94,(_Ios_Iostate *)in_stack_fffffc98);
      p_Var13 = extraout_v1_06;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x21:
    case 0x27:
      iVar6 = *(int *)(local_48 + 8);
      __beg_03._M_c = local_38 + 0x10;
      local_1bc = *(undefined4 *)(iVar6 + 0x94);
      __beg_03._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_238;
      local_1b8 = *(undefined4 *)(iVar6 + 0x98);
      local_1b4 = *(undefined4 *)(iVar6 + 0x9c);
      local_1b0 = *(undefined4 *)(iVar6 + 0xa0);
      local_1ac = *(undefined4 *)(iVar6 + 0xa4);
      local_1a8 = *(undefined4 *)(iVar6 + 0xa8);
      local_1a4 = *(undefined4 *)(iVar6 + 0xac);
      local_1a0 = *(undefined4 *)(iVar6 + 0xb0);
      local_19c = *(undefined4 *)(iVar6 + 0xb4);
      local_198 = *(undefined4 *)(iVar6 + 0xb8);
      local_194 = *(undefined4 *)(iVar6 + 0xbc);
      local_190 = *(undefined4 *)(iVar6 + 0xc0);
      local_238._0_4_ = __io_00;
      local_238._4_4_ = __err_00;
      local_238._8_4_ = piVar16;
      local_22c._M_impl = p_Var13;
      piVar16 = _M_extract_name(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                          *)(local_238 + 8),__beg_03,in_stack_fffffc80,
                                (int *)in_stack_fffffc88,in_stack_fffffc8c,(size_t)in_stack_fffffc90
                                ,in_stack_fffffc94,(_Ios_Iostate *)in_stack_fffffc98);
      p_Var13 = extraout_v1_02;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x22:
      __beg_06._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_258;
      __beg_06._M_c = local_3c;
      local_258._0_4_ = __io_00;
      local_258._4_4_ = __err_00;
      local_258._8_4_ = piVar16;
      local_24c._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_258 + 8),__beg_06,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_05;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x23:
      __beg_05._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_268;
      __beg_05._M_c = local_38 + 0xc;
      local_268._0_4_ = __io_00;
      local_268._4_4_ = __err_00;
      local_268._8_4_ = piVar16;
      local_25c._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_268 + 8),__beg_05,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_04;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    case 0x24:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ac7d0:
        uVar17 = 0xff;
      }
      else if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c) {
          p_Var13 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          p_Var13 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
        }
        if (p_Var13 == (_Impl *)0xffffffff) {
          piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089ac7d0;
        }
        uVar17 = (uint)p_Var13 & 0xff;
      }
      else {
        uVar17 = (uint)p_Var13 & 0xff;
      }
      if ((pcVar5->_M_table[uVar17] & 8U) == 0) {
        __beg_22._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_288;
        __beg_22._M_c = local_38 + 0xc;
        local_288._0_4_ = __io_00;
        local_288._4_4_ = __err_00;
        local_288._8_4_ = piVar16;
        local_27c._M_impl = p_Var13;
        piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                           *)(local_288 + 8),__beg_22,in_stack_fffffc80,
                                 (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                                 (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                                 (_Ios_Iostate *)in_stack_fffffc9c);
        p_Var13 = extraout_v1_20;
        local_208 = (tm *)piVar16;
        local_58 = (tm *)piVar16;
      }
      else {
        if (piVar16 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c)
          {
            piVar16[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf + 1);
          }
          else {
            (*(code *)piVar16->_M_sbuf[1]._M_in_cur)(piVar16);
          }
          p_Var13 = (_Impl *)0xffffffff;
        }
        __beg_04._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_278;
        __beg_04._M_c = local_38 + 0xc;
        local_278._0_4_ = __io_00;
        local_278._4_4_ = __err_00;
        local_278._8_4_ = piVar16;
        local_26c._M_impl = p_Var13;
        piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                           *)(local_278 + 8),__beg_04,in_stack_fffffc80,
                                 (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                                 (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                                 (_Ios_Iostate *)in_stack_fffffc9c);
        p_Var13 = extraout_v1_03;
        local_208 = (tm *)piVar16;
        local_58 = (tm *)piVar16;
      }
      break;
    case 0x2c:
      __beg_02._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_2c8;
      __beg_02._M_c = &local_388;
      local_2c8._0_4_ = __io_00;
      local_2c8._4_4_ = __err_00;
      local_2c8._8_4_ = piVar16;
      local_2bc._M_impl = p_Var13;
      piVar16 = _M_extract_num(local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)(local_2c8 + 8),__beg_02,in_stack_fffffc80,
                               (int *)in_stack_fffffc88,(int)in_stack_fffffc8c,
                               (int)in_stack_fffffc90,(size_t)in_stack_fffffc94,in_stack_fffffc98,
                               (_Ios_Iostate *)in_stack_fffffc9c);
      p_Var13 = extraout_v1_01;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      if (*in_t0 == 0) {
        *(int *)(local_38 + 0x10) = local_388 + -1;
      }
      break;
    case 0x2d:
                    /* Unresolved local var: char * __cs@[???]
                       Unresolved local var: char[10] __wcs@[???]
                       Unresolved local var: char *[7] __days1@[???]
                       Unresolved local var: char *[7] __days2@[???]
                       Unresolved local var: char *[12] __months1@[???]
                       Unresolved local var: char *[12] __months2@[???]
                       Unresolved local var: char *[2] __dt@[???]
                       Unresolved local var: char *[2] __dates@[???]
                       Unresolved local var: char *[2] __times@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ac868:
        iVar6 = -1;
        uVar17 = 0xff;
      }
      else {
        iVar6 = (int)(char)bVar11;
        if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c)
          {
            p_Var9 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            p_Var9 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
          }
          if (p_Var9 == (_Impl *)0xffffffff) {
            piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089ac868;
          }
          iVar6 = (int)(char)p_Var9;
          uVar17 = (uint)p_Var9 & 0xff;
          p_Var13 = p_Var9;
        }
        else {
          uVar17 = (uint)p_Var13 & 0xff;
        }
      }
                    /* Unresolved local var: char __t@[???] */
      iVar8 = (int)pcVar5->_M_narrow[uVar17];
      if (iVar8 == 0) {
        iVar8 = (*(pcVar5->super_facet)._vptr_facet[8])(pcVar5,iVar6,0);
        if (iVar8 != 0) {
          pcVar5->_M_narrow[uVar17] = (char)iVar8;
          goto LAB_089abbf0;
        }
        cVar3 = '\0';
      }
      else {
LAB_089abbf0:
        cVar3 = (char)iVar8;
      }
      if (cVar3 == '\n') goto LAB_089abc00;
      uVar7 = *in_t0;
      goto LAB_089aba58;
    case 0x33:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar16 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ac834:
        iVar6 = -1;
        uVar17 = 0xff;
      }
      else {
        iVar6 = (int)(char)bVar11;
        if (p_Var13 == (_Impl *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar16[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar16[1]._M_c)
          {
            p_Var9 = (_Impl *)(uint)*(byte *)&(piVar16[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            p_Var9 = (_Impl *)(*(code *)piVar16->_M_sbuf[1]._M_in_beg)(piVar16);
          }
          if (p_Var9 == (_Impl *)0xffffffff) {
            piVar16 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089ac834;
          }
          iVar6 = (int)(char)p_Var9;
          uVar17 = (uint)p_Var9 & 0xff;
          p_Var13 = p_Var9;
        }
        else {
          uVar17 = (uint)p_Var13 & 0xff;
        }
      }
                    /* Unresolved local var: char __t@[???] */
      iVar8 = (int)pcVar5->_M_narrow[uVar17];
      if (iVar8 == 0) {
        iVar8 = (*(pcVar5->super_facet)._vptr_facet[8])(pcVar5,iVar6,0);
        if (iVar8 != 0) {
          pcVar5->_M_narrow[uVar17] = (char)iVar8;
          goto LAB_089abda8;
        }
        cVar3 = '\0';
      }
      else {
LAB_089abda8:
        cVar3 = (char)iVar8;
      }
      if (cVar3 == '\t') goto LAB_089abc00;
      uVar7 = *in_t0;
      goto LAB_089aba58;
    case 0x37:
      __beg_01._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_318;
      __beg_01._M_c = local_3c;
      local_318._0_4_ = __io_00;
      local_318._4_4_ = __err_00;
      local_318._8_4_ = piVar16;
      local_30c._M_impl = p_Var13;
      piVar16 = _M_extract_via_format
                          (local_40,(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                     *)(local_318 + 8),__beg_01,in_stack_fffffc80,in_stack_fffffc88,
                           (_Ios_Iostate *)in_stack_fffffc8c,in_stack_fffffc90,
                           (char *)in_stack_fffffc94);
      p_Var13 = extraout_v1_00;
      local_208 = (tm *)piVar16;
      local_58 = (tm *)piVar16;
      break;
    default:
      uVar7 = *in_t0;
LAB_089aba58:
      *in_t0 = uVar7 | 4;
    }
LAB_089aba60:
    uVar17 = uVar18 + 1;
LAB_089aba64:
    if (piVar16 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089ab9b0;
LAB_089aba70:
    p_Var14 = (_Impl *)0xffffffff;
    if (__io_00 != (ios_base *)0x0) goto LAB_089ab9c8;
LAB_089aba80:
    bVar2 = true;
    if (p_Var14 == (_Impl *)0xffffffff) goto LAB_089ab9e8;
LAB_089aba8c:
    if (!bVar2) {
      return piVar16;
    }
  } while( true );
}



----------------------------------------

// Function: do_get_date @ 089acc74

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get_date(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get_date
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  bool bVar1;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  size_t sVar2;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar3;
  uint uVar4;
  int iVar5;
  uint extraout_v1;
  uint *in_t0;
  char *pcVar6;
  _func_int_varargs **pp_Var7;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_50;
  char *local_4c;
  ios_base *in_stack_ffffffc0;
  _Ios_Iostate *in_stack_ffffffc4;
  tm *in_stack_ffffffc8;
  locale in_stack_ffffffcc;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: char *[2] __dates@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  __beg_00._M_c = __beg._M_c;
  pp_Var7 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __end_00 = *(istreambuf_iterator<char,std::char_traits<char>_> *)&this->super_facet;
  pcVar6 = (__beg._M_sbuf)->_M_in_beg;
  sVar2 = locale::id::_M_id(&__timepunct<char>::id);
  if ((*(uint *)(*(int *)(__beg_00._M_c + 0x6c) + 8) <= sVar2) ||
     (*(int *)(sVar2 * 4 + *(int *)(*(int *)(__beg_00._M_c + 0x6c) + 4)) == 0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_50;
  local_50 = pp_Var7;
  local_4c = pcVar6;
  piVar3 = _M_extract_via_format
                     (__return_storage_ptr__,
                      (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)
                      &stack0xffffffb8,__beg_00,__end_00,in_stack_ffffffc0,in_stack_ffffffc4,
                      in_stack_ffffffc8,(char *)in_stack_ffffffcc._M_impl);
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (piVar3 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    uVar4 = 0xffffffff;
LAB_089acd5c:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    bVar1 = true;
    if (pp_Var7 == (_func_int_varargs **)0x0) goto LAB_089acd78;
  }
  else {
    uVar4 = extraout_v1;
    if (extraout_v1 != 0xffffffff) goto LAB_089acd5c;
                    /* Unresolved local var: int __ret@[???] */
    if (piVar3[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar3[1]._M_c) {
      uVar4 = (uint)*(byte *)&(piVar3[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar4 = (*(code *)piVar3->_M_sbuf[1]._M_in_beg)(piVar3);
    }
    if (uVar4 != 0xffffffff) goto LAB_089acd5c;
    uVar4 = 0xffffffff;
    piVar3 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    if (pp_Var7 == (_func_int_varargs **)0x0) {
      bVar1 = true;
      goto LAB_089acd78;
    }
  }
  if (pcVar6 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var7[2] < pp_Var7[3]) {
      bVar1 = (byte)*pp_Var7[2] == 0xffffffff;
    }
    else {
      iVar5 = (**(code **)(*pp_Var7 + 0x24))(pp_Var7);
      bVar1 = iVar5 == -1;
    }
  }
  else {
    bVar1 = pcVar6 == (char *)0xffffffff;
  }
LAB_089acd78:
  if (uVar4 == 0xffffffff) {
    if (!bVar1) {
      return piVar3;
    }
  }
  else if (bVar1) {
    return piVar3;
  }
  *in_t0 = *in_t0 | 2;
  return piVar3;
}



----------------------------------------

// Function: do_get_time @ 089acea4

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get_time(time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   tm * __tm) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get_time
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,tm *__tm)

{
  bool bVar1;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  size_t sVar2;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar3;
  uint uVar4;
  int iVar5;
  uint extraout_v1;
  uint *in_t0;
  char *pcVar6;
  _func_int_varargs **pp_Var7;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_50;
  char *local_4c;
  ios_base *in_stack_ffffffc0;
  _Ios_Iostate *in_stack_ffffffc4;
  tm *in_stack_ffffffc8;
  locale in_stack_ffffffcc;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __timepunct<char> * __tp@[???]
                       Unresolved local var: char *[2] __times@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  __beg_00._M_c = __beg._M_c;
  pp_Var7 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __end_00 = *(istreambuf_iterator<char,std::char_traits<char>_> *)&this->super_facet;
  pcVar6 = (__beg._M_sbuf)->_M_in_beg;
  sVar2 = locale::id::_M_id(&__timepunct<char>::id);
  if ((*(uint *)(*(int *)(__beg_00._M_c + 0x6c) + 8) <= sVar2) ||
     (*(int *)(sVar2 * 4 + *(int *)(*(int *)(__beg_00._M_c + 0x6c) + 4)) == 0)) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_50;
  local_50 = pp_Var7;
  local_4c = pcVar6;
  piVar3 = _M_extract_via_format
                     (__return_storage_ptr__,
                      (time_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)
                      &stack0xffffffb8,__beg_00,__end_00,in_stack_ffffffc0,in_stack_ffffffc4,
                      in_stack_ffffffc8,(char *)in_stack_ffffffcc._M_impl);
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (piVar3 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    uVar4 = 0xffffffff;
LAB_089acf8c:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    bVar1 = true;
    if (pp_Var7 == (_func_int_varargs **)0x0) goto LAB_089acfa8;
  }
  else {
    uVar4 = extraout_v1;
    if (extraout_v1 != 0xffffffff) goto LAB_089acf8c;
                    /* Unresolved local var: int __ret@[???] */
    if (piVar3[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar3[1]._M_c) {
      uVar4 = (uint)*(byte *)&(piVar3[1]._M_sbuf)->_vptr_basic_streambuf;
    }
    else {
      uVar4 = (*(code *)piVar3->_M_sbuf[1]._M_in_beg)(piVar3);
    }
    if (uVar4 != 0xffffffff) goto LAB_089acf8c;
    uVar4 = 0xffffffff;
    piVar3 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    if (pp_Var7 == (_func_int_varargs **)0x0) {
      bVar1 = true;
      goto LAB_089acfa8;
    }
  }
  if (pcVar6 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (pp_Var7[2] < pp_Var7[3]) {
      bVar1 = (byte)*pp_Var7[2] == 0xffffffff;
    }
    else {
      iVar5 = (**(code **)(*pp_Var7 + 0x24))(pp_Var7);
      bVar1 = iVar5 == -1;
    }
  }
  else {
    bVar1 = pcVar6 == (char *)0xffffffff;
  }
LAB_089acfa8:
  if (uVar4 == 0xffffffff) {
    if (!bVar1) {
      return piVar3;
    }
  }
  else if (bVar1) {
    return piVar3;
  }
  *in_t0 = *in_t0 | 2;
  return piVar3;
}



----------------------------------------

// Function: do_transform @ 089ad0d4

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   do_transform(collate<char> * this, char * __lo, char * __hi) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::collate<char>::do_transform
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          collate<char> *this,char *__lo,char *__hi)

{
  int iVar1;
  int iVar2;
  size_t __n;
  size_t sVar3;
  _Atomic_word _Var4;
  char *pcVar5;
  uint __res;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __from;
  uint __n_00;
  char *pcVar6;
  allocator<char> *paVar7;
  char *__s;
  allocator<char> aaStack_40 [3];
  allocator<char> aStack_3d;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_3c [5];
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> *
                       __ret@[DW_OP_reg19(s3)]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                       Unresolved local var: char * __p@[???]
                       Unresolved local var: char * __pend@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __ret@[???]
                        */
                    /* try { // try from 089ad11c to 089ad123 has its CatchHandler @ 089ad2c4 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<const_char*>
            (local_3c,__lo,__hi,&aStack_3d);
                    /* Unresolved local var: void * __p@[???] */
  pcVar6 = (char *)((int)local_3c[0]._M_dataplus._M_p +
                   *(int *)((int)local_3c[0]._M_dataplus._M_p + -0xc));
  __n_00 = ((int)__hi - (int)__lo) * 2;
  (__return_storage_ptr__->_M_dataplus)._M_p = (char *)0x8a1e514;
  __from._M_dataplus._M_p = local_3c[0]._M_dataplus._M_p;
  paVar7 = aaStack_40;
  while( true ) {
    iVar2 = -(__n_00 + 0xe & 0xfffffff8);
    __s = (char *)(paVar7 + iVar2);
    __n = _M_transform(this,(char *)(paVar7 + iVar2),(char *)__from._M_dataplus._M_p,__n_00);
    if (__n_00 <= __n) {
      iVar1 = -(__n + 0xf & 0xfffffff8);
      __s = (char *)(paVar7 + iVar1 + iVar2);
      __n_00 = __n + 1;
      __n = _M_transform(this,(char *)(paVar7 + iVar1 + iVar2),(char *)__from._M_dataplus._M_p,
                         __n_00);
    }
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
              (__return_storage_ptr__,__s,__n);
    sVar3 = strlen((char *)__from._M_dataplus._M_p);
    if (pcVar6 == (char *)((int)__from._M_dataplus._M_p + sVar3)) break;
    pcVar5 = (__return_storage_ptr__->_M_dataplus)._M_p;
                    /* Unresolved local var: char * __c@[???]
                       Unresolved local var: size_t __res@[???]
                       Unresolved local var: size_t __len@[???] */
    __res = *(int *)(pcVar5 + -0xc) + 1;
    if ((*(uint *)(pcVar5 + -8) < __res) || (0 < *(int *)(pcVar5 + -4))) {
                    /* try { // try from 089ad178 to 089ad21f has its CatchHandler @ 089ad29c */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                (__return_storage_ptr__,__res);
      pcVar5 = (__return_storage_ptr__->_M_dataplus)._M_p;
      iVar2 = *(int *)(pcVar5 + -0xc);
    }
    else {
      iVar2 = *(int *)(pcVar5 + -0xc);
    }
    __from._M_dataplus._M_p = (_Alloc_hider)((char *)((int)__from._M_dataplus._M_p + sVar3) + 1);
    pcVar5[iVar2] = '\0';
    pcVar5 = (__return_storage_ptr__->_M_dataplus)._M_p;
    *(uint *)(pcVar5 + -0xc) = __res;
    pcVar5[-0xffffffff00000004] = '\0';
    pcVar5[-0xffffffff00000003] = '\0';
    pcVar5[-0xffffffff00000002] = '\0';
    pcVar5[-0xffffffff00000001] = '\0';
    pcVar5[__res] = '\0';
    paVar7 = (allocator<char> *)__s;
  }
                    /* try { // try from 089ad278 to 089ad27f has its CatchHandler @ 089ad2c4 */
  if (((_Rep *)((int)local_3c[0]._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var4 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_3c[0]._M_dataplus._M_p + -4),-1), _Var4 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_3c[0]._M_dataplus._M_p + -0xc),aaStack_40);
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: do_compare @ 089ad324

/* DWARF original prototype: int do_compare(collate<char> * this, char * __lo1, char * __hi1, char *
   __lo2, char * __hi2) */

int __thiscall
std::collate<char>::do_compare(collate<char> *this,char *__lo1,char *__hi1,char *__lo2,char *__hi2)

{
  size_t sVar1;
  size_t sVar2;
  int iVar3;
  _Atomic_word _Var4;
  char *pcVar5;
  char *in_t0;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __one;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __two;
  char *pcVar6;
  char *pcVar7;
  allocator<char> aaStack_30 [2];
  allocator<char> aaStack_2e [2];
  allocator<char> aStack_2c;
  allocator<char> aaStack_2b [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_28;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_24;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __one@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __two@[???]
                       Unresolved local var: char * __p@[???]
                       Unresolved local var: char * __pend@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __qend@[???] */
                    /* try { // try from 089ad354 to 089ad35b has its CatchHandler @ 089ad47c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<const_char*>
            (&local_28,__lo1,__hi1,aaStack_2b);
                    /* try { // try from 089ad368 to 089ad36f has its CatchHandler @ 089ad484 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<const_char*>
            (&local_24,__lo2,in_t0,&aStack_2c);
  pcVar7 = (char *)((int)local_28._M_dataplus._M_p + *(int *)((int)local_28._M_dataplus._M_p + -0xc)
                   );
  pcVar6 = (char *)((int)local_24._M_dataplus._M_p + *(int *)((int)local_24._M_dataplus._M_p + -0xc)
                   );
  __one._M_dataplus._M_p = local_28._M_dataplus._M_p;
  __two._M_dataplus._M_p = local_24._M_dataplus._M_p;
  do {
                    /* try { // try from 089ad3bc to 089ad3c3 has its CatchHandler @ 089ad4a8 */
    iVar3 = _M_compare(this,(char *)__one._M_dataplus._M_p,(char *)__two._M_dataplus._M_p);
    if (iVar3 != 0) {
LAB_089ad3d0:
                    /* Unresolved local var: void * __p@[???] */
                    /* try { // try from 089ad458 to 089ad45f has its CatchHandler @ 089ad4e8 */
      if (((_Rep *)((int)local_24._M_dataplus._M_p + -0xc) !=
           (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                   _S_empty_rep_storage) &&
         (_Var4 = __gnu_cxx::__exchange_and_add
                            ((_Atomic_word *)((int)local_24._M_dataplus._M_p + -4),-1), _Var4 < 1))
      {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_24._M_dataplus._M_p + -0xc),aaStack_2e);
      }
                    /* try { // try from 089ad434 to 089ad43b has its CatchHandler @ 089ad47c */
      if (((_Rep *)((int)local_28._M_dataplus._M_p + -0xc) !=
           (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                   _S_empty_rep_storage) &&
         (_Var4 = __gnu_cxx::__exchange_and_add
                            ((_Atomic_word *)((int)local_28._M_dataplus._M_p + -4),-1), _Var4 < 1))
      {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_28._M_dataplus._M_p + -0xc),aaStack_30);
      }
      return iVar3;
    }
                    /* Unresolved local var: int __res@[???] */
    sVar1 = strlen((char *)__one._M_dataplus._M_p);
    sVar2 = strlen((char *)__two._M_dataplus._M_p);
    pcVar5 = (char *)((int)__two._M_dataplus._M_p + sVar2);
    if (pcVar7 == (char *)((int)__one._M_dataplus._M_p + sVar1)) {
      if (pcVar6 != pcVar5) {
        iVar3 = -1;
      }
      goto LAB_089ad3d0;
    }
    __one._M_dataplus._M_p = (_Alloc_hider)((char *)((int)__one._M_dataplus._M_p + sVar1) + 1);
    if (pcVar6 == pcVar5) {
      iVar3 = 1;
      goto LAB_089ad3d0;
    }
    __two._M_dataplus._M_p = (_Alloc_hider)(pcVar5 + 1);
  } while( true );
}



----------------------------------------

// Function: _M_cache @ 089ad518

/* DWARF original prototype: void _M_cache(__numpunct_cache<char> * this, locale * __loc) */

void __thiscall std::__numpunct_cache<char>::_M_cache(__numpunct_cache<char> *this,locale *__loc)

{
  size_t sVar1;
  char *pcVar2;
  _func_int_varargs **pp_Var3;
  int iVar4;
  ctype<char> *pcVar5;
  _Atomic_word _Var6;
  facet *pfVar7;
  char *pcVar8;
  allocator<char> aaStack_148 [2];
  allocator<char> aStack_146;
  allocator<char> aaStack_145 [2];
  allocator<char> aStack_143;
  allocator<char> aaStack_142 [2];
  allocator<char> aaStack_140 [2];
  allocator<char> aaStack_13e [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_13c;
  int local_138;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_134;
  int local_130;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_12c;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_128;
  int local_124;
  undefined1 auStack_120 [256];
  
                    /* Unresolved local var: numpunct<char> * __np@[???]
                       Unresolved local var: char * __grouping@[???]
                       Unresolved local var: char * __truename@[???]
                       Unresolved local var: char * __falsename@[???]
                       Unresolved local var: ctype<char> * __ct@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  this->_M_allocated = true;
  sVar1 = locale::id::_M_id(&numpunct<char>::id);
  if (__loc->_M_impl->_M_facets_size <= sVar1) {
LAB_089ad888:
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  pfVar7 = __loc->_M_impl->_M_facets[sVar1];
  if (pfVar7 == (facet *)0x0) goto LAB_089ad888;
  (*pfVar7->_vptr_facet[4])(&local_124,pfVar7);
                    /* Unresolved local var: void * __p@[???] */
  this->_M_grouping_size = *(size_t *)(local_124 + -0xc);
  if ((_Rep *)(local_124 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089ad9e0 to 089ad9e7 has its CatchHandler @ 089adb4c */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_124 + -4),-1);
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_124 + -0xc),aaStack_13e);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[4])(&local_128,pfVar7);
                    /* try { // try from 089ad5e0 to 089ad5e7 has its CatchHandler @ 089adae8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_128,pcVar2,this->_M_grouping_size,0);
  if ((_Rep *)((int)local_128._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089ad96c to 089ad973 has its CatchHandler @ 089adb2c */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_128._M_dataplus._M_p + -4),-1)
    ;
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_128._M_dataplus._M_p + -0xc),aaStack_140);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  this->_M_grouping = pcVar2;
  if (sVar1 == 0) {
    this->_M_use_grouping = false;
  }
  else {
                    /* try { // try from 089ad8a0 to 089ad8a7 has its CatchHandler @ 089ada28 */
    (*pfVar7->_vptr_facet[4])(&local_12c,pfVar7);
    if (-1 < *(int *)((int)local_12c._M_dataplus._M_p + -4)) {
                    /* try { // try from 089ad934 to 089ad93b has its CatchHandler @ 089ada28 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_12c);
    }
    this->_M_use_grouping = '\0' < *(char *)local_12c._M_dataplus._M_p;
    if ((_Rep *)((int)local_12c._M_dataplus._M_p + -0xc) !=
        (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                _S_empty_rep_storage) {
                    /* try { // try from 089ad8d0 to 089ad8d7 has its CatchHandler @ 089adb24 */
      _Var6 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_12c._M_dataplus._M_p + -4),-1);
      if (_Var6 < 1) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_12c._M_dataplus._M_p + -0xc),aaStack_142);
        pp_Var3 = pfVar7->_vptr_facet;
      }
      else {
        pp_Var3 = pfVar7->_vptr_facet;
      }
      goto LAB_089ad610;
    }
  }
  pp_Var3 = pfVar7->_vptr_facet;
LAB_089ad610:
  (*pp_Var3[5])(&local_130,pfVar7);
  this->_M_truename_size = *(size_t *)(local_130 + -0xc);
  if ((_Rep *)(local_130 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_truename_size;
  }
  else {
                    /* try { // try from 089ad948 to 089ad94f has its CatchHandler @ 089adb34 */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_130 + -4),-1);
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_130 + -0xc),&aStack_143);
      sVar1 = this->_M_truename_size;
    }
    else {
      sVar1 = this->_M_truename_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[5])(&local_134,pfVar7);
                    /* try { // try from 089ad664 to 089ad66b has its CatchHandler @ 089ada38 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_134,pcVar2,this->_M_truename_size,0);
  if ((_Rep *)((int)local_134._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var3 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089ad990 to 089ad997 has its CatchHandler @ 089adb44 */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_134._M_dataplus._M_p + -4),-1)
    ;
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_134._M_dataplus._M_p + -0xc),aaStack_145);
      pp_Var3 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var3 = pfVar7->_vptr_facet;
    }
  }
  this->_M_truename = pcVar2;
  (*pp_Var3[6])(&local_138,pfVar7);
  this->_M_falsename_size = *(size_t *)(local_138 + -0xc);
  if ((_Rep *)(local_138 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_falsename_size;
  }
  else {
                    /* try { // try from 089ad9b8 to 089ad9bf has its CatchHandler @ 089adb3c */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_138 + -4),-1);
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_138 + -0xc),&aStack_146);
      sVar1 = this->_M_falsename_size;
    }
    else {
      sVar1 = this->_M_falsename_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[6])(&local_13c,pfVar7);
                    /* try { // try from 089ad6d8 to 089ad6df has its CatchHandler @ 089adab4 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_13c,pcVar2,this->_M_falsename_size,0);
  if ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var3 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089ada04 to 089ada0b has its CatchHandler @ 089ada6c */
    _Var6 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_13c._M_dataplus._M_p + -4),-1)
    ;
    if (_Var6 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc),aaStack_148);
      pp_Var3 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var3 = pfVar7->_vptr_facet;
    }
  }
  this->_M_falsename = pcVar2;
  iVar4 = (*pp_Var3[2])(pfVar7);
  this->_M_decimal_point = (char)iVar4;
  iVar4 = (*pfVar7->_vptr_facet[3])(pfVar7);
  this->_M_thousands_sep = (char)iVar4;
  pcVar5 = use_facet<std::ctype<char>_>(__loc);
  pcVar2 = __num_base::_S_atoms_out;
  pcVar8 = __num_base::_S_atoms_out + 0x24;
  if (pcVar5->_M_widen_ok == '\x01') {
    memcpy(this->_M_atoms_out,__num_base::_S_atoms_out,(int)pcVar8 - (int)__num_base::_S_atoms_out);
  }
  else {
    if (pcVar5->_M_widen_ok == '\0') {
      iVar4 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      do {
        auStack_120[iVar4] = (char)iVar4;
        iVar4 = iVar4 + 1;
      } while (iVar4 != 0x100);
      (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,auStack_120,&stack0xffffffe0,pcVar5->_M_widen);
      pcVar5->_M_widen_ok = '\x01';
      iVar4 = memcmp(auStack_120,pcVar5->_M_widen,0x100);
      if (iVar4 != 0) {
        pcVar5->_M_widen_ok = '\x02';
      }
      pp_Var3 = (pcVar5->super_facet)._vptr_facet;
    }
    else {
      pp_Var3 = (pcVar5->super_facet)._vptr_facet;
    }
    (*pp_Var3[7])(pcVar5,pcVar2,pcVar8,this->_M_atoms_out);
  }
  pcVar2 = __num_base::_S_atoms_in;
  pcVar8 = __num_base::_S_atoms_in + 0x1a;
  if (pcVar5->_M_widen_ok == '\x01') {
    memcpy(this->_M_atoms_in,__num_base::_S_atoms_in,(int)pcVar8 - (int)__num_base::_S_atoms_in);
  }
  else {
    if (pcVar5->_M_widen_ok == '\0') {
      iVar4 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      do {
        auStack_120[iVar4] = (char)iVar4;
        iVar4 = iVar4 + 1;
      } while (iVar4 != 0x100);
      (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,auStack_120,&stack0xffffffe0,pcVar5->_M_widen);
      pcVar5->_M_widen_ok = '\x01';
      iVar4 = memcmp(auStack_120,pcVar5->_M_widen,0x100);
      if (iVar4 != 0) {
        pcVar5->_M_widen_ok = '\x02';
      }
      pp_Var3 = (pcVar5->super_facet)._vptr_facet;
    }
    else {
      pp_Var3 = (pcVar5->super_facet)._vptr_facet;
    }
    (*pp_Var3[7])(pcVar5,pcVar2,pcVar8,this->_M_atoms_in);
  }
  return;
}



----------------------------------------

// Function: _M_cache @ 089adb54

/* DWARF original prototype: void _M_cache(__moneypunct_cache<char,true> * this, locale * __loc) */

void __thiscall
std::__moneypunct_cache<char,true>::_M_cache(__moneypunct_cache<char,true> *this,locale *__loc)

{
  size_t sVar1;
  char *pcVar2;
  int iVar3;
  ctype<char> *pcVar4;
  _Atomic_word _Var5;
  _func_int_varargs **pp_Var6;
  facet *pfVar7;
  char *pcVar8;
  allocator<char> aaStack_178 [2];
  allocator<char> aStack_176;
  allocator<char> aaStack_175 [2];
  allocator<char> aStack_173;
  allocator<char> aaStack_172 [2];
  allocator<char> aStack_170;
  allocator<char> aaStack_16f [2];
  allocator<char> aaStack_16d [2];
  allocator<char> aStack_16b;
  int local_16a;
  int local_166;
  int local_162;
  int local_15e;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_158;
  int local_154;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_150;
  int local_14c;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_148;
  int local_144;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_140;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_13c;
  int local_138;
  undefined1 auStack_134 [256];
  undefined1 auStack_34 [4];
  int local_30;
  
                    /* Unresolved local var: moneypunct<char,true> * __mp@[???]
                       Unresolved local var: char * __grouping@[???]
                       Unresolved local var: char * __curr_symbol@[???]
                       Unresolved local var: char * __positive_sign@[???]
                       Unresolved local var: char * __negative_sign@[???]
                       Unresolved local var: ctype<char> * __ct@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  this->_M_allocated = true;
  sVar1 = locale::id::_M_id(&moneypunct<char,true>::id);
  if (__loc->_M_impl->_M_facets_size <= sVar1) {
LAB_089adfbc:
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  pfVar7 = __loc->_M_impl->_M_facets[sVar1];
  if (pfVar7 == (facet *)0x0) goto LAB_089adfbc;
  (*pfVar7->_vptr_facet[4])(&local_138,pfVar7);
                    /* Unresolved local var: void * __p@[???] */
  this->_M_grouping_size = *(size_t *)(local_138 + -0xc);
  if ((_Rep *)(local_138 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089ae0f8 to 089ae0ff has its CatchHandler @ 089ae2e8 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_138 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_138 + -0xc),&aStack_16b);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[4])(&local_13c,pfVar7);
                    /* try { // try from 089adc20 to 089adc27 has its CatchHandler @ 089ae1d0 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_13c,pcVar2,this->_M_grouping_size,0);
  if ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089ae058 to 089ae05f has its CatchHandler @ 089ae2e0 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_13c._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc),aaStack_16d);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  this->_M_grouping = pcVar2;
  if (sVar1 == 0) {
    this->_M_use_grouping = false;
  }
  else {
                    /* try { // try from 089adfd4 to 089adfdb has its CatchHandler @ 089ae188 */
    (*pfVar7->_vptr_facet[4])(&local_140,pfVar7);
    if (-1 < *(int *)((int)local_140._M_dataplus._M_p + -4)) {
                    /* try { // try from 089ae048 to 089ae04f has its CatchHandler @ 089ae188 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_140);
    }
    this->_M_use_grouping = '\0' < *(char *)local_140._M_dataplus._M_p;
    if ((_Rep *)((int)local_140._M_dataplus._M_p + -0xc) !=
        (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                _S_empty_rep_storage) {
                    /* try { // try from 089ae004 to 089ae00b has its CatchHandler @ 089ae2c0 */
      _Var5 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_140._M_dataplus._M_p + -4),-1);
      if (_Var5 < 1) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_140._M_dataplus._M_p + -0xc),aaStack_16f);
        pp_Var6 = pfVar7->_vptr_facet;
      }
      else {
        pp_Var6 = pfVar7->_vptr_facet;
      }
      goto LAB_089adc50;
    }
  }
  pp_Var6 = pfVar7->_vptr_facet;
LAB_089adc50:
  iVar3 = (*pp_Var6[2])(pfVar7);
  this->_M_decimal_point = (char)iVar3;
  iVar3 = (*pfVar7->_vptr_facet[3])(pfVar7);
  this->_M_thousands_sep = (char)iVar3;
  iVar3 = (*pfVar7->_vptr_facet[8])(pfVar7);
  pp_Var6 = pfVar7->_vptr_facet;
  this->_M_frac_digits = iVar3;
  (*pp_Var6[5])(&local_144,pfVar7);
  this->_M_curr_symbol_size = *(size_t *)(local_144 + -0xc);
  if ((_Rep *)(local_144 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_curr_symbol_size;
  }
  else {
                    /* try { // try from 089ae0a8 to 089ae0af has its CatchHandler @ 089ae2f0 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_144 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_144 + -0xc),&aStack_170);
      sVar1 = this->_M_curr_symbol_size;
    }
    else {
      sVar1 = this->_M_curr_symbol_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[5])(&local_148,pfVar7);
                    /* try { // try from 089adce0 to 089adce7 has its CatchHandler @ 089ae238 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_148,pcVar2,this->_M_curr_symbol_size,0);
  if ((_Rep *)((int)local_148._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089ae140 to 089ae147 has its CatchHandler @ 089ae2f8 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_148._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_148._M_dataplus._M_p + -0xc),aaStack_172);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_curr_symbol = pcVar2;
  (*pp_Var6[6])(&local_14c,pfVar7);
  this->_M_positive_sign_size = *(size_t *)(local_14c + -0xc);
  if ((_Rep *)(local_14c + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_positive_sign_size;
  }
  else {
                    /* try { // try from 089ae080 to 089ae087 has its CatchHandler @ 089ae2d0 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_14c + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_14c + -0xc),&aStack_173);
      sVar1 = this->_M_positive_sign_size;
    }
    else {
      sVar1 = this->_M_positive_sign_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[6])(&local_150,pfVar7);
                    /* try { // try from 089add54 to 089add5b has its CatchHandler @ 089ae204 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_150,pcVar2,this->_M_positive_sign_size,0);
  if ((_Rep *)((int)local_150._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089ae11c to 089ae123 has its CatchHandler @ 089ae2d8 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_150._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_150._M_dataplus._M_p + -0xc),aaStack_175);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_positive_sign = pcVar2;
  (*pp_Var6[7])(&local_154,pfVar7);
  this->_M_negative_sign_size = *(size_t *)(local_154 + -0xc);
  if ((_Rep *)(local_154 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_negative_sign_size;
  }
  else {
                    /* try { // try from 089ae0d0 to 089ae0d7 has its CatchHandler @ 089ae2c8 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_154 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_154 + -0xc),&aStack_176);
      sVar1 = this->_M_negative_sign_size;
    }
    else {
      sVar1 = this->_M_negative_sign_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[7])(&local_158,pfVar7);
                    /* try { // try from 089addc8 to 089addcf has its CatchHandler @ 089ae26c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_158,pcVar2,this->_M_negative_sign_size,0);
  if ((_Rep *)((int)local_158._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089ae164 to 089ae16b has its CatchHandler @ 089ae198 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_158._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_158._M_dataplus._M_p + -0xc),aaStack_178);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_negative_sign = pcVar2;
  local_162 = (*pp_Var6[9])(pfVar7);
  *(int *)(this->_M_pos_format).field = local_162;
  local_15e = local_162;
  local_30 = local_162;
  local_16a = (*pfVar7->_vptr_facet[10])(pfVar7);
  *(int *)(this->_M_neg_format).field = local_16a;
  local_166 = local_16a;
  local_30 = local_16a;
  pcVar4 = use_facet<std::ctype<char>_>(__loc);
  pcVar2 = money_base::_S_atoms;
  pcVar8 = money_base::_S_atoms + 0xb;
  if (pcVar4->_M_widen_ok == '\x01') {
    memcpy(this->_M_atoms,money_base::_S_atoms,(int)pcVar8 - (int)money_base::_S_atoms);
  }
  else {
    if (pcVar4->_M_widen_ok == '\0') {
      iVar3 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      do {
        auStack_134[iVar3] = (char)iVar3;
        iVar3 = iVar3 + 1;
      } while (iVar3 != 0x100);
      (*(pcVar4->super_facet)._vptr_facet[7])(pcVar4,auStack_134,auStack_34,pcVar4->_M_widen);
      pcVar4->_M_widen_ok = '\x01';
      iVar3 = memcmp(auStack_134,pcVar4->_M_widen,0x100);
      if (iVar3 != 0) {
        pcVar4->_M_widen_ok = '\x02';
      }
      pp_Var6 = (pcVar4->super_facet)._vptr_facet;
    }
    else {
      pp_Var6 = (pcVar4->super_facet)._vptr_facet;
    }
    (*pp_Var6[7])(pcVar4,pcVar2,pcVar8,this->_M_atoms);
  }
  return;
}



----------------------------------------

// Function: _M_insert<true> @ 089ae300

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert<true>(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __digits) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_insert<true>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__digits)

{
  undefined1 uVar1;
  int iVar2;
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar3;
  char cVar4;
  size_t sVar5;
  int iVar6;
  char *pcVar7;
  _Atomic_word _Var8;
  __moneypunct_cache<char,true> *this_00;
  byte *pbVar9;
  byte *pbVar10;
  undefined4 *in_t0;
  byte *__s_00;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar11;
  _Rep *p_Var12;
  char **__loc;
  uint __res;
  int iVar13;
  int *piVar14;
  size_t sVar15;
  char *pcVar16;
  allocator<char> *paVar17;
  allocator<char> aaStack_98 [4];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_94;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_90;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_8c;
  ostreambuf_iterator<char,std::char_traits<char>_> *apoStack_88 [3];
  char local_7c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_78;
  char local_74;
  undefined4 local_70;
  uint local_68;
  uint local_64;
  uint local_60;
  char *local_5c;
  int local_58;
  ctype<char> *local_54;
  int local_50;
  basic_streambuf<char,std::char_traits<char>_> *local_4c;
  int local_48;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *local_40;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[DW_OP_breg30(s8): +68]
                       Unresolved local var: __use_cache<std::__moneypunct_cache<char,_true>_>
                       __uc@[???]
                       Unresolved local var: __moneypunct_cache<char,true> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char * __beg@[???]
                       Unresolved local var: pattern __p@[???]
                       Unresolved local var: char * __sign@[???]
                       Unresolved local var: size_t __sign_size@[???]
                       Unresolved local var: size_t __len@[???] */
  local_4c = __s._M_sbuf;
  local_78 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_74 = (char)(this->super_facet)._M_refcount;
  __loc = &local_4c[3]._M_in_end;
  local_48 = (int)__s._M_failed;
  local_54 = use_facet<std::ctype<char>_>((locale *)__loc);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  sVar5 = locale::id::_M_id(&moneypunct<char,true>::id);
  piVar14 = (int *)(sVar5 * 4 + *(int *)(local_4c[3]._M_in_end + 0xc));
  iVar13 = *piVar14;
  if (iVar13 == 0) {
                    /* try { // try from 089ae880 to 089ae8eb has its CatchHandler @ 089ae9ac */
    this_00 = operator_new(0x44);
                    /* Unresolved local var: __moneypunct_cache<char,true> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_curr_symbol = (char *)0x0;
    this_00->_M_curr_symbol_size = 0;
    this_00->_M_positive_sign = (char *)0x0;
    this_00->_M_positive_sign_size = 0;
    this_00->_M_negative_sign = (char *)0x0;
    this_00->_M_negative_sign_size = 0;
    this_00->_M_frac_digits = 0;
    *(undefined4 *)(this_00->_M_pos_format).field = 0;
    local_70 = 0;
    *(undefined4 *)(this_00->_M_neg_format).field = 0;
    this_00->_M_allocated = false;
    __moneypunct_cache<char,true>::_M_cache(this_00,(locale *)__loc);
    locale::_Impl::_M_install_cache((_Impl *)*__loc,&this_00->super_facet,sVar5);
    iVar13 = *piVar14;
  }
  __s_00 = (byte *)*in_t0;
  local_58 = iVar13 + 0x38;
  pbVar9 = __s_00 + -0xc;
  if (*__s_00 == *(byte *)(iVar13 + 0x38)) {
    local_94._M_dataplus._M_p = *(_Alloc_hider *)(iVar13 + 0x34);
    local_5c = *(char **)(iVar13 + 0x24);
    local_60 = *(uint *)(iVar13 + 0x28);
    if (*(int *)(__s_00 + -0xc) != 0) {
      __s_00 = __s_00 + 1;
    }
  }
  else {
    local_94._M_dataplus._M_p = *(_Alloc_hider *)(iVar13 + 0x30);
    local_5c = *(char **)(iVar13 + 0x1c);
    local_60 = *(uint *)(iVar13 + 0x20);
  }
  if ((__s_00 < __s_00 + *(int *)pbVar9) &&
     (pbVar10 = __s_00, (local_54->_M_table[*__s_00] & 4U) != 0)) {
    do {
      pbVar10 = pbVar10 + 1;
      if (pbVar10 == __s_00 + *(int *)pbVar9) break;
    } while ((local_54->_M_table[*pbVar10] & 4U) != 0);
    sVar5 = (int)pbVar10 - (int)__s_00;
    if (sVar5 != 0) {
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __value@[???]
                       Unresolved local var: int __paddec@[???]
                       Unresolved local var: _Ios_Fmtflags __f@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __res@[???]
                       Unresolved local var: size_t __width@[???]
                       Unresolved local var: bool __testipad@[???] */
      local_40 = &local_90;
      local_90._M_dataplus._M_p =
           (_Alloc_hider)
           (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
            _S_empty_rep_storage + 3);
                    /* try { // try from 089ae440 to 089ae507 has its CatchHandler @ 089ae99c */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_40,sVar5 * 2);
      iVar6 = *(int *)(iVar13 + 0x2c);
      sVar15 = sVar5 - iVar6;
      paVar17 = aaStack_98;
      if (0 < (int)sVar15) {
        if (iVar6 < 0) {
          sVar15 = sVar5;
        }
        if (*(size_t *)(iVar13 + 0xc) == 0) {
                    /* try { // try from 089ae844 to 089ae84b has its CatchHandler @ 089ae99c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
                    (&local_90,(char *)__s_00,sVar15);
          iVar6 = *(int *)(iVar13 + 0x2c);
          paVar17 = aaStack_98;
        }
        else {
                    /* Unresolved local var: char * __ws@[???]
                       Unresolved local var: char * __ws_end@[???] */
          iVar2 = -(sVar5 * 2 + 0xe & 0xfffffff8);
          pcVar7 = __add_grouping<char>
                             ((char *)(aaStack_98 + iVar2),*(char *)(iVar13 + 0x12),
                              *(char **)(iVar13 + 8),*(size_t *)(iVar13 + 0xc),
                              *(char **)((int)apoStack_88 + iVar2),
                              *(char **)((int)apoStack_88 + iVar2 + 4));
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
                    (&local_90,(char *)(aaStack_98 + iVar2),(int)pcVar7 - (int)(aaStack_98 + iVar2))
          ;
          iVar6 = *(int *)(iVar13 + 0x2c);
          paVar17 = aaStack_98 + iVar2;
        }
      }
      if (0 < iVar6) {
                    /* Unresolved local var: size_t __len@[???] */
        __res = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) + 1;
        cVar4 = *(char *)(iVar13 + 0x11);
        if ((*(size_t *)((int)local_90._M_dataplus._M_p + -8) < __res) ||
           (0 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4))) {
                    /* try { // try from 089ae700 to 089ae707 has its CatchHandler @ 089ae99c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_90,__res);
        }
        *(char *)((int)local_90._M_dataplus._M_p +
                 *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) = cVar4;
        *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0;
        *(uint *)((int)local_90._M_dataplus._M_p + -0xc) = __res;
        *(char *)((int)local_90._M_dataplus._M_p + __res) = '\0';
        if ((int)sVar15 < 0) {
                    /* try { // try from 089ae910 to 089ae927 has its CatchHandler @ 089ae99c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,-sVar15,*(char *)(local_58 + 1));
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,(char *)__s_00,sVar5);
        }
        else {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,(char *)(__s_00 + sVar15),*(size_t *)(iVar13 + 0x2c));
        }
      }
      pcVar7 = local_4c->_M_in_end;
      iVar6 = 0;
      if (((uint)pcVar7 & 0x200) != 0) {
        iVar6 = *(int *)(iVar13 + 0x18);
      }
      pcVar16 = (char *)(local_60 + iVar6 + *(size_t *)((int)local_90._M_dataplus._M_p + -0xc));
      local_8c._M_dataplus._M_p =
           (_Alloc_hider)
           (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
            _S_empty_rep_storage + 3);
                    /* try { // try from 089ae544 to 089ae643 has its CatchHandler @ 089ae960 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                (&local_8c,(int)pcVar16 * 2);
      local_68 = (uint)pcVar7 & 0xb0;
      pcVar7 = local_4c->_M_in_cur;
      if (local_68 == 0x10) {
        local_64 = (uint)(pcVar16 < pcVar7);
      }
      else {
        local_64 = 0;
      }
      pbVar11 = &local_94;
                    /* Unresolved local var: int __i@[???]
                       Unresolved local var: part __which@[???] */
      uVar1 = local_94._M_dataplus._M_p._0_1_;
      do {
        switch(uVar1) {
        case 0:
          if (local_64 != 0) {
LAB_089ae5a8:
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (&local_8c,(int)pcVar7 - (int)pcVar16,(char)local_48);
          }
          break;
        case 1:
          if (local_64 != 0) goto LAB_089ae5a8;
                    /* Unresolved local var: size_t __len@[???] */
          sVar5 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) + 1;
          if ((*(size_t *)((int)local_8c._M_dataplus._M_p + -8) < sVar5) ||
             (0 < (int)*(size_t *)((int)local_8c._M_dataplus._M_p + -4))) {
                    /* try { // try from 089ae854 to 089ae877 has its CatchHandler @ 089ae960 */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (&local_8c,sVar5);
          }
          *(char *)((int)local_8c._M_dataplus._M_p +
                   *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc)) = (char)local_48;
LAB_089ae77c:
          *(size_t *)((int)local_8c._M_dataplus._M_p + -4) = 0;
          *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) = sVar5;
          *(char *)((int)local_8c._M_dataplus._M_p + sVar5) = '\0';
          break;
        case 2:
          if (((uint)local_4c->_M_in_end & 0x200) != 0) {
                    /* try { // try from 089ae7b0 to 089ae833 has its CatchHandler @ 089ae960 */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (&local_8c,*(char **)(iVar13 + 0x14),*(size_t *)(iVar13 + 0x18));
          }
          break;
        case 3:
          if (local_60 != 0) {
                    /* Unresolved local var: size_t __len@[???] */
            local_50 = (int)*local_5c;
            sVar5 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) + 1;
            if ((*(size_t *)((int)local_8c._M_dataplus._M_p + -8) < sVar5) ||
               (0 < (int)*(size_t *)((int)local_8c._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_8c,sVar5);
              sVar15 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc);
            }
            else {
              sVar15 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc);
            }
            *(char *)((int)local_8c._M_dataplus._M_p + sVar15) = (char)local_50;
            goto LAB_089ae77c;
          }
          break;
        case 4:
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_8c,&local_90);
        }
        pbVar11 = (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                  ((int)&(pbVar11->_M_dataplus)._M_p + 1);
        if (pbVar11 == local_40) goto code_r0x089ae5c8;
        uVar1 = *(undefined1 *)&(pbVar11->_M_dataplus)._M_p;
      } while( true );
    }
  }
LAB_089ae6ac:
  local_4c->_M_in_cur = (char *)0x0;
  return local_78;
code_r0x089ae5c8:
  if (1 < local_60) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
              (&local_8c,local_5c + 1,local_60 - 1);
  }
  pcVar16 = *(char **)((int)local_8c._M_dataplus._M_p + -0xc);
  if (pcVar16 < pcVar7) {
    if (local_68 == 0x20) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                (&local_8c,(int)pcVar7 - (int)pcVar16,(char)local_48);
      pcVar16 = pcVar7;
    }
    else {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
                (&local_8c,0,0,(int)pcVar7 - (int)pcVar16,*(char *)(paVar17 + 0x10));
      pcVar16 = pcVar7;
    }
  }
  cVar4 = local_74;
  poVar3 = local_78;
  if ((local_74 == '\0') &&
     (pcVar7 = (char *)(*(code *)local_78->_M_sbuf[1]._M_out_beg)
                                 (local_78,local_8c._M_dataplus._M_p,pcVar16), pcVar16 != pcVar7)) {
    cVar4 = '\x01';
  }
  p_Var12 = (_Rep *)((int)local_8c._M_dataplus._M_p + -0xc);
  apoStack_88[2] = poVar3;
  local_7c = cVar4;
  local_78 = poVar3;
  local_74 = cVar4;
                    /* try { // try from 089ae93c to 089ae943 has its CatchHandler @ 089ae99c */
  if ((p_Var12 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var8 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_8c._M_dataplus._M_p + -4),-1), _Var8 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var12,aaStack_98 + 3);
  }
  p_Var12 = (_Rep *)((int)local_90._M_dataplus._M_p + -0xc);
                    /* try { // try from 089ae68c to 089ae693 has its CatchHandler @ 089ae9a4 */
  if ((p_Var12 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var8 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_90._M_dataplus._M_p + -4),-1), _Var8 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var12,aaStack_98);
  }
  goto LAB_089ae6ac;
}



----------------------------------------

// Function: _M_extract<true> @ 089aea40

/* WARNING: Removing unreachable block (ram,0x089af670) */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract<true>(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __units) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract<true>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__units)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  char cVar5;
  char cVar6;
  bool bVar7;
  ctype<char> *pcVar8;
  size_t sVar9;
  undefined4 uVar10;
  undefined3 extraout_var;
  void *pvVar11;
  __moneypunct_cache<char,true> *this_00;
  _Atomic_word _Var12;
  int iVar13;
  char *pcVar14;
  char cVar15;
  char cVar16;
  uint *in_t0;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_t1;
  uint uVar17;
  _Rep *p_Var18;
  uint uVar19;
  uint uVar20;
  int iVar21;
  locale *__loc;
  int iVar22;
  int *piVar23;
  _func_int_varargs **pp_Var24;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar25;
  int iVar26;
  uint uVar27;
  allocator<char> aaStack_98 [3];
  allocator<char> aStack_95;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_94;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_90;
  undefined4 local_8c;
  char in_stack_ffffff78;
  char *local_78;
  int local_74;
  int local_68;
  int local_64;
  uint local_5c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: __use_cache<std::__moneypunct_cache<char,_true>_>
                       __uc@[???]
                       Unresolved local var: __moneypunct_cache<char,true> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: size_t __sign_size@[???]
                       Unresolved local var: bool __mandatory_sign@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __grouping_tmp@[???]
                       Unresolved local var: int __last_pos@[???]
                       Unresolved local var: int __n@[???]
                       Unresolved local var: bool __testvalid@[???]
                       Unresolved local var: bool __testdecfound@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __res@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: pattern __p@[???]
                       Unresolved local var: int __ret@[???] */
  iVar13 = __beg._M_c;
  pp_Var24 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_78 = (__beg._M_sbuf)->_M_in_beg;
  __loc = (locale *)(iVar13 + 0x6c);
  piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar27 = (this->super_facet)._M_refcount;
  pcVar8 = use_facet<std::ctype<char>_>(__loc);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  sVar9 = locale::id::_M_id(&moneypunct<char,true>::id);
  piVar23 = (int *)(sVar9 * 4 + *(int *)(*(int *)(iVar13 + 0x6c) + 0xc));
  iVar26 = *piVar23;
  if (iVar26 == 0) {
                    /* try { // try from 089af950 to 089af9bb has its CatchHandler @ 089afedc */
    this_00 = operator_new(0x44);
                    /* Unresolved local var: __moneypunct_cache<char,true> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_curr_symbol = (char *)0x0;
    this_00->_M_curr_symbol_size = 0;
    this_00->_M_positive_sign = (char *)0x0;
    this_00->_M_positive_sign_size = 0;
    this_00->_M_negative_sign = (char *)0x0;
    this_00->_M_negative_sign_size = 0;
    this_00->_M_frac_digits = 0;
    *(undefined4 *)(this_00->_M_pos_format).field = 0;
    *(undefined4 *)(this_00->_M_neg_format).field = 0;
    this_00->_M_allocated = false;
    __moneypunct_cache<char,true>::_M_cache(this_00,__loc);
    locale::_Impl::_M_install_cache(__loc->_M_impl,&this_00->super_facet,sVar9);
    iVar26 = *piVar23;
  }
  if (*(int *)(iVar26 + 0x20) == 0) {
    bVar7 = false;
  }
  else {
    bVar7 = *(int *)(iVar26 + 0x28) != 0;
  }
  local_94._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  if (*(char *)(iVar26 + 0x10) != '\0') {
                    /* try { // try from 089aeb08 to 089aeb0f has its CatchHandler @ 089afe2c */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_94,0x20);
  }
  local_90._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
                    /* try { // try from 089aeb18 to 089af947 has its CatchHandler @ 089afe54 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_90,0x20);
  uVar10 = *(undefined4 *)(iVar26 + 0x34);
  local_8c = uVar10;
  uVar10 = local_8c;
                    /* Unresolved local var: int __i@[???]
                       Unresolved local var: part __which@[???] */
  local_8c._3_1_ = (char)((uint)uVar10 >> 0x18);
  cVar6 = local_8c._3_1_;
  local_8c._0_1_ = (char)uVar10;
  cVar16 = (char)local_8c;
  local_8c._2_1_ = (char)((uint)uVar10 >> 0x10);
  cVar5 = local_8c._2_1_;
  bVar3 = false;
  local_64 = 0;
  local_74 = 0;
  local_68 = 0;
  local_5c = 0;
  bVar4 = false;
  local_8c = uVar10;
LAB_089aeb70:
  do {
    bVar1 = true;
    switch(*(undefined1 *)((int)&local_8c + local_74)) {
    case 0:
switchD_089aeb9c_caseD_0:
      bVar1 = true;
      goto LAB_089aeee0;
    case 1:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar17 = 0xffffffff;
      }
      else {
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
                    /* try { // try from 089afecc to 089afed3 has its CatchHandler @ 089afe54 */
            uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          uVar27 = uVar17;
          if (uVar17 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
          }
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089afa1c:
        bVar1 = true;
      }
      else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          pcVar14 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          pcVar14 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (pcVar14 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089afa1c;
        }
        bVar1 = pcVar14 == (char *)0xffffffff;
        local_78 = pcVar14;
      }
      else {
        bVar1 = local_78 == (char *)0xffffffff;
      }
      if (uVar17 == 0xffffffff) {
        if (!bVar1) {
LAB_089aeea0:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089afa9c:
            uVar17 = 0xff;
          }
          else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar27 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089afa9c;
            }
            uVar17 = uVar27 & 0xff;
          }
          else {
            uVar17 = uVar27 & 0xff;
          }
          if ((pcVar8->_M_table[uVar17] & 8U) != 0) {
            if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto switchD_089aeb9c_caseD_0;
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              bVar1 = true;
              uVar27 = 0xffffffff;
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              bVar1 = true;
              uVar27 = 0xffffffff;
            }
            goto LAB_089aeee0;
          }
        }
      }
      else if (bVar1) goto LAB_089aeea0;
      bVar1 = false;
LAB_089aeee0:
      if (local_74 == 3) goto joined_r0x089af110;
LAB_089aeef4:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar17 = uVar27;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af660;
      if (uVar27 != 0xffffffff) goto LAB_089aef08;
                    /* Unresolved local var: int __ret@[???] */
      if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
        uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
      }
      uVar17 = uVar27;
      if (uVar27 != 0xffffffff) goto LAB_089aef08;
      piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      uVar17 = 0xffffffff;
      if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089aef14;
LAB_089aefc0:
      bVar2 = true;
      if (uVar27 == 0xffffffff) goto LAB_089aef30;
      while (uVar27 = uVar17, bVar2) {
        while( true ) {
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            uVar20 = 0xff;
          }
          else if (uVar17 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar17 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar17 = 0xffffffff;
              uVar20 = 0xff;
            }
            else {
              uVar20 = uVar17 & 0xff;
            }
          }
          else {
            uVar20 = uVar17 & 0xff;
          }
          uVar27 = uVar17;
          if ((pcVar8->_M_table[uVar20] & 8U) == 0) goto joined_r0x089af100;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = 0xffffffff;
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
                    /* try { // try from 089afd6c to 089afe23 has its CatchHandler @ 089afe54 */
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
            goto LAB_089aeef4;
          }
LAB_089af660:
          uVar27 = 0xffffffff;
LAB_089aef08:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089aefc0;
LAB_089aef14:
          if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (pp_Var24[2] < pp_Var24[3]) {
              local_78 = (char *)(uint)(byte)*pp_Var24[2];
            }
            else {
              local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
            }
            if (local_78 == (char *)0xffffffff) {
              pp_Var24 = (_func_int_varargs **)0x0;
              goto LAB_089aefc0;
            }
          }
          bVar2 = local_78 == (char *)0xffffffff;
          if (uVar27 != 0xffffffff) break;
LAB_089aef30:
          uVar27 = uVar17;
          if (bVar2) goto joined_r0x089af100;
        }
      }
      break;
    case 2:
      if ((*(uint *)(iVar13 + 0xc) & 0x200) != 0) goto LAB_089aeff0;
      if (local_5c < 2) {
        if (local_74 == 0) {
          iVar21 = *(int *)(iVar26 + 0x18);
        }
        else {
          if (local_74 == 1) {
            if (bVar7) {
              iVar21 = *(int *)(iVar26 + 0x18);
              goto LAB_089aeff4;
            }
            if ((cVar16 != '\x03') && (cVar5 != '\x01')) {
              local_74 = 2;
              goto LAB_089aeb70;
            }
          }
          else {
            bVar1 = true;
            if (local_74 != 2) break;
            if ((cVar6 != '\x04') && ((!bVar7 || (cVar6 != '\x03')))) {
              local_74 = 3;
              goto LAB_089aeb70;
            }
          }
LAB_089aeff0:
                    /* Unresolved local var: size_t __len@[???]
                       Unresolved local var: size_t __j@[???] */
          iVar21 = *(int *)(iVar26 + 0x18);
        }
      }
      else {
        iVar21 = *(int *)(iVar26 + 0x18);
      }
LAB_089aeff4:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      iVar22 = 0;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af0a0;
LAB_089af004:
      uVar17 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar27 = uVar17;
        if (uVar17 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar27 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089af0b0;
LAB_089af01c:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089af0b0;
        }
      }
      bVar1 = local_78 == (char *)0xffffffff;
      if (uVar17 != 0xffffffff) goto LAB_089af0bc;
      while (!bVar1) {
        while( true ) {
          if (iVar22 == iVar21) goto LAB_089af868;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            cVar15 = -1;
          }
          else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar27 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar27 = 0xffffffff;
              cVar15 = -1;
            }
            else {
              cVar15 = (char)uVar27;
            }
          }
          else {
            cVar15 = (char)uVar27;
          }
          if (cVar15 != *(char *)(iVar22 + *(int *)(iVar26 + 0x14))) goto LAB_089af0c4;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
              uVar27 = 0xffffffff;
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
          }
          iVar22 = iVar22 + 1;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
          goto LAB_089af004;
LAB_089af0a0:
          uVar17 = 0xffffffff;
          if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089af01c;
LAB_089af0b0:
          bVar1 = true;
          if (uVar17 == 0xffffffff) break;
LAB_089af0bc:
          if (!bVar1) goto LAB_089af0c4;
        }
      }
LAB_089af0c4:
      if ((iVar22 == iVar21) || ((iVar22 == 0 && ((*(uint *)(iVar13 + 0xc) & 0x200) == 0)))) {
LAB_089af868:
        bVar1 = true;
      }
      else {
        bVar1 = false;
      }
      break;
    case 3:
      if (*(int *)(iVar26 + 0x20) == 0) goto LAB_089af234;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar17 = 0xffffffff;
      }
      else {
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          uVar27 = uVar17;
          if (uVar17 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
          }
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089afc24:
        bVar1 = true;
      }
      else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089afc24;
        }
        bVar1 = local_78 == (char *)0xffffffff;
      }
      else {
        bVar1 = local_78 == (char *)0xffffffff;
      }
      if (uVar17 == 0xffffffff) {
        if (bVar1) {
LAB_089af234:
          iVar21 = *(int *)(iVar26 + 0x28);
          goto LAB_089af238;
        }
LAB_089af784:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089afb74:
          cVar15 = -1;
        }
        else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          if (uVar27 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089afb74;
          }
          cVar15 = (char)uVar27;
        }
        else {
          cVar15 = (char)uVar27;
        }
        if (cVar15 != **(char **)(iVar26 + 0x1c)) goto LAB_089af234;
        local_5c = *(uint *)(iVar26 + 0x20);
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            bVar1 = true;
            piVar25[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            uVar27 = 0xffffffff;
          }
          else {
            (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            bVar1 = true;
            uVar27 = 0xffffffff;
          }
          break;
        }
      }
      else {
        if (bVar1) goto LAB_089af784;
        iVar21 = *(int *)(iVar26 + 0x28);
LAB_089af238:
        if (iVar21 == 0) {
          iVar21 = *(int *)(iVar26 + 0x20);
LAB_089aeba8:
          if ((iVar21 == 0) || (*(int *)(iVar26 + 0x28) != 0)) {
            if (bVar7) {
              bVar1 = false;
            }
            else {
              bVar1 = true;
            }
            break;
          }
        }
        else {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            uVar17 = 0xffffffff;
          }
          else {
            uVar17 = uVar27;
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              uVar27 = uVar17;
              if (uVar17 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                uVar27 = 0xffffffff;
              }
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089afc54:
            bVar1 = true;
          }
          else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (pp_Var24[2] < pp_Var24[3]) {
              local_78 = (char *)(uint)(byte)*pp_Var24[2];
            }
            else {
              local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
            }
            if (local_78 == (char *)0xffffffff) {
              pp_Var24 = (_func_int_varargs **)0x0;
              goto LAB_089afc54;
            }
            bVar1 = local_78 == (char *)0xffffffff;
          }
          else {
            bVar1 = local_78 == (char *)0xffffffff;
          }
          if (uVar17 != 0xffffffff) {
            if (bVar1) {
              if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
              goto LAB_089af28c;
              cVar15 = -1;
              goto LAB_089af298;
            }
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089aeba8;
          }
          if (bVar1) {
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089aeba8;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          cVar15 = -1;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089af28c:
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                    /* try { // try from 089aff18 to 089affe7 has its CatchHandler @ 089afe54 */
                uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              if (uVar27 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                cVar15 = -1;
              }
              else {
                cVar15 = (char)uVar27;
              }
            }
            else {
              cVar15 = (char)uVar27;
            }
          }
LAB_089af298:
          if (cVar15 != **(char **)(iVar26 + 0x24)) {
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089aeba8;
          }
          local_5c = *(uint *)(iVar26 + 0x28);
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            }
            bVar1 = true;
            bVar3 = true;
            uVar27 = 0xffffffff;
            break;
          }
        }
        bVar3 = true;
      }
      bVar1 = true;
      break;
    case 4:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af404;
LAB_089af2f0:
      uVar17 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar17 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar20 = uVar27;
      uVar27 = uVar17;
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089af414;
LAB_089af308:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089af414;
        }
      }
      bVar2 = local_78 == (char *)0xffffffff;
      if (uVar20 != 0xffffffff) goto LAB_089af420;
LAB_089af328:
      bVar1 = true;
      if (!bVar2) {
        do {
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089af464:
            pvVar11 = memchr((void *)(iVar26 + 0x39),-1,10);
            iVar21 = -1;
            if (pvVar11 == (void *)0x0) goto LAB_089af480;
LAB_089af35c:
                    /* Unresolved local var: size_t __len@[???] */
            uVar17 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) + 1;
            cVar15 = money_base::_S_atoms[(int)pvVar11 - (iVar26 + 0x38)];
            if ((*(size_t *)((int)local_90._M_dataplus._M_p + -8) < uVar17) ||
               (0 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_90,uVar17);
              sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
            }
            else {
              sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
            }
            local_68 = local_68 + 1;
            *(char *)((int)local_90._M_dataplus._M_p + sVar9) = cVar15;
            *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0;
            *(uint *)((int)local_90._M_dataplus._M_p + -0xc) = uVar17;
            *(char *)((int)local_90._M_dataplus._M_p + uVar17) = '\0';
          }
          else {
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                    /* try { // try from 089afa40 to 089afd0b has its CatchHandler @ 089afe54 */
                uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              if (uVar27 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                goto LAB_089af464;
              }
            }
            iVar21 = (int)(char)uVar27;
            pvVar11 = memchr((void *)(iVar26 + 0x39),iVar21,10);
            if (pvVar11 != (void *)0x0) goto LAB_089af35c;
LAB_089af480:
            if (*(char *)(iVar26 + 0x11) == iVar21) {
              if (!bVar4) {
                local_64 = local_68;
                bVar4 = true;
                local_68 = 0;
                goto LAB_089af3d8;
              }
              cVar15 = *(char *)(iVar26 + 0x10);
            }
            else {
              cVar15 = *(char *)(iVar26 + 0x10);
            }
            bVar1 = true;
            if (((cVar15 == '\0') || (*(char *)(iVar26 + 0x12) != iVar21)) || (bVar4)) break;
            if (local_68 == 0) {
              bVar1 = false;
              break;
            }
                    /* Unresolved local var: size_t __len@[???] */
            uVar17 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc) + 1;
            if ((*(size_t *)((int)local_94._M_dataplus._M_p + -8) < uVar17) ||
               (0 < (int)*(size_t *)((int)local_94._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_94,uVar17);
              sVar9 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc);
            }
            else {
              sVar9 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc);
            }
            *(char *)((int)local_94._M_dataplus._M_p + sVar9) = (char)local_68;
            local_68 = 0;
            *(size_t *)((int)local_94._M_dataplus._M_p + -4) = 0;
            *(uint *)((int)local_94._M_dataplus._M_p + -0xc) = uVar17;
            *(char *)((int)local_94._M_dataplus._M_p + uVar17) = '\0';
          }
LAB_089af3d8:
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
              uVar27 = 0xffffffff;
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
          }
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
          goto LAB_089af2f0;
LAB_089af404:
          uVar20 = 0xffffffff;
          if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089af308;
LAB_089af414:
          bVar2 = true;
          if (uVar20 == 0xffffffff) goto LAB_089af328;
LAB_089af420:
          bVar1 = true;
          if (!bVar2) break;
        } while( true );
      }
      if (*(size_t *)((int)local_90._M_dataplus._M_p + -0xc) == 0) {
        bVar1 = false;
      }
    }
joined_r0x089af100:
    if (3 < local_74 + 1) goto joined_r0x089af110;
    local_74 = local_74 + 1;
  } while (bVar1);
  bVar1 = false;
joined_r0x089af110:
  if (local_5c < 2) {
    if (!bVar1) goto LAB_089aed68;
LAB_089aec04:
                    /* Unresolved local var: size_t __first@[???]
                       Unresolved local var: bool __only_zeros@[???] */
    if ((1 < *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) &&
       (sVar9 = basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
                          (&local_90,'0',0), sVar9 != 0)) {
      if (sVar9 == 0xffffffff) {
        sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) - 1;
      }
                    /* Unresolved local var: bool __testoff@[???] */
      uVar17 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
      if (sVar9 <= *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) {
        uVar17 = sVar9;
      }
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
                (&local_90,0,uVar17,0);
    }
    if (bVar3) {
      if (-1 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4)) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_90);
      }
      if (*(char *)local_90._M_dataplus._M_p != '0') {
        if (-1 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4)) {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_90);
        }
                    /* Unresolved local var: size_t __pos@[???] */
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
                  (&local_90,0,0,1,in_stack_ffffff78);
        *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0xffffffff;
      }
    }
    if (*(size_t *)((int)local_94._M_dataplus._M_p + -0xc) != 0) {
      if (!bVar4) {
        local_64._0_1_ = (char)local_68;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar17 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_94._M_dataplus._M_p + -8) < uVar17) ||
         (0 < (int)*(size_t *)((int)local_94._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_94,uVar17);
      }
      *(char *)((int)local_94._M_dataplus._M_p + *(size_t *)((int)local_94._M_dataplus._M_p + -0xc))
           = (char)local_64;
      *(size_t *)((int)local_94._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_94._M_dataplus._M_p + -0xc) = uVar17;
      *(char *)((int)local_94._M_dataplus._M_p + uVar17) = '\0';
      bVar7 = __verify_grouping(*(char **)(iVar26 + 8),*(size_t *)(iVar26 + 0xc),&local_94);
      if (CONCAT31(extraout_var,bVar7) == 0) {
        *in_t0 = *in_t0 | 4;
      }
    }
    if (((bVar4) && (0 < *(int *)(iVar26 + 0x2c))) && (*(int *)(iVar26 + 0x2c) != local_68))
    goto LAB_089aed68;
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::swap(in_t1,&local_90);
    if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089aed80;
LAB_089af684:
    uVar27 = 0xffffffff;
    if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089af690;
LAB_089aed94:
    if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var24[2] < pp_Var24[3]) {
        bVar7 = (byte)*pp_Var24[2] == 0xffffffff;
      }
      else {
        iVar13 = (**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        bVar7 = iVar13 == -1;
      }
    }
    else {
      bVar7 = local_78 == (char *)0xffffffff;
    }
    if (uVar27 == 0xffffffff) goto LAB_089aedb4;
LAB_089af698:
    if (bVar7) goto LAB_089aedc0;
  }
  else {
    if (bVar1) {
                    /* Unresolved local var: char * __sign@[???]
                       Unresolved local var: size_t __i@[???] */
      if (bVar3) {
        iVar13 = *(int *)(iVar26 + 0x24);
      }
      else {
        iVar13 = *(int *)(iVar26 + 0x1c);
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar17 = 1;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af1d8;
LAB_089af13c:
      uVar20 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar20 = uVar27;
        if (uVar27 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar20 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar19 = uVar27;
      uVar27 = uVar20;
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089af1e8;
LAB_089af154:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089af1e8;
        }
      }
      bVar7 = local_78 == (char *)0xffffffff;
      do {
        if (uVar19 != 0xffffffff) {
          if (bVar7) goto LAB_089af180;
LAB_089af200:
          if (uVar17 == local_5c) goto LAB_089aec04;
          *in_t0 = *in_t0 | 4;
          goto LAB_089aed78;
        }
        if (bVar7) goto LAB_089af200;
LAB_089af180:
        if (uVar17 == local_5c) goto LAB_089aec04;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar16 = -1;
        }
        else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          if (uVar27 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
            cVar16 = -1;
          }
          else {
            cVar16 = (char)uVar27;
          }
        }
        else {
          cVar16 = (char)uVar27;
        }
        if (*(char *)(iVar13 + uVar17) != cVar16) goto LAB_089af200;
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            piVar25[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            uVar27 = 0xffffffff;
          }
          else {
            (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            uVar27 = 0xffffffff;
          }
        }
        uVar17 = uVar17 + 1;
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af13c;
LAB_089af1d8:
        uVar19 = 0xffffffff;
        if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089af154;
LAB_089af1e8:
        bVar7 = true;
      } while( true );
    }
LAB_089aed68:
    *in_t0 = *in_t0 | 4;
LAB_089aed78:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089af684;
LAB_089aed80:
    if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
        uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
      }
      if (uVar27 == 0xffffffff) {
        piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089aed94;
LAB_089af690:
    bVar7 = true;
    if (uVar27 != 0xffffffff) goto LAB_089af698;
LAB_089aedb4:
    if (!bVar7) goto LAB_089aedc0;
  }
  *in_t0 = *in_t0 | 2;
LAB_089aedc0:
  p_Var18 = (_Rep *)((int)local_90._M_dataplus._M_p + -0xc);
                    /* try { // try from 089afd40 to 089afd47 has its CatchHandler @ 089afe2c */
  if ((p_Var18 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var12 = __gnu_cxx::__exchange_and_add
                         ((_Atomic_word *)((int)local_90._M_dataplus._M_p + -4),-1), _Var12 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var18,&aStack_95);
  }
  p_Var18 = (_Rep *)((int)local_94._M_dataplus._M_p + -0xc);
                    /* try { // try from 089afd1c to 089afd23 has its CatchHandler @ 089afff0 */
  if ((p_Var18 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var12 = __gnu_cxx::__exchange_and_add
                         ((_Atomic_word *)((int)local_94._M_dataplus._M_p + -4),-1), _Var12 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var18,aaStack_98);
  }
  return piVar25;
}



----------------------------------------

// Function: _M_cache @ 089afff8

/* DWARF original prototype: void _M_cache(__moneypunct_cache<char,false> * this, locale * __loc) */

void __thiscall
std::__moneypunct_cache<char,false>::_M_cache(__moneypunct_cache<char,false> *this,locale *__loc)

{
  size_t sVar1;
  char *pcVar2;
  int iVar3;
  ctype<char> *pcVar4;
  _Atomic_word _Var5;
  _func_int_varargs **pp_Var6;
  facet *pfVar7;
  char *pcVar8;
  allocator<char> aaStack_178 [2];
  allocator<char> aStack_176;
  allocator<char> aaStack_175 [2];
  allocator<char> aStack_173;
  allocator<char> aaStack_172 [2];
  allocator<char> aStack_170;
  allocator<char> aaStack_16f [2];
  allocator<char> aaStack_16d [2];
  allocator<char> aStack_16b;
  int local_16a;
  int local_166;
  int local_162;
  int local_15e;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_158;
  int local_154;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_150;
  int local_14c;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_148;
  int local_144;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_140;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_13c;
  int local_138;
  undefined1 auStack_134 [256];
  undefined1 auStack_34 [4];
  int local_30;
  
                    /* Unresolved local var: moneypunct<char,false> * __mp@[???]
                       Unresolved local var: char * __grouping@[???]
                       Unresolved local var: char * __curr_symbol@[???]
                       Unresolved local var: char * __positive_sign@[???]
                       Unresolved local var: char * __negative_sign@[???]
                       Unresolved local var: ctype<char> * __ct@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  this->_M_allocated = true;
  sVar1 = locale::id::_M_id(&moneypunct<char,false>::id);
  if (__loc->_M_impl->_M_facets_size <= sVar1) {
LAB_089b0460:
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  pfVar7 = __loc->_M_impl->_M_facets[sVar1];
  if (pfVar7 == (facet *)0x0) goto LAB_089b0460;
  (*pfVar7->_vptr_facet[4])(&local_138,pfVar7);
                    /* Unresolved local var: void * __p@[???] */
  this->_M_grouping_size = *(size_t *)(local_138 + -0xc);
  if ((_Rep *)(local_138 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089b059c to 089b05a3 has its CatchHandler @ 089b078c */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_138 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_138 + -0xc),&aStack_16b);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[4])(&local_13c,pfVar7);
                    /* try { // try from 089b00c4 to 089b00cb has its CatchHandler @ 089b0674 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_13c,pcVar2,this->_M_grouping_size,0);
  if ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_grouping_size;
  }
  else {
                    /* try { // try from 089b04fc to 089b0503 has its CatchHandler @ 089b0784 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_13c._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_13c._M_dataplus._M_p + -0xc),aaStack_16d);
      sVar1 = this->_M_grouping_size;
    }
    else {
      sVar1 = this->_M_grouping_size;
    }
  }
  this->_M_grouping = pcVar2;
  if (sVar1 == 0) {
    this->_M_use_grouping = false;
  }
  else {
                    /* try { // try from 089b0478 to 089b047f has its CatchHandler @ 089b062c */
    (*pfVar7->_vptr_facet[4])(&local_140,pfVar7);
    if (-1 < *(int *)((int)local_140._M_dataplus._M_p + -4)) {
                    /* try { // try from 089b04ec to 089b04f3 has its CatchHandler @ 089b062c */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_140);
    }
    this->_M_use_grouping = '\0' < *(char *)local_140._M_dataplus._M_p;
    if ((_Rep *)((int)local_140._M_dataplus._M_p + -0xc) !=
        (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
                _S_empty_rep_storage) {
                    /* try { // try from 089b04a8 to 089b04af has its CatchHandler @ 089b0764 */
      _Var5 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_140._M_dataplus._M_p + -4),-1);
      if (_Var5 < 1) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                  ((_Rep *)((int)local_140._M_dataplus._M_p + -0xc),aaStack_16f);
        pp_Var6 = pfVar7->_vptr_facet;
      }
      else {
        pp_Var6 = pfVar7->_vptr_facet;
      }
      goto LAB_089b00f4;
    }
  }
  pp_Var6 = pfVar7->_vptr_facet;
LAB_089b00f4:
  iVar3 = (*pp_Var6[2])(pfVar7);
  this->_M_decimal_point = (char)iVar3;
  iVar3 = (*pfVar7->_vptr_facet[3])(pfVar7);
  this->_M_thousands_sep = (char)iVar3;
  iVar3 = (*pfVar7->_vptr_facet[8])(pfVar7);
  pp_Var6 = pfVar7->_vptr_facet;
  this->_M_frac_digits = iVar3;
  (*pp_Var6[5])(&local_144,pfVar7);
  this->_M_curr_symbol_size = *(size_t *)(local_144 + -0xc);
  if ((_Rep *)(local_144 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_curr_symbol_size;
  }
  else {
                    /* try { // try from 089b054c to 089b0553 has its CatchHandler @ 089b0794 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_144 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_144 + -0xc),&aStack_170);
      sVar1 = this->_M_curr_symbol_size;
    }
    else {
      sVar1 = this->_M_curr_symbol_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[5])(&local_148,pfVar7);
                    /* try { // try from 089b0184 to 089b018b has its CatchHandler @ 089b06dc */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_148,pcVar2,this->_M_curr_symbol_size,0);
  if ((_Rep *)((int)local_148._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089b05e4 to 089b05eb has its CatchHandler @ 089b079c */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_148._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_148._M_dataplus._M_p + -0xc),aaStack_172);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_curr_symbol = pcVar2;
  (*pp_Var6[6])(&local_14c,pfVar7);
  this->_M_positive_sign_size = *(size_t *)(local_14c + -0xc);
  if ((_Rep *)(local_14c + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_positive_sign_size;
  }
  else {
                    /* try { // try from 089b0524 to 089b052b has its CatchHandler @ 089b0774 */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_14c + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_14c + -0xc),&aStack_173);
      sVar1 = this->_M_positive_sign_size;
    }
    else {
      sVar1 = this->_M_positive_sign_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[6])(&local_150,pfVar7);
                    /* try { // try from 089b01f8 to 089b01ff has its CatchHandler @ 089b06a8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_150,pcVar2,this->_M_positive_sign_size,0);
  if ((_Rep *)((int)local_150._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089b05c0 to 089b05c7 has its CatchHandler @ 089b077c */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_150._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_150._M_dataplus._M_p + -0xc),aaStack_175);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_positive_sign = pcVar2;
  (*pp_Var6[7])(&local_154,pfVar7);
  this->_M_negative_sign_size = *(size_t *)(local_154 + -0xc);
  if ((_Rep *)(local_154 + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    sVar1 = this->_M_negative_sign_size;
  }
  else {
                    /* try { // try from 089b0574 to 089b057b has its CatchHandler @ 089b076c */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_154 + -4),-1);
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)(local_154 + -0xc),&aStack_176);
      sVar1 = this->_M_negative_sign_size;
    }
    else {
      sVar1 = this->_M_negative_sign_size;
    }
  }
  pcVar2 = operator_new___(sVar1);
  (*pfVar7->_vptr_facet[7])(&local_158,pfVar7);
                    /* try { // try from 089b026c to 089b0273 has its CatchHandler @ 089b0710 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
            (&local_158,pcVar2,this->_M_negative_sign_size,0);
  if ((_Rep *)((int)local_158._M_dataplus._M_p + -0xc) ==
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
    pp_Var6 = pfVar7->_vptr_facet;
  }
  else {
                    /* try { // try from 089b0608 to 089b060f has its CatchHandler @ 089b063c */
    _Var5 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_158._M_dataplus._M_p + -4),-1)
    ;
    if (_Var5 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_158._M_dataplus._M_p + -0xc),aaStack_178);
      pp_Var6 = pfVar7->_vptr_facet;
    }
    else {
      pp_Var6 = pfVar7->_vptr_facet;
    }
  }
  this->_M_negative_sign = pcVar2;
  local_162 = (*pp_Var6[9])(pfVar7);
  *(int *)(this->_M_pos_format).field = local_162;
  local_15e = local_162;
  local_30 = local_162;
  local_16a = (*pfVar7->_vptr_facet[10])(pfVar7);
  *(int *)(this->_M_neg_format).field = local_16a;
  local_166 = local_16a;
  local_30 = local_16a;
  pcVar4 = use_facet<std::ctype<char>_>(__loc);
  pcVar2 = money_base::_S_atoms;
  pcVar8 = money_base::_S_atoms + 0xb;
  if (pcVar4->_M_widen_ok == '\x01') {
    memcpy(this->_M_atoms,money_base::_S_atoms,(int)pcVar8 - (int)money_base::_S_atoms);
  }
  else {
    if (pcVar4->_M_widen_ok == '\0') {
      iVar3 = 0;
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      do {
        auStack_134[iVar3] = (char)iVar3;
        iVar3 = iVar3 + 1;
      } while (iVar3 != 0x100);
      (*(pcVar4->super_facet)._vptr_facet[7])(pcVar4,auStack_134,auStack_34,pcVar4->_M_widen);
      pcVar4->_M_widen_ok = '\x01';
      iVar3 = memcmp(auStack_134,pcVar4->_M_widen,0x100);
      if (iVar3 != 0) {
        pcVar4->_M_widen_ok = '\x02';
      }
      pp_Var6 = (pcVar4->super_facet)._vptr_facet;
    }
    else {
      pp_Var6 = (pcVar4->super_facet)._vptr_facet;
    }
    (*pp_Var6[7])(pcVar4,pcVar2,pcVar8,this->_M_atoms);
  }
  return;
}



----------------------------------------

// Function: _M_extract<false> @ 089b07a4

/* WARNING: Removing unreachable block (ram,0x089b13d4) */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract<false>(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __units) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract<false>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__units)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  bool bVar4;
  char cVar5;
  char cVar6;
  bool bVar7;
  ctype<char> *pcVar8;
  size_t sVar9;
  undefined4 uVar10;
  undefined3 extraout_var;
  void *pvVar11;
  __moneypunct_cache<char,false> *this_00;
  _Atomic_word _Var12;
  int iVar13;
  char *pcVar14;
  char cVar15;
  char cVar16;
  uint *in_t0;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_t1;
  uint uVar17;
  _Rep *p_Var18;
  uint uVar19;
  uint uVar20;
  int iVar21;
  locale *__loc;
  int iVar22;
  int *piVar23;
  _func_int_varargs **pp_Var24;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar25;
  int iVar26;
  uint uVar27;
  allocator<char> aaStack_98 [3];
  allocator<char> aStack_95;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_94;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_90;
  undefined4 local_8c;
  char in_stack_ffffff78;
  char *local_78;
  int local_74;
  int local_68;
  int local_64;
  uint local_5c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: __use_cache<std::__moneypunct_cache<char,_false>_>
                       __uc@[???]
                       Unresolved local var: __moneypunct_cache<char,false> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: size_t __sign_size@[???]
                       Unresolved local var: bool __mandatory_sign@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __grouping_tmp@[???]
                       Unresolved local var: int __last_pos@[???]
                       Unresolved local var: int __n@[???]
                       Unresolved local var: bool __testvalid@[???]
                       Unresolved local var: bool __testdecfound@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __res@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: pattern __p@[???]
                       Unresolved local var: int __ret@[???] */
  iVar13 = __beg._M_c;
  pp_Var24 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_78 = (__beg._M_sbuf)->_M_in_beg;
  __loc = (locale *)(iVar13 + 0x6c);
  piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar27 = (this->super_facet)._M_refcount;
  pcVar8 = use_facet<std::ctype<char>_>(__loc);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  sVar9 = locale::id::_M_id(&moneypunct<char,false>::id);
  piVar23 = (int *)(sVar9 * 4 + *(int *)(*(int *)(iVar13 + 0x6c) + 0xc));
  iVar26 = *piVar23;
  if (iVar26 == 0) {
                    /* try { // try from 089b16b4 to 089b171f has its CatchHandler @ 089b1c40 */
    this_00 = operator_new(0x44);
                    /* Unresolved local var: __moneypunct_cache<char,false> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_curr_symbol = (char *)0x0;
    this_00->_M_curr_symbol_size = 0;
    this_00->_M_positive_sign = (char *)0x0;
    this_00->_M_positive_sign_size = 0;
    this_00->_M_negative_sign = (char *)0x0;
    this_00->_M_negative_sign_size = 0;
    this_00->_M_frac_digits = 0;
    *(undefined4 *)(this_00->_M_pos_format).field = 0;
    *(undefined4 *)(this_00->_M_neg_format).field = 0;
    this_00->_M_allocated = false;
    __moneypunct_cache<char,false>::_M_cache(this_00,__loc);
    locale::_Impl::_M_install_cache(__loc->_M_impl,&this_00->super_facet,sVar9);
    iVar26 = *piVar23;
  }
  if (*(int *)(iVar26 + 0x20) == 0) {
    bVar7 = false;
  }
  else {
    bVar7 = *(int *)(iVar26 + 0x28) != 0;
  }
  local_94._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  if (*(char *)(iVar26 + 0x10) != '\0') {
                    /* try { // try from 089b086c to 089b0873 has its CatchHandler @ 089b1b90 */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_94,0x20);
  }
  local_90._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
                    /* try { // try from 089b087c to 089b16ab has its CatchHandler @ 089b1bb8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_90,0x20);
  uVar10 = *(undefined4 *)(iVar26 + 0x34);
  local_8c = uVar10;
  uVar10 = local_8c;
                    /* Unresolved local var: int __i@[???]
                       Unresolved local var: part __which@[???] */
  local_8c._3_1_ = (char)((uint)uVar10 >> 0x18);
  cVar6 = local_8c._3_1_;
  local_8c._0_1_ = (char)uVar10;
  cVar16 = (char)local_8c;
  local_8c._2_1_ = (char)((uint)uVar10 >> 0x10);
  cVar5 = local_8c._2_1_;
  bVar3 = false;
  local_5c = 0;
  local_74 = 0;
  local_68 = 0;
  local_64 = 0;
  bVar4 = false;
  local_8c = uVar10;
LAB_089b08d4:
  do {
    bVar1 = true;
    switch(*(undefined1 *)((int)&local_8c + local_74)) {
    case 0:
switchD_089b0900_caseD_0:
      bVar1 = true;
      goto LAB_089b0c44;
    case 1:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar17 = 0xffffffff;
      }
      else {
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
                    /* try { // try from 089b1c30 to 089b1c37 has its CatchHandler @ 089b1bb8 */
            uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          uVar27 = uVar17;
          if (uVar17 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
          }
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089b1780:
        bVar1 = true;
      }
      else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          pcVar14 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          pcVar14 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (pcVar14 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089b1780;
        }
        bVar1 = pcVar14 == (char *)0xffffffff;
        local_78 = pcVar14;
      }
      else {
        bVar1 = local_78 == (char *)0xffffffff;
      }
      if (uVar17 == 0xffffffff) {
        if (!bVar1) {
LAB_089b0c04:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b1800:
            uVar17 = 0xff;
          }
          else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar27 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b1800;
            }
            uVar17 = uVar27 & 0xff;
          }
          else {
            uVar17 = uVar27 & 0xff;
          }
          if ((pcVar8->_M_table[uVar17] & 8U) != 0) {
            if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto switchD_089b0900_caseD_0;
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              bVar1 = true;
              uVar27 = 0xffffffff;
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              bVar1 = true;
              uVar27 = 0xffffffff;
            }
            goto LAB_089b0c44;
          }
        }
      }
      else if (bVar1) goto LAB_089b0c04;
      bVar1 = false;
LAB_089b0c44:
      if (local_74 == 3) goto joined_r0x089b0e74;
LAB_089b0c58:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar17 = uVar27;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b13c4;
      if (uVar27 != 0xffffffff) goto LAB_089b0c6c;
                    /* Unresolved local var: int __ret@[???] */
      if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
        uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
      }
      uVar17 = uVar27;
      if (uVar27 != 0xffffffff) goto LAB_089b0c6c;
      piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      uVar17 = 0xffffffff;
      if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089b0c78;
LAB_089b0d24:
      bVar2 = true;
      if (uVar27 == 0xffffffff) goto LAB_089b0c94;
      while (uVar27 = uVar17, bVar2) {
        while( true ) {
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            uVar20 = 0xff;
          }
          else if (uVar17 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar17 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar17 = 0xffffffff;
              uVar20 = 0xff;
            }
            else {
              uVar20 = uVar17 & 0xff;
            }
          }
          else {
            uVar20 = uVar17 & 0xff;
          }
          uVar27 = uVar17;
          if ((pcVar8->_M_table[uVar20] & 8U) == 0) goto joined_r0x089b0e64;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = 0xffffffff;
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
                    /* try { // try from 089b1ad0 to 089b1b87 has its CatchHandler @ 089b1bb8 */
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
            goto LAB_089b0c58;
          }
LAB_089b13c4:
          uVar27 = 0xffffffff;
LAB_089b0c6c:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089b0d24;
LAB_089b0c78:
          if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (pp_Var24[2] < pp_Var24[3]) {
              local_78 = (char *)(uint)(byte)*pp_Var24[2];
            }
            else {
              local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
            }
            if (local_78 == (char *)0xffffffff) {
              pp_Var24 = (_func_int_varargs **)0x0;
              goto LAB_089b0d24;
            }
          }
          bVar2 = local_78 == (char *)0xffffffff;
          if (uVar27 != 0xffffffff) break;
LAB_089b0c94:
          uVar27 = uVar17;
          if (bVar2) goto joined_r0x089b0e64;
        }
      }
      break;
    case 2:
      if ((*(uint *)(iVar13 + 0xc) & 0x200) != 0) goto LAB_089b0d54;
      if (local_5c < 2) {
        if (local_74 == 0) {
          iVar21 = *(int *)(iVar26 + 0x18);
        }
        else {
          if (local_74 == 1) {
            if (bVar7) {
              iVar21 = *(int *)(iVar26 + 0x18);
              goto LAB_089b0d58;
            }
            if ((cVar16 != '\x03') && (cVar5 != '\x01')) {
              local_74 = 2;
              goto LAB_089b08d4;
            }
          }
          else {
            bVar1 = true;
            if (local_74 != 2) break;
            if ((cVar6 != '\x04') && ((!bVar7 || (cVar6 != '\x03')))) {
              local_74 = 3;
              goto LAB_089b08d4;
            }
          }
LAB_089b0d54:
                    /* Unresolved local var: size_t __len@[???]
                       Unresolved local var: size_t __j@[???] */
          iVar21 = *(int *)(iVar26 + 0x18);
        }
      }
      else {
        iVar21 = *(int *)(iVar26 + 0x18);
      }
LAB_089b0d58:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      iVar22 = 0;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b0e04;
LAB_089b0d68:
      uVar17 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar27 = uVar17;
        if (uVar17 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar27 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089b0e14;
LAB_089b0d80:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089b0e14;
        }
      }
      bVar1 = local_78 == (char *)0xffffffff;
      if (uVar17 != 0xffffffff) goto LAB_089b0e20;
      while (!bVar1) {
        while( true ) {
          if (iVar22 == iVar21) goto LAB_089b15cc;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            cVar15 = -1;
          }
          else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
            }
            if (uVar27 == 0xffffffff) {
              piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar27 = 0xffffffff;
              cVar15 = -1;
            }
            else {
              cVar15 = (char)uVar27;
            }
          }
          else {
            cVar15 = (char)uVar27;
          }
          if (cVar15 != *(char *)(iVar22 + *(int *)(iVar26 + 0x14))) goto LAB_089b0e28;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
              uVar27 = 0xffffffff;
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
          }
          iVar22 = iVar22 + 1;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
          goto LAB_089b0d68;
LAB_089b0e04:
          uVar17 = 0xffffffff;
          if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089b0d80;
LAB_089b0e14:
          bVar1 = true;
          if (uVar17 == 0xffffffff) break;
LAB_089b0e20:
          if (!bVar1) goto LAB_089b0e28;
        }
      }
LAB_089b0e28:
      if ((iVar22 == iVar21) || ((iVar22 == 0 && ((*(uint *)(iVar13 + 0xc) & 0x200) == 0)))) {
LAB_089b15cc:
        bVar1 = true;
      }
      else {
        bVar1 = false;
      }
      break;
    case 3:
      if (*(int *)(iVar26 + 0x20) == 0) goto LAB_089b0f98;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar17 = 0xffffffff;
      }
      else {
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          uVar27 = uVar17;
          if (uVar17 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
          }
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089b1988:
        bVar1 = true;
      }
      else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089b1988;
        }
        bVar1 = local_78 == (char *)0xffffffff;
      }
      else {
        bVar1 = local_78 == (char *)0xffffffff;
      }
      if (uVar17 == 0xffffffff) {
        if (bVar1) {
LAB_089b0f98:
          iVar21 = *(int *)(iVar26 + 0x28);
          goto LAB_089b0f9c;
        }
LAB_089b14e8:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b18d8:
          cVar15 = -1;
        }
        else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          if (uVar27 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089b18d8;
          }
          cVar15 = (char)uVar27;
        }
        else {
          cVar15 = (char)uVar27;
        }
        if (cVar15 != **(char **)(iVar26 + 0x1c)) goto LAB_089b0f98;
        local_5c = *(uint *)(iVar26 + 0x20);
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            bVar1 = true;
            piVar25[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            uVar27 = 0xffffffff;
          }
          else {
            (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            bVar1 = true;
            uVar27 = 0xffffffff;
          }
          break;
        }
      }
      else {
        if (bVar1) goto LAB_089b14e8;
        iVar21 = *(int *)(iVar26 + 0x28);
LAB_089b0f9c:
        if (iVar21 == 0) {
          iVar21 = *(int *)(iVar26 + 0x20);
LAB_089b090c:
          if ((iVar21 == 0) || (*(int *)(iVar26 + 0x28) != 0)) {
            if (bVar7) {
              bVar1 = false;
            }
            else {
              bVar1 = true;
            }
            break;
          }
        }
        else {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
            uVar17 = 0xffffffff;
          }
          else {
            uVar17 = uVar27;
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar17 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                uVar17 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              uVar27 = uVar17;
              if (uVar17 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                uVar27 = 0xffffffff;
              }
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (pp_Var24 == (_func_int_varargs **)0x0) {
LAB_089b19b8:
            bVar1 = true;
          }
          else if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (pp_Var24[2] < pp_Var24[3]) {
              local_78 = (char *)(uint)(byte)*pp_Var24[2];
            }
            else {
              local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
            }
            if (local_78 == (char *)0xffffffff) {
              pp_Var24 = (_func_int_varargs **)0x0;
              goto LAB_089b19b8;
            }
            bVar1 = local_78 == (char *)0xffffffff;
          }
          else {
            bVar1 = local_78 == (char *)0xffffffff;
          }
          if (uVar17 != 0xffffffff) {
            if (bVar1) {
              if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
              goto LAB_089b0ff0;
              cVar15 = -1;
              goto LAB_089b0ffc;
            }
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089b090c;
          }
          if (bVar1) {
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089b090c;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          cVar15 = -1;
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b0ff0:
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                    /* try { // try from 089b1c7c to 089b1d4b has its CatchHandler @ 089b1bb8 */
                uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              if (uVar27 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                cVar15 = -1;
              }
              else {
                cVar15 = (char)uVar27;
              }
            }
            else {
              cVar15 = (char)uVar27;
            }
          }
LAB_089b0ffc:
          if (cVar15 != **(char **)(iVar26 + 0x24)) {
            iVar21 = *(int *)(iVar26 + 0x20);
            goto LAB_089b090c;
          }
          local_5c = *(uint *)(iVar26 + 0x28);
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            }
            bVar1 = true;
            bVar3 = true;
            uVar27 = 0xffffffff;
            break;
          }
        }
        bVar3 = true;
      }
      bVar1 = true;
      break;
    case 4:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b1168;
LAB_089b1054:
      uVar17 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar17 = uVar27;
        if (uVar27 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar17 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar20 = uVar27;
      uVar27 = uVar17;
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089b1178;
LAB_089b106c:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089b1178;
        }
      }
      bVar2 = local_78 == (char *)0xffffffff;
      if (uVar20 != 0xffffffff) goto LAB_089b1184;
LAB_089b108c:
      bVar1 = true;
      if (!bVar2) {
        do {
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b11c8:
            pvVar11 = memchr((void *)(iVar26 + 0x39),-1,10);
            iVar21 = -1;
            if (pvVar11 == (void *)0x0) goto LAB_089b11e4;
LAB_089b10c0:
                    /* Unresolved local var: size_t __len@[???] */
            uVar17 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) + 1;
            cVar15 = money_base::_S_atoms[(int)pvVar11 - (iVar26 + 0x38)];
            if ((*(size_t *)((int)local_90._M_dataplus._M_p + -8) < uVar17) ||
               (0 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_90,uVar17);
              sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
            }
            else {
              sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
            }
            local_68 = local_68 + 1;
            *(char *)((int)local_90._M_dataplus._M_p + sVar9) = cVar15;
            *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0;
            *(uint *)((int)local_90._M_dataplus._M_p + -0xc) = uVar17;
            *(char *)((int)local_90._M_dataplus._M_p + uVar17) = '\0';
          }
          else {
            if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (piVar25[1]._M_sbuf <
                  (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
                uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
              }
              else {
                    /* try { // try from 089b17a4 to 089b1a6f has its CatchHandler @ 089b1bb8 */
                uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
              }
              if (uVar27 == 0xffffffff) {
                piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
                goto LAB_089b11c8;
              }
            }
            iVar21 = (int)(char)uVar27;
            pvVar11 = memchr((void *)(iVar26 + 0x39),iVar21,10);
            if (pvVar11 != (void *)0x0) goto LAB_089b10c0;
LAB_089b11e4:
            if (*(char *)(iVar26 + 0x11) == iVar21) {
              if (!bVar4) {
                local_64 = local_68;
                bVar4 = true;
                local_68 = 0;
                goto LAB_089b113c;
              }
              cVar15 = *(char *)(iVar26 + 0x10);
            }
            else {
              cVar15 = *(char *)(iVar26 + 0x10);
            }
            bVar1 = true;
            if (((cVar15 == '\0') || (*(char *)(iVar26 + 0x12) != iVar21)) || (bVar4)) break;
            if (local_68 == 0) {
              bVar1 = false;
              break;
            }
                    /* Unresolved local var: size_t __len@[???] */
            uVar17 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc) + 1;
            if ((*(size_t *)((int)local_94._M_dataplus._M_p + -8) < uVar17) ||
               (0 < (int)*(size_t *)((int)local_94._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_94,uVar17);
              sVar9 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc);
            }
            else {
              sVar9 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc);
            }
            *(char *)((int)local_94._M_dataplus._M_p + sVar9) = (char)local_68;
            local_68 = 0;
            *(size_t *)((int)local_94._M_dataplus._M_p + -4) = 0;
            *(uint *)((int)local_94._M_dataplus._M_p + -0xc) = uVar17;
            *(char *)((int)local_94._M_dataplus._M_p + uVar17) = '\0';
          }
LAB_089b113c:
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar25[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
              piVar25[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
              uVar27 = 0xffffffff;
            }
            else {
              (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
              uVar27 = 0xffffffff;
            }
          }
          if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
          goto LAB_089b1054;
LAB_089b1168:
          uVar20 = 0xffffffff;
          if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089b106c;
LAB_089b1178:
          bVar2 = true;
          if (uVar20 == 0xffffffff) goto LAB_089b108c;
LAB_089b1184:
          bVar1 = true;
          if (!bVar2) break;
        } while( true );
      }
      if (*(size_t *)((int)local_90._M_dataplus._M_p + -0xc) == 0) {
        bVar1 = false;
      }
    }
joined_r0x089b0e64:
    if (3 < local_74 + 1) goto joined_r0x089b0e74;
    local_74 = local_74 + 1;
  } while (bVar1);
  bVar1 = false;
joined_r0x089b0e74:
  if (local_5c < 2) {
    if (!bVar1) goto LAB_089b0acc;
LAB_089b0968:
                    /* Unresolved local var: size_t __first@[???]
                       Unresolved local var: bool __only_zeros@[???] */
    if ((1 < *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) &&
       (sVar9 = basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
                          (&local_90,'0',0), sVar9 != 0)) {
      if (sVar9 == 0xffffffff) {
        sVar9 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) - 1;
      }
                    /* Unresolved local var: bool __testoff@[???] */
      uVar17 = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc);
      if (sVar9 <= *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) {
        uVar17 = sVar9;
      }
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
                (&local_90,0,uVar17,0);
    }
    if (bVar3) {
      if (-1 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4)) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_90);
      }
      if (*(char *)local_90._M_dataplus._M_p != '0') {
        if (-1 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4)) {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard(&local_90);
        }
                    /* Unresolved local var: size_t __pos@[???] */
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
                  (&local_90,0,0,1,in_stack_ffffff78);
        *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0xffffffff;
      }
    }
    if (*(size_t *)((int)local_94._M_dataplus._M_p + -0xc) != 0) {
      if (!bVar4) {
        local_64._0_1_ = (char)local_68;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar17 = *(size_t *)((int)local_94._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_94._M_dataplus._M_p + -8) < uVar17) ||
         (0 < (int)*(size_t *)((int)local_94._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_94,uVar17);
      }
      *(char *)((int)local_94._M_dataplus._M_p + *(size_t *)((int)local_94._M_dataplus._M_p + -0xc))
           = (char)local_64;
      *(size_t *)((int)local_94._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_94._M_dataplus._M_p + -0xc) = uVar17;
      *(char *)((int)local_94._M_dataplus._M_p + uVar17) = '\0';
      bVar7 = __verify_grouping(*(char **)(iVar26 + 8),*(size_t *)(iVar26 + 0xc),&local_94);
      if (CONCAT31(extraout_var,bVar7) == 0) {
        *in_t0 = *in_t0 | 4;
      }
    }
    if (((bVar4) && (0 < *(int *)(iVar26 + 0x2c))) && (*(int *)(iVar26 + 0x2c) != local_68))
    goto LAB_089b0acc;
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::swap(in_t1,&local_90);
    if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b0ae4;
LAB_089b13e8:
    uVar27 = 0xffffffff;
    if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089b13f4;
LAB_089b0af8:
    if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var24[2] < pp_Var24[3]) {
        bVar7 = (byte)*pp_Var24[2] == 0xffffffff;
      }
      else {
        iVar13 = (**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        bVar7 = iVar13 == -1;
      }
    }
    else {
      bVar7 = local_78 == (char *)0xffffffff;
    }
    if (uVar27 == 0xffffffff) goto LAB_089b0b18;
LAB_089b13fc:
    if (bVar7) goto LAB_089b0b24;
  }
  else {
    if (bVar1) {
                    /* Unresolved local var: char * __sign@[???]
                       Unresolved local var: size_t __i@[???] */
      if (bVar3) {
        iVar13 = *(int *)(iVar26 + 0x24);
      }
      else {
        iVar13 = *(int *)(iVar26 + 0x1c);
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar17 = 1;
      if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b0f3c;
LAB_089b0ea0:
      uVar20 = uVar27;
      if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
          uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
        }
        uVar20 = uVar27;
        if (uVar27 == 0xffffffff) {
          piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar20 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      uVar19 = uVar27;
      uVar27 = uVar20;
      if (pp_Var24 == (_func_int_varargs **)0x0) goto LAB_089b0f4c;
LAB_089b0eb8:
      if (local_78 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (pp_Var24[2] < pp_Var24[3]) {
          local_78 = (char *)(uint)(byte)*pp_Var24[2];
        }
        else {
          local_78 = (char *)(**(code **)(*pp_Var24 + 0x24))(pp_Var24);
        }
        if (local_78 == (char *)0xffffffff) {
          pp_Var24 = (_func_int_varargs **)0x0;
          goto LAB_089b0f4c;
        }
      }
      bVar7 = local_78 == (char *)0xffffffff;
      do {
        if (uVar19 != 0xffffffff) {
          if (bVar7) goto LAB_089b0ee4;
LAB_089b0f64:
          if (uVar17 == local_5c) goto LAB_089b0968;
          *in_t0 = *in_t0 | 4;
          goto LAB_089b0adc;
        }
        if (bVar7) goto LAB_089b0f64;
LAB_089b0ee4:
        if (uVar17 == local_5c) goto LAB_089b0968;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar16 = -1;
        }
        else if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
          }
          if (uVar27 == 0xffffffff) {
            piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar27 = 0xffffffff;
            cVar16 = -1;
          }
          else {
            cVar16 = (char)uVar27;
          }
        }
        else {
          cVar16 = (char)uVar27;
        }
        if (*(char *)(iVar13 + uVar17) != cVar16) goto LAB_089b0f64;
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c)
          {
            piVar25[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            uVar27 = 0xffffffff;
          }
          else {
            (*(code *)piVar25->_M_sbuf[1]._M_in_cur)(piVar25);
            uVar27 = 0xffffffff;
          }
        }
        uVar17 = uVar17 + 1;
        if (piVar25 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b0ea0;
LAB_089b0f3c:
        uVar19 = 0xffffffff;
        if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089b0eb8;
LAB_089b0f4c:
        bVar7 = true;
      } while( true );
    }
LAB_089b0acc:
    *in_t0 = *in_t0 | 4;
LAB_089b0adc:
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar25 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b13e8;
LAB_089b0ae4:
    if (uVar27 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar25[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar25[1]._M_c) {
        uVar27 = (uint)*(byte *)&(piVar25[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar27 = (*(code *)piVar25->_M_sbuf[1]._M_in_beg)(piVar25);
      }
      if (uVar27 == 0xffffffff) {
        piVar25 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (pp_Var24 != (_func_int_varargs **)0x0) goto LAB_089b0af8;
LAB_089b13f4:
    bVar7 = true;
    if (uVar27 != 0xffffffff) goto LAB_089b13fc;
LAB_089b0b18:
    if (!bVar7) goto LAB_089b0b24;
  }
  *in_t0 = *in_t0 | 2;
LAB_089b0b24:
  p_Var18 = (_Rep *)((int)local_90._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b1aa4 to 089b1aab has its CatchHandler @ 089b1b90 */
  if ((p_Var18 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var12 = __gnu_cxx::__exchange_and_add
                         ((_Atomic_word *)((int)local_90._M_dataplus._M_p + -4),-1), _Var12 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var18,&aStack_95);
  }
  p_Var18 = (_Rep *)((int)local_94._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b1a80 to 089b1a87 has its CatchHandler @ 089b1d54 */
  if ((p_Var18 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var12 = __gnu_cxx::__exchange_and_add
                         ((_Atomic_word *)((int)local_94._M_dataplus._M_p + -4),-1), _Var12 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var18,aaStack_98);
  }
  return piVar25;
}



----------------------------------------

// Function: do_get @ 089b1d5c

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, bool __intl, ios_base * __io,
   _Ios_Iostate * __err, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __units)
    */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,bool __intl,ios_base *__io,
          _Ios_Iostate *__err,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__units)

{
  int iVar1;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  istreambuf_iterator<char,std::char_traits<char>_> __end_01;
  size_t *psVar2;
  ctype<char> *pcVar3;
  _Atomic_word _Var4;
  int iVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  int in_t0;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_t2;
  _Rep *this_00;
  size_t __n;
  _Impl *__err_00;
  ios_base *__io_00;
  int iVar7;
  basic_streambuf<char,std::char_traits<char>_> *__units_00;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_01;
  char acStackY_190 [4];
  size_t *local_18c;
  istreambuf_iterator<char,std::char_traits<char>_> *local_188;
  basic_streambuf<char,std::char_traits<char>_> *in_stack_fffffe80;
  char *in_stack_fffffe84;
  ios_base *in_stack_fffffe88;
  _Ios_Iostate *in_stack_fffffe8c;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_stack_fffffe90;
  money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_168;
  istreambuf_iterator<char,std::char_traits<char>_> *local_160;
  undefined1 auStack_158 [256];
  istreambuf_iterator<char,std::char_traits<char>_> *local_58 [2];
  istreambuf_iterator<char,std::char_traits<char>_> *local_50;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *local_48;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                       Unresolved local var: istreambuf_iterator<char,std::char_traits<char>_>
                       __ret@[???]
                       Unresolved local var: size_type __len@[???] */
  pbVar6 = __beg._M_sbuf;
  __io_00 = (ios_base *)(this->super_facet)._vptr_facet;
  __units_00 = (basic_streambuf<char,std::char_traits<char>_> *)pbVar6->_vptr_basic_streambuf;
  __err_00 = (_Impl *)(this->super_facet)._M_refcount;
  __end_01._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)pbVar6->_vptr_basic_streambuf;
  __end_01._M_c = (int)pbVar6->_M_in_beg;
  local_50 = __return_storage_ptr__;
  local_48 = in_t2;
  pcVar3 = use_facet<std::ctype<char>_>((locale *)(in_t0 + 0x6c));
  local_18c = basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage + 3;
  local_40 = 0;
  local_3c = 0;
  if (((ulonglong)__beg & 0xff00000000) == 0) {
    __beg_01._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xfffffe80;
    __beg_01._M_c = in_t0;
    local_160 = _M_extract<false>(local_50,(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                            *)&stack0xfffffe88,__beg_01,__end_01,__io_00,
                                  (_Ios_Iostate *)__err_00,in_stack_fffffe90);
  }
  else {
    __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xfffffe90;
    __end_00._M_c = (int)in_stack_fffffe84;
    __end_00._M_sbuf = in_stack_fffffe80;
    __beg_00._M_c = in_t0;
    local_168.super_facet._vptr_facet = (_func_int_varargs **)__io_00;
    local_168.super_facet._M_refcount = (_Atomic_word)__err_00;
                    /* try { // try from 089b1e04 to 089b1f77 has its CatchHandler @ 089b1fc8 */
    local_160 = _M_extract<true>(local_50,&local_168,__beg_00,__end_00,in_stack_fffffe88,
                                 in_stack_fffffe8c,
                                 (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                                 __units_00);
  }
  psVar2 = local_18c;
  __n = local_18c[-3];
  local_58[0] = local_160;
  if (__n != 0) {
                    /* Unresolved local var: char * __ws@[???] */
    iVar1 = -(__n + 0xe & 0xfffffff8);
    iVar7 = (int)local_18c + __n;
    if (pcVar3->_M_widen_ok == '\x01') {
      memcpy(acStackY_190 + iVar1,local_18c,iVar7 - (int)local_18c);
    }
    else {
      if (pcVar3->_M_widen_ok == '\0') {
        iVar5 = 0;
        do {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
          auStack_158[iVar5] = (char)iVar5;
          iVar5 = iVar5 + 1;
        } while (iVar5 != 0x100);
        (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,auStack_158,local_58,pcVar3->_M_widen);
        pcVar3->_M_widen_ok = '\x01';
        iVar5 = memcmp(auStack_158,pcVar3->_M_widen,0x100);
        if (iVar5 != 0) {
          pcVar3->_M_widen_ok = '\x02';
        }
      }
      (*(pcVar3->super_facet)._vptr_facet[7])(pcVar3,psVar2,iVar7,acStackY_190 + iVar1);
    }
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
              (local_48,acStackY_190 + iVar1,__n);
  }
  this_00 = (_Rep *)(local_18c + -3);
  local_188 = local_160;
                    /* try { // try from 089b1fa4 to 089b1fab has its CatchHandler @ 089b1fec */
  if ((this_00 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var4 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_18c + -1),-1), _Var4 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_00,(allocator<char> *)(acStackY_190 + 1));
  }
  return local_188;
}



----------------------------------------

// Function: do_get @ 089b2024

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, bool __intl, ios_base * __io,
   _Ios_Iostate * __err, longdouble * __units) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,bool __intl,ios_base *__io,
          _Ios_Iostate *__err,longdouble *__units)

{
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  istreambuf_iterator<char,std::char_traits<char>_> __end_01;
  size_t *__s;
  _Impl *p_Var1;
  _Atomic_word _Var2;
  ios_base *__io_00;
  int in_t0;
  _Ios_Iostate *in_t1;
  _func_int_varargs **__err_00;
  longdouble *in_t2;
  _func_int_varargs **pp_Var3;
  _Rep *this_00;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_01;
  allocator<char> aaStackY_6f [3];
  __c_locale local_6c;
  size_t *local_68;
  basic_streambuf<char,std::char_traits<char>_> *in_stack_ffffffa0;
  _func_int_varargs **in_stack_ffffffa4;
  ios_base *in_stack_ffffffa8;
  _func_int_varargs **in_stack_ffffffac;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_stack_ffffffb0;
  undefined1 local_4c [12];
  locale local_40;
  _Impl *local_3c;
  locale local_30;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                        */
                    /* Unresolved local var: void * __p@[???] */
  local_68 = basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
             _S_empty_rep_storage + 3;
  __err_00 = (this->super_facet)._vptr_facet;
  pp_Var3 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  p_Var1 = (_Impl *)(this->super_facet)._M_refcount;
  __io_00 = (ios_base *)(__beg._M_sbuf)->_M_in_beg;
  if (((ulonglong)__beg & 0xff00000000) == 0) {
    __beg_01._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xffffffa4;
    __end_01._M_c = (int)pp_Var3;
    __end_01._M_sbuf = in_stack_ffffffa0;
    __beg_01._M_c = in_t0;
    p_Var1 = (_Impl *)_M_extract<false>(__return_storage_ptr__,
                                        (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                         *)&stack0xffffffac,__beg_01,__end_01,__io_00,
                                        (_Ios_Iostate *)__err_00,
                                        (basic_string<char,std::char_traits<char>,std::allocator<char>_>
                                         *)p_Var1);
  }
  else {
    __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)local_4c;
    __end_00._M_c = (int)in_stack_ffffffa4;
    __end_00._M_sbuf = in_stack_ffffffa0;
    __beg_00._M_c = in_t0;
    local_4c._0_4_ = pp_Var3;
    local_4c._4_4_ = __io_00;
    local_4c._8_4_ = __err_00;
    local_40._M_impl = p_Var1;
                    /* try { // try from 089b209c to 089b214b has its CatchHandler @ 089b218c */
    p_Var1 = (_Impl *)_M_extract<true>(__return_storage_ptr__,
                                       (money_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                                        *)(local_4c + 8),__beg_00,__end_00,in_stack_ffffffa8,
                                       (_Ios_Iostate *)in_stack_ffffffac,in_stack_ffffffb0);
  }
  __s = local_68;
  local_3c = p_Var1;
  local_30._M_impl = p_Var1;
  local_6c = locale::facet::_S_get_c_locale();
  __convert_to_v<long_double>((char *)__s,in_t2,in_t1,&local_6c);
  this_00 = (_Rep *)(local_68 + -3);
                    /* try { // try from 089b2168 to 089b216f has its CatchHandler @ 089b21a8 */
  if ((this_00 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var2 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(local_68 + -1),-1), _Var2 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_00,aaStackY_6f);
  }
  return (istreambuf_iterator<char,std::char_traits<char>_> *)p_Var1;
}



----------------------------------------

// Function: _M_insert<false> @ 089b21e0

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert<false>(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __digits) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_insert<false>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__digits)

{
  undefined1 uVar1;
  int iVar2;
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar3;
  char cVar4;
  size_t sVar5;
  int iVar6;
  char *pcVar7;
  _Atomic_word _Var8;
  __moneypunct_cache<char,false> *this_00;
  byte *pbVar9;
  byte *pbVar10;
  undefined4 *in_t0;
  byte *__s_00;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar11;
  _Rep *p_Var12;
  char **__loc;
  uint __res;
  int iVar13;
  int *piVar14;
  size_t sVar15;
  char *pcVar16;
  allocator<char> *paVar17;
  allocator<char> aaStack_98 [4];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_94;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_90;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_8c;
  ostreambuf_iterator<char,std::char_traits<char>_> *apoStack_88 [3];
  char local_7c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_78;
  char local_74;
  undefined4 local_70;
  uint local_68;
  uint local_64;
  uint local_60;
  char *local_5c;
  int local_58;
  ctype<char> *local_54;
  int local_50;
  basic_streambuf<char,std::char_traits<char>_> *local_4c;
  int local_48;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *local_40;
  
                    /* Unresolved local var: locale * __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[DW_OP_breg30(s8): +68]
                       Unresolved local var: __use_cache<std::__moneypunct_cache<char,_false>_>
                       __uc@[???]
                       Unresolved local var: __moneypunct_cache<char,false> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char * __beg@[???]
                       Unresolved local var: pattern __p@[???]
                       Unresolved local var: char * __sign@[???]
                       Unresolved local var: size_t __sign_size@[???]
                       Unresolved local var: size_t __len@[???] */
  local_4c = __s._M_sbuf;
  local_78 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_74 = (char)(this->super_facet)._M_refcount;
  __loc = &local_4c[3]._M_in_end;
  local_48 = (int)__s._M_failed;
  local_54 = use_facet<std::ctype<char>_>((locale *)__loc);
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  sVar5 = locale::id::_M_id(&moneypunct<char,false>::id);
  piVar14 = (int *)(sVar5 * 4 + *(int *)(local_4c[3]._M_in_end + 0xc));
  iVar13 = *piVar14;
  if (iVar13 == 0) {
                    /* try { // try from 089b2760 to 089b27cb has its CatchHandler @ 089b288c */
    this_00 = operator_new(0x44);
                    /* Unresolved local var: __moneypunct_cache<char,false> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_curr_symbol = (char *)0x0;
    this_00->_M_curr_symbol_size = 0;
    this_00->_M_positive_sign = (char *)0x0;
    this_00->_M_positive_sign_size = 0;
    this_00->_M_negative_sign = (char *)0x0;
    this_00->_M_negative_sign_size = 0;
    this_00->_M_frac_digits = 0;
    *(undefined4 *)(this_00->_M_pos_format).field = 0;
    local_70 = 0;
    *(undefined4 *)(this_00->_M_neg_format).field = 0;
    this_00->_M_allocated = false;
    __moneypunct_cache<char,false>::_M_cache(this_00,(locale *)__loc);
    locale::_Impl::_M_install_cache((_Impl *)*__loc,&this_00->super_facet,sVar5);
    iVar13 = *piVar14;
  }
  __s_00 = (byte *)*in_t0;
  local_58 = iVar13 + 0x38;
  pbVar9 = __s_00 + -0xc;
  if (*__s_00 == *(byte *)(iVar13 + 0x38)) {
    local_94._M_dataplus._M_p = *(_Alloc_hider *)(iVar13 + 0x34);
    local_5c = *(char **)(iVar13 + 0x24);
    local_60 = *(uint *)(iVar13 + 0x28);
    if (*(int *)(__s_00 + -0xc) != 0) {
      __s_00 = __s_00 + 1;
    }
  }
  else {
    local_94._M_dataplus._M_p = *(_Alloc_hider *)(iVar13 + 0x30);
    local_5c = *(char **)(iVar13 + 0x1c);
    local_60 = *(uint *)(iVar13 + 0x20);
  }
  if ((__s_00 < __s_00 + *(int *)pbVar9) &&
     (pbVar10 = __s_00, (local_54->_M_table[*__s_00] & 4U) != 0)) {
    do {
      pbVar10 = pbVar10 + 1;
      if (__s_00 + *(int *)pbVar9 == pbVar10) break;
    } while ((local_54->_M_table[*pbVar10] & 4U) != 0);
    sVar5 = (int)pbVar10 - (int)__s_00;
    if (sVar5 != 0) {
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __value@[???]
                       Unresolved local var: int __paddec@[???]
                       Unresolved local var: _Ios_Fmtflags __f@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __res@[???]
                       Unresolved local var: size_t __width@[???]
                       Unresolved local var: bool __testipad@[???] */
      local_40 = &local_90;
      local_90._M_dataplus._M_p =
           (_Alloc_hider)
           (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
            _S_empty_rep_storage + 3);
                    /* try { // try from 089b2320 to 089b23e7 has its CatchHandler @ 089b287c */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_40,sVar5 * 2);
      iVar6 = *(int *)(iVar13 + 0x2c);
      sVar15 = sVar5 - iVar6;
      paVar17 = aaStack_98;
      if (0 < (int)sVar15) {
        if (iVar6 < 0) {
          sVar15 = sVar5;
        }
        if (*(size_t *)(iVar13 + 0xc) == 0) {
                    /* try { // try from 089b2724 to 089b272b has its CatchHandler @ 089b287c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
                    (&local_90,(char *)__s_00,sVar15);
          iVar6 = *(int *)(iVar13 + 0x2c);
          paVar17 = aaStack_98;
        }
        else {
                    /* Unresolved local var: char * __ws@[???]
                       Unresolved local var: char * __ws_end@[???] */
          iVar2 = -(sVar5 * 2 + 0xe & 0xfffffff8);
          pcVar7 = __add_grouping<char>
                             ((char *)(aaStack_98 + iVar2),*(char *)(iVar13 + 0x12),
                              *(char **)(iVar13 + 8),*(size_t *)(iVar13 + 0xc),
                              *(char **)((int)apoStack_88 + iVar2),
                              *(char **)((int)apoStack_88 + iVar2 + 4));
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
                    (&local_90,(char *)(aaStack_98 + iVar2),(int)pcVar7 - (int)(aaStack_98 + iVar2))
          ;
          iVar6 = *(int *)(iVar13 + 0x2c);
          paVar17 = aaStack_98 + iVar2;
        }
      }
      if (0 < iVar6) {
                    /* Unresolved local var: size_t __len@[???] */
        __res = *(size_t *)((int)local_90._M_dataplus._M_p + -0xc) + 1;
        cVar4 = *(char *)(iVar13 + 0x11);
        if ((*(size_t *)((int)local_90._M_dataplus._M_p + -8) < __res) ||
           (0 < (int)*(size_t *)((int)local_90._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b25e0 to 089b25e7 has its CatchHandler @ 089b287c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(&local_90,__res);
        }
        *(char *)((int)local_90._M_dataplus._M_p +
                 *(size_t *)((int)local_90._M_dataplus._M_p + -0xc)) = cVar4;
        *(size_t *)((int)local_90._M_dataplus._M_p + -4) = 0;
        *(uint *)((int)local_90._M_dataplus._M_p + -0xc) = __res;
        *(char *)((int)local_90._M_dataplus._M_p + __res) = '\0';
        if ((int)sVar15 < 0) {
                    /* try { // try from 089b27f0 to 089b2807 has its CatchHandler @ 089b287c */
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,-sVar15,*(char *)(local_58 + 1));
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,(char *)__s_00,sVar5);
        }
        else {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_90,(char *)(__s_00 + sVar15),*(size_t *)(iVar13 + 0x2c));
        }
      }
      pcVar7 = local_4c->_M_in_end;
      iVar6 = 0;
      if (((uint)pcVar7 & 0x200) != 0) {
        iVar6 = *(int *)(iVar13 + 0x18);
      }
      pcVar16 = (char *)(local_60 + iVar6 + *(size_t *)((int)local_90._M_dataplus._M_p + -0xc));
      local_8c._M_dataplus._M_p =
           (_Alloc_hider)
           (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
            _S_empty_rep_storage + 3);
                    /* try { // try from 089b2424 to 089b2523 has its CatchHandler @ 089b2840 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                (&local_8c,(int)pcVar16 * 2);
      local_68 = (uint)pcVar7 & 0xb0;
      pcVar7 = local_4c->_M_in_cur;
      if (local_68 == 0x10) {
        local_64 = (uint)(pcVar16 < pcVar7);
      }
      else {
        local_64 = 0;
      }
      pbVar11 = &local_94;
                    /* Unresolved local var: int __i@[???]
                       Unresolved local var: part __which@[???] */
      uVar1 = local_94._M_dataplus._M_p._0_1_;
      do {
        switch(uVar1) {
        case 0:
          if (local_64 != 0) {
LAB_089b2488:
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (&local_8c,(int)pcVar7 - (int)pcVar16,(char)local_48);
          }
          break;
        case 1:
          if (local_64 != 0) goto LAB_089b2488;
                    /* Unresolved local var: size_t __len@[???] */
          sVar5 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) + 1;
          if ((*(size_t *)((int)local_8c._M_dataplus._M_p + -8) < sVar5) ||
             (0 < (int)*(size_t *)((int)local_8c._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b2734 to 089b2757 has its CatchHandler @ 089b2840 */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (&local_8c,sVar5);
          }
          *(char *)((int)local_8c._M_dataplus._M_p +
                   *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc)) = (char)local_48;
LAB_089b265c:
          *(size_t *)((int)local_8c._M_dataplus._M_p + -4) = 0;
          *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) = sVar5;
          *(char *)((int)local_8c._M_dataplus._M_p + sVar5) = '\0';
          break;
        case 2:
          if (((uint)local_4c->_M_in_end & 0x200) != 0) {
                    /* try { // try from 089b2690 to 089b2713 has its CatchHandler @ 089b2840 */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                      (&local_8c,*(char **)(iVar13 + 0x14),*(size_t *)(iVar13 + 0x18));
          }
          break;
        case 3:
          if (local_60 != 0) {
                    /* Unresolved local var: size_t __len@[???] */
            local_50 = (int)*local_5c;
            sVar5 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc) + 1;
            if ((*(size_t *)((int)local_8c._M_dataplus._M_p + -8) < sVar5) ||
               (0 < (int)*(size_t *)((int)local_8c._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (&local_8c,sVar5);
              sVar15 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc);
            }
            else {
              sVar15 = *(size_t *)((int)local_8c._M_dataplus._M_p + -0xc);
            }
            *(char *)((int)local_8c._M_dataplus._M_p + sVar15) = (char)local_50;
            goto LAB_089b265c;
          }
          break;
        case 4:
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                    (&local_8c,&local_90);
        }
        pbVar11 = (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                  ((int)&(pbVar11->_M_dataplus)._M_p + 1);
        if (pbVar11 == local_40) goto code_r0x089b24a8;
        uVar1 = *(undefined1 *)&(pbVar11->_M_dataplus)._M_p;
      } while( true );
    }
  }
LAB_089b258c:
  local_4c->_M_in_cur = (char *)0x0;
  return local_78;
code_r0x089b24a8:
  if (1 < local_60) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
              (&local_8c,local_5c + 1,local_60 - 1);
  }
  pcVar16 = *(char **)((int)local_8c._M_dataplus._M_p + -0xc);
  if (pcVar16 < pcVar7) {
    if (local_68 == 0x20) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
                (&local_8c,(int)pcVar7 - (int)pcVar16,(char)local_48);
      pcVar16 = pcVar7;
    }
    else {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
                (&local_8c,0,0,(int)pcVar7 - (int)pcVar16,*(char *)(paVar17 + 0x10));
      pcVar16 = pcVar7;
    }
  }
  cVar4 = local_74;
  poVar3 = local_78;
  if ((local_74 == '\0') &&
     (pcVar7 = (char *)(*(code *)local_78->_M_sbuf[1]._M_out_beg)
                                 (local_78,local_8c._M_dataplus._M_p,pcVar16), pcVar16 != pcVar7)) {
    cVar4 = '\x01';
  }
  p_Var12 = (_Rep *)((int)local_8c._M_dataplus._M_p + -0xc);
  apoStack_88[2] = poVar3;
  local_7c = cVar4;
  local_78 = poVar3;
  local_74 = cVar4;
                    /* try { // try from 089b281c to 089b2823 has its CatchHandler @ 089b287c */
  if ((p_Var12 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var8 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_8c._M_dataplus._M_p + -4),-1), _Var8 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var12,aaStack_98 + 3);
  }
  p_Var12 = (_Rep *)((int)local_90._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b256c to 089b2573 has its CatchHandler @ 089b2884 */
  if ((p_Var12 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var8 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_90._M_dataplus._M_p + -4),-1), _Var8 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (p_Var12,aaStack_98);
  }
  goto LAB_089b258c;
}



----------------------------------------

// Function: do_put @ 089b2920

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, bool __intl, ios_base * __io, char __fill,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __digits) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,bool __intl,ios_base *__io,
          char __fill,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__digits)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  char in_t0;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_01;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_30;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_28;
  ios_base *in_stack_ffffffe0;
  char in_stack_ffffffe4;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_stack_ffffffe8;
  
  local_30.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_30.super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  if (((ulonglong)__s & 0xff) != 0) {
    __s_00._4_4_ = (int)in_t0;
    __s_00._M_sbuf = __s._4_4_;
    local_28.super_facet._vptr_facet = local_30.super_facet._vptr_facet;
    local_28.super_facet._M_refcount._0_1_ = (undefined1)local_30.super_facet._M_refcount;
    poVar1 = _M_insert<true>(__return_storage_ptr__,&local_28,__s_00,in_stack_ffffffe0,
                             in_stack_ffffffe4,in_stack_ffffffe8);
    return poVar1;
  }
  __s_01._4_4_ = (int)in_t0;
  __s_01._M_sbuf = __s._4_4_;
  poVar1 = _M_insert<false>(__return_storage_ptr__,&local_30,__s_01,in_stack_ffffffe0,
                            in_stack_ffffffe4,in_stack_ffffffe8);
  return poVar1;
}



----------------------------------------

// Function: do_put @ 089b29f4

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, bool __intl, ios_base * __io, char __fill,
   longdouble __units) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,bool __intl,ios_base *__io,
          char __fill,longdouble __units)

{
  ctype<char> *pcVar1;
  _Atomic_word _Var2;
  undefined1 extraout_v1;
  undefined1 extraout_v1_00;
  int iVar3;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this_00;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pmVar4;
  basic_streambuf<char,std::char_traits<char>_> *pbVar5;
  char in_t0;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_01;
  char acStackY_408 [16];
  ios_base *in_stack_fffffc08;
  char in_stack_fffffc0c;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_stack_fffffc10;
  char acStack_2c8 [16];
  longdouble in_stack_fffffd48;
  __c_locale *in_stack_fffffd50;
  int in_stack_fffffd54;
  undefined8 uStack_188;
  locale lStack_180;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_17c;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_178;
  money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_170;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_168;
  undefined1 local_164;
  undefined1 auStack_160 [256];
  ostreambuf_iterator<char,std::char_traits<char>_> *local_60;
  undefined1 local_5c;
  uint local_58;
  _func_int_varargs **local_54;
  char *local_50;
  size_t local_4c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_48;
  uint local_44;
  int local_40;
  
                    /* Unresolved local var: locale __loc@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: int __cs_size@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: int __len@[DW_OP_breg30(s8): +316]
                       Unresolved local var: char * __ws@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __digits@[???] */
  pbVar5 = __s._4_4_;
  pmVar4 = (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)&uStack_188;
  local_54 = (this->super_facet)._vptr_facet;
  local_58 = (uint)(byte)(this->super_facet)._M_refcount;
  local_44 = (uint)__s._M_sbuf & 0xff;
  local_40 = (int)in_t0;
  local_48 = __return_storage_ptr__;
  locale::locale(&lStack_180,(locale *)&pbVar5[3]._M_in_end);
                    /* try { // try from 089b2a64 to 089b2b3f has its CatchHandler @ 089b2c98 */
  pcVar1 = use_facet<std::ctype<char>_>(&lStack_180);
  uStack_188._4_4_ = locale::facet::_S_get_c_locale();
  local_4c = __convert_from_v<long_double>
                       (acStack_2c8,0,"%.*Lf",in_stack_fffffd48,in_stack_fffffd50,in_stack_fffffd54)
  ;
  local_50 = acStack_2c8 + local_4c;
  if (pcVar1->_M_widen_ok == '\x01') {
    memcpy(acStackY_408,acStack_2c8,(int)local_50 - (int)acStack_2c8);
  }
  else {
    if (pcVar1->_M_widen_ok == '\0') {
      iVar3 = 0;
      do {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
        auStack_160[iVar3] = (char)iVar3;
        iVar3 = iVar3 + 1;
      } while (iVar3 != 0x100);
      (*(pcVar1->super_facet)._vptr_facet[7])(pcVar1,auStack_160,&local_60,pcVar1->_M_widen);
      pcVar1->_M_widen_ok = '\x01';
      iVar3 = memcmp(auStack_160,pcVar1->_M_widen,0x100);
      if (iVar3 != 0) {
        pcVar1->_M_widen_ok = '\x02';
      }
    }
    (*(pcVar1->super_facet)._vptr_facet[7])(pcVar1,acStack_2c8,local_50,acStackY_408);
  }
                    /* try { // try from 089b2b50 to 089b2b57 has its CatchHandler @ 089b2ca0 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_17c,acStackY_408,local_4c,(allocator<char> *)((int)&uStack_188 + 2));
  if (local_44 == 0) {
    local_178.super_facet._vptr_facet = local_54;
    this_00 = &local_178;
    __s_01._4_4_ = local_40;
    __s_01._M_sbuf = pbVar5;
    local_178.super_facet._M_refcount._0_1_ = (char)local_58;
    local_168 = _M_insert<false>(local_48,this_00,__s_01,in_stack_fffffc08,in_stack_fffffc0c,
                                 in_stack_fffffc10);
    local_5c = extraout_v1_00;
  }
  else {
    local_170.super_facet._vptr_facet = local_54;
    this_00 = &local_170;
    __s_00._4_4_ = local_40;
    __s_00._M_sbuf = pbVar5;
    local_170.super_facet._M_refcount._0_1_ = (char)local_58;
                    /* try { // try from 089b2b80 to 089b2c23 has its CatchHandler @ 089b2c70 */
    local_168 = _M_insert<true>(local_48,this_00,__s_00,in_stack_fffffc08,in_stack_fffffc0c,
                                in_stack_fffffc10);
    local_5c = extraout_v1;
  }
  local_164 = local_5c;
  local_60 = local_168;
  if ((_Rep *)((int)local_17c._M_dataplus._M_p + -0xc) !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089b2c50 to 089b2c57 has its CatchHandler @ 089b2c98 */
    this_00 = (money_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0xffffffff
    ;
    _Var2 = __gnu_cxx::__exchange_and_add((_Atomic_word *)((int)local_17c._M_dataplus._M_p + -4),-1)
    ;
    if (_Var2 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                ((_Rep *)((int)local_17c._M_dataplus._M_p + -0xc),(allocator<char> *)&uStack_188);
      this_00 = pmVar4;
    }
  }
  locale::~locale(&lStack_180,(int)this_00);
  return local_168;
}



----------------------------------------

// Function: _M_insert_float<long_double> @ 089b2cd8

/* DWARF original name: _M_insert_float<long double>
   DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_float<long_double>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, char
   __mod, longdouble __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_insert_float<long_double>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          char __mod,longdouble __v)

{
  char cVar1;
  int iVar2;
  _Atomic_word _Var3;
  char cVar4;
  size_t __index;
  ctype<char> *pcVar5;
  undefined1 *puVar6;
  __numpunct_cache<char> *this_00;
  int iVar7;
  _func_int_varargs **pp_Var8;
  int iVar9;
  ios_base *__io_00;
  streamsize __w;
  char in_t0;
  facet **ppfVar10;
  int iVar11;
  locale *__loc;
  facet *pfVar12;
  undefined1 *puVar13;
  undefined1 *puVar14;
  undefined4 local_178;
  size_t local_174;
  undefined8 uStack_168;
  int aiStack_160 [2];
  undefined1 local_158 [256];
  uint local_58;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_54;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_50;
  int local_4c;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: streamsize __prec@[???]
                       Unresolved local var: int __max_digits@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: char[16] __fbuf@[???]
                       Unresolved local var: bool __fixed@[???]
                       Unresolved local var: int __max_exp@[???]
                       Unresolved local var: int __cs_size@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: char * __ws@[???]
                       Unresolved local var: char __cdec@[???]
                       Unresolved local var: char __dec@[???]
                       Unresolved local var: char * __p@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_54 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_58 = (uint)(byte)(this->super_facet)._M_refcount;
  local_4c = (int)__s._M_failed;
  local_50 = __return_storage_ptr__;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar10 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar12 = *ppfVar10;
  local_40 = 0;
  local_3c = 0;
  __loc = &__io_00->_M_ios_locale;
  if (pfVar12 == (facet *)0x0) {
                    /* try { // try from 089b3148 to 089b319b has its CatchHandler @ 089b31b4 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,__loc);
    locale::_Impl::_M_install_cache(__loc->_M_impl,&this_00->super_facet,__index);
    pfVar12 = *ppfVar10;
  }
  iVar11 = __io_00->_M_precision;
  if (iVar11 < 0) {
    iVar11 = 6;
  }
  if ((__io_00->_M_flags & _S_fixed) == 0) {
    iVar11 = iVar11 + 0x1e;
  }
  else {
    iVar11 = iVar11 + 0x138;
  }
  iVar11 = -(iVar11 + 0xeU & 0xfffffff8);
  __num_base::_S_format_float(__io_00,(char *)&uStack_168,in_t0);
  local_178 = locale::facet::_S_get_c_locale();
  local_174 = __convert_from_v<long_double>
                        ((char *)((int)&local_178 + iVar11),0,(char *)&uStack_168,
                         *(longdouble *)((int)&uStack_168 + iVar11),
                         *(__c_locale **)((int)aiStack_160 + iVar11),
                         *(int *)((int)aiStack_160 + iVar11 + 4));
  pcVar5 = use_facet<std::ctype<char>_>(__loc);
  iVar2 = -(local_174 + 0xe & 0xfffffff8);
  puVar14 = (undefined1 *)((int)&local_178 + iVar2 + iVar11);
  puVar13 = (undefined1 *)((int)&local_178 + iVar2 + iVar11);
  iVar9 = (int)&local_178 + local_174 + iVar11;
  if (pcVar5->_M_widen_ok == '\x01') {
    memcpy((void *)((int)&local_178 + iVar2 + iVar11),(void *)((int)&local_178 + iVar11),
           iVar9 - ((int)&local_178 + iVar11));
    cVar4 = pcVar5->_M_widen_ok;
  }
  else {
    iVar7 = 0;
    if (pcVar5->_M_widen_ok == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      puVar6 = local_158;
      do {
        *puVar6 = (char)iVar7;
        iVar7 = iVar7 + 1;
        puVar6 = local_158 + iVar7;
      } while (iVar7 != 0x100);
      (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,local_158,&local_58,pcVar5->_M_widen);
      pcVar5->_M_widen_ok = '\x01';
      iVar7 = memcmp(local_158,pcVar5->_M_widen,0x100);
      if (iVar7 != 0) {
        pcVar5->_M_widen_ok = '\x02';
        goto LAB_089b2e24;
      }
      pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    }
    else {
LAB_089b2e24:
      pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    }
    (*pp_Var8[7])(pcVar5,(int)&local_178 + iVar11,iVar9,(int)&local_178 + iVar2 + iVar11);
    cVar4 = pcVar5->_M_widen_ok;
  }
  iVar9 = 0;
  if (cVar4 == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
    puVar6 = local_158;
    do {
      *puVar6 = (char)iVar9;
      iVar9 = iVar9 + 1;
      puVar6 = local_158 + iVar9;
    } while (iVar9 != 0x100);
    (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,local_158,&local_58,pcVar5->_M_widen);
    pcVar5->_M_widen_ok = '\x01';
    iVar9 = memcmp(local_158,pcVar5->_M_widen,0x100);
    pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    if (iVar9 == 0) {
      iVar9 = (*pp_Var8[6])(pcVar5,0x2e);
      cVar4 = (char)iVar9;
    }
    else {
      pcVar5->_M_widen_ok = '\x02';
      iVar9 = (*pp_Var8[6])(pcVar5,0x2e);
      cVar4 = (char)iVar9;
    }
  }
  else {
    cVar4 = pcVar5->_M_widen[0x2e];
  }
  _Var3 = pfVar12[4]._M_refcount;
  puVar6 = memchr((void *)((int)&local_178 + iVar2 + iVar11),(int)cVar4,local_174);
  if (puVar6 != (undefined1 *)0x0) {
    *puVar6 = (char)_Var3;
  }
  if (*(char *)&pfVar12[2]._vptr_facet == '\0') {
    __w = __io_00->_M_width;
LAB_089b2fb0:
    if (__w <= (int)local_174) goto LAB_089b2fbc;
  }
  else {
    if ((puVar6 == (undefined1 *)0x0) && (2 < (int)local_174)) {
      cVar4 = *(char *)((int)&local_178 + iVar11 + 1);
      if (cVar4 < ':') {
        cVar1 = *(char *)((int)&local_178 + iVar11 + 2);
        if (cVar1 < ':') {
          if (cVar4 < '0') {
            __w = __io_00->_M_width;
          }
          else {
            if ('/' < cVar1) goto LAB_089b2e88;
            __w = __io_00->_M_width;
          }
        }
        else {
          __w = __io_00->_M_width;
        }
      }
      else {
        __w = __io_00->_M_width;
      }
      goto LAB_089b2fb0;
    }
LAB_089b2e88:
    iVar9 = -(local_174 * 2 + 0xe & 0xfffffff8);
    puVar14 = (undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11);
    puVar13 = (undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11);
    if ((*(char *)((int)&local_178 + iVar11) == '-') || (*(char *)((int)&local_178 + iVar11) == '+')
       ) {
      iVar7 = 1;
      *(undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11) =
           *(undefined1 *)((int)&local_178 + iVar2 + iVar11);
      local_174 = local_174 - 1;
    }
    else {
      iVar7 = 0;
    }
    _M_group_float((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)
                   local_50,(char *)pfVar12[1]._vptr_facet,pfVar12[1]._M_refcount,
                   *(char *)((int)&pfVar12[4]._M_refcount + 1),
                   *(char **)((int)&uStack_168 + iVar9 + iVar2 + iVar11),
                   *(char **)((int)aiStack_160 + iVar9 + iVar2 + iVar11 + -4),
                   *(char **)((int)aiStack_160 + iVar9 + iVar2 + iVar11),
                   *(int **)((int)aiStack_160 + iVar9 + iVar2 + iVar11 + 4));
    __w = __io_00->_M_width;
    local_174 = local_174 + iVar7;
    if (__w <= (int)local_174) goto LAB_089b2fbc;
  }
                    /* Unresolved local var: char * __ws3@[???] */
  iVar11 = -(__w + 0xeU & 0xfffffff8);
  puVar14 = puVar13 + iVar11;
  _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_50,
         (char)local_4c,__w,__io_00,*(char **)(puVar13 + iVar11 + 0x10),
         *(char **)(puVar13 + iVar11 + 0x14),*(int **)(puVar13 + iVar11 + 0x18));
LAB_089b2fbc:
  __io_00->_M_width = 0;
  if (local_58 == 0) {
    (*(code *)local_54->_M_sbuf[1]._M_out_beg)(local_54,puVar14,local_174);
  }
  return local_54;
}



----------------------------------------

// Function: do_put @ 089b31ec

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, longdouble
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          longdouble __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  char unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  longdouble in_stack_00000000;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_float<long_double>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      unaff_retaddr,in_stack_00000000);
  return poVar1;
}



----------------------------------------

// Function: _M_extract_float @ 089b3238

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_float(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __xtrc) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::_M_extract_float
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__xtrc)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  size_t sVar4;
  undefined3 extraout_var;
  void *pvVar5;
  undefined3 extraout_var_00;
  int iVar6;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var7;
  uint uVar8;
  uint uVar9;
  basic_streambuf<char,std::char_traits<char>_> *pbVar10;
  uint *in_t0;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_t1;
  _Rep *this_01;
  char cVar11;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar12;
  _func_int_varargs **pp_Var13;
  char *pcVar14;
  uint uVar15;
  int *piVar16;
  int iVar17;
  int iVar18;
  locale *__loc;
  char *pcVar19;
  allocator<char> aaStack_67 [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_64 [3];
  _func_int_varargs **local_58;
  char *local_54;
  int local_50;
  int local_4c;
  int local_48;
  int local_44;
  int local_40;
  char *local_3c;
  uint *local_38;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __found_mantissa@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: bool __found_dec@[???]
                       Unresolved local var: bool __found_sci@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???]
                       Unresolved local var: int __ret@[???] */
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  pcVar19 = (__beg._M_sbuf)->_M_in_beg;
  piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_38 = in_t0;
  local_34 = in_t1;
  sVar4 = locale::id::_M_id(&numpunct<char>::id);
  piVar16 = (int *)(sVar4 * 4 + *(int *)(*(int *)(__beg._M_c + 0x6c) + 0xc));
  iVar18 = *piVar16;
  local_30 = 0;
  local_2c = 0;
  __loc = (locale *)(__beg._M_c + 0x6c);
  if (iVar18 == 0) {
                    /* try { // try from 089b3e50 to 089b3ea3 has its CatchHandler @ 089b4218 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,__loc);
    locale::_Impl::_M_install_cache(__loc->_M_impl,&this_00->super_facet,sVar4);
    iVar18 = *piVar16;
  }
  local_3c = (char *)(iVar18 + 0x4a);
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  uVar9 = uVar15;
  if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
    piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar8 = 0xffffffff;
  }
  else {
    uVar8 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar9 = uVar8;
      if (uVar8 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = uVar15;
      }
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var13 == (_func_int_varargs **)0x0) {
LAB_089b3a80:
    bVar3 = true;
    local_58 = (_func_int_varargs **)0x0;
    pcVar14 = pcVar19;
  }
  else {
    local_58 = pp_Var13;
    if (pcVar19 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var13[2] < pp_Var13[3]) {
        pcVar14 = (char *)(uint)(byte)*pp_Var13[2];
      }
      else {
        pcVar14 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
      }
      if (pcVar14 == (char *)0xffffffff) goto LAB_089b3a80;
      bVar3 = pcVar14 == (char *)0xffffffff;
    }
    else {
      bVar3 = pcVar19 == (char *)0xffffffff;
      pcVar14 = pcVar19;
    }
  }
  if (uVar8 == 0xffffffff) {
    if (bVar3) goto LAB_089b3304;
LAB_089b3588:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b3bd0:
      iVar17 = -1;
    }
    else {
      if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar9 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b3bd0;
        }
        cVar11 = (char)uVar9;
      }
      else {
        cVar11 = (char)uVar9;
      }
      iVar17 = (int)cVar11;
    }
    cVar11 = *(char *)(iVar18 + 0x10);
    if ((local_3c[1] != iVar17) && (iVar17 != *local_3c)) goto LAB_089b35cc;
    if (cVar11 == '\0') {
      cVar1 = *(char *)(iVar18 + 0x24);
    }
    else {
      if (iVar17 == *(char *)(iVar18 + 0x25)) goto LAB_089b35cc;
      cVar1 = *(char *)(iVar18 + 0x24);
    }
    if (iVar17 == cVar1) goto LAB_089b35cc;
    cVar11 = '+';
    pcVar19 = (local_34->_M_dataplus)._M_p;
    uVar15 = *(int *)(pcVar19 + -0xc) + 1;
    if (local_3c[1] != iVar17) {
      cVar11 = '-';
    }
    if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_34,uVar15);
      pcVar19 = (local_34->_M_dataplus)._M_p;
      iVar6 = *(int *)(pcVar19 + -0xc);
    }
    else {
      iVar6 = *(int *)(pcVar19 + -0xc);
    }
    pcVar19[iVar6] = cVar11;
    pcVar19 = (local_34->_M_dataplus)._M_p;
    *(uint *)(pcVar19 + -0xc) = uVar15;
    pcVar19[-0xffffffff00000004] = '\0';
    pcVar19[-0xffffffff00000003] = '\0';
    pcVar19[-0xffffffff00000002] = '\0';
    pcVar19[-0xffffffff00000001] = '\0';
    pcVar19[uVar15] = '\0';
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar15 = 0xffffffff;
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar10) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar10) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_58 == (_func_int_varargs **)0x0) {
LAB_089b3f10:
      bVar3 = true;
    }
    else {
      if (pcVar14 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_58[2] < local_58[3]) {
          pcVar14 = (char *)(uint)(byte)*local_58[2];
        }
        else {
          pcVar14 = (char *)(**(code **)(*local_58 + 0x24))(local_58);
        }
        if (pcVar14 == (char *)0xffffffff) {
          local_58 = (_func_int_varargs **)0x0;
          goto LAB_089b3f10;
        }
      }
      bVar3 = pcVar14 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar3) {
LAB_089b39bc:
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar11 = *(char *)(iVar18 + 0x10);
          iVar17 = -1;
        }
        else {
          if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            cVar11 = *(char *)(iVar18 + 0x10);
            if (uVar9 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar17 = -1;
              goto LAB_089b35cc;
            }
          }
          else {
            cVar11 = *(char *)(iVar18 + 0x10);
          }
          iVar17 = (int)(char)uVar9;
        }
LAB_089b35cc:
        local_44 = 0;
        local_48 = 0;
LAB_089b35d4:
        if (cVar11 == '\0') {
          cVar1 = *(char *)(iVar18 + 0x24);
        }
        else {
          if (iVar17 == *(char *)(iVar18 + 0x25)) {
            local_40 = 0;
            goto LAB_089b3320;
          }
          cVar1 = *(char *)(iVar18 + 0x24);
        }
        if ((iVar17 == cVar1) || (iVar17 != local_3c[4])) {
          local_40 = 0;
          goto LAB_089b3320;
        }
        if (local_44 == 0) {
                    /* Unresolved local var: size_t __len@[???] */
          pcVar19 = (local_34->_M_dataplus)._M_p;
          uVar15 = *(int *)(pcVar19 + -0xc) + 1;
          if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (local_34,uVar15);
            pcVar19 = (local_34->_M_dataplus)._M_p;
          }
          local_44 = 1;
          pcVar19[*(int *)(pcVar19 + -0xc)] = '0';
          pcVar19 = (local_34->_M_dataplus)._M_p;
          *(uint *)(pcVar19 + -0xc) = uVar15;
          pcVar19[-0xffffffff00000004] = '\0';
          pcVar19[-0xffffffff00000003] = '\0';
          pcVar19[-0xffffffff00000002] = '\0';
          pcVar19[-0xffffffff00000001] = '\0';
          pcVar19[uVar15] = '\0';
        }
        local_48 = local_48 + 1;
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          uVar15 = 0xffffffff;
          if (local_58 != (_func_int_varargs **)0x0) goto LAB_089b36c4;
          bVar3 = true;
        }
        else {
                    /* Unresolved local var: int __ret@[???] */
          pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
          if (piVar12[1]._M_sbuf < pbVar10) {
            piVar12[1]._M_sbuf =
                 (basic_streambuf<char,std::char_traits<char>_> *)
                 ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
          }
          else {
            (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
            pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
          }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar12[1]._M_sbuf < pbVar10) {
            uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
          }
          uVar9 = uVar15;
          if (uVar15 == 0xffffffff) {
            piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            uVar9 = 0xffffffff;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          bVar3 = true;
          if (local_58 != (_func_int_varargs **)0x0) {
LAB_089b36c4:
            if (pcVar14 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (local_58[2] < local_58[3]) {
                pcVar14 = (char *)(uint)(byte)*local_58[2];
              }
              else {
                pcVar14 = (char *)(**(code **)(*local_58 + 0x24))();
              }
              if (pcVar14 == (char *)0xffffffff) {
                bVar3 = true;
                local_58 = (_func_int_varargs **)0x0;
                goto LAB_089b36d8;
              }
            }
            bVar3 = pcVar14 == (char *)0xffffffff;
          }
        }
LAB_089b36d8:
        if (uVar15 == 0xffffffff) {
          if (bVar3) goto LAB_089b39e4;
        }
        else if (!bVar3) goto LAB_089b39e4;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b3c18:
          cVar11 = *(char *)(iVar18 + 0x10);
          iVar17 = -1;
        }
        else {
          if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            if (uVar9 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b3c18;
            }
            cVar11 = *(char *)(iVar18 + 0x10);
          }
          else {
            cVar11 = *(char *)(iVar18 + 0x10);
          }
          iVar17 = (int)(char)uVar9;
        }
        goto LAB_089b35d4;
      }
      cVar11 = *(char *)(iVar18 + 0x10);
    }
    else {
      if (bVar3) goto LAB_089b39bc;
      cVar11 = *(char *)(iVar18 + 0x10);
    }
  }
  else {
    if (bVar3) goto LAB_089b3588;
LAB_089b3304:
                    /* Unresolved local var: bool __plus@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar17 = 0;
    cVar11 = *(char *)(iVar18 + 0x10);
  }
  local_40 = 1;
  local_44 = 0;
  local_48 = 0;
LAB_089b3320:
  if (cVar11 == '\0') goto LAB_089b3334;
LAB_089b3a04:
  local_64[0]._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
                    /* try { // try from 089b3a08 to 089b3a0f has its CatchHandler @ 089b4258 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_64,0x20);
LAB_089b3338:
  local_54 = local_3c + 4;
  if (local_40 == 0) {
    cVar11 = *(char *)(iVar18 + 0x10);
    local_4c = 0;
    local_50 = 0;
LAB_089b335c:
    while (cVar11 == '\0') {
      cVar11 = *(char *)(iVar18 + 0x24);
LAB_089b3374:
      if (cVar11 == iVar17) {
        if ((local_4c == 0) && (local_50 == 0)) {
          if (*(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
            uVar15 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) + 1;
            if ((*(size_t *)((int)local_64[0]._M_dataplus._M_p + -8) < uVar15) ||
               (0 < (int)*(size_t *)((int)local_64[0]._M_dataplus._M_p + -4))) {
              basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                        (local_64,uVar15);
              sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
            }
            else {
              sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
            }
            *(char *)((int)local_64[0]._M_dataplus._M_p + sVar4) = (char)local_48;
            *(size_t *)((int)local_64[0]._M_dataplus._M_p + -4) = 0;
            *(uint *)((int)local_64[0]._M_dataplus._M_p + -0xc) = uVar15;
            *(char *)((int)local_64[0]._M_dataplus._M_p + uVar15) = '\0';
          }
                    /* Unresolved local var: size_t __len@[???] */
          pcVar19 = (local_34->_M_dataplus)._M_p;
          uVar15 = *(int *)(pcVar19 + -0xc) + 1;
          if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
                    /* try { // try from 089b33d0 to 089b3857 has its CatchHandler @ 089b4258 */
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (local_34,uVar15);
            pcVar19 = (local_34->_M_dataplus)._M_p;
            iVar17 = *(int *)(pcVar19 + -0xc);
          }
          else {
            iVar17 = *(int *)(pcVar19 + -0xc);
          }
          pcVar19[iVar17] = '.';
          local_4c = 1;
          pcVar19 = (local_34->_M_dataplus)._M_p;
          *(uint *)(pcVar19 + -0xc) = uVar15;
          pcVar19[-0xffffffff00000004] = '\0';
          pcVar19[-0xffffffff00000003] = '\0';
          pcVar19[-0xffffffff00000002] = '\0';
          pcVar19[-0xffffffff00000001] = '\0';
          pcVar19[uVar15] = '\0';
          goto joined_r0x089b37cc;
        }
        goto LAB_089b348c;
      }
      pvVar5 = memchr(local_54,iVar17,10);
      if (pvVar5 != (void *)0x0) {
                    /* Unresolved local var: size_t __len@[???] */
        pcVar19 = (local_34->_M_dataplus)._M_p;
        uVar15 = *(int *)(pcVar19 + -0xc) + 1;
        cVar11 = __num_base::_S_atoms_in[(int)pvVar5 - (int)local_3c];
        if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_34,uVar15);
          pcVar19 = (local_34->_M_dataplus)._M_p;
        }
        local_48 = local_48 + 1;
        pcVar19[*(int *)(pcVar19 + -0xc)] = cVar11;
        local_44 = 1;
        pcVar19 = (local_34->_M_dataplus)._M_p;
LAB_089b37bc:
                    /* Unresolved local var: bool __plus@[???]
                       Unresolved local var: size_t __len@[???] */
        *(uint *)(pcVar19 + -0xc) = uVar15;
        pcVar19[-0xffffffff00000004] = '\0';
        pcVar19[-0xffffffff00000003] = '\0';
        pcVar19[-0xffffffff00000002] = '\0';
        pcVar19[-0xffffffff00000001] = '\0';
        pcVar19[uVar15] = '\0';
        goto joined_r0x089b37cc;
      }
      if ((((local_3c[0x12] != iVar17) && (local_3c[0x18] != iVar17)) || (local_50 != 0)) ||
         (local_44 == 0)) goto LAB_089b348c;
      if ((*(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) != 0) && (local_4c == 0)) {
                    /* Unresolved local var: size_t __len@[???] */
        uVar15 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) + 1;
        if ((*(size_t *)((int)local_64[0]._M_dataplus._M_p + -8) < uVar15) ||
           (0 < (int)*(size_t *)((int)local_64[0]._M_dataplus._M_p + -4))) {
          basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_64,uVar15);
          sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
        }
        else {
          sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
        }
        *(char *)((int)local_64[0]._M_dataplus._M_p + sVar4) = (char)local_48;
        *(size_t *)((int)local_64[0]._M_dataplus._M_p + -4) = 0;
        *(uint *)((int)local_64[0]._M_dataplus._M_p + -0xc) = uVar15;
        *(char *)((int)local_64[0]._M_dataplus._M_p + uVar15) = '\0';
      }
                    /* Unresolved local var: size_t __len@[???] */
      pcVar19 = (local_34->_M_dataplus)._M_p;
      uVar15 = *(int *)(pcVar19 + -0xc) + 1;
      if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_34,uVar15);
        pcVar19 = (local_34->_M_dataplus)._M_p;
        iVar17 = *(int *)(pcVar19 + -0xc);
      }
      else {
        iVar17 = *(int *)(pcVar19 + -0xc);
      }
      pcVar19[iVar17] = 'e';
      pcVar19 = (local_34->_M_dataplus)._M_p;
      *(uint *)(pcVar19 + -0xc) = uVar15;
      pcVar19[-0xffffffff00000004] = '\0';
      pcVar19[-0xffffffff00000003] = '\0';
      pcVar19[-0xffffffff00000002] = '\0';
      pcVar19[-0xffffffff00000001] = '\0';
      pcVar19[uVar15] = '\0';
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        uVar15 = 0xffffffff;
      }
      else {
                    /* Unresolved local var: int __ret@[???] */
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
        if (piVar12[1]._M_sbuf < pbVar10) {
          piVar12[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        }
        else {
          (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
          pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
        }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < pbVar10) {
          uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        uVar9 = uVar15;
        if (uVar15 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          uVar9 = 0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_58 != (_func_int_varargs **)0x0) {
        if (pcVar14 == (char *)0xffffffff) {
          if (local_58[2] < local_58[3]) {
            pcVar14 = (char *)(uint)(byte)*local_58[2];
          }
          else {
                    /* try { // try from 089b3f34 to 089b4067 has its CatchHandler @ 089b4258 */
            pcVar14 = (char *)(**(code **)(*local_58 + 0x24))(local_58);
          }
          if (pcVar14 == (char *)0xffffffff) {
            local_58 = (_func_int_varargs **)0x0;
            bVar3 = true;
            goto LAB_089b3d40;
          }
        }
        bVar3 = pcVar14 == (char *)0xffffffff;
      }
LAB_089b3d40:
      if (uVar15 == 0xffffffff) {
        if (bVar3) {
LAB_089b3ec4:
          local_40 = 1;
          local_50 = 1;
          goto LAB_089b348c;
        }
      }
      else if (!bVar3) goto LAB_089b3ec4;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b3f74:
        iVar17 = -1;
      }
      else {
        if (uVar9 == 0xffffffff) {
          if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c)
          {
            uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
          }
          if (uVar9 == 0xffffffff) {
            piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            goto LAB_089b3f74;
          }
          cVar11 = (char)uVar9;
        }
        else {
          cVar11 = (char)uVar9;
        }
        iVar17 = (int)cVar11;
      }
      cVar11 = *(char *)(iVar18 + 0x10);
      if ((local_3c[1] == iVar17) || (*local_3c == iVar17)) {
        if (cVar11 == '\0') {
          cVar1 = *(char *)(iVar18 + 0x24);
        }
        else {
          if (*(char *)(iVar18 + 0x25) == iVar17) goto LAB_089b3d90;
          cVar1 = *(char *)(iVar18 + 0x24);
        }
        if (cVar1 != iVar17) {
          cVar11 = '+';
          pcVar19 = (local_34->_M_dataplus)._M_p;
          uVar15 = *(int *)(pcVar19 + -0xc) + 1;
          if (local_3c[1] != iVar17) {
            cVar11 = '-';
          }
          if ((*(uint *)(pcVar19 + -8) < uVar15) || (0 < *(int *)(pcVar19 + -4))) {
            basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
                      (local_34,uVar15);
            pcVar19 = (local_34->_M_dataplus)._M_p;
            iVar17 = *(int *)(pcVar19 + -0xc);
          }
          else {
            iVar17 = *(int *)(pcVar19 + -0xc);
          }
          pcVar19[iVar17] = cVar11;
          local_50 = 1;
          pcVar19 = (local_34->_M_dataplus)._M_p;
          goto LAB_089b37bc;
        }
      }
LAB_089b3d90:
      local_50 = 1;
    }
    if (iVar17 != *(char *)(iVar18 + 0x25)) {
      cVar11 = *(char *)(iVar18 + 0x24);
      goto LAB_089b3374;
    }
    if ((local_4c != 0) || (local_50 != 0)) goto LAB_089b348c;
    if (local_48 == 0) {
                    /* try { // try from 089b419c to 089b41cf has its CatchHandler @ 089b4258 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
                (local_34,0,*(size_t *)((local_34->_M_dataplus)._M_p + -0xc),0);
      goto LAB_089b348c;
    }
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_64[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_64[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b3ad0 to 089b3e0f has its CatchHandler @ 089b4258 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_64,uVar15);
      sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar4 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_64[0]._M_dataplus._M_p + sVar4) = (char)local_48;
    local_48 = 0;
    *(size_t *)((int)local_64[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_64[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_64[0]._M_dataplus._M_p + uVar15) = '\0';
joined_r0x089b37cc:
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar15 = 0xffffffff;
      if (local_58 != (_func_int_varargs **)0x0) goto LAB_089b3464;
      bVar3 = true;
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar10) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar10) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_58 != (_func_int_varargs **)0x0) {
LAB_089b3464:
        if (pcVar14 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_58[2] < local_58[3]) {
            pcVar14 = (char *)(uint)(byte)*local_58[2];
          }
          else {
                    /* try { // try from 089b40a0 to 089b40a7 has its CatchHandler @ 089b4258 */
            pcVar14 = (char *)(**(code **)(*local_58 + 0x24))(local_58);
          }
          if (pcVar14 == (char *)0xffffffff) {
            bVar3 = true;
            local_58 = (_func_int_varargs **)0x0;
          }
          else {
            bVar3 = pcVar14 == (char *)0xffffffff;
          }
        }
        else {
          bVar3 = pcVar14 == (char *)0xffffffff;
        }
      }
    }
    if (uVar15 == 0xffffffff) {
      if (bVar3) goto LAB_089b3480;
    }
    else if (!bVar3) goto LAB_089b3480;
    iVar17 = -1;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          bVar2 = *(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
          uVar9 = (uint)bVar2;
          if (uVar9 == 0xffffffff) goto LAB_089b3884;
          iVar17 = (int)(char)bVar2;
        }
        else {
                    /* try { // try from 089b4114 to 089b411b has its CatchHandler @ 089b4258 */
          uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
          if (uVar9 == 0xffffffff) {
LAB_089b3884:
            piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            iVar17 = -1;
          }
          else {
            iVar17 = (int)(char)uVar9;
          }
        }
      }
      else {
        iVar17 = (int)(char)uVar9;
      }
    }
    cVar11 = *(char *)(iVar18 + 0x10);
    goto LAB_089b335c;
  }
  local_50 = 0;
  local_4c = 0;
LAB_089b348c:
  if (*(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) == 0) goto LAB_089b3510;
  if (local_4c == 0) {
    if (local_50 != 0) {
      sVar4 = *(size_t *)(iVar18 + 0xc);
      goto LAB_089b3890;
    }
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_64[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_64[0]._M_dataplus._M_p + -4))) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_64,uVar15);
    }
    *(char *)((int)local_64[0]._M_dataplus._M_p +
             *(size_t *)((int)local_64[0]._M_dataplus._M_p + -0xc)) = (char)local_48;
    *(size_t *)((int)local_64[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_64[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_64[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar3 = __verify_grouping(*(char **)(iVar18 + 8),*(size_t *)(iVar18 + 0xc),local_64);
    iVar18 = CONCAT31(extraout_var,bVar3);
  }
  else {
    sVar4 = *(size_t *)(iVar18 + 0xc);
LAB_089b3890:
    bVar3 = __verify_grouping(*(char **)(iVar18 + 8),sVar4,local_64);
    iVar18 = CONCAT31(extraout_var_00,bVar3);
  }
  if (iVar18 == 0) {
    *local_38 = *local_38 | 4;
  }
LAB_089b3510:
  if (local_40 != 0) {
    *local_38 = *local_38 | 2;
  }
  this_01 = (_Rep *)((int)local_64[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b4070 to 089b4077 has its CatchHandler @ 089b4250 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var7 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_64[0]._M_dataplus._M_p + -4),-1), _Var7 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_67);
  }
  return piVar12;
LAB_089b39e4:
  local_40 = 1;
  if (*(char *)(iVar18 + 0x10) != '\0') goto LAB_089b3a04;
LAB_089b3334:
  local_64[0]._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  goto LAB_089b3338;
LAB_089b3480:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  local_40 = 1;
  goto LAB_089b348c;
}



----------------------------------------

// Function: do_get @ 089b42a8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   longdouble * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,longdouble *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __s;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _Atomic_word _Var2;
  _Ios_Iostate *in_t0;
  longdouble *in_t1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *__xtrc;
  _Rep *this_00;
  ios_base *__io_00;
  _func_int_varargs **__err_00;
  _func_int_varargs **pp_Var3;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  allocator<char> aaStackY_67 [3];
  __c_locale local_64;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_60 [2];
  basic_streambuf<char,std::char_traits<char>_> *in_stack_ffffffa8;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __xtrc@[???]
                        */
  __beg_00._M_c = __beg._M_c;
  __err_00 = (this->super_facet)._vptr_facet;
  __xtrc = (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
           (this->super_facet)._M_refcount;
  local_60[0]._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  pp_Var3 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __io_00 = (ios_base *)(__beg._M_sbuf)->_M_in_beg;
                    /* try { // try from 089b4308 to 089b4373 has its CatchHandler @ 089b43e8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_60,0x20);
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xffffffac;
  __end_00._M_c = (int)pp_Var3;
  __end_00._M_sbuf = in_stack_ffffffa8;
  piVar1 = _M_extract_float(__return_storage_ptr__,
                            (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             *)&stack0xffffffb4,__beg_00,__end_00,__io_00,(_Ios_Iostate *)__err_00,
                            __xtrc);
  __s._M_dataplus._M_p = local_60[0]._M_dataplus._M_p;
  local_64 = locale::facet::_S_get_c_locale();
  __convert_to_v<long_double>((char *)__s._M_dataplus._M_p,in_t1,in_t0,&local_64);
  this_00 = (_Rep *)((int)local_60[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b43c4 to 089b43cb has its CatchHandler @ 089b440c */
  if ((this_00 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var2 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_60[0]._M_dataplus._M_p + -4),-1), _Var2 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_00,aaStackY_67);
  }
  return piVar1;
}



----------------------------------------

// Function: do_get @ 089b4444

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   double * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,double *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __s;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _Atomic_word _Var2;
  _Ios_Iostate *in_t0;
  double *in_t1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *__xtrc;
  _Rep *this_00;
  ios_base *__io_00;
  _func_int_varargs **__err_00;
  _func_int_varargs **pp_Var3;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  allocator<char> aaStackY_67 [3];
  __c_locale local_64;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_60 [2];
  basic_streambuf<char,std::char_traits<char>_> *in_stack_ffffffa8;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __xtrc@[???]
                        */
  __beg_00._M_c = __beg._M_c;
  __err_00 = (this->super_facet)._vptr_facet;
  __xtrc = (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
           (this->super_facet)._M_refcount;
  local_60[0]._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  pp_Var3 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __io_00 = (ios_base *)(__beg._M_sbuf)->_M_in_beg;
                    /* try { // try from 089b44a4 to 089b450f has its CatchHandler @ 089b4584 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_60,0x20);
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xffffffac;
  __end_00._M_c = (int)pp_Var3;
  __end_00._M_sbuf = in_stack_ffffffa8;
  piVar1 = _M_extract_float(__return_storage_ptr__,
                            (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             *)&stack0xffffffb4,__beg_00,__end_00,__io_00,(_Ios_Iostate *)__err_00,
                            __xtrc);
  __s._M_dataplus._M_p = local_60[0]._M_dataplus._M_p;
  local_64 = locale::facet::_S_get_c_locale();
  __convert_to_v<double>((char *)__s._M_dataplus._M_p,in_t1,in_t0,&local_64);
  this_00 = (_Rep *)((int)local_60[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b4560 to 089b4567 has its CatchHandler @ 089b45a8 */
  if ((this_00 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var2 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_60[0]._M_dataplus._M_p + -4),-1), _Var2 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_00,aaStackY_67);
  }
  return piVar1;
}



----------------------------------------

// Function: do_get @ 089b45e0

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   float * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,float *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> __s;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  _Atomic_word _Var2;
  _Ios_Iostate *in_t0;
  float *in_t1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *__xtrc;
  _Rep *this_00;
  ios_base *__io_00;
  _func_int_varargs **__err_00;
  _func_int_varargs **pp_Var3;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  allocator<char> aaStackY_67 [3];
  __c_locale local_64;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_60 [2];
  basic_streambuf<char,std::char_traits<char>_> *in_stack_ffffffa8;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __xtrc@[???]
                        */
  __beg_00._M_c = __beg._M_c;
  __err_00 = (this->super_facet)._vptr_facet;
  __xtrc = (basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
           (this->super_facet)._M_refcount;
  local_60[0]._M_dataplus._M_p =
       (_Alloc_hider)
       (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep_storage
       + 3);
  pp_Var3 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __io_00 = (ios_base *)(__beg._M_sbuf)->_M_in_beg;
                    /* try { // try from 089b4640 to 089b46ab has its CatchHandler @ 089b4720 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_60,0x20);
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&stack0xffffffac;
  __end_00._M_c = (int)pp_Var3;
  __end_00._M_sbuf = in_stack_ffffffa8;
  piVar1 = _M_extract_float(__return_storage_ptr__,
                            (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
                             *)&stack0xffffffb4,__beg_00,__end_00,__io_00,(_Ios_Iostate *)__err_00,
                            __xtrc);
  __s._M_dataplus._M_p = local_60[0]._M_dataplus._M_p;
  local_64 = locale::facet::_S_get_c_locale();
  __convert_to_v<float>((char *)__s._M_dataplus._M_p,in_t1,in_t0,&local_64);
  this_00 = (_Rep *)((int)local_60[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b46fc to 089b4703 has its CatchHandler @ 089b4744 */
  if ((this_00 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var2 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_60[0]._M_dataplus._M_p + -4),-1), _Var2 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_00,aaStackY_67);
  }
  return piVar1;
}



----------------------------------------

// Function: _M_insert_float<double> @ 089b477c

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_float<double>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, char
   __mod, double __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_insert_float<double>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          char __mod,double __v)

{
  char cVar1;
  int iVar2;
  _Atomic_word _Var3;
  char cVar4;
  size_t __index;
  ctype<char> *pcVar5;
  undefined1 *puVar6;
  __numpunct_cache<char> *this_00;
  int iVar7;
  _func_int_varargs **pp_Var8;
  int iVar9;
  ios_base *__io_00;
  streamsize __w;
  char in_t0;
  facet **ppfVar10;
  int iVar11;
  locale *__loc;
  facet *pfVar12;
  undefined1 *puVar13;
  undefined1 *puVar14;
  undefined4 local_178;
  size_t local_174;
  undefined8 uStack_168;
  int aiStack_160 [2];
  undefined1 local_158 [256];
  uint local_58;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_54;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_50;
  int local_4c;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: streamsize __prec@[???]
                       Unresolved local var: int __max_digits@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: char[16] __fbuf@[???]
                       Unresolved local var: bool __fixed@[???]
                       Unresolved local var: int __max_exp@[???]
                       Unresolved local var: int __cs_size@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: ctype<char> * __ctype@[???]
                       Unresolved local var: char * __ws@[???]
                       Unresolved local var: char __cdec@[???]
                       Unresolved local var: char __dec@[???]
                       Unresolved local var: char * __p@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_54 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_58 = (uint)(byte)(this->super_facet)._M_refcount;
  local_4c = (int)__s._M_failed;
  local_50 = __return_storage_ptr__;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar10 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar12 = *ppfVar10;
  local_40 = 0;
  local_3c = 0;
  __loc = &__io_00->_M_ios_locale;
  if (pfVar12 == (facet *)0x0) {
                    /* try { // try from 089b4bec to 089b4c3f has its CatchHandler @ 089b4c58 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,__loc);
    locale::_Impl::_M_install_cache(__loc->_M_impl,&this_00->super_facet,__index);
    pfVar12 = *ppfVar10;
  }
  iVar11 = __io_00->_M_precision;
  if (iVar11 < 0) {
    iVar11 = 6;
  }
  if ((__io_00->_M_flags & _S_fixed) == 0) {
    iVar11 = iVar11 + 0x1e;
  }
  else {
    iVar11 = iVar11 + 0x138;
  }
  iVar11 = -(iVar11 + 0xeU & 0xfffffff8);
  __num_base::_S_format_float(__io_00,(char *)&uStack_168,in_t0);
  local_178 = locale::facet::_S_get_c_locale();
  local_174 = __convert_from_v<double>
                        ((char *)((int)&local_178 + iVar11),0,(char *)&uStack_168,
                         *(double *)((int)&uStack_168 + iVar11),
                         *(__c_locale **)((int)aiStack_160 + iVar11),
                         *(int *)((int)aiStack_160 + iVar11 + 4));
  pcVar5 = use_facet<std::ctype<char>_>(__loc);
  iVar2 = -(local_174 + 0xe & 0xfffffff8);
  puVar14 = (undefined1 *)((int)&local_178 + iVar2 + iVar11);
  puVar13 = (undefined1 *)((int)&local_178 + iVar2 + iVar11);
  iVar9 = (int)&local_178 + local_174 + iVar11;
  if (pcVar5->_M_widen_ok == '\x01') {
    memcpy((void *)((int)&local_178 + iVar2 + iVar11),(void *)((int)&local_178 + iVar11),
           iVar9 - ((int)&local_178 + iVar11));
    cVar4 = pcVar5->_M_widen_ok;
  }
  else {
    iVar7 = 0;
    if (pcVar5->_M_widen_ok == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
      puVar6 = local_158;
      do {
        *puVar6 = (char)iVar7;
        iVar7 = iVar7 + 1;
        puVar6 = local_158 + iVar7;
      } while (iVar7 != 0x100);
      (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,local_158,&local_58,pcVar5->_M_widen);
      pcVar5->_M_widen_ok = '\x01';
      iVar7 = memcmp(local_158,pcVar5->_M_widen,0x100);
      if (iVar7 != 0) {
        pcVar5->_M_widen_ok = '\x02';
        goto LAB_089b48c8;
      }
      pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    }
    else {
LAB_089b48c8:
      pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    }
    (*pp_Var8[7])(pcVar5,(int)&local_178 + iVar11,iVar9,(int)&local_178 + iVar2 + iVar11);
    cVar4 = pcVar5->_M_widen_ok;
  }
  iVar9 = 0;
  if (cVar4 == '\0') {
                    /* Unresolved local var: char[256] __tmp@[???]
                       Unresolved local var: size_t __i@[???] */
    puVar6 = local_158;
    do {
      *puVar6 = (char)iVar9;
      iVar9 = iVar9 + 1;
      puVar6 = local_158 + iVar9;
    } while (iVar9 != 0x100);
    (*(pcVar5->super_facet)._vptr_facet[7])(pcVar5,local_158,&local_58,pcVar5->_M_widen);
    pcVar5->_M_widen_ok = '\x01';
    iVar9 = memcmp(local_158,pcVar5->_M_widen,0x100);
    pp_Var8 = (pcVar5->super_facet)._vptr_facet;
    if (iVar9 == 0) {
      iVar9 = (*pp_Var8[6])(pcVar5,0x2e);
      cVar4 = (char)iVar9;
    }
    else {
      pcVar5->_M_widen_ok = '\x02';
      iVar9 = (*pp_Var8[6])(pcVar5,0x2e);
      cVar4 = (char)iVar9;
    }
  }
  else {
    cVar4 = pcVar5->_M_widen[0x2e];
  }
  _Var3 = pfVar12[4]._M_refcount;
  puVar6 = memchr((void *)((int)&local_178 + iVar2 + iVar11),(int)cVar4,local_174);
  if (puVar6 != (undefined1 *)0x0) {
    *puVar6 = (char)_Var3;
  }
  if (*(char *)&pfVar12[2]._vptr_facet == '\0') {
    __w = __io_00->_M_width;
LAB_089b4a54:
    if (__w <= (int)local_174) goto LAB_089b4a60;
  }
  else {
    if ((puVar6 == (undefined1 *)0x0) && (2 < (int)local_174)) {
      cVar4 = *(char *)((int)&local_178 + iVar11 + 1);
      if (cVar4 < ':') {
        cVar1 = *(char *)((int)&local_178 + iVar11 + 2);
        if (cVar1 < ':') {
          if (cVar4 < '0') {
            __w = __io_00->_M_width;
          }
          else {
            if ('/' < cVar1) goto LAB_089b492c;
            __w = __io_00->_M_width;
          }
        }
        else {
          __w = __io_00->_M_width;
        }
      }
      else {
        __w = __io_00->_M_width;
      }
      goto LAB_089b4a54;
    }
LAB_089b492c:
    iVar9 = -(local_174 * 2 + 0xe & 0xfffffff8);
    puVar14 = (undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11);
    puVar13 = (undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11);
    if ((*(char *)((int)&local_178 + iVar11) == '-') || (*(char *)((int)&local_178 + iVar11) == '+')
       ) {
      iVar7 = 1;
      *(undefined1 *)((int)&local_178 + iVar9 + iVar2 + iVar11) =
           *(undefined1 *)((int)&local_178 + iVar2 + iVar11);
      local_174 = local_174 - 1;
    }
    else {
      iVar7 = 0;
    }
    _M_group_float((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)
                   local_50,(char *)pfVar12[1]._vptr_facet,pfVar12[1]._M_refcount,
                   *(char *)((int)&pfVar12[4]._M_refcount + 1),
                   *(char **)((int)&uStack_168 + iVar9 + iVar2 + iVar11),
                   *(char **)((int)aiStack_160 + iVar9 + iVar2 + iVar11 + -4),
                   *(char **)((int)aiStack_160 + iVar9 + iVar2 + iVar11),
                   *(int **)((int)aiStack_160 + iVar9 + iVar2 + iVar11 + 4));
    __w = __io_00->_M_width;
    local_174 = local_174 + iVar7;
    if (__w <= (int)local_174) goto LAB_089b4a60;
  }
                    /* Unresolved local var: char * __ws3@[???] */
  iVar11 = -(__w + 0xeU & 0xfffffff8);
  puVar14 = puVar13 + iVar11;
  _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_50,
         (char)local_4c,__w,__io_00,*(char **)(puVar13 + iVar11 + 0x10),
         *(char **)(puVar13 + iVar11 + 0x14),*(int **)(puVar13 + iVar11 + 0x18));
LAB_089b4a60:
  __io_00->_M_width = 0;
  if (local_58 == 0) {
    (*(code *)local_54->_M_sbuf[1]._M_out_beg)(local_54,puVar14,local_174);
  }
  return local_54;
}



----------------------------------------

// Function: do_put @ 089b4c90

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, double __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          double __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  char unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  double in_stack_00000000;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_float<double>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      unaff_retaddr,in_stack_00000000);
  return poVar1;
}



----------------------------------------

// Function: _M_insert_int<long_long_unsigned_int> @ 089b4cdc

/* DWARF original name: _M_insert_int<long long unsigned int>
   DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_int<long_long_unsigned_int>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill,
   ulonglong __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_insert_int<long_long_unsigned_int>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          ulonglong __v)

{
  int iVar1;
  size_t __index;
  __numpunct_cache<char> *this_00;
  _Ios_Fmtflags _Var2;
  ios_base *__io_00;
  int iVar3;
  int in_t0;
  int in_t1;
  char *pcVar4;
  facet **ppfVar5;
  facet *pfVar6;
  _Ios_Fmtflags _Var7;
  char *pcVar8;
  char acStackY_90 [16];
  char *in_stack_ffffff80;
  _Ios_Fmtflags in_stack_ffffff84;
  undefined1 in_stack_ffffff88;
  undefined4 auStack_74 [3];
  char acStack_68 [8];
  int local_60;
  uint local_50;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_4c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_48;
  int local_44;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: _Ios_Fmtflags __flags@[???]
                       Unresolved local var: int __ilen@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_4c = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_50 = (uint)(byte)(this->super_facet)._M_refcount;
  local_44 = (int)__s._M_failed;
  local_48 = __return_storage_ptr__;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar5 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar6 = *ppfVar5;
  local_40 = 0;
  local_3c = 0;
  if (pfVar6 == (facet *)0x0) {
                    /* try { // try from 089b4f20 to 089b4f73 has its CatchHandler @ 089b4fa4 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,&__io_00->_M_ios_locale);
    locale::_Impl::_M_install_cache((__io_00->_M_ios_locale)._M_impl,&this_00->super_facet,__index);
    pfVar6 = *ppfVar5;
  }
  _Var7 = __io_00->_M_flags;
  pcVar8 = acStackY_90;
  local_60 = __int_to_char<char,_long_long_unsigned_int>
                       (acStack_68,CONCAT44(in_t1,in_t0),in_stack_ffffff80,in_stack_ffffff84,
                        (bool)in_stack_ffffff88);
  pcVar4 = acStack_68 + -local_60;
  if (*(char *)&pfVar6[2]._vptr_facet != '\0') {
                    /* Unresolved local var: char * __cs2@[???] */
    iVar3 = -(local_60 * 2 + 0x10U & 0xfffffff8);
    pcVar8 = acStackY_90 + iVar3;
    pcVar4 = acStackY_90 + iVar3 + 2;
    _M_group_int((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
                 (char *)pfVar6[1]._vptr_facet,pfVar6[1]._M_refcount,
                 *(char *)((int)&pfVar6[4]._M_refcount + 1),*(ios_base **)(&stack0xffffff80 + iVar3)
                 ,*(char **)(&stack0xffffff84 + iVar3),*(char **)(&stack0xffffff88 + iVar3),
                 *(int **)((int)auStack_74 + iVar3));
  }
  _Var2 = _Var7 & _S_basefield;
  if (((_Var2 == _S_oct) || (_Var2 == _S_hex)) && ((_Var7 & _S_showbase) != 0)) {
    if (in_t0 == 0 && in_t1 == 0) {
      iVar3 = __io_00->_M_width;
      goto LAB_089b4dd0;
    }
    if (_Var2 == _S_oct) {
      pcVar4 = pcVar4 + -1;
      *pcVar4 = *(char *)((int)&pfVar6[5]._vptr_facet + 2);
      local_60 = local_60 + 1;
    }
    else {
                    /* Unresolved local var: bool __uppercase@[???] */
      pcVar4[-1] = *(char *)((int)pfVar6 + (0x28 - ((int)(_Var7 << 0x11) >> 0x1f)));
      pcVar4 = pcVar4 + -2;
      *pcVar4 = *(char *)((int)&pfVar6[5]._vptr_facet + 2);
      local_60 = local_60 + 2;
    }
  }
  iVar3 = __io_00->_M_width;
LAB_089b4dd0:
  if (local_60 < iVar3) {
                    /* Unresolved local var: char * __cs3@[???] */
    iVar1 = -(iVar3 + 0xeU & 0xfffffff8);
    pcVar4 = pcVar8 + iVar1;
    _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
           (char)local_44,iVar3,__io_00,*(char **)(pcVar8 + iVar1 + 0x10),
           *(char **)(pcVar8 + iVar1 + 0x14),*(int **)(pcVar8 + iVar1 + 0x18));
  }
  __io_00->_M_width = 0;
  if (local_50 == 0) {
    (*(code *)local_4c->_M_sbuf[1]._M_out_beg)(local_4c,pcVar4,local_60);
  }
  return local_4c;
}



----------------------------------------

// Function: do_put @ 089b4fdc

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, ulonglong
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          ulonglong __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  undefined4 unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  undefined4 in_stack_fffffffc;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_int<long_long_unsigned_int>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      CONCAT44(in_stack_fffffffc,unaff_retaddr));
  return poVar1;
}



----------------------------------------

// Function: _M_insert_int<long_long_int> @ 089b501c

/* DWARF original name: _M_insert_int<long long int>
   DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_int<long_long_int>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill,
   longlong __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_insert_int<long_long_int>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          longlong __v)

{
  size_t __index;
  __numpunct_cache<char> *this_00;
  int iVar1;
  ios_base *__io_00;
  streamsize __w;
  int in_t0;
  int in_t1;
  char *pcVar2;
  facet *pfVar3;
  facet **ppfVar4;
  int iVar5;
  _Ios_Fmtflags _Var6;
  _Ios_Fmtflags _Var7;
  char *pcVar8;
  char *pcVar9;
  char acStackY_98 [16];
  char *in_stack_ffffff78;
  _Ios_Fmtflags in_stack_ffffff7c;
  undefined1 in_stack_ffffff80;
  undefined4 auStack_7c [3];
  char acStack_70 [8];
  int local_68;
  uint local_58;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_54;
  char *local_50;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_4c;
  int local_48;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: _Ios_Fmtflags __flags@[???]
                       Unresolved local var: int __ilen@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_54 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_58 = (uint)(byte)(this->super_facet)._M_refcount;
  local_48 = (int)__s._M_failed;
  local_4c = __return_storage_ptr__;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar4 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar3 = *ppfVar4;
  local_40 = 0;
  local_3c = 0;
  if (pfVar3 == (facet *)0x0) {
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
                    /* try { // try from 089b52d0 to 089b5323 has its CatchHandler @ 089b53ac */
    this_00 = operator_new(0x68);
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,&__io_00->_M_ios_locale);
    locale::_Impl::_M_install_cache((__io_00->_M_ios_locale)._M_impl,&this_00->super_facet,__index);
    pfVar3 = *ppfVar4;
  }
  _Var7 = __io_00->_M_flags;
  local_50 = (char *)((int)&pfVar3[4]._M_refcount + 2);
  pcVar8 = acStackY_98;
                    /* Unresolved local var: ulonglong __ull@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???] */
  _Var6 = _Var7 & _S_basefield;
  iVar5 = in_t0;
  iVar1 = in_t1;
  if (((_Var6 != _S_oct) && (_Var6 != _S_hex)) && (in_t1 < 0)) {
    iVar1 = -(uint)(-in_t0 != 0) - in_t1;
    iVar5 = -in_t0;
  }
  local_68 = __int_to_char<char,_long_long_unsigned_int>
                       (acStack_70,CONCAT44(iVar1,iVar5),in_stack_ffffff78,in_stack_ffffff7c,
                        (bool)in_stack_ffffff80);
  pcVar2 = acStack_70 + -local_68;
  if (*(char *)&pfVar3[2]._vptr_facet == '\0') {
    pcVar9 = acStackY_98;
    if (_Var6 == _S_oct) goto LAB_089b527c;
LAB_089b5124:
    pcVar9 = pcVar8;
    if (_Var6 == _S_hex) goto LAB_089b527c;
    if ((in_t1 < 1) && ((in_t1 != 0 || (in_t0 == 0)))) {
      if (in_t0 != 0 || in_t1 != 0) {
        pcVar2 = pcVar2 + -1;
        *pcVar2 = *local_50;
        local_68 = local_68 + 1;
      }
      goto LAB_089b5144;
    }
    if ((_Var7 & _S_showpos) == 0) goto LAB_089b5144;
    pcVar2 = pcVar2 + -1;
    iVar5 = local_68 + 1;
    *pcVar2 = local_50[1];
    __w = __io_00->_M_width;
    local_68 = iVar5;
    if (__w <= iVar5) goto LAB_089b5154;
  }
  else {
                    /* Unresolved local var: char * __cs2@[???] */
    iVar5 = -(local_68 * 2 + 0x10U & 0xfffffff8);
    pcVar8 = acStackY_98 + iVar5;
    pcVar9 = acStackY_98 + iVar5;
    pcVar2 = acStackY_98 + iVar5 + 2;
    _M_group_int((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_4c,
                 (char *)pfVar3[1]._vptr_facet,pfVar3[1]._M_refcount,
                 *(char *)((int)&pfVar3[4]._M_refcount + 1),*(ios_base **)(&stack0xffffff78 + iVar5)
                 ,*(char **)(&stack0xffffff7c + iVar5),*(char **)(&stack0xffffff80 + iVar5),
                 *(int **)((int)auStack_7c + iVar5));
    if (_Var6 != _S_oct) goto LAB_089b5124;
LAB_089b527c:
    pcVar8 = pcVar9;
    if ((_Var7 & _S_showbase) == 0) {
LAB_089b5144:
      __w = __io_00->_M_width;
      pcVar9 = pcVar8;
    }
    else {
      if (in_t0 != 0 || in_t1 != 0) {
        if (_Var6 == _S_oct) {
          pcVar2 = pcVar2 + -1;
          *pcVar2 = local_50[4];
          local_68 = local_68 + 1;
        }
        else {
                    /* Unresolved local var: bool __uppercase@[???] */
          pcVar2[-1] = local_50[2 - ((int)(_Var7 << 0x11) >> 0x1f)];
          pcVar2 = pcVar2 + -2;
          *pcVar2 = local_50[4];
          local_68 = local_68 + 2;
        }
        goto LAB_089b5144;
      }
      __w = __io_00->_M_width;
    }
    pcVar8 = pcVar9;
    if (__w <= local_68) goto LAB_089b5154;
  }
  iVar5 = -(__w + 0xeU & 0xfffffff8);
  pcVar2 = pcVar8 + iVar5;
  _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_4c,
         (char)local_48,__w,__io_00,*(char **)(pcVar8 + iVar5 + 0x10),
         *(char **)(pcVar8 + iVar5 + 0x14),*(int **)(pcVar8 + iVar5 + 0x18));
LAB_089b5154:
  __io_00->_M_width = 0;
  if (local_58 == 0) {
    (*(code *)local_54->_M_sbuf[1]._M_out_beg)(local_54,pcVar2,local_68);
  }
  return local_54;
}



----------------------------------------

// Function: do_put @ 089b53e4

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, longlong
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,
          longlong __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  undefined4 unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  undefined4 in_stack_fffffffc;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_int<long_long_int>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      CONCAT44(in_stack_fffffffc,unaff_retaddr));
  return poVar1;
}



----------------------------------------

// Function: _M_insert_int<long_int> @ 089b5424

/* DWARF original name: _M_insert_int<long int>
   DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_int<long_int>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, long
   __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::_M_insert_int<long_int>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,long __v)

{
  int iVar1;
  size_t __index;
  __numpunct_cache<char> *this_00;
  ulong __v_00;
  ios_base *__io_00;
  streamsize __w;
  ulong in_t0;
  char *pcVar2;
  facet *pfVar3;
  facet **ppfVar4;
  _Ios_Fmtflags _Var5;
  _Ios_Fmtflags __flags;
  char *__lit;
  char *pcVar6;
  char *pcVar7;
  char acStack_80 [16];
  undefined1 in_stack_ffffff90;
  char acStack_6c [4];
  int aiStack_68 [6];
  uint local_50;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_4c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_48;
  int local_44;
  undefined4 local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: _Ios_Fmtflags __flags@[???]
                       Unresolved local var: int __ilen@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_4c = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_50 = (uint)(byte)(this->super_facet)._M_refcount;
  local_44 = (int)__s._M_failed;
  local_48 = __return_storage_ptr__;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar4 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar3 = *ppfVar4;
  local_40 = 0;
  local_3c = 0;
  if (pfVar3 == (facet *)0x0) {
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
                    /* try { // try from 089b56bc to 089b570f has its CatchHandler @ 089b5760 */
    this_00 = operator_new(0x68);
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,&__io_00->_M_ios_locale);
    locale::_Impl::_M_install_cache((__io_00->_M_ios_locale)._M_impl,&this_00->super_facet,__index);
    pfVar3 = *ppfVar4;
  }
  __flags = __io_00->_M_flags;
  pcVar6 = acStack_80;
                    /* Unresolved local var: ulong __ul@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???] */
  _Var5 = __flags & _S_basefield;
  __lit = (char *)((int)&pfVar3[4]._M_refcount + 2);
  __v_00 = in_t0;
  if (((_Var5 != _S_oct) && (_Var5 != _S_hex)) && ((int)in_t0 < 0)) {
    __v_00 = -in_t0;
  }
  aiStack_68[2] =
       __int_to_char<char,_long_unsigned_int>
                 (acStack_6c,__v_00,__lit,__flags,(bool)in_stack_ffffff90);
  pcVar2 = acStack_6c + -aiStack_68[2];
  if (*(char *)&pfVar3[2]._vptr_facet == '\0') {
    pcVar7 = acStack_80;
    if (_Var5 == _S_oct) goto LAB_089b5674;
LAB_089b5520:
    pcVar7 = pcVar6;
    if (_Var5 == _S_hex) goto LAB_089b5674;
    if ((int)in_t0 < 1) {
      if (in_t0 != 0) {
        pcVar2 = pcVar2 + -1;
        *pcVar2 = *__lit;
        aiStack_68[2] = aiStack_68[2] + 1;
      }
      goto LAB_089b5540;
    }
    if ((__flags & _S_showpos) == 0) goto LAB_089b5540;
    pcVar2 = pcVar2 + -1;
    *pcVar2 = *(char *)((int)&pfVar3[4]._M_refcount + 3);
    __w = __io_00->_M_width;
    aiStack_68[2] = aiStack_68[2] + 1;
    if (__w <= aiStack_68[2]) goto LAB_089b5550;
  }
  else {
                    /* Unresolved local var: char * __cs2@[???] */
    iVar1 = -(aiStack_68[2] * 2 + 0x10U & 0xfffffff8);
    pcVar6 = acStack_80 + iVar1;
    pcVar7 = acStack_80 + iVar1;
    pcVar2 = acStack_80 + iVar1 + 2;
    _M_group_int((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
                 (char *)pfVar3[1]._vptr_facet,pfVar3[1]._M_refcount,
                 *(char *)((int)&pfVar3[4]._M_refcount + 1),*(ios_base **)(&stack0xffffff90 + iVar1)
                 ,*(char **)(acStack_6c + iVar1),*(char **)((int)aiStack_68 + iVar1),
                 *(int **)((int)aiStack_68 + iVar1 + 4));
    if (_Var5 != _S_oct) goto LAB_089b5520;
LAB_089b5674:
    pcVar6 = pcVar7;
    if ((__flags & _S_showbase) == 0) {
LAB_089b5540:
      __w = __io_00->_M_width;
      pcVar7 = pcVar6;
    }
    else {
      if (in_t0 != 0) {
        if (_Var5 == _S_oct) {
          pcVar2 = pcVar2 + -1;
          *pcVar2 = *(char *)((int)&pfVar3[5]._vptr_facet + 2);
          aiStack_68[2] = aiStack_68[2] + 1;
        }
        else {
                    /* Unresolved local var: bool __uppercase@[???] */
          pcVar2[-1] = __lit[2 - ((int)(__flags << 0x11) >> 0x1f)];
          pcVar2 = pcVar2 + -2;
          *pcVar2 = *(char *)((int)&pfVar3[5]._vptr_facet + 2);
          aiStack_68[2] = aiStack_68[2] + 2;
        }
        goto LAB_089b5540;
      }
      __w = __io_00->_M_width;
    }
    pcVar6 = pcVar7;
    if (__w <= aiStack_68[2]) goto LAB_089b5550;
  }
                    /* Unresolved local var: char * __cs3@[???] */
  iVar1 = -(__w + 0xeU & 0xfffffff8);
  pcVar2 = pcVar6 + iVar1;
  _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
         (char)local_44,__w,__io_00,*(char **)(pcVar6 + iVar1 + 0x10),
         *(char **)(pcVar6 + iVar1 + 0x14),*(int **)(pcVar6 + iVar1 + 0x18));
LAB_089b5550:
  __io_00->_M_width = 0;
  if (local_50 == 0) {
    (*(code *)local_4c->_M_sbuf[1]._M_out_beg)(local_4c,pcVar2,aiStack_68[2]);
  }
  return local_4c;
}



----------------------------------------

// Function: do_put @ 089b5798

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, long __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,long __v)

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  long unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_int<long_int>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      unaff_retaddr);
  return poVar1;
}



----------------------------------------

// Function: do_put @ 089b57d8

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, bool __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,bool __v)

{
  char cVar1;
  int iVar2;
  size_t __index;
  __numpunct_cache<char> *this_00;
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar3;
  facet *pfVar4;
  undefined1 *puVar5;
  streamsize __w;
  char in_t0;
  facet **ppfVar6;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  _func_int_varargs **local_80 [4];
  ios_base *in_stack_ffffff90;
  _Atomic_word in_stack_ffffff98;
  
                    /* Unresolved local var: _Ios_Fmtflags __flags@[???] */
  __s_00._M_sbuf = (ios_base *)__s._M_sbuf;
  cVar1 = (char)(this->super_facet)._M_refcount;
  poVar3 = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  if (((__s_00._M_sbuf)->_M_flags & _S_boolalpha) == 0) {
                    /* Unresolved local var: long __l@[???] */
    __s_00._4_4_ = (int)__s._M_failed;
    poVar3 = _M_insert_int<long_int>
                       (__return_storage_ptr__,
                        (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)
                        &stack0xffffff94,__s_00,in_stack_ffffff90,(char)poVar3,
                        CONCAT31((int3)((uint)in_stack_ffffff98 >> 8),cVar1));
    return poVar3;
  }
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __name@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar6 = (((__s_00._M_sbuf)->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar4 = *ppfVar6;
  if (pfVar4 == (facet *)0x0) {
                    /* try { // try from 089b59a4 to 089b59f7 has its CatchHandler @ 089b5a1c */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,&(__s_00._M_sbuf)->_M_ios_locale);
    locale::_Impl::_M_install_cache
              (((__s_00._M_sbuf)->_M_ios_locale)._M_impl,&this_00->super_facet,__index);
    pfVar4 = *ppfVar6;
    if (in_t0 != '\0') {
      local_80[0] = pfVar4[3]._vptr_facet;
      goto LAB_089b58f4;
    }
    local_80[0] = pfVar4[4]._vptr_facet;
LAB_089b5958:
    __w = (__s_00._M_sbuf)->_M_width;
    puVar5 = (undefined1 *)pfVar4[3]._M_refcount;
    if (__w <= (int)local_80[0]) goto LAB_089b5910;
  }
  else {
    if (in_t0 == '\0') {
      local_80[0] = pfVar4[4]._vptr_facet;
      goto LAB_089b5958;
    }
    local_80[0] = pfVar4[3]._vptr_facet;
LAB_089b58f4:
    __w = (__s_00._M_sbuf)->_M_width;
    puVar5 = (undefined1 *)pfVar4[2]._M_refcount;
    if (__w <= (int)local_80[0]) goto LAB_089b5910;
  }
  iVar2 = -(__w + 0xeU & 0xfffffff8);
  puVar5 = (undefined1 *)((int)local_80 + iVar2);
  _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)
         __return_storage_ptr__,__s._M_failed,__w,__s_00._M_sbuf,
         *(char **)(&stack0xffffff90 + iVar2),*(char **)(&stack0xffffff94 + iVar2),
         *(int **)(&stack0xffffff98 + iVar2));
LAB_089b5910:
  (__s_00._M_sbuf)->_M_width = 0;
  if (cVar1 == '\0') {
    (*(code *)poVar3->_M_sbuf[1]._M_out_beg)(poVar3,puVar5,local_80[0]);
  }
  return poVar3;
}



----------------------------------------

// Function: _M_insert_int<long_unsigned_int> @ 089b5a58

/* DWARF original name: _M_insert_int<long unsigned int>
   DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   _M_insert_int<long_unsigned_int>(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill,
   ulong __v) */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_insert_int<long_unsigned_int>
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,ulong __v
          )

{
  int iVar1;
  size_t __index;
  __numpunct_cache<char> *this_00;
  _Ios_Fmtflags _Var2;
  ios_base *__io_00;
  int iVar3;
  ulong in_t0;
  char *pcVar4;
  facet **ppfVar5;
  facet *pfVar6;
  _Ios_Fmtflags __flags;
  char *__lit;
  char *pcVar7;
  char acStack_80 [16];
  undefined1 in_stack_ffffff90;
  char acStack_6c [4];
  int aiStack_68 [6];
  uint local_50;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_4c;
  ostreambuf_iterator<char,std::char_traits<char>_> *local_48;
  int local_44;
  ulong local_40;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: _Ios_Fmtflags __flags@[???]
                       Unresolved local var: int __ilen@[???]
                       Unresolved local var: char * __cs@[???]
                       Unresolved local var: int __len@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: streamsize __w@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __io_00 = (ios_base *)__s._M_sbuf;
  local_4c = (ostreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_50 = (uint)(byte)(this->super_facet)._M_refcount;
  local_44 = (int)__s._M_failed;
  local_48 = __return_storage_ptr__;
  local_40 = in_t0;
  __index = locale::id::_M_id(&numpunct<char>::id);
  ppfVar5 = ((__io_00->_M_ios_locale)._M_impl)->_M_caches + __index;
  pfVar6 = *ppfVar5;
  if (pfVar6 == (facet *)0x0) {
                    /* try { // try from 089b5c7c to 089b5ccf has its CatchHandler @ 089b5d00 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,&__io_00->_M_ios_locale);
    locale::_Impl::_M_install_cache((__io_00->_M_ios_locale)._M_impl,&this_00->super_facet,__index);
    pfVar6 = *ppfVar5;
  }
  __flags = __io_00->_M_flags;
  pcVar7 = acStack_80;
  __lit = (char *)((int)&pfVar6[4]._M_refcount + 2);
  aiStack_68[2] =
       __int_to_char<char,_long_unsigned_int>
                 (acStack_6c,local_40,__lit,__flags,(bool)in_stack_ffffff90);
  pcVar4 = acStack_6c + -aiStack_68[2];
  if (*(char *)&pfVar6[2]._vptr_facet != '\0') {
                    /* Unresolved local var: char * __cs2@[???] */
    iVar3 = -(aiStack_68[2] * 2 + 0x10U & 0xfffffff8);
    pcVar7 = acStack_80 + iVar3;
    pcVar4 = acStack_80 + iVar3 + 2;
    _M_group_int((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
                 (char *)pfVar6[1]._vptr_facet,pfVar6[1]._M_refcount,
                 *(char *)((int)&pfVar6[4]._M_refcount + 1),*(ios_base **)(&stack0xffffff90 + iVar3)
                 ,*(char **)(acStack_6c + iVar3),*(char **)((int)aiStack_68 + iVar3),
                 *(int **)((int)aiStack_68 + iVar3 + 4));
  }
  _Var2 = __flags & _S_basefield;
  if (((_Var2 == _S_oct) || (_Var2 == _S_hex)) && ((__flags & _S_showbase) != 0)) {
    if (local_40 == 0) {
      iVar3 = __io_00->_M_width;
      goto LAB_089b5b34;
    }
    if (_Var2 == _S_oct) {
      pcVar4 = pcVar4 + -1;
      *pcVar4 = *(char *)((int)&pfVar6[5]._vptr_facet + 2);
      aiStack_68[2] = aiStack_68[2] + 1;
    }
    else {
                    /* Unresolved local var: bool __uppercase@[???] */
      pcVar4[-1] = __lit[2 - ((int)(__flags << 0x11) >> 0x1f)];
      pcVar4 = pcVar4 + -2;
      *pcVar4 = *(char *)((int)&pfVar6[5]._vptr_facet + 2);
      aiStack_68[2] = aiStack_68[2] + 2;
    }
  }
  iVar3 = __io_00->_M_width;
LAB_089b5b34:
  if (aiStack_68[2] < iVar3) {
                    /* Unresolved local var: char * __cs3@[???] */
    iVar1 = -(iVar3 + 0xeU & 0xfffffff8);
    pcVar4 = pcVar7 + iVar1;
    _M_pad((num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)local_48,
           (char)local_44,iVar3,__io_00,*(char **)(pcVar7 + iVar1 + 0x10),
           *(char **)(pcVar7 + iVar1 + 0x14),*(int **)(pcVar7 + iVar1 + 0x18));
  }
  __io_00->_M_width = 0;
  if (local_50 == 0) {
    (*(code *)local_4c->_M_sbuf[1]._M_out_beg)(local_4c,pcVar4,aiStack_68[2]);
  }
  return local_4c;
}



----------------------------------------

// Function: do_put @ 089b5d38

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, void * __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,void *__v
          )

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  char *pcVar2;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_30;
  ios_base *in_stack_ffffffd8;
  char in_stack_ffffffdc;
  
                    /* Unresolved local var: _Ios_Fmtflags __flags@[???]
                       Unresolved local var: _Ios_Fmtflags __fmt@[???] */
  __s_00._M_sbuf = __s._M_sbuf;
  pcVar2 = (__s_00._M_sbuf)->_M_in_end;
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  local_30.super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_30.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  (__s_00._M_sbuf)->_M_in_end = (char *)((uint)pcVar2 & 0xffffbfa5 | 0x208);
  poVar1 = _M_insert_int<long_unsigned_int>
                     (__return_storage_ptr__,&local_30,__s_00,in_stack_ffffffd8,in_stack_ffffffdc,
                      (ulong)local_30.super_facet._vptr_facet);
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  (__s_00._M_sbuf)->_M_in_end = pcVar2;
  return poVar1;
}



----------------------------------------

// Function: do_put @ 089b5db0

/* DWARF original prototype: ostreambuf_iterator<char,std::char_traits<char>_>
   do_put(num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   ostreambuf_iterator<char,std::char_traits<char>_> __s, ios_base * __io, char __fill, ulong __v)
    */

ostreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_>::do_put
          (ostreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          ostreambuf_iterator<char,std::char_traits<char>_> __s,ios_base *__io,char __fill,ulong __v
          )

{
  ostreambuf_iterator<char,std::char_traits<char>_> *poVar1;
  ulong unaff_retaddr;
  ostreambuf_iterator<char,std::char_traits<char>_> __s_00;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> local_20 [2];
  ios_base *in_stack_fffffff0;
  char in_stack_fffffff4;
  
  __s_00._M_sbuf = __s._M_sbuf;
  local_20[0].super_facet._M_refcount._0_1_ = (undefined1)(this->super_facet)._M_refcount;
  local_20[0].super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  __s_00._4_4_ = (int)__s._M_failed;
  poVar1 = _M_insert_int<long_unsigned_int>
                     (__return_storage_ptr__,local_20,__s_00,in_stack_fffffff0,in_stack_fffffff4,
                      unaff_retaddr);
  return poVar1;
}



----------------------------------------

// Function: _M_extract_int<long_long_unsigned_int> @ 089b5df0

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x089b6384) */
/* DWARF original name: _M_extract_int<long long unsigned int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<long_long_unsigned_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulonglong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<long_long_unsigned_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulonglong *__v)

{
  char cVar1;
  bool bVar2;
  bool bVar3;
  size_t sVar4;
  void *pvVar5;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var6;
  char *pcVar7;
  uint uVar8;
  uint uVar9;
  int iVar10;
  basic_streambuf<char,std::char_traits<char>_> *pbVar11;
  uint *in_t0;
  undefined4 *in_t1;
  _Rep *this_01;
  char cVar12;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar13;
  _func_int_varargs **pp_Var14;
  uint uVar15;
  int *piVar16;
  uint uVar17;
  int iVar18;
  int iVar19;
  UDItype UVar20;
  allocator<char> aaStack_87 [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_84 [3];
  undefined4 local_78;
  undefined4 local_74;
  _func_int_varargs **local_70;
  char *local_6c;
  char *local_68;
  char *local_64;
  uint local_60;
  void *local_5c;
  int local_58;
  uint local_54;
  int local_50;
  int local_4c;
  int local_48;
  uint *local_44;
  undefined4 *local_40;
  undefined4 local_38;
  undefined4 local_34;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: ulonglong __max@[???]
                       Unresolved local var: ulonglong __smax@[???]
                       Unresolved local var: ulonglong __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar19 = __beg._M_c;
  pp_Var14 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_64 = (__beg._M_sbuf)->_M_in_beg;
  piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_44 = in_t0;
  local_40 = in_t1;
  sVar4 = locale::id::_M_id(&numpunct<char>::id);
  piVar16 = (int *)(sVar4 * 4 + *(int *)(*(int *)(iVar19 + 0x6c) + 0xc));
  iVar18 = *piVar16;
  local_38 = 0;
  local_34 = 0;
  if (iVar18 == 0) {
                    /* try { // try from 089b6760 to 089b67b3 has its CatchHandler @ 089b6a48 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,(locale *)(iVar19 + 0x6c));
    locale::_Impl::_M_install_cache
              (((locale *)(iVar19 + 0x6c))->_M_impl,&this_00->super_facet,sVar4);
    iVar18 = *piVar16;
  }
  local_48 = iVar18 + 0x4a;
  local_60 = *(uint *)(iVar19 + 0xc) & 0x4a;
  uVar9 = uVar15;
  if (local_60 == 0x40) {
    uVar17 = 8;
    if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b6504;
LAB_089b5eac:
    uVar8 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar13[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c) {
        uVar8 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar8 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
      }
      uVar9 = uVar8;
      if (uVar8 == 0xffffffff) {
        piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = uVar15;
      }
    }
  }
  else {
    uVar17 = 0x10;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_60 != 8) {
      uVar17 = 10;
    }
    if (piVar13 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b5eac;
LAB_089b6504:
    piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar8 = 0xffffffff;
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var14 == (_func_int_varargs **)0x0) {
LAB_089b64f0:
    bVar2 = true;
    local_70 = (_func_int_varargs **)0x0;
  }
  else {
    local_70 = pp_Var14;
    if (local_64 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var14[2] < pp_Var14[3]) {
        pcVar7 = (char *)(uint)(byte)*pp_Var14[2];
      }
      else {
        pcVar7 = (char *)(**(code **)(*pp_Var14 + 0x24))(pp_Var14);
      }
      if (pcVar7 == (char *)0xffffffff) goto LAB_089b64f0;
      bVar2 = pcVar7 == (char *)0xffffffff;
      local_64 = pcVar7;
    }
    else {
      bVar2 = local_64 == (char *)0xffffffff;
    }
  }
  if (uVar8 == 0xffffffff) {
    if (bVar2) goto LAB_089b5eec;
LAB_089b6100:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar19 = -1;
    if (piVar13 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar13[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c) {
          uVar9 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar9 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
        }
        if (uVar9 == 0xffffffff) {
          piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          iVar19 = -1;
          goto LAB_089b611c;
        }
        cVar12 = (char)uVar9;
      }
      else {
        cVar12 = (char)uVar9;
      }
      iVar19 = (int)cVar12;
    }
LAB_089b611c:
    iVar10 = (int)*(char *)(local_48 + 1);
    cVar12 = *(char *)(iVar18 + 0x10);
    if (iVar10 != iVar19) goto LAB_089b6130;
    if (cVar12 == '\0') {
      cVar1 = *(char *)(iVar18 + 0x24);
    }
    else {
      if (*(char *)(iVar18 + 0x25) == iVar10) goto LAB_089b6130;
      cVar1 = *(char *)(iVar18 + 0x24);
    }
    if (cVar1 == iVar10) goto LAB_089b6130;
    uVar15 = 0xffffffff;
    if (piVar13 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
      if (piVar13[1]._M_sbuf < pbVar11) {
        piVar13[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar13->_M_sbuf[1]._M_in_cur)(piVar13);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar13[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_70 == (_func_int_varargs **)0x0) {
LAB_089b6888:
      bVar2 = true;
    }
    else if (local_64 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (local_70[2] < local_70[3]) {
        local_64 = (char *)(uint)(byte)*local_70[2];
      }
      else {
        local_64 = (char *)(**(code **)(*local_70 + 0x24))(local_70);
      }
      if (local_64 == (char *)0xffffffff) {
        local_70 = (_func_int_varargs **)0x0;
        goto LAB_089b6888;
      }
      bVar2 = local_64 == (char *)0xffffffff;
    }
    else {
      bVar2 = local_64 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar2) {
LAB_089b6738:
        if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar12 = *(char *)(iVar18 + 0x10);
          iVar19 = -1;
        }
        else {
          if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar13[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
            }
            cVar12 = *(char *)(iVar18 + 0x10);
            if (uVar9 == 0xffffffff) {
              piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar19 = -1;
              goto LAB_089b6130;
            }
          }
          else {
            cVar12 = *(char *)(iVar18 + 0x10);
          }
          iVar19 = (int)(char)uVar9;
        }
LAB_089b6130:
        local_4c = 0;
        local_50 = 0;
        local_68 = local_64;
        do {
          if (cVar12 == '\0') {
            cVar1 = *(char *)(iVar18 + 0x24);
          }
          else {
            bVar2 = false;
            if (iVar19 == *(char *)(iVar18 + 0x25)) goto LAB_089b5f08;
            cVar1 = *(char *)(iVar18 + 0x24);
          }
          if (cVar1 == iVar19) {
LAB_089b684c:
            bVar2 = false;
            goto LAB_089b5f08;
          }
          if (*(char *)(local_48 + 4) == iVar19) {
            if ((local_4c != 0) && (uVar17 != 10)) goto LAB_089b6178;
            if (local_60 == 0) {
              uVar17 = 8;
              local_4c = 1;
              local_50 = 0;
            }
            else if (uVar17 == 8) {
              local_4c = 1;
              local_50 = 0;
            }
            else {
              local_4c = 1;
              local_50 = local_50 + 1;
            }
LAB_089b61a4:
            if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b64b8;
LAB_089b61ac:
                    /* Unresolved local var: int __ret@[???] */
            pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
            if (piVar13[1]._M_sbuf < pbVar11) {
              piVar13[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar13->_M_sbuf[1]._M_in_cur)(piVar13);
              pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar13[1]._M_sbuf < pbVar11) {
              uVar15 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar15 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
            }
            uVar9 = uVar15;
            if (uVar15 == 0xffffffff) {
              piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar9 = 0xffffffff;
            }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            bVar2 = true;
            if (local_70 != (_func_int_varargs **)0x0) goto LAB_089b61f4;
          }
          else {
            bVar2 = false;
            if (local_4c == 0) goto LAB_089b5f08;
LAB_089b6178:
            if ((*(char *)(local_48 + 2) != iVar19) && (*(char *)(local_48 + 3) != iVar19)) {
              local_4c = 1;
              goto LAB_089b684c;
            }
            if (local_60 == 0) {
              uVar17 = 0x10;
              local_4c = 0;
              local_50 = 0;
              goto LAB_089b61a4;
            }
            if (uVar17 != 0x10) {
              bVar2 = false;
              local_4c = 1;
              goto LAB_089b5f14;
            }
            local_4c = 0;
            local_50 = 0;
            if (piVar13 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b61ac;
LAB_089b64b8:
            uVar15 = 0xffffffff;
            if (local_70 == (_func_int_varargs **)0x0) {
              bVar2 = true;
            }
            else {
LAB_089b61f4:
              if (local_68 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (local_70[2] < local_70[3]) {
                  local_68 = (char *)(uint)(byte)*local_70[2];
                }
                else {
                  local_68 = (char *)(**(code **)(*local_70 + 0x24))(local_70);
                }
                if (local_68 == (char *)0xffffffff) {
                  bVar2 = true;
                  local_70 = (_func_int_varargs **)0x0;
                }
                else {
                  bVar2 = local_68 == (char *)0xffffffff;
                }
              }
              else {
                bVar2 = local_68 == (char *)0xffffffff;
              }
            }
          }
          if (uVar15 == 0xffffffff) {
            if (bVar2) {
LAB_089b621c:
              cVar12 = *(char *)(iVar18 + 0x10);
              bVar2 = true;
              if (uVar17 != 0x10) goto LAB_089b5f14;
              goto LAB_089b6230;
            }
          }
          else if (!bVar2) goto LAB_089b621c;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b6694:
            iVar19 = -1;
          }
          else if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar13[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
            }
            if (uVar9 == 0xffffffff) {
              piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b6694;
            }
            iVar19 = (int)(char)uVar9;
          }
          else {
            iVar19 = (int)(char)uVar9;
          }
          if (local_4c == 0) goto LAB_089b6920;
          cVar12 = *(char *)(iVar18 + 0x10);
        } while( true );
      }
    }
    else if (bVar2) goto LAB_089b6738;
  }
  else {
    if (bVar2) goto LAB_089b6100;
LAB_089b5eec:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar19 = 0;
  }
  cVar12 = *(char *)(iVar18 + 0x10);
  local_4c = 0;
  local_50 = 0;
  bVar2 = true;
  local_68 = local_64;
LAB_089b5f08:
  if (uVar17 == 0x10) {
LAB_089b6230:
    local_54 = 0x16;
    if (cVar12 != '\0') goto LAB_089b6248;
LAB_089b5f2c:
    local_84[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  else {
LAB_089b5f14:
    local_54 = uVar17;
    if (cVar12 == '\0') goto LAB_089b5f2c;
LAB_089b6248:
    local_84[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
                    /* try { // try from 089b624c to 089b654b has its CatchHandler @ 089b6a80 */
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_84,0x20);
  }
  UVar20 = __udivdi3(0xffffffffffffffff,(ulonglong)uVar17);
  local_5c = (void *)(local_48 + 4);
  if (!bVar2) {
    local_6c = local_68;
    local_58 = 0;
    local_78 = 0;
    local_74 = 0;
LAB_089b5f80:
    bVar2 = false;
    if (*(char *)(iVar18 + 0x10) == '\0') {
      cVar12 = *(char *)(iVar18 + 0x24);
LAB_089b5f9c:
      if (iVar19 == cVar12) goto LAB_089b6268;
      pvVar5 = memchr(local_5c,iVar19,local_54);
      if (pvVar5 == (void *)0x0) goto LAB_089b6268;
                    /* Unresolved local var: int __digit@[???] */
      if (CONCAT44(local_74,local_78) <= UVar20) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      local_58 = 1;
      if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b63a0;
LAB_089b6068:
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
      if (piVar13[1]._M_sbuf < pbVar11) {
        piVar13[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
                    /* try { // try from 089b68a8 to 089b68c3 has its CatchHandler @ 089b6a80 */
        (*(code *)piVar13->_M_sbuf[1]._M_in_cur)(piVar13);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar13[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar2 = true;
      if (local_70 != (_func_int_varargs **)0x0) goto LAB_089b60b0;
    }
    else {
      if (iVar19 != *(char *)(iVar18 + 0x25)) {
        cVar12 = *(char *)(iVar18 + 0x24);
        goto LAB_089b5f9c;
      }
      if (local_50 == 0) {
        local_58 = 1;
        goto LAB_089b6268;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar15 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_84[0]._M_dataplus._M_p + -8) < uVar15) ||
         (0 < (int)*(size_t *)((int)local_84[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_84,uVar15);
        sVar4 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar4 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_84[0]._M_dataplus._M_p + sVar4) = (char)local_50;
      local_50 = 0;
      *(size_t *)((int)local_84[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_84[0]._M_dataplus._M_p + -0xc) = uVar15;
      *(char *)((int)local_84[0]._M_dataplus._M_p + uVar15) = '\0';
      if (piVar13 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b6068;
LAB_089b63a0:
      uVar15 = 0xffffffff;
      if (local_70 == (_func_int_varargs **)0x0) {
        bVar2 = true;
      }
      else {
LAB_089b60b0:
        if (local_6c == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_70[2] < local_70[3]) {
            local_6c = (char *)(uint)(byte)*local_70[2];
          }
          else {
                    /* try { // try from 089b696c to 089b6973 has its CatchHandler @ 089b6a80 */
            local_6c = (char *)(**(code **)(*local_70 + 0x24))(local_70);
          }
          if (local_6c == (char *)0xffffffff) {
            bVar2 = true;
            local_70 = (_func_int_varargs **)0x0;
          }
          else {
            bVar2 = local_6c == (char *)0xffffffff;
          }
        }
        else {
          bVar2 = local_6c == (char *)0xffffffff;
        }
      }
    }
    if (uVar15 == 0xffffffff) {
      if (bVar2) goto LAB_089b6264;
    }
    else if (!bVar2) goto LAB_089b6264;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar13 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b6424:
      iVar19 = -1;
    }
    else {
      if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar13[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar13[1]._M_c) {
          uVar9 = (uint)*(byte *)&(piVar13[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
                    /* try { // try from 089b69b4 to 089b69bb has its CatchHandler @ 089b6a80 */
          uVar9 = (*(code *)piVar13->_M_sbuf[1]._M_in_beg)(piVar13);
        }
        if (uVar9 == 0xffffffff) {
          piVar13 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b6424;
        }
        cVar12 = (char)uVar9;
      }
      else {
        cVar12 = (char)uVar9;
      }
      iVar19 = (int)cVar12;
    }
    goto LAB_089b5f80;
  }
  local_58 = 0;
  local_78 = 0;
  local_74 = 0;
LAB_089b6268:
  if (*(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_84[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_84[0]._M_dataplus._M_p + -4))) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_84,uVar15);
      sVar4 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar4 = *(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_84[0]._M_dataplus._M_p + sVar4) = (char)local_50;
    *(size_t *)((int)local_84[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_84[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_84[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar3 = __verify_grouping(*(char **)(iVar18 + 8),*(size_t *)(iVar18 + 0xc),local_84);
    if (CONCAT31(extraout_var,bVar3) == 0) {
      *local_44 = *local_44 | 4;
    }
  }
  if ((local_58 == 0) &&
     (((local_50 != 0 || (local_4c != 0)) ||
      (*(size_t *)((int)local_84[0]._M_dataplus._M_p + -0xc) != 0)))) {
    *local_40 = local_78;
    local_40[1] = local_74;
  }
  else {
    *local_44 = *local_44 | 4;
  }
  if (bVar2) {
    *local_44 = *local_44 | 2;
  }
  this_01 = (_Rep *)((int)local_84[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b68f0 to 089b68f7 has its CatchHandler @ 089b6aa4 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var6 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_84[0]._M_dataplus._M_p + -4),-1), _Var6 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_87);
  }
  return piVar13;
LAB_089b6920:
  cVar12 = *(char *)(iVar18 + 0x10);
  bVar2 = false;
  goto LAB_089b5f08;
LAB_089b6264:
  bVar2 = true;
  goto LAB_089b6268;
}



----------------------------------------

// Function: do_get @ 089b6adc

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulonglong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulonglong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  ulonglong *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<long_long_unsigned_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: _M_extract_int<long_long_int> @ 089b6b24

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x089b7110) */
/* DWARF original name: _M_extract_int<long long int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<long_long_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   longlong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<long_long_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,longlong *__v)

{
  char cVar1;
  bool bVar2;
  bool bVar3;
  size_t sVar4;
  void *pvVar5;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var6;
  uint uVar7;
  uint uVar8;
  char *pcVar9;
  basic_streambuf<char,std::char_traits<char>_> *pbVar10;
  uint *in_t0;
  int *in_t1;
  _Rep *this_01;
  char cVar11;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar12;
  _func_int_varargs **pp_Var13;
  uint uVar14;
  int *piVar15;
  uint uVar16;
  int iVar17;
  int iVar18;
  UDItype UVar19;
  allocator<char> aaStack_8f [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_8c [3];
  int local_80;
  int local_7c;
  undefined4 local_78;
  undefined4 local_74;
  _func_int_varargs **local_70;
  char *local_6c;
  char *local_68;
  char *local_64;
  uint local_60;
  char *local_5c;
  int local_58;
  uint local_54;
  int local_50;
  int local_4c;
  uint local_48;
  char *local_44;
  uint *local_40;
  int *local_3c;
  undefined4 local_38;
  undefined4 local_34;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: ulonglong __max@[???]
                       Unresolved local var: ulonglong __smax@[???]
                       Unresolved local var: ulonglong __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar18 = __beg._M_c;
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_64 = (__beg._M_sbuf)->_M_in_beg;
  piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar14 = (this->super_facet)._M_refcount;
  local_40 = in_t0;
  local_3c = in_t1;
  sVar4 = locale::id::_M_id(&numpunct<char>::id);
  piVar15 = (int *)(sVar4 * 4 + *(int *)(*(int *)(iVar18 + 0x6c) + 0xc));
  iVar17 = *piVar15;
  local_38 = 0;
  local_34 = 0;
  if (iVar17 == 0) {
                    /* try { // try from 089b7520 to 089b7573 has its CatchHandler @ 089b7828 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,(locale *)(iVar18 + 0x6c));
    locale::_Impl::_M_install_cache
              (((locale *)(iVar18 + 0x6c))->_M_impl,&this_00->super_facet,sVar4);
    iVar17 = *piVar15;
  }
  local_44 = (char *)(iVar17 + 0x4a);
  local_60 = *(uint *)(iVar18 + 0xc) & 0x4a;
  uVar7 = uVar14;
  if (local_60 == 0x40) {
    uVar16 = 8;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b6be0;
LAB_089b7358:
    piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar8 = 0xffffffff;
  }
  else {
    uVar16 = 0x10;
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_60 != 8) {
      uVar16 = 10;
    }
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b7358;
LAB_089b6be0:
    uVar8 = uVar14;
    if (uVar14 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar7 = uVar8;
      if (uVar8 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar7 = uVar14;
      }
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var13 == (_func_int_varargs **)0x0) {
LAB_089b7318:
    bVar2 = true;
    local_70 = (_func_int_varargs **)0x0;
  }
  else {
    local_70 = pp_Var13;
    if (local_64 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var13[2] < pp_Var13[3]) {
        pcVar9 = (char *)(uint)(byte)*pp_Var13[2];
      }
      else {
        pcVar9 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
      }
      if (pcVar9 == (char *)0xffffffff) goto LAB_089b7318;
      bVar2 = pcVar9 == (char *)0xffffffff;
      local_64 = pcVar9;
    }
    else {
      bVar2 = local_64 == (char *)0xffffffff;
    }
  }
  if (uVar8 == 0xffffffff) {
    if (!bVar2) goto LAB_089b6e68;
LAB_089b6c20:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    local_48 = 0;
    iVar18 = 0;
  }
  else {
    if (!bVar2) goto LAB_089b6c20;
LAB_089b6e68:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b7474:
      iVar18 = -1;
    }
    else {
      if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar7 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar7 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar7 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b7474;
        }
        cVar11 = (char)uVar7;
      }
      else {
        cVar11 = (char)uVar7;
      }
      iVar18 = (int)cVar11;
    }
    local_48 = (uint)(*local_44 == iVar18);
    if (local_48 == 0) {
      cVar11 = *(char *)(iVar17 + 0x10);
      if (iVar18 != local_44[1]) goto LAB_089b6eac;
    }
    else {
      cVar11 = *(char *)(iVar17 + 0x10);
    }
    if (cVar11 == '\0') {
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    else {
      if (iVar18 == *(char *)(iVar17 + 0x25)) goto LAB_089b6eac;
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    if (iVar18 == cVar1) goto LAB_089b6eac;
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar14 = 0xffffffff;
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar10) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar10) {
        uVar14 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar14 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar7 = uVar14;
      if (uVar14 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar7 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_70 == (_func_int_varargs **)0x0) {
LAB_089b75f8:
      bVar2 = true;
    }
    else if (local_64 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (local_70[2] < local_70[3]) {
        local_64 = (char *)(uint)(byte)*local_70[2];
      }
      else {
        local_64 = (char *)(**(code **)(*local_70 + 0x24))();
      }
      if (local_64 == (char *)0xffffffff) {
        local_70 = (_func_int_varargs **)0x0;
        goto LAB_089b75f8;
      }
      bVar2 = local_64 == (char *)0xffffffff;
    }
    else {
      bVar2 = local_64 == (char *)0xffffffff;
    }
    if (uVar14 == 0xffffffff) {
      if (!bVar2) {
LAB_089b7284:
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar11 = *(char *)(iVar17 + 0x10);
          iVar18 = -1;
        }
        else {
          if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar7 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar7 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            cVar11 = *(char *)(iVar17 + 0x10);
            if (uVar7 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar18 = -1;
              goto LAB_089b6eac;
            }
          }
          else {
            cVar11 = *(char *)(iVar17 + 0x10);
          }
          iVar18 = (int)(char)uVar7;
        }
LAB_089b6eac:
        local_4c = 0;
        local_50 = 0;
        local_68 = local_64;
        do {
          if (cVar11 == '\0') {
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          else {
            bVar2 = false;
            if (iVar18 == *(char *)(iVar17 + 0x25)) goto LAB_089b6c40;
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          if (cVar1 == iVar18) {
LAB_089b7640:
            bVar2 = false;
            goto LAB_089b6c40;
          }
          if (local_44[4] == iVar18) {
            if ((local_4c != 0) && (uVar16 != 10)) goto LAB_089b6ef0;
            if (local_60 == 0) {
              uVar16 = 8;
              local_4c = 1;
              local_50 = 0;
            }
            else if (uVar16 == 8) {
              local_4c = 1;
              local_50 = 0;
            }
            else {
              local_4c = 1;
              local_50 = local_50 + 1;
            }
LAB_089b6f1c:
            if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b6f24;
LAB_089b733c:
            uVar14 = 0xffffffff;
            if (local_70 != (_func_int_varargs **)0x0) goto LAB_089b6f6c;
            bVar2 = true;
          }
          else {
            bVar2 = false;
            if (local_4c == 0) goto LAB_089b6c40;
LAB_089b6ef0:
            if ((local_44[2] != iVar18) && (local_44[3] != iVar18)) {
              local_4c = 1;
              goto LAB_089b7640;
            }
            if (local_60 == 0) {
              uVar16 = 0x10;
              local_4c = 0;
              local_50 = 0;
              goto LAB_089b6f1c;
            }
            if (uVar16 != 0x10) {
              bVar2 = false;
              local_4c = 1;
              goto LAB_089b6c4c;
            }
            local_4c = 0;
            local_50 = 0;
            if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b733c;
LAB_089b6f24:
                    /* Unresolved local var: int __ret@[???] */
            pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            if (piVar12[1]._M_sbuf < pbVar10) {
              piVar12[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
              pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf < pbVar10) {
              uVar14 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar14 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            uVar7 = uVar14;
            if (uVar14 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar7 = 0xffffffff;
            }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            bVar2 = true;
            if (local_70 != (_func_int_varargs **)0x0) {
LAB_089b6f6c:
              if (local_68 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (local_70[2] < local_70[3]) {
                  local_68 = (char *)(uint)(byte)*local_70[2];
                }
                else {
                  local_68 = (char *)(**(code **)(*local_70 + 0x24))(local_70);
                }
                if (local_68 == (char *)0xffffffff) {
                  bVar2 = true;
                  local_70 = (_func_int_varargs **)0x0;
                }
                else {
                  bVar2 = local_68 == (char *)0xffffffff;
                }
              }
              else {
                bVar2 = local_68 == (char *)0xffffffff;
              }
            }
          }
          if (uVar14 == 0xffffffff) {
            if (bVar2) {
              cVar11 = *(char *)(iVar17 + 0x10);
LAB_089b72ac:
              bVar2 = true;
              goto LAB_089b6c40;
            }
          }
          else if (!bVar2) {
            cVar11 = *(char *)(iVar17 + 0x10);
            goto LAB_089b72ac;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b74cc:
            iVar18 = -1;
          }
          else if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar7 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar7 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            if (uVar7 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b74cc;
            }
            iVar18 = (int)(char)uVar7;
          }
          else {
            iVar18 = (int)(char)uVar7;
          }
          if (local_4c == 0) goto LAB_089b76c8;
          cVar11 = *(char *)(iVar17 + 0x10);
        } while( true );
      }
    }
    else if (bVar2) goto LAB_089b7284;
  }
  cVar11 = *(char *)(iVar17 + 0x10);
  local_4c = 0;
  local_50 = 0;
  bVar2 = true;
  local_68 = local_64;
LAB_089b6c40:
  if (uVar16 == 0x10) {
    local_54 = 0x16;
    if (cVar11 == '\0') goto LAB_089b6c64;
LAB_089b71b0:
    local_8c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_8c,0x20);
  }
  else {
LAB_089b6c4c:
    local_54 = uVar16;
    if (cVar11 != '\0') goto LAB_089b71b0;
LAB_089b6c64:
    local_8c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  if (local_48 == 0) {
    local_78 = 0xffffffff;
    local_74 = 0x7fffffff;
  }
  else {
    local_78 = 0;
    local_74 = 0x80000000;
  }
  UVar19 = __udivdi3(CONCAT44(local_74,local_78),(ulonglong)uVar16);
  local_5c = local_44 + 4;
  if (!bVar2) {
    local_6c = local_68;
    local_58 = 0;
    local_80 = 0;
    local_7c = 0;
LAB_089b6cd8:
    bVar2 = false;
    if (*(char *)(iVar17 + 0x10) == '\0') {
      cVar11 = *(char *)(iVar17 + 0x24);
LAB_089b6cf4:
      if (iVar18 == cVar11) goto LAB_089b6fc8;
      pvVar5 = memchr(local_5c,iVar18,local_54);
      if (pvVar5 == (void *)0x0) goto LAB_089b6fc8;
                    /* Unresolved local var: int __digit@[???] */
      if (CONCAT44(local_7c,local_80) <= UVar19) {
                    /* WARNING: Bad instruction - Truncating control flow here */
        halt_baddata();
      }
      local_58 = 1;
      if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b6dd0;
LAB_089b712c:
      uVar14 = 0xffffffff;
      if (local_70 != (_func_int_varargs **)0x0) goto LAB_089b6e18;
      bVar2 = true;
    }
    else {
      if (iVar18 != *(char *)(iVar17 + 0x25)) {
        cVar11 = *(char *)(iVar17 + 0x24);
        goto LAB_089b6cf4;
      }
      if (local_50 == 0) {
        local_58 = 1;
        goto LAB_089b6fc8;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar14 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -8) < uVar14) ||
         (0 < (int)*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_8c,uVar14);
        sVar4 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar4 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_8c[0]._M_dataplus._M_p + sVar4) = (char)local_50;
      local_50 = 0;
      *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_8c[0]._M_dataplus._M_p + -0xc) = uVar14;
      *(char *)((int)local_8c[0]._M_dataplus._M_p + uVar14) = '\0';
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b712c;
LAB_089b6dd0:
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar10) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar10) {
        uVar14 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
                    /* try { // try from 089b7664 to 089b7683 has its CatchHandler @ 089b7804 */
        uVar14 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar7 = uVar14;
      if (uVar14 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar7 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar2 = true;
      if (local_70 != (_func_int_varargs **)0x0) {
LAB_089b6e18:
        if (local_6c == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_70[2] < local_70[3]) {
            local_6c = (char *)(uint)(byte)*local_70[2];
          }
          else {
                    /* try { // try from 089b7708 to 089b773b has its CatchHandler @ 089b7804 */
            local_6c = (char *)(**(code **)(*local_70 + 0x24))(local_70);
          }
          if (local_6c == (char *)0xffffffff) {
            bVar2 = true;
            local_70 = (_func_int_varargs **)0x0;
          }
          else {
            bVar2 = local_6c == (char *)0xffffffff;
          }
        }
        else {
          bVar2 = local_6c == (char *)0xffffffff;
        }
      }
    }
    if (uVar14 == 0xffffffff) {
      if (bVar2) goto LAB_089b6fc4;
    }
    else if (!bVar2) goto LAB_089b6fc4;
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b71e8:
      iVar18 = -1;
    }
    else {
      if (uVar7 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar7 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar7 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar7 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b71e8;
        }
        cVar11 = (char)uVar7;
      }
      else {
        cVar11 = (char)uVar7;
      }
      iVar18 = (int)cVar11;
    }
    goto LAB_089b6cd8;
  }
  local_58 = 0;
  local_80 = 0;
  local_7c = 0;
LAB_089b6fc8:
  if (*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar14 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -8) < uVar14) ||
       (0 < (int)*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b6ffc to 089b739f has its CatchHandler @ 089b7804 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_8c,uVar14);
      sVar4 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar4 = *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_8c[0]._M_dataplus._M_p + sVar4) = (char)local_50;
    *(size_t *)((int)local_8c[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_8c[0]._M_dataplus._M_p + -0xc) = uVar14;
    *(char *)((int)local_8c[0]._M_dataplus._M_p + uVar14) = '\0';
    bVar3 = __verify_grouping(*(char **)(iVar17 + 8),*(size_t *)(iVar17 + 0xc),local_8c);
    if (CONCAT31(extraout_var,bVar3) == 0) {
      *local_40 = *local_40 | 4;
    }
  }
  if ((local_58 == 0) &&
     (((local_50 != 0 || (local_4c != 0)) ||
      (*(size_t *)((int)local_8c[0]._M_dataplus._M_p + -0xc) != 0)))) {
    if (local_48 != 0) {
      local_80 = -local_80;
      local_7c = -(uint)(local_80 != 0) - local_7c;
    }
    *local_3c = local_80;
    local_3c[1] = local_7c;
  }
  else {
    *local_40 = *local_40 | 4;
  }
  if (bVar2) {
    *local_40 = *local_40 | 2;
  }
  this_01 = (_Rep *)((int)local_8c[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b76a4 to 089b76ab has its CatchHandler @ 089b7860 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var6 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_8c[0]._M_dataplus._M_p + -4),-1), _Var6 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_8f);
  }
  return piVar12;
LAB_089b76c8:
  cVar11 = *(char *)(iVar17 + 0x10);
  bVar2 = false;
  goto LAB_089b6c40;
LAB_089b6fc4:
  bVar2 = true;
  goto LAB_089b6fc8;
}



----------------------------------------

// Function: do_get @ 089b7898

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   longlong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,longlong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  longlong *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<long_long_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: _M_extract_int<long_unsigned_int> @ 089b78e0

/* DWARF original name: _M_extract_int<long unsigned int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<long_unsigned_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<long_unsigned_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulong *__v)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  bool bVar4;
  size_t sVar5;
  void *pvVar6;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var7;
  uint uVar8;
  uint uVar9;
  char cVar10;
  basic_streambuf<char,std::char_traits<char>_> *pbVar11;
  uint *in_t0;
  uint *in_t1;
  _Rep *this_01;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar12;
  _func_int_varargs **pp_Var13;
  int iVar14;
  uint uVar15;
  char *pcVar16;
  int iVar17;
  int *piVar18;
  char *pcVar19;
  allocator<char> aaStack_6f [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_6c [3];
  uint local_60;
  _func_int_varargs **local_5c;
  uint local_58;
  uint local_54;
  size_t local_50;
  int local_4c;
  int local_48;
  size_t local_44;
  locale *local_40;
  uint *local_3c;
  uint *local_38;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: ulong __max@[???]
                       Unresolved local var: ulong __smax@[???]
                       Unresolved local var: ulong __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar14 = __beg._M_c;
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  pcVar19 = (__beg._M_sbuf)->_M_in_beg;
  piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_3c = in_t0;
  local_38 = in_t1;
  sVar5 = locale::id::_M_id(&numpunct<char>::id);
  piVar18 = (int *)(sVar5 * 4 + *(int *)(*(int *)(iVar14 + 0x6c) + 0xc));
  iVar17 = *piVar18;
  local_2c = 0;
  local_40 = (locale *)(iVar14 + 0x6c);
  local_30 = 0;
  if (iVar17 == 0) {
                    /* try { // try from 089b8174 to 089b81c7 has its CatchHandler @ 089b8478 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,local_40);
    locale::_Impl::_M_install_cache(local_40->_M_impl,&this_00->super_facet,sVar5);
    iVar17 = *piVar18;
  }
  local_58 = *(uint *)(iVar14 + 0xc) & 0x4a;
  uVar8 = uVar15;
  if (local_58 == 0x40) {
    local_44 = 8;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b799c;
LAB_089b7f5c:
    piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar9 = 0xffffffff;
  }
  else {
    local_44 = 0x10;
    if (local_58 != 8) {
      local_44 = 10;
    }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b7f5c;
LAB_089b799c:
    uVar9 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar9;
      if (uVar9 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = uVar15;
      }
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var13 == (_func_int_varargs **)0x0) {
LAB_089b7f44:
    bVar3 = true;
    local_5c = (_func_int_varargs **)0x0;
    pcVar16 = pcVar19;
  }
  else {
    local_5c = pp_Var13;
    if (pcVar19 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var13[2] < pp_Var13[3]) {
        pcVar16 = (char *)(uint)(byte)*pp_Var13[2];
      }
      else {
        pcVar16 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
      }
      if (pcVar16 == (char *)0xffffffff) goto LAB_089b7f44;
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    else {
      bVar3 = pcVar19 == (char *)0xffffffff;
      pcVar16 = pcVar19;
    }
  }
  if (uVar9 == 0xffffffff) {
    if (!bVar3) goto LAB_089b7c40;
LAB_089b79d8:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar14 = 0;
    cVar10 = *(char *)(iVar17 + 0x10);
  }
  else {
    if (!bVar3) goto LAB_089b79d8;
LAB_089b7c40:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b8084:
      iVar14 = -1;
      if (*(char *)(iVar17 + 0x4b) != -1) goto LAB_089b7c64;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar8 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b8084;
        }
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      else {
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      iVar14 = (int)(char)uVar8;
      if (iVar14 != cVar10) {
LAB_089b7c64:
        cVar10 = *(char *)(iVar17 + 0x10);
        goto LAB_089b7c6c;
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    if (cVar10 == '\0') {
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    else {
      if (iVar14 == *(char *)(iVar17 + 0x25)) goto LAB_089b7c6c;
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    if (iVar14 == cVar1) goto LAB_089b7c6c;
    uVar15 = 0xffffffff;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b8234:
      bVar3 = true;
    }
    else {
      if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_5c[2] < local_5c[3]) {
          pcVar16 = (char *)(uint)(byte)*local_5c[2];
        }
        else {
          pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
        }
        if (pcVar16 == (char *)0xffffffff) {
          local_5c = (_func_int_varargs **)0x0;
          goto LAB_089b8234;
        }
      }
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar3) {
LAB_089b812c:
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar10 = *(char *)(iVar17 + 0x10);
          iVar14 = -1;
        }
        else {
          if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            cVar10 = *(char *)(iVar17 + 0x10);
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar14 = -1;
              goto LAB_089b7c6c;
            }
          }
          else {
            cVar10 = *(char *)(iVar17 + 0x10);
          }
          iVar14 = (int)(char)uVar8;
        }
LAB_089b7c6c:
        local_48 = 0;
        local_4c = 0;
        do {
          if (cVar10 == '\0') {
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          else {
            bVar3 = false;
            if (iVar14 == *(char *)(iVar17 + 0x25)) goto joined_r0x089b7d5c;
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          bVar3 = false;
          if (iVar14 == cVar1) goto joined_r0x089b7d5c;
          if (iVar14 == *(char *)(iVar17 + 0x4e)) {
            if ((local_48 != 0) && (local_44 != 10)) {
              cVar1 = *(char *)(iVar17 + 0x4c);
              goto LAB_089b7cb0;
            }
            if (local_58 == 0) {
              local_44 = 8;
              local_48 = 1;
              local_4c = 0;
            }
            else if (local_44 == 8) {
              local_48 = 1;
              local_4c = 0;
            }
            else {
              local_48 = 1;
              local_4c = local_4c + 1;
            }
LAB_089b7cdc:
            if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b7f18;
LAB_089b7ce4:
                    /* Unresolved local var: int __ret@[???] */
            pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            if (piVar12[1]._M_sbuf < pbVar11) {
              piVar12[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
              pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf < pbVar11) {
              uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            uVar8 = uVar15;
            if (uVar15 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar8 = 0xffffffff;
            }
          }
          else {
            if (local_48 == 0) goto joined_r0x089b7d5c;
            cVar1 = *(char *)(iVar17 + 0x4c);
LAB_089b7cb0:
            if ((iVar14 != cVar1) && (iVar14 != *(char *)(iVar17 + 0x4d))) {
              local_48 = 1;
              bVar3 = false;
              goto joined_r0x089b7d5c;
            }
            if (local_58 == 0) {
              local_44 = 0x10;
              local_48 = 0;
              local_4c = 0;
              goto LAB_089b7cdc;
            }
            if (local_44 != 0x10) {
              bVar3 = false;
              local_48 = 1;
              goto LAB_089b7a00;
            }
            local_48 = 0;
            local_4c = 0;
            if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b7ce4;
LAB_089b7f18:
            uVar15 = 0xffffffff;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b7ec0:
            bVar3 = true;
            if (uVar15 == 0xffffffff) goto LAB_089b7d48;
LAB_089b7ecc:
            if (!bVar3) goto LAB_089b7d50;
          }
          else {
            if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (local_5c[2] < local_5c[3]) {
                pcVar16 = (char *)(uint)(byte)*local_5c[2];
              }
              else {
                pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
              }
              if (pcVar16 == (char *)0xffffffff) {
                local_5c = (_func_int_varargs **)0x0;
                goto LAB_089b7ec0;
              }
            }
            bVar3 = pcVar16 == (char *)0xffffffff;
            if (uVar15 != 0xffffffff) goto LAB_089b7ecc;
LAB_089b7d48:
            if (bVar3) {
LAB_089b7d50:
              cVar10 = *(char *)(iVar17 + 0x10);
              bVar3 = true;
              goto joined_r0x089b7d5c;
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b816c:
            iVar14 = -1;
          }
          else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b816c;
            }
            iVar14 = (int)(char)uVar8;
          }
          else {
            iVar14 = (int)(char)uVar8;
          }
          if (local_48 == 0) goto LAB_089b831c;
          cVar10 = *(char *)(iVar17 + 0x10);
        } while( true );
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (bVar3) goto LAB_089b812c;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
  }
  local_48 = 0;
  local_4c = 0;
  bVar3 = true;
joined_r0x089b7d5c:
  if (local_44 == 0x10) {
    local_50 = 0x16;
    if (cVar10 == '\0') goto LAB_089b7a1c;
LAB_089b7d80:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,0x20);
  }
  else {
LAB_089b7a00:
    local_50 = local_44;
    if (cVar10 != '\0') goto LAB_089b7d80;
LAB_089b7a1c:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  local_34 = 0xffffffff / local_44;
  if (local_44 == 0) {
    trap(7);
  }
  if (!bVar3) {
    local_54 = 0;
    local_60 = 0;
LAB_089b7a54:
    bVar3 = false;
    if (*(char *)(iVar17 + 0x10) == '\0') {
      cVar10 = *(char *)(iVar17 + 0x24);
LAB_089b7a70:
      if (iVar14 == cVar10) goto LAB_089b7b24;
      pvVar6 = memchr((void *)(iVar17 + 0x4e),iVar14,local_50);
      uVar15 = (int)pvVar6 - (iVar17 + 0x4e);
      if (pvVar6 == (void *)0x0) goto LAB_089b7b24;
                    /* Unresolved local var: int __digit@[???] */
      if (0xf < (int)uVar15) {
        uVar15 = uVar15 - 6;
      }
      if (local_34 < local_60) {
        local_54 = 1;
        goto LAB_089b7ab4;
      }
      local_4c = local_4c + 1;
      local_54 = local_54 | ~uVar15 < local_44 * local_60;
      local_60 = local_44 * local_60 + uVar15;
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b7df8;
LAB_089b7abc:
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
                    /* try { // try from 089b82b8 to 089b82d3 has its CatchHandler @ 089b8458 */
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_5c != (_func_int_varargs **)0x0) {
LAB_089b7b00:
        if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_5c[2] < local_5c[3]) {
            pcVar16 = (char *)(uint)(byte)*local_5c[2];
          }
          else {
                    /* try { // try from 089b8368 to 089b838f has its CatchHandler @ 089b8458 */
            pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
          }
          if (pcVar16 == (char *)0xffffffff) {
            bVar3 = true;
            local_5c = (_func_int_varargs **)0x0;
            goto LAB_089b7b10;
          }
        }
        bVar3 = pcVar16 == (char *)0xffffffff;
      }
    }
    else {
      if (iVar14 != *(char *)(iVar17 + 0x25)) {
        cVar10 = *(char *)(iVar17 + 0x24);
        goto LAB_089b7a70;
      }
      if (local_4c == 0) {
        local_54 = 1;
        goto LAB_089b7b24;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
         (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_4c;
      local_4c = 0;
      *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
      *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
LAB_089b7ab4:
      if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b7abc;
LAB_089b7df8:
      uVar15 = 0xffffffff;
      if (local_5c != (_func_int_varargs **)0x0) goto LAB_089b7b00;
      bVar3 = true;
    }
LAB_089b7b10:
    if (uVar15 == 0xffffffff) {
      if (bVar3) goto LAB_089b7b20;
    }
    else if (!bVar3) goto LAB_089b7b20;
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b7e8c:
      iVar14 = -1;
    }
    else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        bVar2 = *(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        uVar8 = (uint)bVar2;
        if (uVar8 == 0xffffffff) goto LAB_089b7e88;
        iVar14 = (int)(char)bVar2;
      }
      else {
        uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        if (uVar8 == 0xffffffff) {
LAB_089b7e88:
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b7e8c;
        }
        iVar14 = (int)(char)uVar8;
      }
    }
    else {
      iVar14 = (int)(char)uVar8;
    }
    goto LAB_089b7a54;
  }
  local_54 = 0;
  local_60 = 0;
LAB_089b7b24:
  if (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b7b58 to 089b7fa3 has its CatchHandler @ 089b8458 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_4c;
    *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar4 = __verify_grouping(*(char **)(iVar17 + 8),*(size_t *)(iVar17 + 0xc),local_6c);
    if (CONCAT31(extraout_var,bVar4) == 0) {
      *local_3c = *local_3c | 4;
    }
  }
  if ((local_54 == 0) &&
     (((local_4c != 0 || (local_48 != 0)) ||
      (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0)))) {
    *local_38 = local_60;
  }
  else {
    *local_3c = *local_3c | 4;
  }
  if (bVar3) {
    *local_3c = *local_3c | 2;
  }
  this_01 = (_Rep *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b82ec to 089b82f3 has its CatchHandler @ 089b8450 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var7 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_6c[0]._M_dataplus._M_p + -4),-1), _Var7 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_6f);
  }
  return piVar12;
LAB_089b831c:
  cVar10 = *(char *)(iVar17 + 0x10);
  bVar3 = false;
  goto joined_r0x089b7d5c;
LAB_089b7b20:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  bVar3 = true;
  goto LAB_089b7b24;
}



----------------------------------------

// Function: do_get @ 089b84e0

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   void * * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,void **__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  ios_base *__io_00;
  uint uVar2;
  uint *in_t0;
  undefined4 *in_t1;
  basic_streambuf<char,std::char_traits<char>_> *pbVar3;
  _func_int_varargs **pp_Var4;
  uint uVar5;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  undefined4 local_48;
  _func_int_varargs **local_3c;
  _Ios_Iostate *in_stack_ffffffd4;
  ulong *in_stack_ffffffd8;
  
                    /* Unresolved local var: fmtflags __fmt@[???]
                       Unresolved local var: ulong __ul@[???] */
  __beg_00._M_c = __beg._M_c;
  uVar5 = *(uint *)(__beg_00._M_c + 0xc);
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  pp_Var4 = (this->super_facet)._vptr_facet;
  local_3c = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __io_00 = (ios_base *)(this->super_facet)._M_refcount;
  pbVar3 = (basic_streambuf<char,std::char_traits<char>_> *)(__beg._M_sbuf)->_M_in_beg;
  *(uint *)(__beg_00._M_c + 0xc) = uVar5 & 0xffffffb5 | 8;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_3c;
  __end_00._M_c = (int)pp_Var4;
  __end_00._M_sbuf = pbVar3;
  piVar1 = _M_extract_int<long_unsigned_int>
                     (__return_storage_ptr__,
                      (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)
                      &stack0xffffffcc,__beg_00,__end_00,__io_00,in_stack_ffffffd4,in_stack_ffffffd8
                     );
  uVar2 = *in_t0;
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(uint *)(__beg_00._M_c + 0xc) = uVar5;
  if ((uVar2 & 4) == 0) {
    *in_t1 = local_48;
  }
  return piVar1;
}



----------------------------------------

// Function: do_get @ 089b85a0

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ulong * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ulong *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  ulong *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<long_unsigned_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: _M_extract_int<unsigned_int> @ 089b85e8

/* DWARF original name: _M_extract_int<unsigned int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<unsigned_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   uint * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<unsigned_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,uint *__v)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  bool bVar4;
  size_t sVar5;
  void *pvVar6;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var7;
  uint uVar8;
  uint uVar9;
  char cVar10;
  basic_streambuf<char,std::char_traits<char>_> *pbVar11;
  uint *in_t0;
  uint *in_t1;
  _Rep *this_01;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar12;
  _func_int_varargs **pp_Var13;
  int iVar14;
  uint uVar15;
  char *pcVar16;
  int iVar17;
  int *piVar18;
  char *pcVar19;
  allocator<char> aaStack_6f [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_6c [3];
  uint local_60;
  _func_int_varargs **local_5c;
  uint local_58;
  uint local_54;
  size_t local_50;
  int local_4c;
  int local_48;
  size_t local_44;
  locale *local_40;
  uint *local_3c;
  uint *local_38;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: uint __max@[???]
                       Unresolved local var: uint __smax@[???]
                       Unresolved local var: uint __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar14 = __beg._M_c;
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  pcVar19 = (__beg._M_sbuf)->_M_in_beg;
  piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_3c = in_t0;
  local_38 = in_t1;
  sVar5 = locale::id::_M_id(&numpunct<char>::id);
  piVar18 = (int *)(sVar5 * 4 + *(int *)(*(int *)(iVar14 + 0x6c) + 0xc));
  iVar17 = *piVar18;
  local_2c = 0;
  local_40 = (locale *)(iVar14 + 0x6c);
  local_30 = 0;
  if (iVar17 == 0) {
                    /* try { // try from 089b8e7c to 089b8ecf has its CatchHandler @ 089b9180 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,local_40);
    locale::_Impl::_M_install_cache(local_40->_M_impl,&this_00->super_facet,sVar5);
    iVar17 = *piVar18;
  }
  local_58 = *(uint *)(iVar14 + 0xc) & 0x4a;
  uVar8 = uVar15;
  if (local_58 == 0x40) {
    local_44 = 8;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b86a4;
LAB_089b8c64:
    piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar9 = 0xffffffff;
  }
  else {
    local_44 = 0x10;
    if (local_58 != 8) {
      local_44 = 10;
    }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b8c64;
LAB_089b86a4:
    uVar9 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar9;
      if (uVar9 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = uVar15;
      }
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var13 == (_func_int_varargs **)0x0) {
LAB_089b8c4c:
    bVar3 = true;
    local_5c = (_func_int_varargs **)0x0;
    pcVar16 = pcVar19;
  }
  else {
    local_5c = pp_Var13;
    if (pcVar19 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var13[2] < pp_Var13[3]) {
        pcVar16 = (char *)(uint)(byte)*pp_Var13[2];
      }
      else {
        pcVar16 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
      }
      if (pcVar16 == (char *)0xffffffff) goto LAB_089b8c4c;
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    else {
      bVar3 = pcVar19 == (char *)0xffffffff;
      pcVar16 = pcVar19;
    }
  }
  if (uVar9 == 0xffffffff) {
    if (!bVar3) goto LAB_089b8948;
LAB_089b86e0:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar14 = 0;
    cVar10 = *(char *)(iVar17 + 0x10);
  }
  else {
    if (!bVar3) goto LAB_089b86e0;
LAB_089b8948:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b8d8c:
      iVar14 = -1;
      if (*(char *)(iVar17 + 0x4b) != -1) goto LAB_089b896c;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar8 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b8d8c;
        }
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      else {
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      iVar14 = (int)(char)uVar8;
      if (iVar14 != cVar10) {
LAB_089b896c:
        cVar10 = *(char *)(iVar17 + 0x10);
        goto LAB_089b8974;
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    if (cVar10 == '\0') {
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    else {
      if (iVar14 == *(char *)(iVar17 + 0x25)) goto LAB_089b8974;
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    if (iVar14 == cVar1) goto LAB_089b8974;
    uVar15 = 0xffffffff;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b8f3c:
      bVar3 = true;
    }
    else {
      if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_5c[2] < local_5c[3]) {
          pcVar16 = (char *)(uint)(byte)*local_5c[2];
        }
        else {
          pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
        }
        if (pcVar16 == (char *)0xffffffff) {
          local_5c = (_func_int_varargs **)0x0;
          goto LAB_089b8f3c;
        }
      }
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar3) {
LAB_089b8e34:
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar10 = *(char *)(iVar17 + 0x10);
          iVar14 = -1;
        }
        else {
          if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            cVar10 = *(char *)(iVar17 + 0x10);
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar14 = -1;
              goto LAB_089b8974;
            }
          }
          else {
            cVar10 = *(char *)(iVar17 + 0x10);
          }
          iVar14 = (int)(char)uVar8;
        }
LAB_089b8974:
        local_48 = 0;
        local_4c = 0;
        do {
          if (cVar10 == '\0') {
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          else {
            bVar3 = false;
            if (iVar14 == *(char *)(iVar17 + 0x25)) goto joined_r0x089b8a64;
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          bVar3 = false;
          if (cVar1 == iVar14) goto joined_r0x089b8a64;
          if (*(char *)(iVar17 + 0x4e) == iVar14) {
            if ((local_48 != 0) && (local_44 != 10)) {
              cVar1 = *(char *)(iVar17 + 0x4c);
              goto LAB_089b89b8;
            }
            if (local_58 == 0) {
              local_44 = 8;
              local_48 = 1;
              local_4c = 0;
            }
            else if (local_44 == 8) {
              local_48 = 1;
              local_4c = 0;
            }
            else {
              local_48 = 1;
              local_4c = local_4c + 1;
            }
LAB_089b89e4:
            if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b8c20;
LAB_089b89ec:
                    /* Unresolved local var: int __ret@[???] */
            pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            if (piVar12[1]._M_sbuf < pbVar11) {
              piVar12[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
              pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf < pbVar11) {
              uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            uVar8 = uVar15;
            if (uVar15 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar8 = 0xffffffff;
            }
          }
          else {
            if (local_48 == 0) goto joined_r0x089b8a64;
            cVar1 = *(char *)(iVar17 + 0x4c);
LAB_089b89b8:
            if ((cVar1 != iVar14) && (*(char *)(iVar17 + 0x4d) != iVar14)) {
              local_48 = 1;
              bVar3 = false;
              goto joined_r0x089b8a64;
            }
            if (local_58 == 0) {
              local_44 = 0x10;
              local_48 = 0;
              local_4c = 0;
              goto LAB_089b89e4;
            }
            if (local_44 != 0x10) {
              bVar3 = false;
              local_48 = 1;
              goto LAB_089b8708;
            }
            local_48 = 0;
            local_4c = 0;
            if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b89ec;
LAB_089b8c20:
            uVar15 = 0xffffffff;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b8bc8:
            bVar3 = true;
            if (uVar15 == 0xffffffff) goto LAB_089b8a50;
LAB_089b8bd4:
            if (!bVar3) goto LAB_089b8a58;
          }
          else {
            if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (local_5c[2] < local_5c[3]) {
                pcVar16 = (char *)(uint)(byte)*local_5c[2];
              }
              else {
                pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
              }
              if (pcVar16 == (char *)0xffffffff) {
                local_5c = (_func_int_varargs **)0x0;
                goto LAB_089b8bc8;
              }
            }
            bVar3 = pcVar16 == (char *)0xffffffff;
            if (uVar15 != 0xffffffff) goto LAB_089b8bd4;
LAB_089b8a50:
            if (bVar3) {
LAB_089b8a58:
              cVar10 = *(char *)(iVar17 + 0x10);
              bVar3 = true;
              goto joined_r0x089b8a64;
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b8e74:
            iVar14 = -1;
          }
          else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b8e74;
            }
            iVar14 = (int)(char)uVar8;
          }
          else {
            iVar14 = (int)(char)uVar8;
          }
          if (local_48 == 0) goto LAB_089b9024;
          cVar10 = *(char *)(iVar17 + 0x10);
        } while( true );
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (bVar3) goto LAB_089b8e34;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
  }
  local_48 = 0;
  local_4c = 0;
  bVar3 = true;
joined_r0x089b8a64:
  if (local_44 == 0x10) {
    local_50 = 0x16;
    if (cVar10 == '\0') goto LAB_089b8724;
LAB_089b8a88:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,0x20);
  }
  else {
LAB_089b8708:
    local_50 = local_44;
    if (cVar10 != '\0') goto LAB_089b8a88;
LAB_089b8724:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  local_34 = 0xffffffff / local_44;
  if (local_44 == 0) {
    trap(7);
  }
  if (!bVar3) {
    local_54 = 0;
    local_60 = 0;
LAB_089b875c:
    bVar3 = false;
    if (*(char *)(iVar17 + 0x10) == '\0') {
      cVar10 = *(char *)(iVar17 + 0x24);
LAB_089b8778:
      if (cVar10 == iVar14) goto LAB_089b882c;
      pvVar6 = memchr((void *)(iVar17 + 0x4e),iVar14,local_50);
      uVar15 = (int)pvVar6 - (iVar17 + 0x4e);
      if (pvVar6 == (void *)0x0) goto LAB_089b882c;
                    /* Unresolved local var: int __digit@[???] */
      if (0xf < (int)uVar15) {
        uVar15 = uVar15 - 6;
      }
      if (local_34 < local_60) {
        local_54 = 1;
        goto LAB_089b87bc;
      }
      local_4c = local_4c + 1;
      local_54 = local_54 | ~uVar15 < local_44 * local_60;
      local_60 = local_44 * local_60 + uVar15;
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b8b00;
LAB_089b87c4:
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
                    /* try { // try from 089b8fc0 to 089b8fdb has its CatchHandler @ 089b9160 */
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_5c != (_func_int_varargs **)0x0) {
LAB_089b8808:
        if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_5c[2] < local_5c[3]) {
            pcVar16 = (char *)(uint)(byte)*local_5c[2];
          }
          else {
                    /* try { // try from 089b9070 to 089b9097 has its CatchHandler @ 089b9160 */
            pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
          }
          if (pcVar16 == (char *)0xffffffff) {
            bVar3 = true;
            local_5c = (_func_int_varargs **)0x0;
            goto LAB_089b8818;
          }
        }
        bVar3 = pcVar16 == (char *)0xffffffff;
      }
    }
    else {
      if (iVar14 != *(char *)(iVar17 + 0x25)) {
        cVar10 = *(char *)(iVar17 + 0x24);
        goto LAB_089b8778;
      }
      if (local_4c == 0) {
        local_54 = 1;
        goto LAB_089b882c;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
         (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_4c;
      local_4c = 0;
      *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
      *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
LAB_089b87bc:
      if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b87c4;
LAB_089b8b00:
      uVar15 = 0xffffffff;
      if (local_5c != (_func_int_varargs **)0x0) goto LAB_089b8808;
      bVar3 = true;
    }
LAB_089b8818:
    if (uVar15 == 0xffffffff) {
      if (bVar3) goto LAB_089b8828;
    }
    else if (!bVar3) goto LAB_089b8828;
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b8b94:
      iVar14 = -1;
    }
    else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        bVar2 = *(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        uVar8 = (uint)bVar2;
        if (uVar8 == 0xffffffff) goto LAB_089b8b90;
        iVar14 = (int)(char)bVar2;
      }
      else {
        uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        if (uVar8 == 0xffffffff) {
LAB_089b8b90:
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b8b94;
        }
        iVar14 = (int)(char)uVar8;
      }
    }
    else {
      iVar14 = (int)(char)uVar8;
    }
    goto LAB_089b875c;
  }
  local_54 = 0;
  local_60 = 0;
LAB_089b882c:
  if (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b8860 to 089b8cab has its CatchHandler @ 089b9160 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_4c;
    *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar4 = __verify_grouping(*(char **)(iVar17 + 8),*(size_t *)(iVar17 + 0xc),local_6c);
    if (CONCAT31(extraout_var,bVar4) == 0) {
      *local_3c = *local_3c | 4;
    }
  }
  if ((local_54 == 0) &&
     (((local_4c != 0 || (local_48 != 0)) ||
      (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0)))) {
    *local_38 = local_60;
  }
  else {
    *local_3c = *local_3c | 4;
  }
  if (bVar3) {
    *local_3c = *local_3c | 2;
  }
  this_01 = (_Rep *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b8ff4 to 089b8ffb has its CatchHandler @ 089b9158 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var7 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_6c[0]._M_dataplus._M_p + -4),-1), _Var7 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_6f);
  }
  return piVar12;
LAB_089b9024:
  cVar10 = *(char *)(iVar17 + 0x10);
  bVar3 = false;
  goto joined_r0x089b8a64;
LAB_089b8828:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  bVar3 = true;
  goto LAB_089b882c;
}



----------------------------------------

// Function: do_get @ 089b91e8

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   uint * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,uint *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  uint *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<unsigned_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: _M_extract_int<short_unsigned_int> @ 089b9230

/* DWARF original name: _M_extract_int<short unsigned int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<short_unsigned_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>
   * this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ushort * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<short_unsigned_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ushort *__v)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  bool bVar4;
  size_t sVar5;
  void *pvVar6;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var7;
  uint uVar8;
  uint uVar9;
  char cVar10;
  basic_streambuf<char,std::char_traits<char>_> *pbVar11;
  uint *in_t0;
  undefined2 *in_t1;
  _Rep *this_01;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar12;
  _func_int_varargs **pp_Var13;
  int iVar14;
  uint uVar15;
  char *pcVar16;
  int iVar17;
  int *piVar18;
  char *pcVar19;
  allocator<char> aaStack_6f [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_6c [3];
  uint local_60;
  _func_int_varargs **local_5c;
  uint local_58;
  uint local_54;
  uint local_50;
  size_t local_4c;
  int local_48;
  int local_44;
  size_t local_40;
  locale *local_3c;
  uint *local_38;
  undefined2 *local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: ushort __max@[???]
                       Unresolved local var: ushort __smax@[???]
                       Unresolved local var: ushort __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar14 = __beg._M_c;
  pp_Var13 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  pcVar19 = (__beg._M_sbuf)->_M_in_beg;
  piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_38 = in_t0;
  local_34 = in_t1;
  sVar5 = locale::id::_M_id(&numpunct<char>::id);
  piVar18 = (int *)(sVar5 * 4 + *(int *)(*(int *)(iVar14 + 0x6c) + 0xc));
  iVar17 = *piVar18;
  local_2c = 0;
  local_3c = (locale *)(iVar14 + 0x6c);
  local_30 = 0;
  if (iVar17 == 0) {
                    /* try { // try from 089b9ad4 to 089b9b27 has its CatchHandler @ 089b9dd8 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,local_3c);
    locale::_Impl::_M_install_cache(local_3c->_M_impl,&this_00->super_facet,sVar5);
    iVar17 = *piVar18;
  }
  local_58 = *(uint *)(iVar14 + 0xc) & 0x4a;
  uVar8 = uVar15;
  if (local_58 == 0x40) {
    local_40 = 8;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b92ec;
LAB_089b98bc:
    piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar9 = 0xffffffff;
  }
  else {
    local_40 = 0x10;
    if (local_58 != 8) {
      local_40 = 10;
    }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b98bc;
LAB_089b92ec:
    uVar9 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        uVar9 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar9 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar9;
      if (uVar9 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = uVar15;
      }
    }
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var13 == (_func_int_varargs **)0x0) {
LAB_089b98a4:
    bVar3 = true;
    local_5c = (_func_int_varargs **)0x0;
    pcVar16 = pcVar19;
  }
  else {
    local_5c = pp_Var13;
    if (pcVar19 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var13[2] < pp_Var13[3]) {
        pcVar16 = (char *)(uint)(byte)*pp_Var13[2];
      }
      else {
        pcVar16 = (char *)(**(code **)(*pp_Var13 + 0x24))(pp_Var13);
      }
      if (pcVar16 == (char *)0xffffffff) goto LAB_089b98a4;
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    else {
      bVar3 = pcVar19 == (char *)0xffffffff;
      pcVar16 = pcVar19;
    }
  }
  if (uVar9 == 0xffffffff) {
    if (!bVar3) goto LAB_089b9594;
LAB_089b9328:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    iVar14 = 0;
    cVar10 = *(char *)(iVar17 + 0x10);
  }
  else {
    if (!bVar3) goto LAB_089b9328;
LAB_089b9594:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b99e4:
      iVar14 = -1;
      if (*(char *)(iVar17 + 0x4b) != -1) goto LAB_089b95b8;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
          uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        }
        if (uVar8 == 0xffffffff) {
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b99e4;
        }
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      else {
        cVar10 = *(char *)(iVar17 + 0x4b);
      }
      iVar14 = (int)(char)uVar8;
      if (iVar14 != cVar10) {
LAB_089b95b8:
        cVar10 = *(char *)(iVar17 + 0x10);
        goto LAB_089b95c0;
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    if (cVar10 == '\0') {
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    else {
      if (iVar14 == *(char *)(iVar17 + 0x25)) goto LAB_089b95c0;
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    if (iVar14 == cVar1) goto LAB_089b95c0;
    uVar15 = 0xffffffff;
    if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b9b94:
      bVar3 = true;
    }
    else {
      if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_5c[2] < local_5c[3]) {
          pcVar16 = (char *)(uint)(byte)*local_5c[2];
        }
        else {
          pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
        }
        if (pcVar16 == (char *)0xffffffff) {
          local_5c = (_func_int_varargs **)0x0;
          goto LAB_089b9b94;
        }
      }
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar3) {
LAB_089b9a8c:
        if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar10 = *(char *)(iVar17 + 0x10);
          iVar14 = -1;
        }
        else {
          if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            cVar10 = *(char *)(iVar17 + 0x10);
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar14 = -1;
              goto LAB_089b95c0;
            }
          }
          else {
            cVar10 = *(char *)(iVar17 + 0x10);
          }
          iVar14 = (int)(char)uVar8;
        }
LAB_089b95c0:
        local_48 = 0;
        local_44 = 0;
        do {
          if (cVar10 == '\0') {
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          else {
            bVar3 = false;
            if (iVar14 == *(char *)(iVar17 + 0x25)) goto joined_r0x089b96b0;
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          bVar3 = false;
          if (cVar1 == iVar14) goto joined_r0x089b96b0;
          if (*(char *)(iVar17 + 0x4e) == iVar14) {
            if ((local_44 != 0) && (local_40 != 10)) {
              cVar1 = *(char *)(iVar17 + 0x4c);
              goto LAB_089b9604;
            }
            if (local_58 == 0) {
              local_40 = 8;
              local_48 = 0;
              local_44 = 1;
            }
            else if (local_40 == 8) {
              local_48 = 0;
              local_44 = 1;
            }
            else {
              local_44 = 1;
              local_48 = local_48 + 1;
            }
LAB_089b9630:
            if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b9878;
LAB_089b9638:
                    /* Unresolved local var: int __ret@[???] */
            pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            if (piVar12[1]._M_sbuf < pbVar11) {
              piVar12[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
              pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf < pbVar11) {
              uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            uVar8 = uVar15;
            if (uVar15 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar8 = 0xffffffff;
            }
          }
          else {
            if (local_44 == 0) goto joined_r0x089b96b0;
            cVar1 = *(char *)(iVar17 + 0x4c);
LAB_089b9604:
            if ((cVar1 != iVar14) && (*(char *)(iVar17 + 0x4d) != iVar14)) {
              local_44 = 1;
              bVar3 = false;
              goto joined_r0x089b96b0;
            }
            if (local_58 == 0) {
              local_40 = 0x10;
              local_48 = 0;
              local_44 = 0;
              goto LAB_089b9630;
            }
            if (local_40 != 0x10) {
              bVar3 = false;
              local_44 = 1;
              goto LAB_089b9350;
            }
            local_48 = 0;
            local_44 = 0;
            if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089b9638;
LAB_089b9878:
            uVar15 = 0xffffffff;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (local_5c == (_func_int_varargs **)0x0) {
LAB_089b9820:
            bVar3 = true;
            if (uVar15 == 0xffffffff) goto LAB_089b969c;
LAB_089b982c:
            if (!bVar3) goto LAB_089b96a4;
          }
          else {
            if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
              if (local_5c[2] < local_5c[3]) {
                pcVar16 = (char *)(uint)(byte)*local_5c[2];
              }
              else {
                pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
              }
              if (pcVar16 == (char *)0xffffffff) {
                local_5c = (_func_int_varargs **)0x0;
                goto LAB_089b9820;
              }
            }
            bVar3 = pcVar16 == (char *)0xffffffff;
            if (uVar15 != 0xffffffff) goto LAB_089b982c;
LAB_089b969c:
            if (bVar3) {
LAB_089b96a4:
              cVar10 = *(char *)(iVar17 + 0x10);
              bVar3 = true;
              goto joined_r0x089b96b0;
            }
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b9acc:
            iVar14 = -1;
          }
          else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar12[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
              uVar8 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
            }
            if (uVar8 == 0xffffffff) {
              piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089b9acc;
            }
            iVar14 = (int)(char)uVar8;
          }
          else {
            iVar14 = (int)(char)uVar8;
          }
          if (local_44 == 0) goto LAB_089b9c7c;
          cVar10 = *(char *)(iVar17 + 0x10);
        } while( true );
      }
      cVar10 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (bVar3) goto LAB_089b9a8c;
      cVar10 = *(char *)(iVar17 + 0x10);
    }
  }
  local_48 = 0;
  local_44 = 0;
  bVar3 = true;
joined_r0x089b96b0:
  if (local_40 == 0x10) {
    local_4c = 0x16;
    if (cVar10 == '\0') goto LAB_089b936c;
LAB_089b96d4:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,0x20);
  }
  else {
LAB_089b9350:
    local_4c = local_40;
    if (cVar10 != '\0') goto LAB_089b96d4;
LAB_089b936c:
    local_6c[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  if (local_40 == 0) {
    trap(7);
  }
  local_54 = 0xffff / (int)local_40 & 0xffff;
  if (!bVar3) {
    local_50 = 0;
    local_60 = 0;
LAB_089b93a8:
    bVar3 = false;
    if (*(char *)(iVar17 + 0x10) == '\0') {
      cVar10 = *(char *)(iVar17 + 0x24);
LAB_089b93c4:
      if (iVar14 == cVar10) goto LAB_089b9478;
      pvVar6 = memchr((void *)(iVar17 + 0x4e),iVar14,local_4c);
      iVar14 = (int)pvVar6 - (iVar17 + 0x4e);
      if (pvVar6 == (void *)0x0) goto LAB_089b9478;
                    /* Unresolved local var: int __digit@[???] */
      if (0xf < iVar14) {
        iVar14 = iVar14 + -6;
      }
      if (local_54 < local_60) {
        local_50 = 1;
        goto LAB_089b9408;
      }
      local_48 = local_48 + 1;
      uVar15 = local_40 * local_60 & 0xffff;
      local_50 = local_50 | 0xffff - iVar14 < (int)uVar15;
      local_60 = uVar15 + iVar14 & 0xffff;
      if (piVar12 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b9410;
LAB_089b9758:
      uVar15 = 0xffffffff;
      if (local_5c == (_func_int_varargs **)0x0) {
        bVar3 = true;
      }
      else {
LAB_089b9454:
        if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_5c[2] < local_5c[3]) {
            pcVar16 = (char *)(uint)(byte)*local_5c[2];
          }
          else {
                    /* try { // try from 089b9cc8 to 089b9cef has its CatchHandler @ 089b9db8 */
            pcVar16 = (char *)(**(code **)(*local_5c + 0x24))(local_5c);
          }
          if (pcVar16 == (char *)0xffffffff) {
            bVar3 = true;
            local_5c = (_func_int_varargs **)0x0;
            goto LAB_089b9464;
          }
        }
        bVar3 = pcVar16 == (char *)0xffffffff;
      }
    }
    else {
      if (iVar14 != *(char *)(iVar17 + 0x25)) {
        cVar10 = *(char *)(iVar17 + 0x24);
        goto LAB_089b93c4;
      }
      if (local_48 == 0) {
        local_50 = 1;
        goto LAB_089b9478;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
         (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_48;
      local_48 = 0;
      *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
      *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
LAB_089b9408:
      if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b9758;
LAB_089b9410:
                    /* Unresolved local var: int __ret@[???] */
      pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      if (piVar12[1]._M_sbuf < pbVar11) {
        piVar12[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
                    /* try { // try from 089b9c18 to 089b9c33 has its CatchHandler @ 089b9db8 */
        (*(code *)piVar12->_M_sbuf[1]._M_in_cur)(piVar12);
        pbVar11 = (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < pbVar11) {
        uVar15 = (uint)*(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
      }
      uVar8 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar8 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_5c != (_func_int_varargs **)0x0) goto LAB_089b9454;
    }
LAB_089b9464:
    if (uVar15 == 0xffffffff) {
      if (bVar3) goto LAB_089b9474;
    }
    else if (!bVar3) goto LAB_089b9474;
    if (piVar12 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089b97ec:
      iVar14 = -1;
    }
    else if (uVar8 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar12[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar12[1]._M_c) {
        bVar2 = *(byte *)&(piVar12[1]._M_sbuf)->_vptr_basic_streambuf;
        uVar8 = (uint)bVar2;
        if (uVar8 == 0xffffffff) goto LAB_089b97e8;
        iVar14 = (int)(char)bVar2;
      }
      else {
        uVar8 = (*(code *)piVar12->_M_sbuf[1]._M_in_beg)(piVar12);
        if (uVar8 == 0xffffffff) {
LAB_089b97e8:
          piVar12 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089b97ec;
        }
        iVar14 = (int)(char)uVar8;
      }
    }
    else {
      iVar14 = (int)(char)uVar8;
    }
    goto LAB_089b93a8;
  }
  local_50 = 0;
  local_60 = 0;
LAB_089b9478:
  if (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089b94ac to 089b9903 has its CatchHandler @ 089b9db8 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_6c,uVar15);
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar5 = *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_6c[0]._M_dataplus._M_p + sVar5) = (char)local_48;
    *(size_t *)((int)local_6c[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_6c[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_6c[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar4 = __verify_grouping(*(char **)(iVar17 + 8),*(size_t *)(iVar17 + 0xc),local_6c);
    if (CONCAT31(extraout_var,bVar4) == 0) {
      *local_38 = *local_38 | 4;
    }
  }
  if ((local_50 == 0) &&
     (((local_48 != 0 || (local_44 != 0)) ||
      (*(size_t *)((int)local_6c[0]._M_dataplus._M_p + -0xc) != 0)))) {
    *local_34 = (short)local_60;
  }
  else {
    *local_38 = *local_38 | 4;
  }
  if (bVar3) {
    *local_38 = *local_38 | 2;
  }
  this_01 = (_Rep *)((int)local_6c[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089b9c4c to 089b9c53 has its CatchHandler @ 089b9db0 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var7 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_6c[0]._M_dataplus._M_p + -4),-1), _Var7 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_6f);
  }
  return piVar12;
LAB_089b9c7c:
  cVar10 = *(char *)(iVar17 + 0x10);
  bVar3 = false;
  goto joined_r0x089b96b0;
LAB_089b9474:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  bVar3 = true;
  goto LAB_089b9478;
}



----------------------------------------

// Function: do_get @ 089b9e40

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   ushort * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,ushort *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  ushort *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<short_unsigned_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: _M_extract_int<long_int> @ 089b9e88

/* DWARF original name: _M_extract_int<long int>
   DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   _M_extract_int<long_int>(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *
   this, istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   long * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::
_M_extract_int<long_int>
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,long *__v)

{
  char cVar1;
  byte bVar2;
  bool bVar3;
  bool bVar4;
  size_t sVar5;
  void *pvVar6;
  undefined3 extraout_var;
  __numpunct_cache<char> *this_00;
  _Atomic_word _Var7;
  uint uVar8;
  uint uVar9;
  basic_streambuf<char,std::char_traits<char>_> *pbVar10;
  uint *in_t0;
  uint *in_t1;
  _Rep *this_01;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar11;
  _func_int_varargs **pp_Var12;
  int iVar13;
  char cVar14;
  uint uVar15;
  char *pcVar16;
  int iVar17;
  int *piVar18;
  char *pcVar19;
  allocator<char> aaStack_77 [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_74 [3];
  uint local_68;
  _func_int_varargs **local_64;
  uint local_60;
  uint local_5c;
  uint local_58;
  size_t local_54;
  int local_50;
  int local_4c;
  uint local_48;
  size_t local_44;
  locale *local_40;
  uint *local_3c;
  uint *local_38;
  uint local_34;
  undefined4 local_30;
  undefined4 local_2c;
  
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: char * __lit@[???]
                       Unresolved local var: char __c@[???]
                       Unresolved local var: _Ios_Fmtflags __basefield@[???]
                       Unresolved local var: bool __oct@[???]
                       Unresolved local var: int __base@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __negative@[???]
                       Unresolved local var: bool __found_zero@[???]
                       Unresolved local var: int __sep_pos@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_>
                       __found_grouping@[???]
                       Unresolved local var: bool __testfail@[???]
                       Unresolved local var: ulong __max@[???]
                       Unresolved local var: ulong __smax@[???]
                       Unresolved local var: ulong __result@[???]
                       Unresolved local var: char * __q@[???]
                       Unresolved local var: char * __lit_zero@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  iVar13 = __beg._M_c;
  pp_Var12 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  pcVar19 = (__beg._M_sbuf)->_M_in_beg;
  piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  uVar15 = (this->super_facet)._M_refcount;
  local_3c = in_t0;
  local_38 = in_t1;
  sVar5 = locale::id::_M_id(&numpunct<char>::id);
  piVar18 = (int *)(sVar5 * 4 + *(int *)(*(int *)(iVar13 + 0x6c) + 0xc));
  iVar17 = *piVar18;
  local_2c = 0;
  local_40 = (locale *)(iVar13 + 0x6c);
  local_30 = 0;
  if (iVar17 == 0) {
                    /* try { // try from 089ba78c to 089ba7df has its CatchHandler @ 089baa6c */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,local_40);
    locale::_Impl::_M_install_cache(local_40->_M_impl,&this_00->super_facet,sVar5);
    iVar17 = *piVar18;
  }
  local_60 = *(uint *)(iVar13 + 0xc) & 0x4a;
  uVar9 = uVar15;
  if (local_60 == 0x40) {
    local_44 = 8;
    if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089ba5c4;
LAB_089b9f44:
    uVar8 = uVar15;
    if (uVar15 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
        uVar8 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar8 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
      }
      uVar9 = uVar8;
      if (uVar8 == 0xffffffff) {
        piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = uVar15;
      }
    }
  }
  else {
    local_44 = 0x10;
    if (local_60 != 8) {
      local_44 = 10;
    }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar11 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089b9f44;
LAB_089ba5c4:
    piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    uVar8 = 0xffffffff;
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (pp_Var12 == (_func_int_varargs **)0x0) {
LAB_089ba57c:
    bVar3 = true;
    local_64 = (_func_int_varargs **)0x0;
    pcVar16 = pcVar19;
  }
  else {
    local_64 = pp_Var12;
    if (pcVar19 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (pp_Var12[2] < pp_Var12[3]) {
        pcVar16 = (char *)(uint)(byte)*pp_Var12[2];
      }
      else {
        pcVar16 = (char *)(**(code **)(*pp_Var12 + 0x24))(pp_Var12);
      }
      if (pcVar16 == (char *)0xffffffff) goto LAB_089ba57c;
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    else {
      bVar3 = pcVar19 == (char *)0xffffffff;
      pcVar16 = pcVar19;
    }
  }
  if (uVar8 == 0xffffffff) {
    if (bVar3) goto LAB_089b9f80;
LAB_089ba214:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ba718:
      iVar13 = -1;
    }
    else {
      if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
          uVar9 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          uVar9 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
        }
        if (uVar9 == 0xffffffff) {
          piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089ba718;
        }
        cVar14 = (char)uVar9;
      }
      else {
        cVar14 = (char)uVar9;
      }
      iVar13 = (int)cVar14;
    }
    local_48 = (uint)(*(char *)(iVar17 + 0x4a) == iVar13);
    if (local_48 == 0) {
      cVar14 = *(char *)(iVar17 + 0x10);
      if (iVar13 != *(char *)(iVar17 + 0x4b)) goto LAB_089ba254;
    }
    else {
      cVar14 = *(char *)(iVar17 + 0x10);
    }
    if (cVar14 == '\0') {
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    else {
      if (iVar13 == *(char *)(iVar17 + 0x25)) goto LAB_089ba254;
      cVar1 = *(char *)(iVar17 + 0x24);
    }
    if (iVar13 == cVar1) goto LAB_089ba254;
    if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
      uVar15 = 0xffffffff;
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
      if (piVar11[1]._M_sbuf < pbVar10) {
        piVar11[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar11->_M_sbuf[1]._M_in_cur)(piVar11);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < pbVar10) {
        uVar15 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        uVar15 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
    }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (local_64 == (_func_int_varargs **)0x0) {
LAB_089ba854:
      bVar3 = true;
    }
    else {
      if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
        if (local_64[2] < local_64[3]) {
          pcVar16 = (char *)(uint)(byte)*local_64[2];
        }
        else {
          pcVar16 = (char *)(**(code **)(*local_64 + 0x24))(local_64);
        }
        if (pcVar16 == (char *)0xffffffff) {
          local_64 = (_func_int_varargs **)0x0;
          goto LAB_089ba854;
        }
      }
      bVar3 = pcVar16 == (char *)0xffffffff;
    }
    if (uVar15 == 0xffffffff) {
      if (!bVar3) {
LAB_089ba524:
        if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
          cVar14 = *(char *)(iVar17 + 0x10);
          iVar13 = -1;
        }
        else {
          if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar11[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
            }
            cVar14 = *(char *)(iVar17 + 0x10);
            if (uVar9 == 0xffffffff) {
              piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              iVar13 = -1;
              goto LAB_089ba254;
            }
          }
          else {
            cVar14 = *(char *)(iVar17 + 0x10);
          }
          iVar13 = (int)(char)uVar9;
        }
LAB_089ba254:
        local_4c = 0;
        local_50 = 0;
        do {
          if (cVar14 == '\0') {
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          else {
            bVar3 = false;
            if (iVar13 == *(char *)(iVar17 + 0x25)) goto LAB_089b9fa0;
            cVar1 = *(char *)(iVar17 + 0x24);
          }
          bVar3 = false;
          if (cVar1 == iVar13) goto LAB_089b9fa0;
          if (*(char *)(iVar17 + 0x4e) == iVar13) {
            if ((local_4c != 0) && (local_44 != 10)) {
              cVar1 = *(char *)(iVar17 + 0x4c);
              goto LAB_089ba294;
            }
            if (local_60 == 0) {
              local_44 = 8;
              local_4c = 1;
              local_50 = 0;
            }
            else if (local_44 == 8) {
              local_4c = 1;
              local_50 = 0;
            }
            else {
              local_4c = 1;
              local_50 = local_50 + 1;
            }
LAB_089ba2c0:
            if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089ba5a4;
LAB_089ba2c8:
                    /* Unresolved local var: int __ret@[???] */
            pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
            if (piVar11[1]._M_sbuf < pbVar10) {
              piVar11[1]._M_sbuf =
                   (basic_streambuf<char,std::char_traits<char>_> *)
                   ((int)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf + 1);
            }
            else {
              (*(code *)piVar11->_M_sbuf[1]._M_in_cur)(piVar11);
              pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
            }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            if (piVar11[1]._M_sbuf < pbVar10) {
              uVar15 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar15 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
            }
            uVar9 = uVar15;
            if (uVar15 == 0xffffffff) {
              piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              uVar9 = 0xffffffff;
            }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
            bVar3 = true;
            if (local_64 != (_func_int_varargs **)0x0) goto LAB_089ba310;
          }
          else {
            if (local_4c == 0) goto LAB_089b9fa0;
            cVar1 = *(char *)(iVar17 + 0x4c);
LAB_089ba294:
            if ((cVar1 != iVar13) && (*(char *)(iVar17 + 0x4d) != iVar13)) {
              local_4c = 1;
              bVar3 = false;
              goto LAB_089b9fa0;
            }
            if (local_60 == 0) {
              local_44 = 0x10;
              local_4c = 0;
              local_50 = 0;
              goto LAB_089ba2c0;
            }
            if (local_44 != 0x10) {
              bVar3 = false;
              local_4c = 1;
              goto LAB_089b9fac;
            }
            local_4c = 0;
            local_50 = 0;
            if (piVar11 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0)
            goto LAB_089ba2c8;
LAB_089ba5a4:
            uVar15 = 0xffffffff;
            if (local_64 == (_func_int_varargs **)0x0) {
              bVar3 = true;
            }
            else {
LAB_089ba310:
              if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
                if (local_64[2] < local_64[3]) {
                  pcVar16 = (char *)(uint)(byte)*local_64[2];
                }
                else {
                  pcVar16 = (char *)(**(code **)(*local_64 + 0x24))(local_64);
                }
                if (pcVar16 == (char *)0xffffffff) {
                  bVar3 = true;
                  local_64 = (_func_int_varargs **)0x0;
                  goto LAB_089ba324;
                }
              }
              bVar3 = pcVar16 == (char *)0xffffffff;
            }
          }
LAB_089ba324:
          if (uVar15 == 0xffffffff) {
            if (bVar3) {
              cVar14 = *(char *)(iVar17 + 0x10);
LAB_089ba54c:
              bVar3 = true;
              goto LAB_089b9fa0;
            }
          }
          else if (!bVar3) {
            cVar14 = *(char *)(iVar17 + 0x10);
            goto LAB_089ba54c;
          }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
          if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ba774:
            iVar13 = -1;
          }
          else if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
            if (piVar11[1]._M_sbuf <
                (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
              uVar9 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
            }
            else {
              uVar9 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
            }
            if (uVar9 == 0xffffffff) {
              piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
              goto LAB_089ba774;
            }
            iVar13 = (int)(char)uVar9;
          }
          else {
            iVar13 = (int)(char)uVar9;
          }
          if (local_4c == 0) goto LAB_089ba914;
          cVar14 = *(char *)(iVar17 + 0x10);
        } while( true );
      }
      cVar14 = *(char *)(iVar17 + 0x10);
    }
    else {
      if (bVar3) goto LAB_089ba524;
      cVar14 = *(char *)(iVar17 + 0x10);
    }
  }
  else {
    if (bVar3) goto LAB_089ba214;
LAB_089b9f80:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    local_48 = 0;
    iVar13 = 0;
    cVar14 = *(char *)(iVar17 + 0x10);
  }
  local_4c = 0;
  local_50 = 0;
  bVar3 = true;
LAB_089b9fa0:
  if (local_44 == 0x10) {
    local_54 = 0x16;
    if (cVar14 != '\0') goto LAB_089ba454;
LAB_089b9fc8:
    local_74[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
  }
  else {
LAB_089b9fac:
    local_54 = local_44;
    if (cVar14 == '\0') goto LAB_089b9fc8;
LAB_089ba454:
    local_74[0]._M_dataplus._M_p =
         (_Alloc_hider)
         (basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
          _S_empty_rep_storage + 3);
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_74,0x20);
  }
  if (local_48 == 0) {
    local_5c = 0x7fffffff;
  }
  else {
    local_5c = 0x80000000;
  }
  local_34 = local_5c / local_44;
  if (local_44 == 0) {
    trap(7);
  }
  if (!bVar3) {
    local_58 = 0;
    local_68 = 0;
LAB_089ba018:
    bVar3 = false;
    if (*(char *)(iVar17 + 0x10) == '\0') {
      cVar14 = *(char *)(iVar17 + 0x24);
LAB_089ba034:
      if (iVar13 == cVar14) goto LAB_089ba0e8;
      pvVar6 = memchr((void *)(iVar17 + 0x4e),iVar13,local_54);
      iVar13 = (int)pvVar6 - (iVar17 + 0x4e);
      if (pvVar6 == (void *)0x0) goto LAB_089ba0e8;
                    /* Unresolved local var: int __digit@[???] */
      if (0xf < iVar13) {
        iVar13 = iVar13 + -6;
      }
      if (local_34 < local_68) {
        local_58 = 1;
        goto LAB_089ba078;
      }
      local_50 = local_50 + 1;
      local_58 = local_58 | local_5c - iVar13 < local_44 * local_68;
      local_68 = local_44 * local_68 + iVar13;
      if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089ba3c8;
LAB_089ba080:
                    /* Unresolved local var: int __ret@[???] */
      pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
      if (piVar11[1]._M_sbuf < pbVar10) {
        piVar11[1]._M_sbuf =
             (basic_streambuf<char,std::char_traits<char>_> *)
             ((int)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf + 1);
      }
      else {
        (*(code *)piVar11->_M_sbuf[1]._M_in_cur)(piVar11);
        pbVar10 = (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c;
      }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < pbVar10) {
        uVar15 = (uint)*(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
                    /* try { // try from 089ba8b8 to 089ba8d7 has its CatchHandler @ 089baa94 */
        uVar15 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
      }
      uVar9 = uVar15;
      if (uVar15 == 0xffffffff) {
        piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        uVar9 = 0xffffffff;
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_64 != (_func_int_varargs **)0x0) {
LAB_089ba0c4:
        if (pcVar16 == (char *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_64[2] < local_64[3]) {
            pcVar16 = (char *)(uint)(byte)*local_64[2];
          }
          else {
                    /* try { // try from 089ba958 to 089ba95f has its CatchHandler @ 089baa94 */
            pcVar16 = (char *)(**(code **)(*local_64 + 0x24))(local_64);
          }
          if (pcVar16 == (char *)0xffffffff) {
            bVar3 = true;
            local_64 = (_func_int_varargs **)0x0;
            goto LAB_089ba0d4;
          }
        }
        bVar3 = pcVar16 == (char *)0xffffffff;
      }
    }
    else {
      if (iVar13 != *(char *)(iVar17 + 0x25)) {
        cVar14 = *(char *)(iVar17 + 0x24);
        goto LAB_089ba034;
      }
      if (local_50 == 0) {
        local_58 = 1;
        goto LAB_089ba0e8;
      }
                    /* Unresolved local var: size_t __len@[???] */
      uVar15 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc) + 1;
      if ((*(size_t *)((int)local_74[0]._M_dataplus._M_p + -8) < uVar15) ||
         (0 < (int)*(size_t *)((int)local_74[0]._M_dataplus._M_p + -4))) {
        basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_74,uVar15);
        sVar5 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc);
      }
      else {
        sVar5 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc);
      }
      *(char *)((int)local_74[0]._M_dataplus._M_p + sVar5) = (char)local_50;
      local_50 = 0;
      *(size_t *)((int)local_74[0]._M_dataplus._M_p + -4) = 0;
      *(uint *)((int)local_74[0]._M_dataplus._M_p + -0xc) = uVar15;
      *(char *)((int)local_74[0]._M_dataplus._M_p + uVar15) = '\0';
LAB_089ba078:
      if (piVar11 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089ba080;
LAB_089ba3c8:
      uVar15 = 0xffffffff;
      if (local_64 != (_func_int_varargs **)0x0) goto LAB_089ba0c4;
      bVar3 = true;
    }
LAB_089ba0d4:
    if (uVar15 == 0xffffffff) {
      if (bVar3) goto LAB_089ba0e4;
    }
    else if (!bVar3) goto LAB_089ba0e4;
    if (piVar11 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
LAB_089ba48c:
      iVar13 = -1;
    }
    else if (uVar9 == 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar11[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar11[1]._M_c) {
        bVar2 = *(byte *)&(piVar11[1]._M_sbuf)->_vptr_basic_streambuf;
        uVar9 = (uint)bVar2;
        if (uVar9 == 0xffffffff) goto LAB_089ba488;
        iVar13 = (int)(char)bVar2;
      }
      else {
                    /* try { // try from 089ba9ac to 089ba9b3 has its CatchHandler @ 089baa94 */
        uVar9 = (*(code *)piVar11->_M_sbuf[1]._M_in_beg)(piVar11);
        if (uVar9 == 0xffffffff) {
LAB_089ba488:
          piVar11 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          goto LAB_089ba48c;
        }
        iVar13 = (int)(char)uVar9;
      }
    }
    else {
      iVar13 = (int)(char)uVar9;
    }
    goto LAB_089ba018;
  }
  local_58 = 0;
  local_68 = 0;
LAB_089ba0e8:
  if (*(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc) != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    uVar15 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc) + 1;
    if ((*(size_t *)((int)local_74[0]._M_dataplus._M_p + -8) < uVar15) ||
       (0 < (int)*(size_t *)((int)local_74[0]._M_dataplus._M_p + -4))) {
                    /* try { // try from 089ba11c to 089ba60b has its CatchHandler @ 089baa94 */
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve(local_74,uVar15);
      sVar5 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc);
    }
    else {
      sVar5 = *(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc);
    }
    *(char *)((int)local_74[0]._M_dataplus._M_p + sVar5) = (char)local_50;
    *(size_t *)((int)local_74[0]._M_dataplus._M_p + -4) = 0;
    *(uint *)((int)local_74[0]._M_dataplus._M_p + -0xc) = uVar15;
    *(char *)((int)local_74[0]._M_dataplus._M_p + uVar15) = '\0';
    bVar4 = __verify_grouping(*(char **)(iVar17 + 8),*(size_t *)(iVar17 + 0xc),local_74);
    if (CONCAT31(extraout_var,bVar4) == 0) {
      *local_3c = *local_3c | 4;
    }
  }
  if ((local_58 == 0) &&
     (((local_50 != 0 || (local_4c != 0)) ||
      (*(size_t *)((int)local_74[0]._M_dataplus._M_p + -0xc) != 0)))) {
    if (local_48 == 0) {
      *local_38 = local_68;
    }
    else {
      *local_38 = -local_68;
    }
  }
  else {
    *local_3c = *local_3c | 4;
  }
  if (bVar3) {
    *local_3c = *local_3c | 2;
  }
  this_01 = (_Rep *)((int)local_74[0]._M_dataplus._M_p + -0xc);
                    /* try { // try from 089ba8f0 to 089ba8f7 has its CatchHandler @ 089baa64 */
  if ((this_01 !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var7 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_74[0]._M_dataplus._M_p + -4),-1), _Var7 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              (this_01,aaStack_77);
  }
  return piVar11;
LAB_089ba914:
  cVar14 = *(char *)(iVar17 + 0x10);
  bVar3 = false;
  goto LAB_089b9fa0;
LAB_089ba0e4:
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  bVar3 = true;
  goto LAB_089ba0e8;
}



----------------------------------------

// Function: do_get @ 089baaf4

/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   long * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,long *__v)

{
  istreambuf_iterator<char,std::char_traits<char>_> *piVar1;
  long *unaff_retaddr;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_28;
  char *local_24;
  num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> local_20;
  istreambuf_iterator<char,std::char_traits<char>_> in_stack_ffffffe8;
  ios_base *in_stack_fffffff0;
  locale in_stack_fffffff4;
  
  __beg_00._M_c = __beg._M_c;
  local_28 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  local_20.super_facet._M_refcount = (this->super_facet)._M_refcount;
  local_20.super_facet._vptr_facet = (this->super_facet)._vptr_facet;
  local_24 = (__beg._M_sbuf)->_M_in_beg;
  __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_28;
  piVar1 = _M_extract_int<long_int>
                     (__return_storage_ptr__,&local_20,__beg_00,in_stack_ffffffe8,in_stack_fffffff0,
                      (_Ios_Iostate *)in_stack_fffffff4._M_impl,unaff_retaddr);
  return piVar1;
}



----------------------------------------

// Function: do_get @ 089bab3c

/* WARNING: Removing unreachable block (ram,0x089baf24) */
/* DWARF original prototype: istreambuf_iterator<char,std::char_traits<char>_>
   do_get(num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> * this,
   istreambuf_iterator<char,std::char_traits<char>_> __beg,
   istreambuf_iterator<char,std::char_traits<char>_> __end, ios_base * __io, _Ios_Iostate * __err,
   bool * __v) */

istreambuf_iterator<char,std::char_traits<char>_> * __thiscall
std::num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_>::do_get
          (istreambuf_iterator<char,std::char_traits<char>_> *__return_storage_ptr__,
          num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *this,
          istreambuf_iterator<char,std::char_traits<char>_> __beg,
          istreambuf_iterator<char,std::char_traits<char>_> __end,ios_base *__io,_Ios_Iostate *__err
          ,bool *__v)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  istreambuf_iterator<char,std::char_traits<char>_> __end_00;
  size_t __index;
  __numpunct_cache<char> *this_00;
  uint uVar4;
  basic_streambuf<char,std::char_traits<char>_> *pbVar5;
  uint *in_t0;
  undefined1 *in_t1;
  char cVar6;
  istreambuf_iterator<char,std::char_traits<char>_> *piVar7;
  ios_base *__io_00;
  ios_base *piVar8;
  basic_streambuf<char,std::char_traits<char>_> *pbVar9;
  uint uVar10;
  int iVar11;
  int *piVar12;
  istreambuf_iterator<char,std::char_traits<char>_> __beg_00;
  _func_int_varargs **local_6c;
  _Ios_Iostate *in_stack_ffffffa4;
  long *in_stack_ffffffa8;
  _func_int_varargs **local_48;
  
  __beg_00._M_c = __beg._M_c;
  piVar7 = (istreambuf_iterator<char,std::char_traits<char>_> *)(this->super_facet)._vptr_facet;
  local_48 = (__beg._M_sbuf)->_vptr_basic_streambuf;
  __io_00 = (ios_base *)(this->super_facet)._M_refcount;
  pbVar9 = (basic_streambuf<char,std::char_traits<char>_> *)(__beg._M_sbuf)->_M_in_beg;
  if ((*(uint *)(__beg_00._M_c + 0xc) & 1) == 0) {
                    /* Unresolved local var: long __l@[???] */
    __beg_00._M_sbuf = (basic_streambuf<char,std::char_traits<char>_> *)&local_6c;
    __end_00._M_c = (int)piVar7;
    __end_00._M_sbuf = pbVar9;
    local_6c = local_48;
    piVar7 = _M_extract_int<long_int>
                       (__return_storage_ptr__,
                        (num_get<char,std::istreambuf_iterator<char,_std::char_traits<char>_>_> *)
                        &stack0xffffff9c,__beg_00,__end_00,__io_00,in_stack_ffffffa4,
                        in_stack_ffffffa8);
    *in_t0 = *in_t0 | 4;
    return piVar7;
  }
                    /* Unresolved local var: __use_cache<std::__numpunct_cache<char>_> __uc@[???]
                       Unresolved local var: locale * __loc@[???]
                       Unresolved local var: __numpunct_cache<char> * __lc@[???]
                       Unresolved local var: bool __testf@[???]
                       Unresolved local var: bool __testt@[???]
                       Unresolved local var: size_t __n@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __caches@[???] */
  __index = locale::id::_M_id(&numpunct<char>::id);
  piVar12 = (int *)(__index * 4 + *(int *)(*(int *)(__beg_00._M_c + 0x6c) + 0xc));
  iVar11 = *piVar12;
  if (iVar11 == 0) {
                    /* try { // try from 089baf9c to 089bafef has its CatchHandler @ 089bb0a4 */
    this_00 = operator_new(0x68);
                    /* Unresolved local var: __numpunct_cache<char> * __tmp@[???] */
    this_00->_M_decimal_point = '\0';
    this_00->_M_thousands_sep = '\0';
    (this_00->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (this_00->super_facet)._M_refcount = 0;
    this_00->_M_grouping = (char *)0x0;
    this_00->_M_grouping_size = 0;
    this_00->_M_use_grouping = false;
    this_00->_M_truename = (char *)0x0;
    this_00->_M_truename_size = 0;
    this_00->_M_falsename = (char *)0x0;
    this_00->_M_falsename_size = 0;
    this_00->_M_allocated = false;
    __numpunct_cache<char>::_M_cache(this_00,(locale *)(__beg_00._M_c + 0x6c));
    locale::_Impl::_M_install_cache
              (((locale *)(__beg_00._M_c + 0x6c))->_M_impl,&this_00->super_facet,__index);
    iVar11 = *piVar12;
    if (piVar7 == (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089baf68;
LAB_089bac60:
    piVar8 = __io_00;
    if (__io_00 == (ios_base *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (piVar7[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar7[1]._M_c) {
        __io_00 = (ios_base *)(uint)*(byte *)&(piVar7[1]._M_sbuf)->_vptr_basic_streambuf;
      }
      else {
        __io_00 = (ios_base *)(*(code *)piVar7->_M_sbuf[1]._M_in_beg)(piVar7);
      }
      piVar8 = __io_00;
      if (__io_00 == (ios_base *)0xffffffff) {
        piVar7 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
        piVar8 = (ios_base *)0xffffffff;
      }
    }
  }
  else {
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
    if (piVar7 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) goto LAB_089bac60;
LAB_089baf68:
    piVar7 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
    piVar8 = (ios_base *)0xffffffff;
  }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
  if (local_48 == (_func_int_varargs **)0x0) {
LAB_089baf90:
    bVar1 = true;
    local_48 = (_func_int_varargs **)0x0;
  }
  else {
    if (pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
      if (local_48[2] < local_48[3]) {
        pbVar9 = (basic_streambuf<char,std::char_traits<char>_> *)(uint)(byte)*local_48[2];
      }
      else {
        pbVar9 = (basic_streambuf<char,std::char_traits<char>_> *)
                 (**(code **)(*local_48 + 0x24))(local_48);
      }
      if (pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) goto LAB_089baf90;
    }
    bVar1 = pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
  }
  if (piVar8 == (ios_base *)0xffffffff) {
    if (bVar1) {
      uVar4 = *(uint *)(iVar11 + 0x20);
      goto LAB_089baca8;
    }
LAB_089bad3c:
    bVar1 = true;
    bVar2 = true;
    uVar4 = 0;
LAB_089bad54:
    do {
      uVar10 = uVar4;
                    /* Unresolved local var: char __c@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      cVar6 = -1;
      if (piVar7 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
        if (__io_00 == (ios_base *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (piVar7[1]._M_sbuf < (basic_streambuf<char,std::char_traits<char>_> *)piVar7[1]._M_c) {
            __io_00 = (ios_base *)(uint)*(byte *)&(piVar7[1]._M_sbuf)->_vptr_basic_streambuf;
          }
          else {
            __io_00 = (ios_base *)(*(code *)piVar7->_M_sbuf[1]._M_in_beg)(piVar7);
          }
          if (__io_00 == (ios_base *)0xffffffff) {
            piVar7 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
            cVar6 = -1;
          }
          else {
            cVar6 = (char)__io_00;
          }
        }
        else {
          cVar6 = (char)__io_00;
        }
      }
      if (bVar1) {
        uVar4 = *(uint *)(iVar11 + 0x20);
        if (uVar4 <= uVar10) {
          bVar3 = false;
          goto LAB_089bacb8;
        }
        bVar1 = *(char *)(uVar10 + *(int *)(iVar11 + 0x1c)) == cVar6;
      }
      if (bVar2) {
        if (*(uint *)(iVar11 + 0x18) <= uVar10) {
          bVar3 = false;
          goto LAB_089bae54;
        }
        bVar2 = *(char *)(uVar10 + *(int *)(iVar11 + 0x14)) == cVar6;
      }
      if ((!bVar1) && (bVar3 = false, !bVar2)) goto LAB_089bae7c;
      piVar8 = (ios_base *)0xffffffff;
      if (piVar7 != (istreambuf_iterator<char,std::char_traits<char>_> *)0x0) {
                    /* Unresolved local var: int __ret@[???] */
        pbVar5 = (basic_streambuf<char,std::char_traits<char>_> *)piVar7[1]._M_c;
        if (piVar7[1]._M_sbuf < pbVar5) {
          piVar7[1]._M_sbuf =
               (basic_streambuf<char,std::char_traits<char>_> *)
               ((int)&(piVar7[1]._M_sbuf)->_vptr_basic_streambuf + 1);
        }
        else {
          (*(code *)piVar7->_M_sbuf[1]._M_in_cur)(piVar7);
          pbVar5 = (basic_streambuf<char,std::char_traits<char>_> *)piVar7[1]._M_c;
        }
                    /* Unresolved local var: bool __thiseof@[???]
                       Unresolved local var: bool __beof@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
        if (piVar7[1]._M_sbuf < pbVar5) {
          piVar8 = (ios_base *)(uint)*(byte *)&(piVar7[1]._M_sbuf)->_vptr_basic_streambuf;
        }
        else {
          piVar8 = (ios_base *)(*(code *)piVar7->_M_sbuf[1]._M_in_beg)(piVar7);
        }
        __io_00 = piVar8;
        if (piVar8 == (ios_base *)0xffffffff) {
          piVar7 = (istreambuf_iterator<char,std::char_traits<char>_> *)0x0;
          __io_00 = (ios_base *)0xffffffff;
        }
      }
                    /* Unresolved local var: int __eof@[???]
                       Unresolved local var: int __ret@[???] */
      bVar3 = true;
      if (local_48 != (_func_int_varargs **)0x0) {
        if (pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
          if (local_48[2] < local_48[3]) {
            pbVar9 = (basic_streambuf<char,std::char_traits<char>_> *)(uint)(byte)*local_48[2];
          }
          else {
            pbVar9 = (basic_streambuf<char,std::char_traits<char>_> *)
                     (**(code **)(*local_48 + 0x24))(local_48);
          }
          if (pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff) {
            local_48 = (_func_int_varargs **)0x0;
            bVar3 = true;
            goto LAB_089bae40;
          }
        }
        bVar3 = pbVar9 == (basic_streambuf<char,std::char_traits<char>_> *)0xffffffff;
      }
LAB_089bae40:
      if (piVar8 == (ios_base *)0xffffffff) {
        uVar4 = uVar10 + 1;
        if (bVar3) break;
        goto LAB_089bad54;
      }
      uVar4 = uVar10 + 1;
    } while (bVar3);
    uVar10 = uVar10 + 1;
    bVar3 = true;
LAB_089bae54:
    if ((bVar1) && (*(uint *)(iVar11 + 0x20) == uVar10)) goto LAB_089bae70;
  }
  else {
    if (bVar1) goto LAB_089bad3c;
    uVar4 = *(uint *)(iVar11 + 0x20);
LAB_089baca8:
    bVar3 = true;
    bVar2 = true;
    uVar10 = 0;
LAB_089bacb8:
    if (uVar4 == uVar10) {
LAB_089bae70:
      *in_t1 = 0;
      goto LAB_089bace4;
    }
  }
  if (bVar2) {
    if (*(uint *)(iVar11 + 0x18) == uVar10) {
      *in_t1 = 1;
      goto LAB_089bace4;
    }
    uVar4 = *in_t0;
  }
  else {
LAB_089bae7c:
    uVar4 = *in_t0;
  }
  *in_t0 = uVar4 | 4;
LAB_089bace4:
  if (!bVar3) {
    return piVar7;
  }
  *in_t0 = *in_t0 | 2;
  return piVar7;
}



----------------------------------------

// Function: __convert_from_v<long_double> @ 089bb0dc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: __convert_from_v<long double> */

int std::__convert_from_v<long_double>
              (char *__out,int __size,char *__fmt,longdouble __v,__c_locale *param_5,int __prec)

{
  char *s1;
  int iVar1;
  size_t sVar2;
  char *dst0;
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: char * __sav@[???]
                       Unresolved local var: int __ret@[???] */
  s1 = setlocale(4,(char *)0x0);
  iVar1 = strcmp(s1,"C");
  if (iVar1 != 0) {
    sVar2 = strlen(s1);
    dst0 = operator_new___(sVar2 + 1);
    strcpy(dst0,s1);
    setlocale(4,"C");
    iVar1 = sprintf(__out,__fmt);
    if (dst0 != (char *)0x0) {
      setlocale(4,dst0);
      operator_delete___(dst0);
    }
    return iVar1;
  }
  iVar1 = sprintf(__out,__fmt);
  return iVar1;
}



----------------------------------------

// Function: __convert_from_v<double> @ 089bb214

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

int std::__convert_from_v<double>
              (char *__out,int __size,char *__fmt,double __v,__c_locale *param_5,int __prec)

{
  char *s1;
  int iVar1;
  size_t sVar2;
  char *dst0;
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: char * __sav@[???]
                       Unresolved local var: int __ret@[???] */
  s1 = setlocale(4,(char *)0x0);
  iVar1 = strcmp(s1,"C");
  if (iVar1 != 0) {
    sVar2 = strlen(s1);
    dst0 = operator_new___(sVar2 + 1);
    strcpy(dst0,s1);
    setlocale(4,"C");
    iVar1 = sprintf(__out,__fmt);
    if (dst0 != (char *)0x0) {
      setlocale(4,dst0);
      operator_delete___(dst0);
    }
    return iVar1;
  }
  iVar1 = sprintf(__out,__fmt);
  return iVar1;
}



----------------------------------------

// Function: file @ 089bb34c

/* DWARF original prototype: __c_file * file(stdio_sync_filebuf<char,std::char_traits<char>_> *
   this) */

__c_file * __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::file
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this)

{
  return this->_M_file;
}



----------------------------------------

// Function: seekpos @ 089bb354

/* DWARF original prototype: fpos<_mbstate_t>
   seekpos(stdio_sync_filebuf<char,std::char_traits<char>_> * this, fpos<_mbstate_t> __pos,
   _Ios_Openmode __mode) */

fpos<_mbstate_t> * __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::seekpos
          (fpos<_mbstate_t> *__return_storage_ptr__,
          stdio_sync_filebuf<char,std::char_traits<char>_> *this,fpos<_mbstate_t> __pos,
          _Ios_Openmode __mode)

{
  (*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf[4])
            (__return_storage_ptr__,this,*(undefined4 *)__pos._M_off,((undefined4 *)__pos._M_off)[1]
            );
  return __return_storage_ptr__;
}



----------------------------------------

// Function: xsputn @ 089bb3b4

/* DWARF original prototype: streamsize xsputn(stdio_sync_filebuf<char,std::char_traits<char>_> *
   this, char * __s, streamsize __n) */

streamsize __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::xsputn
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  size_t sVar1;
  
  sVar1 = fwrite(__s,1,__n,this->_M_file);
  return sVar1;
}



----------------------------------------

// Function: xsgetn @ 089bb3c4

/* DWARF original prototype: streamsize xsgetn(stdio_sync_filebuf<char,std::char_traits<char>_> *
   this, char * __s, streamsize __n) */

streamsize __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::xsgetn
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  size_t sVar1;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  sVar1 = fread(__s,1,__n,this->_M_file);
  if (0 < (int)sVar1) {
    this->_M_unget_buf = (uint)(byte)__s[sVar1 - 1];
    return sVar1;
  }
  this->_M_unget_buf = -1;
  return sVar1;
}



----------------------------------------

// Function: ~stdio_sync_filebuf @ 089bb438

/* DWARF original prototype: void
   ~stdio_sync_filebuf(stdio_sync_filebuf<char,std::char_traits<char>_> * this, int __in_chrg) */

void __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::~stdio_sync_filebuf
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  std::locale::~locale
            (&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale,__in_chrg);
  return;
}



----------------------------------------

// Function: sync @ 089bb44c

/* DWARF original prototype: int sync(stdio_sync_filebuf<char,std::char_traits<char>_> * this) */

int __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::sync
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this)

{
  _fpos_t _Var1;
  uchar *puVar2;
  int iVar3;
  _fpos_t _Var4;
  ushort uVar5;
  __c_file *p_Var6;
  int iVar7;
  uchar *puVar8;
  _func__fpos_t_void_ptr__fpos_t_int *p_Var9;
  
  p_Var6 = this->_M_file;
  if (p_Var6 == (__c_file *)0x0) {
    iVar7 = _fwalk(_global_impure_ptr,fflush);
    return iVar7;
  }
  if (_impure_ptr == (_reent *)0x0) {
    uVar5 = p_Var6->_flags;
  }
  else if (_impure_ptr->__sdidinit == 0) {
    __sinit(_impure_ptr);
    uVar5 = p_Var6->_flags;
  }
  else {
    uVar5 = p_Var6->_flags;
  }
  if ((uVar5 & 8) == 0) {
    p_Var6->_flags = uVar5 | 0x800;
    if (p_Var6->_r < 1) {
      if (p_Var6->_ur < 1) {
        return 0;
      }
      p_Var9 = p_Var6->_seek;
    }
    else {
      p_Var9 = p_Var6->_seek;
    }
    if (p_Var9 != (_func__fpos_t_void_ptr__fpos_t_int *)0x0) {
      if ((uVar5 & 0x1000) == 0) {
        _Var4 = (*p_Var9)(p_Var6->_cookie,0,1);
        if (_Var4 == -1) {
          return 0;
        }
        uVar5 = p_Var6->_flags;
      }
      else {
        _Var4 = p_Var6->_offset;
        uVar5 = p_Var6->_flags;
      }
      if (((uVar5 & 4) != 0) && (_Var4 = _Var4 - p_Var6->_r, (p_Var6->_ub)._base != (uchar *)0x0)) {
        _Var4 = _Var4 - p_Var6->_ur;
      }
      _Var1 = (*p_Var9)(p_Var6->_cookie,_Var4,0);
      if (_Var1 != -1) {
        uVar5 = p_Var6->_flags;
        puVar8 = (p_Var6->_bf)._base;
        p_Var6->_r = 0;
        p_Var6->_flags = uVar5 & 0xf7ff;
        p_Var6->_p = puVar8;
        if ((uVar5 & 0x1000) != 0) {
          p_Var6->_offset = _Var4;
          return 0;
        }
      }
    }
  }
  else {
    puVar8 = (p_Var6->_bf)._base;
    if (puVar8 != (uchar *)0x0) {
      puVar2 = p_Var6->_p;
      p_Var6->_p = puVar8;
      iVar7 = (int)puVar2 - (int)puVar8;
      if ((uVar5 & 3) == 0) {
        p_Var6->_w = (p_Var6->_bf)._size;
      }
      else {
        p_Var6->_w = 0;
      }
      while (0 < iVar7) {
        iVar3 = (*p_Var6->_write)(p_Var6->_cookie,(char *)puVar8,iVar7);
        puVar8 = puVar8 + iVar3;
        iVar7 = iVar7 - iVar3;
        if (iVar3 < 1) {
          p_Var6->_flags = p_Var6->_flags | 0x40;
          return -1;
        }
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: uflow @ 089bb454

/* DWARF original prototype: int uflow(stdio_sync_filebuf<char,std::char_traits<char>_> * this) */

int __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::uflow
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
  iVar1 = getc(this->_M_file);
  this->_M_unget_buf = iVar1;
  return iVar1;
}



----------------------------------------

// Function: getline<char,_std::char_traits<char>,_std::allocator<char>_> @ 089bb480

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: getline<char, std::char_traits<char>, std::allocator<char> > */

basic_istream<char,std::char_traits<char>_> *
std::getline<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_istream<char,std::char_traits<char>_> *__in,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  char __delim;
  basic_istream<char,std::char_traits<char>_> *pbVar1;
  
  __delim = basic_ios<char,std::char_traits<char>_>::widen
                      ((basic_ios<char,std::char_traits<char>_> *)
                       ((int)&__in->_vptr_basic_istream + (int)__in->_vptr_basic_istream[-3]),'\n');
  pbVar1 = getline<char,_std::char_traits<char>,_std::allocator<char>_>(__in,__str,__delim);
  return pbVar1;
}



----------------------------------------

// Function: overflow @ 089bb4cc

/* DWARF original prototype: int overflow(stdio_sync_filebuf<char,std::char_traits<char>_> * this,
   int __c) */

int __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::overflow
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,int __c)

{
  int iVar1;
  int iVar2;
  
                    /* Unresolved local var: int __ret@[???] */
  if (__c != -1) {
    iVar1 = putc(__c,this->_M_file);
    return iVar1;
  }
  iVar2 = fflush(this->_M_file);
  iVar1 = -1;
  if (iVar2 == 0) {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: stdio_sync_filebuf @ 089bb520

/* DWARF original prototype: void
   stdio_sync_filebuf(stdio_sync_filebuf<char,std::char_traits<char>_> * this, __c_file * __f) */

void __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::stdio_sync_filebuf
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,__c_file *__f)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
  std::locale::locale(&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale);
  this->_M_unget_buf = -1;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_sync_filebuf_089f02d8;
  this->_M_file = __f;
  return;
}



----------------------------------------

// Function: seekoff @ 089bb590

/* DWARF original prototype: fpos<_mbstate_t>
   seekoff(stdio_sync_filebuf<char,std::char_traits<char>_> * this, streamoff __off, _Ios_Seekdir
   __dir, _Ios_Openmode param_3) */

fpos<_mbstate_t> * __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::seekoff
          (fpos<_mbstate_t> *__return_storage_ptr__,
          stdio_sync_filebuf<char,std::char_traits<char>_> *this,streamoff __off,_Ios_Seekdir __dir,
          _Ios_Openmode param_3)

{
  long lVar1;
  int in_t0;
  int iVar2;
  
                    /* Unresolved local var: fpos<_mbstate_t> __ret@[???]
                       Unresolved local var: int __whence@[???] */
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  iVar2 = 0;
  if ((in_t0 != 0) && (iVar2 = 1, in_t0 != 1)) {
    iVar2 = 2;
  }
  iVar2 = fseek(this->_M_file,(long)__off,iVar2);
  if (iVar2 == 0) {
    lVar1 = ftell(this->_M_file);
    *(long *)((int)&__return_storage_ptr__->_M_off + 4) = lVar1 >> 0x1f;
    (__return_storage_ptr__->_M_state).__count = 0;
    (__return_storage_ptr__->_M_state).__value.__wch = 0;
    *(long *)&__return_storage_ptr__->_M_off = lVar1;
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: pbackfail @ 089bb634

/* DWARF original prototype: int pbackfail(stdio_sync_filebuf<char,std::char_traits<char>_> * this,
   int __c) */

int __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::pbackfail
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,int __c)

{
  int iVar1;
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: int __eof@[???] */
  if (__c == -1) {
    __c = this->_M_unget_buf;
    iVar1 = -1;
    if (__c == -1) goto LAB_089bb65c;
  }
  iVar1 = ungetc(__c,this->_M_file);
LAB_089bb65c:
  this->_M_unget_buf = -1;
  return iVar1;
}



----------------------------------------

// Function: underflow @ 089bb690

/* DWARF original prototype: int underflow(stdio_sync_filebuf<char,std::char_traits<char>_> * this)
    */

int __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::underflow
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
                    /* Unresolved local var: int __c@[???] */
  iVar1 = getc(this->_M_file);
  iVar1 = ungetc(iVar1,this->_M_file);
  return iVar1;
}



----------------------------------------

// Function: stdio_sync_filebuf @ 089bb6c0

/* DWARF original prototype: void
   stdio_sync_filebuf(stdio_sync_filebuf<char,std::char_traits<char>_> * this, __c_file * __f) */

void __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::stdio_sync_filebuf
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,__c_file *__f)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
  std::locale::locale(&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale);
  this->_M_unget_buf = -1;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__stdio_sync_filebuf_089f02d8;
  this->_M_file = __f;
  return;
}



----------------------------------------

// Function: ~stdio_sync_filebuf @ 089bb730

/* DWARF original prototype: void
   ~stdio_sync_filebuf(stdio_sync_filebuf<char,std::char_traits<char>_> * this, int __in_chrg) */

void __thiscall
__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char>_>::~stdio_sync_filebuf
          (stdio_sync_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  std::locale::~locale
            (&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>,_std::allocator<char>_> @ 089bb768

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char>, std::allocator<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  bool bVar1;
  char cVar2;
  char *__olds;
  undefined3 extraout_var;
  int iVar3;
  _func_int_varargs **pp_Var4;
  basic_ios<char,std::char_traits<char>_> *pbVar5;
  int iVar6;
  char *pcVar7;
  sentry local_38 [2];
  streamsize asStack_28 [2];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(local_38,__out);
  if (local_38[0]._M_ok != false) {
                    /* Unresolved local var: streamsize __w@[???]
                       Unresolved local var: streamsize __len@[???]
                       Unresolved local var: char * __s@[???] */
    pp_Var4 = __out->_vptr_basic_ostream;
    __olds = (__str->_M_dataplus)._M_p;
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var4[-3]);
    iVar6 = (pbVar5->super_ios_base)._M_width;
    iVar3 = *(int *)(__olds + -0xc);
    pcVar7 = __olds;
    if (*(int *)(__olds + -0xc) < iVar6) {
                    /* Unresolved local var: char * __cs@[???] */
      iVar3 = -(iVar6 + 0xeU & 0xfffffff8);
      pcVar7 = (char *)((int)local_38 + iVar3);
      if (pbVar5->_M_fill_init == false) {
                    /* try { // try from 089bb930 to 089bb937 has its CatchHandler @ 089bb948 */
        cVar2 = basic_ios<char,std::char_traits<char>_>::widen(pbVar5,' ');
        pbVar5->_M_fill = cVar2;
        pbVar5->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar5,pbVar5->_M_fill,(char *)((int)local_38 + iVar3),__olds,
                 *(streamsize *)((int)asStack_28 + iVar3),
                 *(streamsize *)((int)asStack_28 + iVar3 + 4),(bool)(&stack0xffffffe0)[iVar3]);
      pp_Var4 = __out->_vptr_basic_ostream;
      iVar3 = iVar6;
    }
                    /* Unresolved local var: streamsize __put@[???] */
                    /* try { // try from 089bb7f0 to 089bb8af has its CatchHandler @ 089bb948 */
    iVar6 = (**(code **)(**(int **)(&__out->field_0x78 + (int)pp_Var4[-3]) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)pp_Var4[-3]),pcVar7,iVar3);
    if (iVar3 == iVar6) {
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
                    /* Unresolved local var: streamsize __old@[???] */
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var4[-3]) = 0;
  }
  if (((((*(uint *)(&(local_38[0]._M_os)->field_0xc +
                   (int)(local_38[0]._M_os)->_vptr_basic_ostream[-3]) & 0x2000) != 0) &&
       (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (*(int **)(&(local_38[0]._M_os)->field_0x78 +
                (int)(local_38[0]._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_38[0]._M_os)->field_0x78 +
                                     (int)(local_38[0]._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_38[0]._M_os)->_vptr_basic_ostream +
             (int)(local_38[0]._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<< @ 089bb9d8

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this,
   _func_basic_ostream<char,std::char_traits<char>_>_ptr_basic_ostream<char,std::char_traits<char>_>_ptr
   * __pf) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,
          _func_basic_ostream<char,std::char_traits<char>_>_ptr_basic_ostream<char,std::char_traits<char>_>_ptr
          *__pf)

{
  basic_ostream<char,std::char_traits<char>_> *pbVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089bb9dc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  pbVar1 = (*__pf)(this);
  return pbVar1;
}



----------------------------------------

// Function: operator<< @ 089bb9e4

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this,
   _func_basic_ios<char,std::char_traits<char>_>_ptr_basic_ios<char,std::char_traits<char>_>_ptr *
   __pf) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,
          _func_basic_ios<char,std::char_traits<char>_>_ptr_basic_ios<char,std::char_traits<char>_>_ptr
          *__pf)

{
  (*__pf)((basic_ios<char,std::char_traits<char>_> *)
          ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]));
  return this;
}



----------------------------------------

// Function: operator<< @ 089bba18

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, _func_ios_base_ptr_ios_base_ptr *
   __pf) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,_func_ios_base_ptr_ios_base_ptr *__pf)

{
  (*__pf)((ios_base *)((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]));
  return this;
}



----------------------------------------

// Function: basic_ostream @ 089bba4c

/* DWARF original prototype: void basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_ostream = *(_func_int_varargs ***)__in_chrg;
  *(undefined4 *)((int)&this->_vptr_basic_ostream + (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: operator_bool @ 089bba68

/* DWARF original name: operator bool
   DWARF original prototype: bool operator_bool(sentry * this) */

bool __thiscall
std::basic_ostream<char,std::char_traits<char>_>::sentry::operator_bool(sentry *this)

{
  return this->_M_ok;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bba70

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Setprecision __f)

{
                    /* Unresolved local var: streamsize __old@[???] */
  *(int *)(&__os->field_0x4 + (int)__os->_vptr_basic_ostream[-3]) = __f._M_n;
  return __os;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bba88

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Setfill<char> __f)

{
  char cVar1;
  basic_ios<char,std::char_traits<char>_> *this;
  
                    /* Unresolved local var: char __old@[???] */
  this = (basic_ios<char,std::char_traits<char>_> *)
         ((int)&__os->_vptr_basic_ostream + (int)__os->_vptr_basic_ostream[-3]);
  if (this->_M_fill_init == false) {
    cVar1 = basic_ios<char,std::char_traits<char>_>::widen(this,' ');
    this->_M_fill_init = true;
    this->_M_fill = cVar1;
  }
  this->_M_fill = __f._M_c;
  return __os;
}



----------------------------------------

// Function: basic_ostream @ 089bbaf4

/* DWARF original prototype: void basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  ios_base::ios_base((ios_base *)&this->field_0x4);
  *(undefined4 *)&this->field_0x4 = 0x89f0378;
  this->field_0x78 = 0;
  *(undefined4 *)&this->field_0x88 = 0;
  this->_vptr_basic_ostream = (_func_int_varargs **)0x89f0364;
  *(undefined4 *)&this->field_0x74 = 0;
  this->field_0x79 = 0;
  *(undefined4 *)&this->field_0x7c = 0;
  *(undefined4 *)&this->field_0x80 = 0;
  *(undefined4 *)&this->field_0x84 = 0;
  return;
}



----------------------------------------

// Function: basic_ostream @ 089bbb5c

/* DWARF original prototype: void basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_ostream = *(_func_int_varargs ***)__in_chrg;
  *(undefined4 *)((int)&this->_vptr_basic_ostream + (int)p_Var1) = uVar2;
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]),
             (basic_streambuf<char,std::char_traits<char>_> *)__vtt_parm);
  return;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bbb8c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Resetiosflags __f)

{
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(_Ios_Fmtflags *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) =
       *(uint *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) & ~__f._M_mask;
  return __os;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bbbb0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Setw __f)

{
                    /* Unresolved local var: streamsize __old@[???] */
  *(int *)(&__os->field_0x8 + (int)__os->_vptr_basic_ostream[-3]) = __f._M_n;
  return __os;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bbbc8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Setiosflags __f)

{
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(_Ios_Fmtflags *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) =
       *(_Ios_Fmtflags *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) | __f._M_mask;
  return __os;
}



----------------------------------------

// Function: operator<<_<char,_std::char_traits<char>_> @ 089bbbe8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<char,_std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__os,_Setbase __f)

{
  uint uVar1;
  
  uVar1 = 0x40;
  if (((__f._M_base != 8) && (uVar1 = 2, __f._M_base != 10)) && (uVar1 = 8, __f._M_base != 0x10)) {
    uVar1 = 0;
  }
                    /* Unresolved local var: _Ios_Fmtflags __old@[???] */
  *(uint *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) =
       uVar1 | *(uint *)(&__os->field_0xc + (int)__os->_vptr_basic_ostream[-3]) & 0xffffffb5;
  return __os;
}



----------------------------------------

// Function: ~sentry @ 089bbc34

/* DWARF original prototype: void ~sentry(sentry * this, int __in_chrg) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::sentry::~sentry(sentry *this,int __in_chrg)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  int *piVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  if (((((*(uint *)(&this->_M_os->field_0xc + (int)this->_M_os->_vptr_basic_ostream[-3]) & 0x2000)
         != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (piVar3 = *(int **)(&this->_M_os->field_0x78 + (int)this->_M_os->_vptr_basic_ostream[-3]),
      piVar3 != (int *)0x0)) && (iVar2 = (**(code **)(*piVar3 + 0x18))(piVar3), iVar2 == -1)) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_M_os->_vptr_basic_ostream + (int)this->_M_os->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
    return;
  }
  return;
}



----------------------------------------

// Function: basic_ostream @ 089bbcdc

/* DWARF original prototype: void basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  ios_base::ios_base((ios_base *)&this->field_0x4);
  *(undefined4 *)&this->field_0x4 = 0x89f0378;
  this->field_0x78 = 0;
  *(undefined4 *)&this->field_0x74 = 0;
  this->_vptr_basic_ostream = (_func_int_varargs **)0x89f0364;
  this->field_0x79 = 0;
  *(undefined4 *)&this->field_0x7c = 0;
  *(undefined4 *)&this->field_0x80 = 0;
  *(undefined4 *)&this->field_0x84 = 0;
  *(undefined4 *)&this->field_0x88 = 0;
                    /* try { // try from 089bbd3c to 089bbd43 has its CatchHandler @ 089bbd5c */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)&this->field_0x4,
             (basic_streambuf<char,std::char_traits<char>_> *)__in_chrg);
  return;
}



----------------------------------------

// Function: ~sentry @ 089bbd7c

/* DWARF original prototype: void ~sentry(sentry * this, int __in_chrg) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::sentry::~sentry(sentry *this,int __in_chrg)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  int *piVar3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  if (((((*(uint *)(&this->_M_os->field_0xc + (int)this->_M_os->_vptr_basic_ostream[-3]) & 0x2000)
         != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (piVar3 = *(int **)(&this->_M_os->field_0x78 + (int)this->_M_os->_vptr_basic_ostream[-3]),
      piVar3 != (int *)0x0)) && (iVar2 = (**(code **)(*piVar3 + 0x18))(piVar3), iVar2 == -1)) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_M_os->_vptr_basic_ostream + (int)this->_M_os->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
    return;
  }
  return;
}



----------------------------------------

// Function: _M_write @ 089bbe24

/* DWARF original prototype: void _M_write(basic_ostream<char,std::char_traits<char>_> * this, char
   * __s, streamsize __n) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::_M_write
          (basic_ostream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
                    /* Unresolved local var: streamsize __put@[???] */
  iVar1 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) + 0x30))()
  ;
  if (__n != iVar1) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
    return;
  }
  return;
}



----------------------------------------

// Function: seekp @ 089bbe94

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   seekp(basic_ostream<char,std::char_traits<char>_> * this, streamoff __off, _Ios_Seekdir __dir) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::seekp
          (basic_ostream<char,std::char_traits<char>_> *this,streamoff __off,_Ios_Seekdir __dir)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  int local_18;
  int local_14;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
                    /* Unresolved local var: streampos __p@[???] */
                    /* try { // try from 089bbee0 to 089bbee7 has its CatchHandler @ 089bbf24 */
  if ((((*(uint *)(&this->field_0x14 + (int)this->_vptr_basic_ostream[-3]) & 5) == 0) &&
      ((**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) + 0x10))
                 (&local_18,*(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]),
                  (int)__off,(int)((ulonglong)__off >> 0x20)), local_18 == -1)) && (local_14 == -1))
  {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  }
  return this;
}



----------------------------------------

// Function: tellp @ 089bbf78

/* DWARF original prototype: streampos tellp(basic_ostream<char,std::char_traits<char>_> * this) */

streampos * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::tellp
          (streampos *__return_storage_ptr__,basic_ostream<char,std::char_traits<char>_> *this)

{
  _func_int_varargs *p_Var1;
  
                    /* Unresolved local var: streampos __ret@[???] */
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  p_Var1 = this->_vptr_basic_ostream[-3];
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  if ((*(uint *)(&this->field_0x14 + (int)p_Var1) & 5) != 0) {
    return __return_storage_ptr__;
  }
                    /* try { // try from 089bbff8 to 089bbfff has its CatchHandler @ 089bc018 */
  (**(code **)(**(int **)(&this->field_0x78 + (int)p_Var1) + 0x10))
            (__return_storage_ptr__,*(int **)(&this->field_0x78 + (int)p_Var1),0,0);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: seekp @ 089bc06c

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   seekp(basic_ostream<char,std::char_traits<char>_> * this, streampos __pos) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::seekp
          (basic_ostream<char,std::char_traits<char>_> *this,streampos __pos)

{
  basic_ios<char,std::char_traits<char>_> *this_00;
  undefined4 *in_a1;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  int local_28;
  int local_24;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
  local_4c = in_a1[3];
  local_58 = *in_a1;
  local_54 = in_a1[1];
  local_50 = in_a1[2];
                    /* Unresolved local var: streampos __p@[???] */
                    /* try { // try from 089bc11c to 089bc123 has its CatchHandler @ 089bc160 */
  if ((((*(uint *)(&this->field_0x14 + (int)this->_vptr_basic_ostream[-3]) & 5) == 0) &&
      (local_48 = local_58, local_44 = local_54, local_40 = local_50, local_3c = local_4c,
      local_38 = local_58, local_34 = local_54, local_30 = local_50, local_2c = local_4c,
      local_18 = local_58, local_14 = local_54, local_10 = local_50, local_c = local_4c,
      (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) + 0x14))
                (&local_28,*(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]),
                 &local_58,0x10), local_28 == -1)) && (local_24 == -1)) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  }
  return this;
}



----------------------------------------

// Function: flush @ 089bc1b4

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   flush(basic_ostream<char,std::char_traits<char>_> * this) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::flush
          (basic_ostream<char,std::char_traits<char>_> *this)

{
  int iVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???] */
                    /* try { // try from 089bc1e4 to 089bc1eb has its CatchHandler @ 089bc234 */
  if ((*(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) != (int *)0x0) &&
     (iVar1 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) + 0x18
                          ))(), iVar1 == -1)) {
    this_00 = (basic_ios<char,std::char_traits<char>_> *)
              ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_badbit);
    return this;
  }
  return this;
}



----------------------------------------

// Function: flush<char,_std::char_traits<char>_> @ 089bc288

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: flush<char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::flush<char,_std::char_traits<char>_>(basic_ostream<char,std::char_traits<char>_> *__os)

{
  int iVar1;
  basic_ios<char,std::char_traits<char>_> *this;
  
  if ((*(int **)(&__os->field_0x78 + (int)__os->_vptr_basic_ostream[-3]) != (int *)0x0) &&
     (iVar1 = (**(code **)(**(int **)(&__os->field_0x78 + (int)__os->_vptr_basic_ostream[-3]) + 0x18
                          ))(), iVar1 == -1)) {
    this = (basic_ios<char,std::char_traits<char>_> *)
           ((int)&__os->_vptr_basic_ostream + (int)__os->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (this,(this->super_ios_base)._M_streambuf_state | _S_badbit);
    return __os;
  }
  return __os;
}



----------------------------------------

// Function: sentry @ 089bc290

/* DWARF original prototype: void sentry(sentry * this, basic_ostream<char,std::char_traits<char>_>
   * __os) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::sentry::sentry
          (sentry *this,basic_ostream<char,std::char_traits<char>_> *__os)

{
  _func_int_varargs *p_Var1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  _func_int_varargs **pp_Var2;
  _Ios_Iostate _Var3;
  
  pp_Var2 = __os->_vptr_basic_ostream;
  this->_M_ok = false;
  p_Var1 = pp_Var2[-3];
  this->_M_os = __os;
  if ((*(basic_ostream<char,std::char_traits<char>_> **)(&__os->field_0x70 + (int)p_Var1) !=
       (basic_ostream<char,std::char_traits<char>_> *)0x0) &&
     (*(int *)(&__os->field_0x14 + (int)p_Var1) == 0)) {
    flush(*(basic_ostream<char,std::char_traits<char>_> **)(&__os->field_0x70 + (int)p_Var1));
    pp_Var2 = __os->_vptr_basic_ostream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&__os->_vptr_basic_ostream + (int)pp_Var2[-3]);
  _Var3 = (this_00->super_ios_base)._M_streambuf_state;
  if (_Var3 == _S_goodbit) {
    this->_M_ok = true;
    return;
  }
  basic_ios<char,std::char_traits<char>_>::clear(this_00,_Var3 | _S_failbit);
  return;
}



----------------------------------------

// Function: sentry @ 089bc328

/* DWARF original prototype: void sentry(sentry * this, basic_ostream<char,std::char_traits<char>_>
   * __os) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::sentry::sentry
          (sentry *this,basic_ostream<char,std::char_traits<char>_> *__os)

{
  _func_int_varargs *p_Var1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  _func_int_varargs **pp_Var2;
  _Ios_Iostate _Var3;
  
  pp_Var2 = __os->_vptr_basic_ostream;
  this->_M_ok = false;
  p_Var1 = pp_Var2[-3];
  this->_M_os = __os;
  if ((*(basic_ostream<char,std::char_traits<char>_> **)(&__os->field_0x70 + (int)p_Var1) !=
       (basic_ostream<char,std::char_traits<char>_> *)0x0) &&
     (*(int *)(&__os->field_0x14 + (int)p_Var1) == 0)) {
    flush(*(basic_ostream<char,std::char_traits<char>_> **)(&__os->field_0x70 + (int)p_Var1));
    pp_Var2 = __os->_vptr_basic_ostream;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&__os->_vptr_basic_ostream + (int)pp_Var2[-3]);
  _Var3 = (this_00->super_ios_base)._M_streambuf_state;
  if (_Var3 == _S_goodbit) {
    this->_M_ok = true;
    return;
  }
  basic_ios<char,std::char_traits<char>_>::clear(this_00,_Var3 | _S_failbit);
  return;
}



----------------------------------------

// Function: ~ostream @ 089bc3c0

/* virtual thunk to std::ostream::~ostream() */

void __thiscall std::ostream::~ostream(ostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ostream<char,std::char_traits<char>_>::~basic_ostream
            ((basic_ostream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ostream @ 089bc3d4

/* DWARF original prototype: void ~basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::~basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  this->_vptr_basic_ostream = (_func_int_varargs **)0x89f0364;
  *(undefined ***)&this->field_0x4 = &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)&this->field_0x4,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~ostream @ 089bc418

/* virtual thunk to std::ostream::~ostream() */

void __thiscall std::ostream::~ostream(ostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ostream<char,std::char_traits<char>_>::~basic_ostream
            ((basic_ostream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ostream @ 089bc42c

/* DWARF original prototype: void ~basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::~basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  this->_vptr_basic_ostream = (_func_int_varargs **)0x89f0364;
  *(undefined ***)&this->field_0x4 = &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)&this->field_0x4,__in_chrg);
  return;
}



----------------------------------------

// Function: ~basic_ostream @ 089bc44c

/* DWARF original prototype: void ~basic_ostream(basic_ostream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ostream<char,std::char_traits<char>_>::~basic_ostream
          (basic_ostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  
  uVar2 = *(undefined4 *)(__in_chrg + 4);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  this->_vptr_basic_ostream = *(_func_int_varargs ***)__in_chrg;
  *(undefined4 *)((int)&this->_vptr_basic_ostream + (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bc468

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,char *__s)

{
  char cVar1;
  bool bVar2;
  size_t sVar3;
  _func_int_varargs *p_Var4;
  uint uVar5;
  undefined3 extraout_var;
  int iVar6;
  _func_int_varargs **pp_Var7;
  char *pcVar8;
  basic_ios<char,std::char_traits<char>_> *pbVar9;
  size_t sVar10;
  sentry local_40 [2];
  streamsize asStack_30 [2];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(local_40,__out);
  if (local_40[0]._M_ok == false) {
    if (__s == (char *)0x0) goto LAB_089bc5ec;
  }
  else {
    if (__s == (char *)0x0) {
LAB_089bc5ec:
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bc5fc to 089bc603 has its CatchHandler @ 089bc690 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
      uVar5 = *(uint *)(&(local_40[0]._M_os)->field_0xc +
                       (int)(local_40[0]._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bc5a8;
    }
                    /* Unresolved local var: streamsize __w@[???]
                       Unresolved local var: streamsize __len@[???] */
    pp_Var7 = __out->_vptr_basic_ostream;
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var7[-3]);
    sVar10 = (pbVar9->super_ios_base)._M_width;
    sVar3 = strlen(__s);
    if ((int)sVar3 < (int)sVar10) {
                    /* Unresolved local var: char * __cs@[???] */
      iVar6 = -(sVar10 + 0xe & 0xfffffff8);
      pcVar8 = (char *)((int)local_40 + iVar6);
      if (pbVar9->_M_fill_init == false) {
                    /* try { // try from 089bc500 to 089bc57f has its CatchHandler @ 089bc6bc */
        cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar9,' ');
        pbVar9->_M_fill = cVar1;
        pbVar9->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar9,pbVar9->_M_fill,(char *)((int)local_40 + iVar6),__s,
                 *(streamsize *)((int)asStack_30 + iVar6),
                 *(streamsize *)((int)asStack_30 + iVar6 + 4),(bool)(&stack0xffffffd8)[iVar6]);
                    /* Unresolved local var: streamsize __put@[???] */
      p_Var4 = __out->_vptr_basic_ostream[-3];
    }
    else {
      p_Var4 = pp_Var7[-3];
      pcVar8 = __s;
      sVar10 = sVar3;
    }
    sVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)p_Var4) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)p_Var4),pcVar8,sVar10);
    if (sVar10 == sVar3) {
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
                    /* Unresolved local var: streamsize __old@[???] */
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var7[-3]) = 0;
  }
  uVar5 = *(uint *)(&(local_40[0]._M_os)->field_0xc +
                   (int)(local_40[0]._M_os)->_vptr_basic_ostream[-3]);
joined_r0x089bc5a8:
  if (((((uVar5 & 0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)
       ) && (*(int **)(&(local_40[0]._M_os)->field_0x78 +
                      (int)(local_40[0]._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(local_40[0]._M_os)->field_0x78 +
                                     (int)(local_40[0]._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar6 == -1)) {
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_40[0]._M_os)->_vptr_basic_ostream +
             (int)(local_40[0]._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bc774

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,char *__s)

{
  char cVar1;
  bool bVar2;
  size_t sVar3;
  _func_int_varargs *p_Var4;
  uint uVar5;
  undefined3 extraout_var;
  int iVar6;
  _func_int_varargs **pp_Var7;
  char *pcVar8;
  basic_ios<char,std::char_traits<char>_> *pbVar9;
  size_t sVar10;
  sentry asStack_40 [2];
  streamsize asStack_30 [2];
  
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(asStack_40,__out);
  if (asStack_40[0]._M_ok == false) {
    if (__s == (char *)0x0) goto LAB_089bc5ec;
  }
  else {
    if (__s == (char *)0x0) {
LAB_089bc5ec:
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
      uVar5 = *(uint *)(&(asStack_40[0]._M_os)->field_0xc +
                       (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bc5a8;
    }
    pp_Var7 = __out->_vptr_basic_ostream;
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var7[-3]);
    sVar10 = (pbVar9->super_ios_base)._M_width;
    sVar3 = strlen(__s);
    if ((int)sVar3 < (int)sVar10) {
      iVar6 = -(sVar10 + 0xe & 0xfffffff8);
      pcVar8 = (char *)((int)asStack_40 + iVar6);
      if (pbVar9->_M_fill_init == false) {
        cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar9,' ');
        pbVar9->_M_fill = cVar1;
        pbVar9->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar9,pbVar9->_M_fill,(char *)((int)asStack_40 + iVar6),__s,
                 *(streamsize *)((int)asStack_30 + iVar6),
                 *(streamsize *)((int)asStack_30 + iVar6 + 4),(bool)(&stack0xffffffd8)[iVar6]);
      p_Var4 = __out->_vptr_basic_ostream[-3];
    }
    else {
      p_Var4 = pp_Var7[-3];
      pcVar8 = __s;
      sVar10 = sVar3;
    }
    sVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)p_Var4) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)p_Var4),pcVar8,sVar10);
    if (sVar10 == sVar3) {
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var7[-3]) = 0;
  }
  uVar5 = *(uint *)(&(asStack_40[0]._M_os)->field_0xc +
                   (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
joined_r0x089bc5a8:
  if (((((uVar5 & 0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)
       ) && (*(int **)(&(asStack_40[0]._M_os)->field_0x78 +
                      (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(asStack_40[0]._M_os)->field_0x78 +
                                     (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]) + 0x18))()
     , iVar6 == -1)) {
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(asStack_40[0]._M_os)->_vptr_basic_ostream +
             (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bc77c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,uchar *__s)

{
  char cVar1;
  bool bVar2;
  size_t sVar3;
  _func_int_varargs *p_Var4;
  uint uVar5;
  undefined3 extraout_var;
  int iVar6;
  _func_int_varargs **pp_Var7;
  uchar *puVar8;
  basic_ios<char,std::char_traits<char>_> *pbVar9;
  size_t sVar10;
  sentry asStack_40 [2];
  streamsize asStack_30 [2];
  
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(asStack_40,__out);
  if (asStack_40[0]._M_ok == false) {
    if (__s == (uchar *)0x0) goto LAB_089bc5ec;
  }
  else {
    if (__s == (uchar *)0x0) {
LAB_089bc5ec:
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
      uVar5 = *(uint *)(&(asStack_40[0]._M_os)->field_0xc +
                       (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bc5a8;
    }
    pp_Var7 = __out->_vptr_basic_ostream;
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var7[-3]);
    sVar10 = (pbVar9->super_ios_base)._M_width;
    sVar3 = strlen((char *)__s);
    if ((int)sVar3 < (int)sVar10) {
      iVar6 = -(sVar10 + 0xe & 0xfffffff8);
      puVar8 = (uchar *)((int)asStack_40 + iVar6);
      if (pbVar9->_M_fill_init == false) {
        cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar9,' ');
        pbVar9->_M_fill = cVar1;
        pbVar9->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar9,pbVar9->_M_fill,(char *)((int)asStack_40 + iVar6),(char *)__s,
                 *(streamsize *)((int)asStack_30 + iVar6),
                 *(streamsize *)((int)asStack_30 + iVar6 + 4),(bool)(&stack0xffffffd8)[iVar6]);
      p_Var4 = __out->_vptr_basic_ostream[-3];
    }
    else {
      p_Var4 = pp_Var7[-3];
      puVar8 = __s;
      sVar10 = sVar3;
    }
    sVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)p_Var4) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)p_Var4),puVar8,sVar10);
    if (sVar10 == sVar3) {
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
      pp_Var7 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var7[-3]) = 0;
  }
  uVar5 = *(uint *)(&(asStack_40[0]._M_os)->field_0xc +
                   (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
joined_r0x089bc5a8:
  if (((((uVar5 & 0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)
       ) && (*(int **)(&(asStack_40[0]._M_os)->field_0x78 +
                      (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(asStack_40[0]._M_os)->field_0x78 +
                                     (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]) + 0x18))()
     , iVar6 == -1)) {
    pbVar9 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(asStack_40[0]._M_os)->_vptr_basic_ostream +
             (int)(asStack_40[0]._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar9,(pbVar9->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<< @ 089bc784

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, void * __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,void *__n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bc908 to 089bc90f has its CatchHandler @ 089bc910 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bc7e8 to 089bc827 has its CatchHandler @ 089bc910 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[9])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bc854 to 089bc85b has its CatchHandler @ 089bc94c */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bc9f4

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, longdouble __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,longdouble __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_38;
  undefined1 local_34;
  sentry local_30;
  int local_28;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_30,this);
  if (local_30._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bcb88 to 089bcb8f has its CatchHandler @ 089bcb90 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bca60 to 089bcaa3 has its CatchHandler @ 089bcb90 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_34 = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_38 = pbVar6;
    local_28 = (*(pnVar5->super_facet)._vptr_facet[8])(pnVar5,&local_38,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bcad0 to 089bcad7 has its CatchHandler @ 089bcbcc */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_30._M_os)->field_0xc + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_30._M_os)->field_0x78 + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_30._M_os)->field_0x78 +
                                     (int)(local_30._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_30._M_os)->_vptr_basic_ostream +
             (int)(local_30._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bcc74

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, float __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,float __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_streambuf<char,std::char_traits<char>_> *pbVar4;
  _func_int_varargs *p_Var5;
  basic_ios<char,std::char_traits<char>_> *pbVar6;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar7;
  SFtype in_f12;
  basic_streambuf<char,std::char_traits<char>_> *local_38;
  undefined1 local_34;
  sentry local_30;
  int local_28;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_30,this);
  if (local_30._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar6 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar7 = pbVar6->_M_num_put;
    if (pnVar7 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bce10 to 089bce17 has its CatchHandler @ 089bce18 */
      __throw_bad_cast();
    }
    pbVar4 = pbVar6->_M_streambuf;
    if (pbVar6->_M_fill_init == false) {
                    /* try { // try from 089bccdc to 089bcd2b has its CatchHandler @ 089bce18 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar6,' ');
      pbVar6->_M_fill = cVar1;
      pbVar6->_M_fill_init = true;
    }
    cVar1 = pbVar6->_M_fill;
    local_34 = pbVar4 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    p_Var5 = (pnVar7->super_facet)._vptr_facet[7];
    local_38 = pbVar4;
    __extendsfdf2(in_f12);
    local_28 = (*p_Var5)(pnVar7,&local_38,pbVar6,(int)cVar1);
    if (extraout_v1 != '\0') {
      pbVar6 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bcd58 to 089bcd5f has its CatchHandler @ 089bce54 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar6,(pbVar6->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_30._M_os)->field_0xc + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_30._M_os)->field_0x78 + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_30._M_os)->field_0x78 +
                                     (int)(local_30._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar6 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_30._M_os)->_vptr_basic_ostream +
             (int)(local_30._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar6,(pbVar6->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bcefc

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, double __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,double __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_38;
  undefined1 local_34;
  sentry local_30;
  int local_28;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_30,this);
  if (local_30._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bd090 to 089bd097 has its CatchHandler @ 089bd098 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bcf68 to 089bcfab has its CatchHandler @ 089bd098 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_34 = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_38 = pbVar6;
    local_28 = (*(pnVar5->super_facet)._vptr_facet[7])(pnVar5,&local_38,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bcfd8 to 089bcfdf has its CatchHandler @ 089bd0d4 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_30._M_os)->field_0xc + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_30._M_os)->field_0x78 + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_30._M_os)->field_0x78 +
                                     (int)(local_30._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_30._M_os)->_vptr_basic_ostream +
             (int)(local_30._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bd17c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,char __c)

{
  bool bVar1;
  char cVar2;
  int iVar3;
  undefined3 extraout_var;
  _func_int_varargs **pp_Var4;
  basic_ios<char,std::char_traits<char>_> *pbVar5;
  int iVar6;
  char *pcVar7;
  sentry local_38;
  char local_30 [8];
  streamsize asStack_28 [2];
  undefined1 auStack_20 [8];
  
                    /* Unresolved local var: sentry __cerb@[???] */
  local_30[0] = __c;
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(&local_38,__out);
  if (local_38._M_ok != false) {
                    /* Unresolved local var: streamsize __w@[???]
                       Unresolved local var: streamsize __len@[???]
                       Unresolved local var: char * __cs@[???] */
    pp_Var4 = __out->_vptr_basic_ostream;
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var4[-3]);
    iVar6 = (pbVar5->super_ios_base)._M_width;
    if (iVar6 < 2) {
      iVar6 = 1;
      pcVar7 = local_30;
    }
    else {
      iVar3 = -(iVar6 + 0xeU & 0xfffffff8);
      pcVar7 = (char *)((int)&local_38 + iVar3);
      if (pbVar5->_M_fill_init == false) {
                    /* try { // try from 089bd320 to 089bd327 has its CatchHandler @ 089bd344 */
        cVar2 = basic_ios<char,std::char_traits<char>_>::widen(pbVar5,' ');
        pbVar5->_M_fill = cVar2;
        pbVar5->_M_fill_init = true;
      }
                    /* try { // try from 089bd208 to 089bd257 has its CatchHandler @ 089bd344 */
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar5,pbVar5->_M_fill,(char *)((int)&local_38 + iVar3),local_30,
                 *(streamsize *)((int)asStack_28 + iVar3),
                 *(streamsize *)((int)asStack_28 + iVar3 + 4),(bool)auStack_20[iVar3]);
      pp_Var4 = __out->_vptr_basic_ostream;
    }
                    /* Unresolved local var: streamsize __put@[???] */
    iVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)pp_Var4[-3]) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)pp_Var4[-3]),pcVar7,iVar6);
    if (iVar6 == iVar3) {
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
                    /* Unresolved local var: streamsize __old@[???] */
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var4[-3]) = 0;
  }
  if (((((*(uint *)(&(local_38._M_os)->field_0xc + (int)(local_38._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (*(int **)(&(local_38._M_os)->field_0x78 + (int)(local_38._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(local_38._M_os)->field_0x78 +
                                     (int)(local_38._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar6 == -1)) {
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_38._M_os)->_vptr_basic_ostream +
             (int)(local_38._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bd428

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,char __c)

{
  bool bVar1;
  char cVar2;
  int iVar3;
  undefined3 extraout_var;
  _func_int_varargs **pp_Var4;
  basic_ios<char,std::char_traits<char>_> *pbVar5;
  int iVar6;
  char *pcVar7;
  sentry sStack_38;
  char acStack_30 [8];
  streamsize asStack_28 [2];
  undefined1 auStack_20 [8];
  
  acStack_30[0] = __c;
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(&sStack_38,__out);
  if (sStack_38._M_ok != false) {
    pp_Var4 = __out->_vptr_basic_ostream;
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var4[-3]);
    iVar6 = (pbVar5->super_ios_base)._M_width;
    if (iVar6 < 2) {
      iVar6 = 1;
      pcVar7 = acStack_30;
    }
    else {
      iVar3 = -(iVar6 + 0xeU & 0xfffffff8);
      pcVar7 = (char *)((int)&sStack_38 + iVar3);
      if (pbVar5->_M_fill_init == false) {
        cVar2 = basic_ios<char,std::char_traits<char>_>::widen(pbVar5,' ');
        pbVar5->_M_fill = cVar2;
        pbVar5->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar5,pbVar5->_M_fill,(char *)((int)&sStack_38 + iVar3),acStack_30,
                 *(streamsize *)((int)asStack_28 + iVar3),
                 *(streamsize *)((int)asStack_28 + iVar3 + 4),(bool)auStack_20[iVar3]);
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    iVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)pp_Var4[-3]) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)pp_Var4[-3]),pcVar7,iVar6);
    if (iVar6 == iVar3) {
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var4[-3]) = 0;
  }
  if (((((*(uint *)(&(sStack_38._M_os)->field_0xc + (int)(sStack_38._M_os)->_vptr_basic_ostream[-3])
         & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (*(int **)(&(sStack_38._M_os)->field_0x78 + (int)(sStack_38._M_os)->_vptr_basic_ostream[-3])
       != (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(sStack_38._M_os)->field_0x78 +
                                     (int)(sStack_38._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar6 == -1)) {
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(sStack_38._M_os)->_vptr_basic_ostream +
             (int)(sStack_38._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: operator<<_<std::char_traits<char>_> @ 089bd430

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator<< <std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::operator<<_<std::char_traits<char>_>
          (basic_ostream<char,std::char_traits<char>_> *__out,uchar __c)

{
  bool bVar1;
  char cVar2;
  int iVar3;
  undefined3 extraout_var;
  _func_int_varargs **pp_Var4;
  basic_ios<char,std::char_traits<char>_> *pbVar5;
  int iVar6;
  uchar *puVar7;
  sentry sStack_38;
  uchar auStack_30 [8];
  streamsize asStack_28 [2];
  undefined1 auStack_20 [8];
  
  auStack_30[0] = __c;
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(&sStack_38,__out);
  if (sStack_38._M_ok != false) {
    pp_Var4 = __out->_vptr_basic_ostream;
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&__out->_vptr_basic_ostream + (int)pp_Var4[-3]);
    iVar6 = (pbVar5->super_ios_base)._M_width;
    if (iVar6 < 2) {
      iVar6 = 1;
      puVar7 = auStack_30;
    }
    else {
      iVar3 = -(iVar6 + 0xeU & 0xfffffff8);
      puVar7 = (uchar *)((int)&sStack_38 + iVar3);
      if (pbVar5->_M_fill_init == false) {
        cVar2 = basic_ios<char,std::char_traits<char>_>::widen(pbVar5,' ');
        pbVar5->_M_fill = cVar2;
        pbVar5->_M_fill_init = true;
      }
      __pad<char,std::char_traits<char>_>::_S_pad
                ((ios_base *)pbVar5,pbVar5->_M_fill,(char *)((int)&sStack_38 + iVar3),
                 (char *)auStack_30,*(streamsize *)((int)asStack_28 + iVar3),
                 *(streamsize *)((int)asStack_28 + iVar3 + 4),(bool)auStack_20[iVar3]);
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    iVar3 = (**(code **)(**(int **)(&__out->field_0x78 + (int)pp_Var4[-3]) + 0x30))
                      (*(int **)(&__out->field_0x78 + (int)pp_Var4[-3]),puVar7,iVar6);
    if (iVar6 == iVar3) {
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    else {
      pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__out->_vptr_basic_ostream + (int)__out->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
      pp_Var4 = __out->_vptr_basic_ostream;
    }
    *(undefined4 *)(&__out->field_0x8 + (int)pp_Var4[-3]) = 0;
  }
  if (((((*(uint *)(&(sStack_38._M_os)->field_0xc + (int)(sStack_38._M_os)->_vptr_basic_ostream[-3])
         & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)) &&
      (*(int **)(&(sStack_38._M_os)->field_0x78 + (int)(sStack_38._M_os)->_vptr_basic_ostream[-3])
       != (int *)0x0)) &&
     (iVar6 = (**(code **)(**(int **)(&(sStack_38._M_os)->field_0x78 +
                                     (int)(sStack_38._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar6 == -1)) {
    pbVar5 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(sStack_38._M_os)->_vptr_basic_ostream +
             (int)(sStack_38._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar5,(pbVar5->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __out;
}



----------------------------------------

// Function: write @ 089bd438

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   write(basic_ostream<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::write
          (basic_ostream<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  undefined3 extraout_var;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  sentry local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_18,this);
                    /* Unresolved local var: streamsize __put@[???] */
                    /* try { // try from 089bd4c0 to 089bd4e7 has its CatchHandler @ 089bd574 */
  if ((local_18._M_ok == false) ||
     (iVar2 = (**(code **)(**(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]) + 0x30
                          ))(*(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]),__s,
                             __n), __n == iVar2)) {
    uVar3 = *(uint *)(&(local_18._M_os)->field_0xc + (int)(local_18._M_os)->_vptr_basic_ostream[-3])
    ;
  }
  else {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    uVar3 = *(uint *)(&(local_18._M_os)->field_0xc + (int)(local_18._M_os)->_vptr_basic_ostream[-3])
    ;
  }
  if (((((uVar3 & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)
       ) && (*(int **)(&(local_18._M_os)->field_0x78 +
                      (int)(local_18._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar2 = (**(code **)(**(int **)(&(local_18._M_os)->field_0x78 +
                                     (int)(local_18._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar2 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_18._M_os)->_vptr_basic_ostream +
             (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: put @ 089bd658

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   put(basic_ostream<char,std::char_traits<char>_> * this, char __c) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::put
          (basic_ostream<char,std::char_traits<char>_> *this,char __c)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  int *piVar3;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  uint uVar5;
  sentry local_18;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_18,this);
  if (local_18._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __put@[???] */
    piVar3 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((char *)piVar3[5] < (char *)piVar3[6]) {
      *(char *)piVar3[5] = __c;
      uVar5 = (uint)(byte)__c;
      piVar3[5] = piVar3[5] + 1;
    }
    else {
                    /* try { // try from 089bd7a8 to 089bd7af has its CatchHandler @ 089bd7e4 */
      uVar5 = (**(code **)(*piVar3 + 0x34))(piVar3,__c);
    }
    if (uVar5 == 0xffffffff) {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bd70c to 089bd713 has its CatchHandler @ 089bd7b8 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
      uVar5 = *(uint *)(&(local_18._M_os)->field_0xc +
                       (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bd6a0;
    }
  }
  uVar5 = *(uint *)(&(local_18._M_os)->field_0xc + (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
joined_r0x089bd6a0:
  if (((((uVar5 & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)
       ) && (*(int **)(&(local_18._M_os)->field_0x78 +
                      (int)(local_18._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar2 = (**(code **)(**(int **)(&(local_18._M_os)->field_0x78 +
                                     (int)(local_18._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar2 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_18._M_os)->_vptr_basic_ostream +
             (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: ends<char,_std::char_traits<char>_> @ 089bd89c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: ends<char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::ends<char,_std::char_traits<char>_>(basic_ostream<char,std::char_traits<char>_> *__os)

{
  bool bVar1;
  uint uVar2;
  undefined3 extraout_var;
  int *piVar3;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  int iVar5;
  sentry sStack_18;
  
  basic_ostream<char,std::char_traits<char>_>::sentry::sentry(&sStack_18,__os);
  if (sStack_18._M_ok != false) {
    piVar3 = *(int **)(&__os->field_0x78 + (int)__os->_vptr_basic_ostream[-3]);
    if ((undefined1 *)piVar3[5] < (undefined1 *)piVar3[6]) {
      *(undefined1 *)piVar3[5] = 0;
      iVar5 = 0;
      piVar3[5] = piVar3[5] + 1;
    }
    else {
      iVar5 = (**(code **)(*piVar3 + 0x34))(piVar3,0);
    }
    if (iVar5 == -1) {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&__os->_vptr_basic_ostream + (int)__os->_vptr_basic_ostream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
      uVar2 = *(uint *)(&(sStack_18._M_os)->field_0xc +
                       (int)(sStack_18._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bd6a0;
    }
  }
  uVar2 = *(uint *)(&(sStack_18._M_os)->field_0xc + (int)(sStack_18._M_os)->_vptr_basic_ostream[-3])
  ;
joined_r0x089bd6a0:
  if (((((uVar2 & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)
       ) && (*(int **)(&(sStack_18._M_os)->field_0x78 +
                      (int)(sStack_18._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar5 = (**(code **)(**(int **)(&(sStack_18._M_os)->field_0x78 +
                                     (int)(sStack_18._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar5 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(sStack_18._M_os)->_vptr_basic_ostream +
             (int)(sStack_18._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return __os;
}



----------------------------------------

// Function: endl<char,_std::char_traits<char>_> @ 089bd8a4

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: endl<char, std::char_traits<char> > */

basic_ostream<char,std::char_traits<char>_> *
std::endl<char,_std::char_traits<char>_>(basic_ostream<char,std::char_traits<char>_> *__os)

{
  char __c;
  basic_ostream<char,std::char_traits<char>_> *pbVar1;
  
  __c = basic_ios<char,std::char_traits<char>_>::widen
                  ((basic_ios<char,std::char_traits<char>_> *)
                   ((int)&__os->_vptr_basic_ostream + (int)__os->_vptr_basic_ostream[-3]),'\n');
  pbVar1 = basic_ostream<char,std::char_traits<char>_>::put(__os,__c);
  pbVar1 = flush<char,_std::char_traits<char>_>(pbVar1);
  return pbVar1;
}



----------------------------------------

// Function: operator<< @ 089bd8e8

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * __sbin) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sbin)

{
  bool bVar1;
  streamsize sVar2;
  uint uVar3;
  undefined3 extraout_var;
  int iVar4;
  _Ios_Iostate _Var5;
  basic_ios<char,std::char_traits<char>_> *pbVar6;
  sentry local_18;
  
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_18,this);
  if (local_18._M_ok == false) {
    if (__sbin != (basic_streambuf<char,std::char_traits<char>_> *)0x0) {
LAB_089bd940:
      uVar3 = *(uint *)(&(local_18._M_os)->field_0xc +
                       (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
      goto joined_r0x089bd9ac;
    }
LAB_089bd978:
    _Var5 = _S_badbit;
  }
  else {
    if (__sbin == (basic_streambuf<char,std::char_traits<char>_> *)0x0) goto LAB_089bd978;
                    /* try { // try from 089bd92c to 089bd933 has its CatchHandler @ 089bda4c */
    sVar2 = __copy_streambufs<char,_std::char_traits<char>_>
                      (__sbin,*(basic_streambuf<char,std::char_traits<char>_> **)
                               (&this->field_0x78 + (int)this->_vptr_basic_ostream[-3]));
    _Var5 = _S_failbit;
    if (sVar2 != 0) goto LAB_089bd940;
  }
  pbVar6 = (basic_ios<char,std::char_traits<char>_> *)
           ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bd98c to 089bd993 has its CatchHandler @ 089bda20 */
  basic_ios<char,std::char_traits<char>_>::clear
            (pbVar6,_Var5 | (pbVar6->super_ios_base)._M_streambuf_state);
  uVar3 = *(uint *)(&(local_18._M_os)->field_0xc + (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
joined_r0x089bd9ac:
  if (((((uVar3 & 0x2000) != 0) && (bVar1 = uncaught_exception(), CONCAT31(extraout_var,bVar1) == 0)
       ) && (*(int **)(&(local_18._M_os)->field_0x78 +
                      (int)(local_18._M_os)->_vptr_basic_ostream[-3]) != (int *)0x0)) &&
     (iVar4 = (**(code **)(**(int **)(&(local_18._M_os)->field_0x78 +
                                     (int)(local_18._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar4 == -1)) {
    pbVar6 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_18._M_os)->_vptr_basic_ostream +
             (int)(local_18._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar6,(pbVar6->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bdb04

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, ulonglong __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,ulonglong __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_38;
  undefined1 local_34;
  sentry local_30;
  int local_28;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_30,this);
  if (local_30._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bdc98 to 089bdc9f has its CatchHandler @ 089bdca0 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bdb70 to 089bdbb3 has its CatchHandler @ 089bdca0 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_34 = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_38 = pbVar6;
    local_28 = (*(pnVar5->super_facet)._vptr_facet[6])(pnVar5,&local_38,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bdbe0 to 089bdbe7 has its CatchHandler @ 089bdcdc */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_30._M_os)->field_0xc + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_30._M_os)->field_0x78 + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_30._M_os)->field_0x78 +
                                     (int)(local_30._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_30._M_os)->_vptr_basic_ostream +
             (int)(local_30._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bdd84

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, longlong __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,longlong __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_38;
  undefined1 local_34;
  sentry local_30;
  int local_28;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_30,this);
  if (local_30._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bdf18 to 089bdf1f has its CatchHandler @ 089bdf20 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bddf0 to 089bde33 has its CatchHandler @ 089bdf20 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_34 = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_38 = pbVar6;
    local_28 = (*(pnVar5->super_facet)._vptr_facet[5])(pnVar5,&local_38,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bde60 to 089bde67 has its CatchHandler @ 089bdf5c */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_30._M_os)->field_0xc + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_30._M_os)->field_0x78 + (int)(local_30._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_30._M_os)->field_0x78 +
                                     (int)(local_30._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_30._M_os)->_vptr_basic_ostream +
             (int)(local_30._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089be004

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, uint __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,uint __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089be188 to 089be18f has its CatchHandler @ 089be190 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089be068 to 089be0a7 has its CatchHandler @ 089be190 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[4])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089be0d4 to 089be0db has its CatchHandler @ 089be1cc */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089be274

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, int __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,int __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: long __l@[???]
                       Unresolved local var: _Ios_Fmtflags __fmt@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089be3f8 to 089be3ff has its CatchHandler @ 089be400 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089be2d8 to 089be317 has its CatchHandler @ 089be400 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[3])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089be344 to 089be34b has its CatchHandler @ 089be43c */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089be4e4

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, ushort __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,ushort __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089be668 to 089be66f has its CatchHandler @ 089be670 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089be548 to 089be587 has its CatchHandler @ 089be670 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[4])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089be5b4 to 089be5bb has its CatchHandler @ 089be6ac */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089be754

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, short __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,short __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: long __l@[???]
                       Unresolved local var: _Ios_Fmtflags __fmt@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089be900 to 089be907 has its CatchHandler @ 089be908 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089be7d8 to 089be817 has its CatchHandler @ 089be908 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[3])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089be844 to 089be84b has its CatchHandler @ 089be944 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089be9ec

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, bool __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,bool __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089beb70 to 089beb77 has its CatchHandler @ 089beb78 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bea50 to 089bea8f has its CatchHandler @ 089beb78 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[2])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089beabc to 089beac3 has its CatchHandler @ 089bebb4 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089bec5c

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, ulong __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,ulong __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bede0 to 089bede7 has its CatchHandler @ 089bede8 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089becc0 to 089becff has its CatchHandler @ 089bede8 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[4])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bed2c to 089bed33 has its CatchHandler @ 089bee24 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: operator<< @ 089beecc

/* DWARF original prototype: basic_ostream<char,std::char_traits<char>_> *
   operator<<(basic_ostream<char,std::char_traits<char>_> * this, long __n) */

basic_ostream<char,std::char_traits<char>_> * __thiscall
std::basic_ostream<char,std::char_traits<char>_>::operator<<
          (basic_ostream<char,std::char_traits<char>_> *this,long __n)

{
  char cVar1;
  bool bVar2;
  undefined3 extraout_var;
  int iVar3;
  char extraout_v1;
  basic_ios<char,std::char_traits<char>_> *pbVar4;
  num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *pnVar5;
  basic_streambuf<char,std::char_traits<char>_> *pbVar6;
  basic_streambuf<char,std::char_traits<char>_> *local_30;
  undefined1 local_2c;
  sentry local_28;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  sentry::sentry(&local_28,this);
  if (local_28._M_ok != false) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var:
                       num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *
                       __np@[???] */
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
    pnVar5 = pbVar4->_M_num_put;
    if (pnVar5 == (num_put<char,std::ostreambuf_iterator<char,_std::char_traits<char>_>_> *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089bf050 to 089bf057 has its CatchHandler @ 089bf058 */
      __throw_bad_cast();
    }
    pbVar6 = pbVar4->_M_streambuf;
    if (pbVar4->_M_fill_init == false) {
                    /* try { // try from 089bef30 to 089bef6f has its CatchHandler @ 089bf058 */
      cVar1 = basic_ios<char,std::char_traits<char>_>::widen(pbVar4,' ');
      pbVar4->_M_fill = cVar1;
      pbVar4->_M_fill_init = true;
    }
    local_2c = pbVar6 == (basic_streambuf<char,std::char_traits<char>_> *)0x0;
    local_30 = pbVar6;
    local_20 = (*(pnVar5->super_facet)._vptr_facet[3])(pnVar5,&local_30,pbVar4,(int)pbVar4->_M_fill)
    ;
    if (extraout_v1 != '\0') {
      pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
               ((int)&this->_vptr_basic_ostream + (int)this->_vptr_basic_ostream[-3]);
                    /* try { // try from 089bef9c to 089befa3 has its CatchHandler @ 089bf094 */
      basic_ios<char,std::char_traits<char>_>::clear
                (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
    }
  }
  if (((((*(uint *)(&(local_28._M_os)->field_0xc + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) &
         0x2000) != 0) && (bVar2 = uncaught_exception(), CONCAT31(extraout_var,bVar2) == 0)) &&
      (*(int **)(&(local_28._M_os)->field_0x78 + (int)(local_28._M_os)->_vptr_basic_ostream[-3]) !=
       (int *)0x0)) &&
     (iVar3 = (**(code **)(**(int **)(&(local_28._M_os)->field_0x78 +
                                     (int)(local_28._M_os)->_vptr_basic_ostream[-3]) + 0x18))(),
     iVar3 == -1)) {
    pbVar4 = (basic_ios<char,std::char_traits<char>_> *)
             ((int)&(local_28._M_os)->_vptr_basic_ostream +
             (int)(local_28._M_os)->_vptr_basic_ostream[-3]);
    basic_ios<char,std::char_traits<char>_>::clear
              (pbVar4,(pbVar4->super_ios_base)._M_streambuf_state | _S_badbit);
  }
  return this;
}



----------------------------------------

// Function: pubsetbuf @ 089bf13c

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   pubsetbuf(basic_streambuf<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pubsetbuf
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  basic_streambuf<char,std::char_traits<char>_> *pbVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089bf144. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  pbVar1 = (basic_streambuf<char,std::char_traits<char>_> *)(*this->_vptr_basic_streambuf[3])();
  return pbVar1;
}



----------------------------------------

// Function: pubseekoff @ 089bf14c

/* DWARF original prototype: streampos pubseekoff(basic_streambuf<char,std::char_traits<char>_> *
   this, streamoff __off, _Ios_Seekdir __way, _Ios_Openmode __mode) */

streampos * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pubseekoff
          (streampos *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this,
          streamoff __off,_Ios_Seekdir __way,_Ios_Openmode __mode)

{
  (*this->_vptr_basic_streambuf[4])
            (__return_storage_ptr__,this,(int)__off,(int)((ulonglong)__off >> 0x20));
  return __return_storage_ptr__;
}



----------------------------------------

// Function: pubseekpos @ 089bf17c

/* DWARF original prototype: streampos pubseekpos(basic_streambuf<char,std::char_traits<char>_> *
   this, streampos __sp, _Ios_Openmode __mode) */

streampos * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pubseekpos
          (streampos *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this,
          streampos __sp,_Ios_Openmode __mode)

{
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  
  local_1c = ((undefined4 *)__sp._M_off)[3];
  local_28 = *(undefined4 *)__sp._M_off;
  local_24 = ((undefined4 *)__sp._M_off)[1];
  local_20 = ((undefined4 *)__sp._M_off)[2];
  local_18 = local_28;
  local_14 = local_24;
  local_10 = local_20;
  local_c = local_1c;
  (*this->_vptr_basic_streambuf[5])(__return_storage_ptr__,this,&local_28,__sp._M_off._4_4_);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: pubsync @ 089bf1e0

/* DWARF original prototype: int pubsync(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pubsync
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089bf1e8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[6])();
  return iVar1;
}



----------------------------------------

// Function: sgetn @ 089bf1f0

/* DWARF original prototype: streamsize sgetn(basic_streambuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sgetn
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089bf1f8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[8])();
  return iVar1;
}



----------------------------------------

// Function: sputn @ 089bf200

/* DWARF original prototype: streamsize sputn(basic_streambuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sputn
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  
                    /* WARNING: Could not recover jumptable at 0x089bf208. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[0xc])();
  return iVar1;
}



----------------------------------------

// Function: eback @ 089bf210

/* DWARF original prototype: char * eback(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::eback
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_in_beg;
}



----------------------------------------

// Function: gptr @ 089bf218

/* DWARF original prototype: char * gptr(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::gptr
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_in_cur;
}



----------------------------------------

// Function: egptr @ 089bf220

/* DWARF original prototype: char * egptr(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::egptr
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_in_end;
}



----------------------------------------

// Function: gbump @ 089bf228

/* DWARF original prototype: void gbump(basic_streambuf<char,std::char_traits<char>_> * this, int
   __n) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::gbump
          (basic_streambuf<char,std::char_traits<char>_> *this,int __n)

{
  this->_M_in_cur = this->_M_in_cur + __n;
  return;
}



----------------------------------------

// Function: setg @ 089bf238

/* DWARF original prototype: void setg(basic_streambuf<char,std::char_traits<char>_> * this, char *
   __gbeg, char * __gnext, char * __gend) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::setg
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__gbeg,char *__gnext,
          char *__gend)

{
  this->_M_in_end = __gend;
  this->_M_in_beg = __gbeg;
  this->_M_in_cur = __gnext;
  return;
}



----------------------------------------

// Function: pbase @ 089bf248

/* DWARF original prototype: char * pbase(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pbase
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_out_beg;
}



----------------------------------------

// Function: pptr @ 089bf250

/* DWARF original prototype: char * pptr(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pptr
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_out_cur;
}



----------------------------------------

// Function: epptr @ 089bf258

/* DWARF original prototype: char * epptr(basic_streambuf<char,std::char_traits<char>_> * this) */

char * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::epptr
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return this->_M_out_end;
}



----------------------------------------

// Function: pbump @ 089bf260

/* DWARF original prototype: void pbump(basic_streambuf<char,std::char_traits<char>_> * this, int
   __n) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pbump
          (basic_streambuf<char,std::char_traits<char>_> *this,int __n)

{
  this->_M_out_cur = this->_M_out_cur + __n;
  return;
}



----------------------------------------

// Function: setp @ 089bf270

/* DWARF original prototype: void setp(basic_streambuf<char,std::char_traits<char>_> * this, char *
   __pbeg, char * __pend) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::setp
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__pbeg,char *__pend)

{
  this->_M_out_end = __pend;
  this->_M_out_beg = __pbeg;
  this->_M_out_cur = __pbeg;
  return;
}



----------------------------------------

// Function: imbue @ 089bf280

/* DWARF original prototype: void imbue(basic_streambuf<char,std::char_traits<char>_> * this, locale
   * param_1) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::imbue
          (basic_streambuf<char,std::char_traits<char>_> *this,locale *param_1)

{
  return;
}



----------------------------------------

// Function: setbuf @ 089bf288

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   setbuf(basic_streambuf<char,std::char_traits<char>_> * this, char * param_1, streamsize param_2)
    */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::setbuf
          (basic_streambuf<char,std::char_traits<char>_> *this,char *param_1,streamsize param_2)

{
  return this;
}



----------------------------------------

// Function: sync @ 089bf290

/* DWARF original prototype: int sync(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sync
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return 0;
}



----------------------------------------

// Function: showmanyc @ 089bf298

/* DWARF original prototype: streamsize showmanyc(basic_streambuf<char,std::char_traits<char>_> *
   this) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::showmanyc
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return 0;
}



----------------------------------------

// Function: operator= @ 089bf2a0

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   operator=(basic_streambuf<char,std::char_traits<char>_> * this,
   basic_streambuf<char,std::char_traits<char>_> * param_1) */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::operator=
          (basic_streambuf<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *param_1)

{
  return this;
}



----------------------------------------

// Function: seekpos @ 089bf2a8

/* DWARF original prototype: streampos seekpos(basic_streambuf<char,std::char_traits<char>_> * this,
   streampos param_1, _Ios_Openmode param_2) */

streampos * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::seekpos
          (streampos *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this,
          streampos param_1,_Ios_Openmode param_2)

{
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  return __return_storage_ptr__;
}



----------------------------------------

// Function: basic_streambuf @ 089bf2d0

/* DWARF original prototype: void basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  char *pcVar4;
  char *pcVar5;
  
  pcVar5 = __sb->_M_in_beg;
  pcVar1 = __sb->_M_in_cur;
  this->_M_out_cur = __sb->_M_out_cur;
  pcVar2 = __sb->_M_in_end;
  pcVar3 = __sb->_M_out_beg;
  pcVar4 = __sb->_M_out_cur;
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  this->_M_in_beg = pcVar5;
  this->_M_in_cur = pcVar1;
  this->_M_in_end = pcVar2;
  this->_M_out_beg = pcVar3;
  this->_M_out_end = pcVar4;
  locale::locale(&this->_M_buf_locale,&__sb->_M_buf_locale);
  return;
}



----------------------------------------

// Function: basic_streambuf @ 089bf318

/* DWARF original prototype: void basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this, basic_streambuf<char,std::char_traits<char>_> * __sb) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  char *pcVar4;
  char *pcVar5;
  
  pcVar5 = __sb->_M_in_beg;
  pcVar1 = __sb->_M_in_cur;
  this->_M_out_cur = __sb->_M_out_cur;
  pcVar2 = __sb->_M_in_end;
  pcVar3 = __sb->_M_out_beg;
  pcVar4 = __sb->_M_out_cur;
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  this->_M_in_beg = pcVar5;
  this->_M_in_cur = pcVar1;
  this->_M_in_end = pcVar2;
  this->_M_out_beg = pcVar3;
  this->_M_out_end = pcVar4;
  locale::locale(&this->_M_buf_locale,&__sb->_M_buf_locale);
  return;
}



----------------------------------------

// Function: getloc @ 089bf360

/* DWARF original prototype: locale getloc(basic_streambuf<char,std::char_traits<char>_> * this) */

locale * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::getloc
          (locale *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this)

{
  locale::locale(__return_storage_ptr__,&this->_M_buf_locale);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: basic_streambuf @ 089bf38c

/* DWARF original prototype: void basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  this->_M_in_beg = (char *)0x0;
  this->_M_in_cur = (char *)0x0;
  this->_M_in_end = (char *)0x0;
  this->_M_out_beg = (char *)0x0;
  this->_M_out_cur = (char *)0x0;
  this->_M_out_end = (char *)0x0;
  locale::locale(&this->_M_buf_locale);
  return;
}



----------------------------------------

// Function: basic_streambuf @ 089bf3b8

/* DWARF original prototype: void basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  this->_M_in_beg = (char *)0x0;
  this->_M_in_cur = (char *)0x0;
  this->_M_in_end = (char *)0x0;
  this->_M_out_beg = (char *)0x0;
  this->_M_out_cur = (char *)0x0;
  this->_M_out_end = (char *)0x0;
  locale::locale(&this->_M_buf_locale);
  return;
}



----------------------------------------

// Function: ~basic_streambuf @ 089bf3e4

/* DWARF original prototype: void ~basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this, int __in_chrg) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::~basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&this->_M_buf_locale,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~basic_streambuf @ 089bf41c

/* DWARF original prototype: void ~basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this, int __in_chrg) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::~basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&this->_M_buf_locale,__in_chrg);
  return;
}



----------------------------------------

// Function: ~basic_streambuf @ 089bf430

/* DWARF original prototype: void ~basic_streambuf(basic_streambuf<char,std::char_traits<char>_> *
   this, int __in_chrg) */

void __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::~basic_streambuf
          (basic_streambuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  this->_vptr_basic_streambuf = (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&this->_M_buf_locale,__in_chrg);
  return;
}



----------------------------------------

// Function: overflow @ 089bf444

/* DWARF original prototype: int overflow(basic_streambuf<char,std::char_traits<char>_> * this, int
   param_1) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::overflow
          (basic_streambuf<char,std::char_traits<char>_> *this,int param_1)

{
  return -1;
}



----------------------------------------

// Function: pbackfail @ 089bf44c

/* DWARF original prototype: int pbackfail(basic_streambuf<char,std::char_traits<char>_> * this, int
   param_1) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pbackfail
          (basic_streambuf<char,std::char_traits<char>_> *this,int param_1)

{
  return -1;
}



----------------------------------------

// Function: underflow @ 089bf454

/* DWARF original prototype: int underflow(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::underflow
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  return -1;
}



----------------------------------------

// Function: uflow @ 089bf45c

/* DWARF original prototype: int uflow(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::uflow
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  uint uVar2;
  
                    /* Unresolved local var: int __ret@[DW_OP_reg4(a0)]
                       Unresolved local var: bool __testeof@[???] */
  iVar1 = (*this->_vptr_basic_streambuf[9])();
  uVar2 = 0xffffffff;
  if (iVar1 != -1) {
    uVar2 = (uint)(byte)*this->_M_in_cur;
    this->_M_in_cur = this->_M_in_cur + 1;
  }
  return uVar2;
}



----------------------------------------

// Function: sgetc @ 089bf4a8

/* DWARF original prototype: int sgetc(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sgetc
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
                    /* Unresolved local var: int __ret@[???] */
  if (this->_M_in_end <= this->_M_in_cur) {
                    /* WARNING: Could not recover jumptable at 0x089bf4c8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    iVar1 = (*this->_vptr_basic_streambuf[9])();
    return iVar1;
  }
  return (uint)(byte)*this->_M_in_cur;
}



----------------------------------------

// Function: sbumpc @ 089bf4d0

/* DWARF original prototype: int sbumpc(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sbumpc
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  byte bVar1;
  int iVar2;
  byte *pbVar3;
  
                    /* Unresolved local var: int __ret@[???] */
  pbVar3 = (byte *)this->_M_in_cur;
  if (pbVar3 < this->_M_in_end) {
    bVar1 = *pbVar3;
    this->_M_in_cur = (char *)(pbVar3 + 1);
    return (uint)bVar1;
  }
                    /* WARNING: Could not recover jumptable at 0x089bf4f8. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar2 = (*this->_vptr_basic_streambuf[10])();
  return iVar2;
}



----------------------------------------

// Function: in_avail @ 089bf500

/* DWARF original prototype: streamsize in_avail(basic_streambuf<char,std::char_traits<char>_> *
   this) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::in_avail
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  iVar1 = (int)this->_M_in_end - (int)this->_M_in_cur;
  if (iVar1 == 0) {
                    /* WARNING: Could not recover jumptable at 0x089bf520. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    iVar1 = (*this->_vptr_basic_streambuf[7])();
    return iVar1;
  }
  return iVar1;
}



----------------------------------------

// Function: sungetc @ 089bf528

/* DWARF original prototype: int sungetc(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sungetc
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  char *pcVar2;
  
                    /* Unresolved local var: int __ret@[???] */
  pcVar2 = this->_M_in_cur;
  if (this->_M_in_beg < pcVar2) {
    this->_M_in_cur = pcVar2 + -1;
    return (uint)(byte)pcVar2[-1];
  }
                    /* WARNING: Could not recover jumptable at 0x089bf554. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[0xb])(this,0xffffffff);
  return iVar1;
}



----------------------------------------

// Function: sputbackc @ 089bf55c

/* DWARF original prototype: int sputbackc(basic_streambuf<char,std::char_traits<char>_> * this,
   char __c) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sputbackc
          (basic_streambuf<char,std::char_traits<char>_> *this,char __c)

{
  int iVar1;
  char *pcVar2;
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: bool __testpos@[???] */
  pcVar2 = this->_M_in_cur;
  if ((this->_M_in_beg < pcVar2) && (pcVar2[-1] == __c)) {
    this->_M_in_cur = pcVar2 + -1;
    return (uint)(byte)pcVar2[-1];
  }
                    /* WARNING: Could not recover jumptable at 0x089bf598. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[0xb])(this,(uint)(byte)__c);
  return iVar1;
}



----------------------------------------

// Function: seekoff @ 089bf5a0

/* DWARF original prototype: streampos seekoff(basic_streambuf<char,std::char_traits<char>_> * this,
   streamoff param_1, _Ios_Seekdir param_2, _Ios_Openmode param_3) */

streampos * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::seekoff
          (streampos *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this,
          streamoff param_1,_Ios_Seekdir param_2,_Ios_Openmode param_3)

{
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  return __return_storage_ptr__;
}



----------------------------------------

// Function: sputc @ 089bf5c8

/* DWARF original prototype: int sputc(basic_streambuf<char,std::char_traits<char>_> * this, char
   __c) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::sputc
          (basic_streambuf<char,std::char_traits<char>_> *this,char __c)

{
  int iVar1;
  
                    /* Unresolved local var: int __ret@[???] */
  if (this->_M_out_cur < this->_M_out_end) {
    *this->_M_out_cur = __c;
    this->_M_out_cur = this->_M_out_cur + 1;
    return (uint)(byte)__c;
  }
                    /* WARNING: Could not recover jumptable at 0x089bf600. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  iVar1 = (*this->_vptr_basic_streambuf[0xd])(this,(uint)(byte)__c);
  return iVar1;
}



----------------------------------------

// Function: xsputn @ 089bf608

/* DWARF original prototype: streamsize xsputn(basic_streambuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::xsputn
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  byte bVar1;
  int iVar2;
  char *dst0;
  size_t *psVar3;
  size_t len0;
  int iVar4;
  size_t local_28;
  size_t local_24;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  if (__n < 1) {
    return 0;
  }
  iVar4 = 0;
                    /* Unresolved local var: streamsize __buf_len@[???] */
  dst0 = this->_M_out_cur;
  while( true ) {
                    /* Unresolved local var: streamsize __remaining@[???]
                       Unresolved local var: streamsize __len@[???] */
    local_28 = (int)this->_M_out_end - (int)dst0;
    if (local_28 != 0) {
      local_24 = __n - iVar4;
      psVar3 = &local_24;
      if ((int)local_28 <= __n - iVar4) {
        psVar3 = &local_28;
      }
      len0 = *psVar3;
      memcpy(dst0,__s,len0);
      iVar4 = iVar4 + len0;
      this->_M_out_cur = this->_M_out_cur + len0;
      if (__n <= iVar4) {
        return iVar4;
      }
      __s = __s + len0;
    }
                    /* Unresolved local var: int __c@[???] */
    bVar1 = *__s;
    __s = __s + 1;
    iVar2 = (*this->_vptr_basic_streambuf[0xd])(this,(uint)bVar1);
    if (iVar2 == -1) {
      return iVar4;
    }
    iVar4 = iVar4 + 1;
    if (__n <= iVar4) break;
    dst0 = this->_M_out_cur;
  }
  return iVar4;
}



----------------------------------------

// Function: xsgetn @ 089bf6f8

/* DWARF original prototype: streamsize xsgetn(basic_streambuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::xsgetn
          (basic_streambuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  size_t *psVar2;
  size_t len0;
  int iVar3;
  size_t local_28;
  size_t local_24;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  if (__n < 1) {
    iVar3 = 0;
  }
  else {
    iVar3 = 0;
    do {
                    /* Unresolved local var: streamsize __buf_len@[???] */
                    /* Unresolved local var: streamsize __remaining@[???]
                       Unresolved local var: streamsize __len@[???] */
      local_28 = (int)this->_M_in_end - (int)this->_M_in_cur;
      if (local_28 != 0) {
        local_24 = __n - iVar3;
        psVar2 = &local_24;
        if ((int)local_28 <= __n - iVar3) {
          psVar2 = &local_28;
        }
        len0 = *psVar2;
        memcpy(__s,this->_M_in_cur,len0);
        iVar3 = iVar3 + len0;
        this->_M_in_cur = this->_M_in_cur + len0;
        if (__n <= iVar3) {
          return iVar3;
        }
        __s = __s + len0;
      }
                    /* Unresolved local var: int __c@[???] */
      iVar1 = (*this->_vptr_basic_streambuf[10])(this);
      if (iVar1 == -1) {
        return iVar3;
      }
      iVar3 = iVar3 + 1;
      *__s = (char)iVar1;
      __s = __s + 1;
    } while (iVar3 < __n);
  }
  return iVar3;
}



----------------------------------------

// Function: pubimbue @ 089bf7e4

/* DWARF original prototype: locale pubimbue(basic_streambuf<char,std::char_traits<char>_> * this,
   locale * __loc) */

locale * __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::pubimbue
          (locale *__return_storage_ptr__,basic_streambuf<char,std::char_traits<char>_> *this,
          locale *__loc)

{
                    /* Unresolved local var: locale * __tmp@[DW_OP_reg19(s3)]
                       Unresolved local var: locale __tmp@[???] */
  locale::locale(__return_storage_ptr__,&this->_M_buf_locale);
                    /* try { // try from 089bf820 to 089bf827 has its CatchHandler @ 089bf854 */
  (*this->_vptr_basic_streambuf[2])(this,__loc);
  locale::operator=(&this->_M_buf_locale,__loc);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: snextc @ 089bf868

/* DWARF original prototype: int snextc(basic_streambuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_streambuf<char,std::char_traits<char>_>::snextc
          (basic_streambuf<char,std::char_traits<char>_> *this)

{
  uint uVar1;
  int iVar2;
  byte *pbVar3;
  uint uVar4;
  
                    /* Unresolved local var: int __ret@[???] */
                    /* Unresolved local var: int __ret@[???] */
  pbVar3 = (byte *)this->_M_in_cur;
  if (pbVar3 < this->_M_in_end) {
    uVar1 = (uint)*pbVar3;
    this->_M_in_cur = (char *)(pbVar3 + 1);
  }
  else {
    uVar1 = (*this->_vptr_basic_streambuf[10])();
  }
  uVar4 = 0xffffffff;
  if (uVar1 != 0xffffffff) {
                    /* Unresolved local var: int __ret@[???] */
    if (this->_M_in_end <= this->_M_in_cur) {
                    /* WARNING: Could not recover jumptable at 0x089bf8f4. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      iVar2 = (*this->_vptr_basic_streambuf[9])(this);
      return iVar2;
    }
    uVar4 = (uint)(byte)*this->_M_in_cur;
  }
  return uVar4;
}



----------------------------------------

// Function: __copy_streambufs<char,_std::char_traits<char>_> @ 089bf8fc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: __copy_streambufs<char, std::char_traits<char> > */

streamsize
std::__copy_streambufs<char,_std::char_traits<char>_>
          (basic_streambuf<char,std::char_traits<char>_> *__sbin,
          basic_streambuf<char,std::char_traits<char>_> *__sbout)

{
  int iVar1;
  byte *pbVar2;
  uint uVar3;
  char *pcVar4;
  int iVar5;
  int iVar6;
  
                    /* Unresolved local var: streamsize __ret@[???]
                       Unresolved local var: int __c@[???] */
                    /* Unresolved local var: int __ret@[???] */
  if (__sbin->_M_in_cur < __sbin->_M_in_end) {
    uVar3 = (uint)(byte)*__sbin->_M_in_cur;
    iVar6 = 0;
  }
  else {
    iVar6 = 0;
    uVar3 = (*__sbin->_vptr_basic_streambuf[9])();
  }
  do {
    if (uVar3 == 0xffffffff) {
      return iVar6;
    }
                    /* Unresolved local var: streamsize __n@[???] */
    pcVar4 = __sbin->_M_in_cur;
    while (iVar5 = (int)__sbin->_M_in_end - (int)pcVar4, 1 < iVar5) {
                    /* Unresolved local var: streamsize __wrote@[???] */
      iVar1 = (*__sbout->_vptr_basic_streambuf[0xc])(__sbout,pcVar4,iVar5);
      iVar6 = iVar6 + iVar1;
      __sbin->_M_in_cur = __sbin->_M_in_cur + iVar1;
      if (iVar1 < iVar5) {
        return iVar6;
      }
      uVar3 = (*__sbin->_vptr_basic_streambuf[9])(__sbin);
      if (uVar3 == 0xffffffff) {
        return iVar6;
      }
      pcVar4 = __sbin->_M_in_cur;
    }
                    /* Unresolved local var: int __ret@[???] */
    if (__sbout->_M_out_cur < __sbout->_M_out_end) {
      *__sbout->_M_out_cur = (char)uVar3;
      uVar3 = uVar3 & 0xff;
      __sbout->_M_out_cur = __sbout->_M_out_cur + 1;
    }
    else {
      uVar3 = (*__sbout->_vptr_basic_streambuf[0xd])(__sbout,uVar3 & 0xff);
    }
    if (uVar3 == 0xffffffff) {
      return iVar6;
    }
                    /* Unresolved local var: int __ret@[???] */
    pbVar2 = (byte *)__sbin->_M_in_cur;
    if (pbVar2 < __sbin->_M_in_end) {
      uVar3 = (uint)*pbVar2;
      __sbin->_M_in_cur = (char *)(pbVar2 + 1);
    }
    else {
      uVar3 = (*__sbin->_vptr_basic_streambuf[10])(__sbin);
    }
    if (uVar3 == 0xffffffff) {
      iVar6 = iVar6 + 1;
      uVar3 = 0xffffffff;
    }
    else {
                    /* Unresolved local var: int __ret@[???] */
      if (__sbin->_M_in_cur < __sbin->_M_in_end) {
        uVar3 = (uint)(byte)*__sbin->_M_in_cur;
        iVar6 = iVar6 + 1;
      }
      else {
        iVar6 = iVar6 + 1;
        uVar3 = (*__sbin->_vptr_basic_streambuf[9])(__sbin);
      }
    }
  } while( true );
}



----------------------------------------

// Function: eq @ 089bfab4

bool std::char_traits<char>::eq(char *__c1,char *__c2)

{
  return *__c1 == *__c2;
}



----------------------------------------

// Function: _M_data @ 089bfac8

/* DWARF original prototype: char *
   _M_data(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_data
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (this->_M_dataplus)._M_p;
}



----------------------------------------

// Function: _M_data @ 089bfad0

/* DWARF original prototype: char *
   _M_data(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __p) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_data
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__p)

{
  (this->_M_dataplus)._M_p = __p;
  return __p;
}



----------------------------------------

// Function: _S_empty_rep @ 089bfadc

_Rep * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_empty_rep(void)

{
  return (_Rep *)_Rep::_S_empty_rep_storage;
}



----------------------------------------

// Function: max_size @ 089bfae8

/* DWARF original prototype: size_t
   max_size(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::max_size
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return 0x3ffffffc;
}



----------------------------------------

// Function: data @ 089bfaf4

/* DWARF original prototype: char *
   data(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::data
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (this->_M_dataplus)._M_p;
}



----------------------------------------

// Function: _Alloc_hider @ 089bfafc

/* DWARF original prototype: void _Alloc_hider(_Alloc_hider * this, char * __dat, allocator<char> *
   __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Alloc_hider::_Alloc_hider
          (_Alloc_hider *this,char *__dat,allocator<char> *__a)

{
  this->_M_p = __dat;
  return;
}



----------------------------------------

// Function: _S_empty_rep @ 089bfb04

_Rep * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_empty_rep
                 (void)

{
                    /* Unresolved local var: void * __p@[???] */
  return (_Rep *)_S_empty_rep_storage;
}



----------------------------------------

// Function: _M_is_leaked @ 089bfb10

/* DWARF original prototype: bool _M_is_leaked(_Rep * this) */

bool __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_is_leaked(_Rep *this)

{
  return SUB41((uint)(this->super__Rep_base)._M_refcount >> 0x1f,0);
}



----------------------------------------

// Function: _M_is_shared @ 089bfb1c

/* DWARF original prototype: bool _M_is_shared(_Rep * this) */

bool __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_is_shared(_Rep *this)

{
  return 0 < (this->super__Rep_base)._M_refcount;
}



----------------------------------------

// Function: _M_set_leaked @ 089bfb28

/* DWARF original prototype: void _M_set_leaked(_Rep * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_set_leaked
          (_Rep *this)

{
  (this->super__Rep_base)._M_refcount = -1;
  return;
}



----------------------------------------

// Function: _M_set_sharable @ 089bfb34

/* DWARF original prototype: void _M_set_sharable(_Rep * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_set_sharable
          (_Rep *this)

{
  (this->super__Rep_base)._M_refcount = 0;
  return;
}



----------------------------------------

// Function: _M_refdata @ 089bfb3c

/* DWARF original prototype: char * _M_refdata(_Rep * this) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_refdata(_Rep *this)

{
  return (char *)(this + 1);
}



----------------------------------------

// Function: search<const_char*,_const_char*,_bool_(*)(const_char&,_const_char&)> @ 089bfb44

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: search<const char*, const char*, bool (*)(const char&, const char&)> */

char * std::search<const_char*,_const_char*,_bool_(*)(const_char&,_const_char&)>
                 (char *__first1,char *__last1,char *__first2,char *__last2,
                 _func_bool_char_ptr_char_ptr *__predicate)

{
  bool bVar1;
  char *pcVar2;
  int iVar3;
  char *pcVar4;
  code *in_t0;
  char *pcVar5;
  char *pcVar6;
  char *pcVar7;
  char *local_38;
  
                    /* Unresolved local var: char * __tmp@[???]
                       Unresolved local var: char * __p1@[???]
                       Unresolved local var: char * __p@[???]
                       Unresolved local var: char * __current@[???] */
  if ((__first1 != __last1) && (pcVar6 = __first2 + 1, __first2 != __last2)) {
    pcVar5 = __first1;
    if (__last2 == pcVar6) {
      while (iVar3 = (*in_t0)(__first1,__first2), iVar3 == 0) {
        __first1 = __first1 + 1;
        if (__first1 == __last1) {
          return __first1;
        }
      }
    }
    else {
      do {
        while (iVar3 = (*in_t0)(pcVar5,__first2), pcVar2 = pcVar5, iVar3 != 0) {
          while( true ) {
            if (__last1 == pcVar2) {
              return __last1;
            }
            iVar3 = (*in_t0)(pcVar2,__first2);
            if (iVar3 != 0) break;
            pcVar2 = pcVar2 + 1;
          }
          pcVar5 = pcVar2 + 1;
          if (__last1 == pcVar5) {
            return pcVar5;
          }
          pcVar4 = (char *)0x0;
          pcVar7 = pcVar5;
          local_38 = pcVar6;
          while( true ) {
            iVar3 = (*in_t0)(pcVar7,local_38);
            local_38 = local_38 + 1;
            pcVar7 = pcVar7 + 1;
            if (iVar3 == 0) break;
            bVar1 = pcVar4 == __last2 + (-1 - (int)pcVar6);
            pcVar4 = pcVar4 + 1;
            if (bVar1) {
              return pcVar2;
            }
            if (pcVar4 == __last1 + -(int)pcVar5) {
              return pcVar7;
            }
          }
        }
        pcVar5 = pcVar5 + 1;
        __first1 = __last1;
      } while (pcVar5 != __last1);
    }
  }
  return __first1;
}



----------------------------------------

// Function: _Alloc_hider @ 089bfce0

/* DWARF original prototype: void _Alloc_hider(_Alloc_hider * this, char * __dat, allocator<char> *
   __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Alloc_hider::_Alloc_hider
          (_Alloc_hider *this,char *__dat,allocator<char> *__a)

{
  this->_M_p = __dat;
  return;
}



----------------------------------------

// Function: get_allocator @ 089bfce8

/* DWARF original prototype: allocator<char>
   get_allocator(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

allocator<char> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::get_allocator
          (allocator<char> *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return __return_storage_ptr__;
}



----------------------------------------

// Function: _M_copy @ 089bfcf0

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_copy
               (char *__d,char *__s,size_t __n)

{
  if (__n == 1) {
    *__d = *__s;
    return;
  }
  memcpy(__d,__s,__n);
  return;
}



----------------------------------------

// Function: _M_rep @ 089bfd0c

/* DWARF original prototype: _Rep *
   _M_rep(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

_Rep * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_rep
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (_Rep *)((this->_M_dataplus)._M_p + -0xc);
}



----------------------------------------

// Function: c_str @ 089bfd18

/* DWARF original prototype: char *
   c_str(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::c_str
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (this->_M_dataplus)._M_p;
}



----------------------------------------

// Function: operator[] @ 089bfd20

/* DWARF original prototype: char *
   operator[](basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos)
    */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator[]
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos)

{
  return (this->_M_dataplus)._M_p + __pos;
}



----------------------------------------

// Function: capacity @ 089bfd2c

/* DWARF original prototype: size_t
   capacity(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::capacity
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return *(size_t *)((this->_M_dataplus)._M_p + -8);
}



----------------------------------------

// Function: size @ 089bfd38

/* DWARF original prototype: size_t
   size(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::size
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return *(size_t *)((this->_M_dataplus)._M_p + -0xc);
}



----------------------------------------

// Function: _M_ibegin @ 089bfd44

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   _M_ibegin(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_ibegin
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)__return_storage_ptr__->_M_current;
}



----------------------------------------

// Function: begin @ 089bfd4c

/* DWARF original prototype:
   __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   begin(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::begin
          (__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)__return_storage_ptr__->_M_current;
}



----------------------------------------

// Function: find_first_not_of @ 089bfd54

/* DWARF original prototype: size_t
   find_first_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char *
   __s, size_t __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  void *pvVar1;
  char *pcVar2;
  
  pcVar2 = (this->_M_dataplus)._M_p;
  if (__pos < *(uint *)(pcVar2 + -0xc)) {
    do {
      pvVar1 = memchr(__s,(int)pcVar2[__pos],__n);
      if (pvVar1 == (void *)0x0) {
        return __pos;
      }
      pcVar2 = (this->_M_dataplus)._M_p;
      __pos = __pos + 1;
    } while (__pos < *(uint *)(pcVar2 + -0xc));
  }
  return 0xffffffff;
}



----------------------------------------

// Function: rfind @ 089bfe04

/* DWARF original prototype: size_t
   rfind(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rfind
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  size_t sVar1;
  size_t *psVar2;
  int iVar3;
  char *pcVar4;
  uint local_28 [2];
  size_t local_20 [2];
  
                    /* Unresolved local var: size_t __size@[???] */
  psVar2 = local_28;
  pcVar4 = (this->_M_dataplus)._M_p;
  local_28[0] = *(uint *)(pcVar4 + -0xc);
  local_20[0] = __pos;
  if (__n <= local_28[0]) {
                    /* Unresolved local var: char * __data@[???] */
    local_28[0] = local_28[0] - __n;
    if (__pos < local_28[0]) {
      psVar2 = local_20;
    }
    local_20[0] = *psVar2;
    do {
      sVar1 = local_20[0];
      iVar3 = memcmp(pcVar4 + local_20[0],__s,__n);
      local_20[0] = sVar1 - 1;
      if (iVar3 == 0) {
        return sVar1;
      }
    } while (local_20[0] != 0xffffffff);
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find @ 089bfeb0

/* DWARF original prototype: size_t
   find(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  uint uVar1;
  char *pcVar2;
  char *pcVar3;
  _func_bool_char_ptr_char_ptr *in_stack_00000000;
  
                    /* Unresolved local var: size_t __ret@[???]
                       Unresolved local var: size_t __size@[???] */
  pcVar3 = (this->_M_dataplus)._M_p;
                    /* Unresolved local var: char * __data@[???]
                       Unresolved local var: char * __p@[???] */
  uVar1 = *(uint *)(pcVar3 + -0xc);
  if (__pos + __n <= uVar1) {
    pcVar2 = search<const_char*,_const_char*,_bool_(*)(const_char&,_const_char&)>
                       (pcVar3 + __pos,pcVar3 + uVar1,__s,__s + __n,in_stack_00000000);
    if (pcVar3 + uVar1 != pcVar2) {
      return (int)pcVar2 - (int)pcVar3;
    }
    if (__n == 0) {
      return (int)pcVar2 - (int)pcVar3;
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: at @ 089bff48

/* DWARF original prototype: char *
   at(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::at
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  if (__n < *(uint *)(pcVar1 + -0xc)) {
    return pcVar1 + __n;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::at");
}



----------------------------------------

// Function: empty @ 089bff7c

/* DWARF original prototype: bool
   empty(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

bool __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::empty
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return *(int *)((this->_M_dataplus)._M_p + -0xc) == 0;
}



----------------------------------------

// Function: _M_limit @ 089bff8c

/* DWARF original prototype: size_t
   _M_limit(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __off) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_limit
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __off)

{
  uint uVar1;
  
  uVar1 = *(int *)((this->_M_dataplus)._M_p + -0xc) - __pos;
  if (__off < uVar1) {
    uVar1 = __off;
  }
  return uVar1;
}



----------------------------------------

// Function: _M_check @ 089bffa4

/* DWARF original prototype: size_t
   _M_check(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   char * __s) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_check
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          char *__s)

{
  if (__pos <= *(uint *)((this->_M_dataplus)._M_p + -0xc)) {
    return __pos;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range(__s);
}



----------------------------------------

// Function: length @ 089bffd8

/* DWARF original prototype: size_t
   length(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::length
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return *(size_t *)((this->_M_dataplus)._M_p + -0xc);
}



----------------------------------------

// Function: operator==<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> @ 089bffe4

/* DWARF original name: operator==<char*, std::basic_string<char, std::char_traits<char>,
   std::allocator<char> > > */

bool __gnu_cxx::
     operator==<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                *__lhs,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                       *__rhs)

{
  return __lhs->_M_current == __rhs->_M_current;
}



----------------------------------------

// Function: find_first_not_of @ 089bfff8

/* DWARF original prototype: size_t
   find_first_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = find_first_not_of(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: rfind @ 089c0004

/* DWARF original prototype: size_t
   rfind(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rfind
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = rfind(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: find @ 089c0010

/* DWARF original prototype: size_t
   find(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = find(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: operator==<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> @ 089c001c

/* DWARF original name: operator==<const char*, std::basic_string<char, std::char_traits<char>,
   std::allocator<char> > > */

bool __gnu_cxx::
     operator==<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               (__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                *__lhs,__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                       *__rhs)

{
  return __lhs->_M_current == __rhs->_M_current;
}



----------------------------------------

// Function: basic_string @ 089c0030

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  (this->_M_dataplus)._M_p = (char *)0x8a1e514;
  return;
}



----------------------------------------

// Function: basic_string @ 089c0044

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  (this->_M_dataplus)._M_p = (char *)0x8a1e514;
  return;
}



----------------------------------------

// Function: _M_assign @ 089c0058

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_assign
               (char *__d,size_t __n,char __c)

{
  if (__n != 1) {
    memset(__d,(int)__c,__n);
    return;
  }
  *__d = __c;
  return;
}



----------------------------------------

// Function: _M_move @ 089c0080

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_move
               (char *__d,char *__s,size_t __n)

{
  if (__n == 1) {
    *__d = *__s;
    return;
  }
  memmove(__d,__s,__n);
  return;
}



----------------------------------------

// Function: _M_iend @ 089c009c

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   _M_iend(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_iend
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(__return_storage_ptr__->_M_current +
            *(int *)(__return_storage_ptr__->_M_current + -0xc));
}



----------------------------------------

// Function: _M_destroy @ 089c00ac

/* DWARF original prototype: void _M_destroy(_Rep * this, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
          (_Rep *this,allocator<char> *__a)

{
  if (this != (_Rep *)0x0) {
    free(this);
    return;
  }
  return;
}



----------------------------------------

// Function: _S_create @ 089c00b4

_Rep * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_S_create
                 (size_t __capacity,size_t __old_capacity,allocator<char> *__alloc)

{
  _Rep *p_Var1;
  uint uVar2;
  size_t len;
  
                    /* Unresolved local var: size_t __pagesize@[???]
                       Unresolved local var: size_t __malloc_header_size@[???]
                       Unresolved local var: size_t __size@[???]
                       Unresolved local var: size_t __adj_size@[???]
                       Unresolved local var: void * __place@[???]
                       Unresolved local var: _Rep * __p@[???] */
  if (0x3ffffffc < __capacity) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::_S_create");
  }
  if ((__old_capacity < __capacity) && (__capacity < __old_capacity << 1)) {
    __capacity = __old_capacity << 1;
  }
  len = __capacity + 0xd;
  if ((0x1000 < __capacity + 0x1d) && (__old_capacity < __capacity)) {
                    /* Unresolved local var: size_t __extra@[???] */
    uVar2 = __capacity + (0x1000 - (__capacity + 0x1d & 0xfff));
    __capacity = 0x3ffffffc;
    if (uVar2 < 0x3ffffffd) {
      __capacity = uVar2;
    }
    len = __capacity + 0xd;
  }
                    /* try { // try from 089c00f0 to 089c00f7 has its CatchHandler @ 089c0164 */
  p_Var1 = operator_new(len);
  (p_Var1->super__Rep_base)._M_capacity = __capacity;
  return p_Var1;
}



----------------------------------------

// Function: find_last_not_of @ 089c016c

/* DWARF original prototype: size_t
   find_last_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char
   __c, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  char cVar1;
  int iVar2;
  uint uVar3;
  char *pcVar4;
  
                    /* Unresolved local var: size_t __size@[???] */
  pcVar4 = (this->_M_dataplus)._M_p;
  iVar2 = *(int *)(pcVar4 + -0xc);
  if (iVar2 != 0) {
    uVar3 = iVar2 - 1;
    if (__pos < uVar3) {
      uVar3 = __pos;
    }
    pcVar4 = pcVar4 + uVar3;
    cVar1 = *pcVar4;
    while ((pcVar4 = pcVar4 + -1, cVar1 == __c && (uVar3 = uVar3 - 1, uVar3 != 0xffffffff))) {
      cVar1 = *pcVar4;
    }
    return uVar3;
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_first_not_of @ 089c01bc

/* DWARF original prototype: size_t
   find_first_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char
   __c, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  char *pcVar1;
  uint uVar2;
  char *pcVar3;
  
  pcVar3 = (this->_M_dataplus)._M_p;
  uVar2 = *(uint *)(pcVar3 + -0xc);
  if (__pos < uVar2) {
    pcVar3 = pcVar3 + __pos;
    if (*pcVar3 != __c) {
      return __pos;
    }
    while (__pos = __pos + 1, uVar2 != __pos) {
      pcVar1 = pcVar3 + 1;
      pcVar3 = pcVar3 + 1;
      if (*pcVar1 != __c) {
        return __pos;
      }
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: rfind @ 089c0218

/* DWARF original prototype: size_t
   rfind(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c, size_t
   __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rfind
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  char cVar1;
  int iVar2;
  uint uVar3;
  char *pcVar4;
  size_t sVar5;
  
                    /* Unresolved local var: size_t __size@[???] */
  pcVar4 = (this->_M_dataplus)._M_p;
  iVar2 = *(int *)(pcVar4 + -0xc);
  if (iVar2 != 0) {
    uVar3 = iVar2 - 1;
    if (__pos < uVar3) {
      uVar3 = __pos;
    }
    pcVar4 = pcVar4 + uVar3;
    iVar2 = 0;
    while (sVar5 = uVar3 - iVar2, uVar3 + 1 != iVar2) {
      cVar1 = *pcVar4;
      iVar2 = iVar2 + 1;
      pcVar4 = pcVar4 + -1;
      if (cVar1 == __c) {
        return sVar5;
      }
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_last_of @ 089c026c

/* DWARF original prototype: size_t
   find_last_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c,
   size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  char cVar1;
  int iVar2;
  uint uVar3;
  char *pcVar4;
  size_t sVar5;
  
  pcVar4 = (this->_M_dataplus)._M_p;
  iVar2 = *(int *)(pcVar4 + -0xc);
  if (iVar2 != 0) {
    uVar3 = iVar2 - 1;
    if (__pos < uVar3) {
      uVar3 = __pos;
    }
    pcVar4 = pcVar4 + uVar3;
    iVar2 = 0;
    while (sVar5 = uVar3 - iVar2, uVar3 + 1 != iVar2) {
      cVar1 = *pcVar4;
      iVar2 = iVar2 + 1;
      pcVar4 = pcVar4 + -1;
      if (cVar1 == __c) {
        return sVar5;
      }
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: _M_set_length_and_sharable @ 089c0274

/* DWARF original prototype: void _M_set_length_and_sharable(_Rep * this, size_t __n) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
_M_set_length_and_sharable(_Rep *this,size_t __n)

{
  (this->super__Rep_base)._M_refcount = 0;
  (this->super__Rep_base)._M_length = __n;
  *(undefined1 *)((int)&this[1].super__Rep_base._M_length + __n) = 0;
  return;
}



----------------------------------------

// Function: _M_disjunct @ 089c0288

/* DWARF original prototype: bool
   _M_disjunct(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s)
    */

bool __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_disjunct
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  bool bVar1;
  char *pcVar2;
  
  pcVar2 = (this->_M_dataplus)._M_p;
  bVar1 = true;
  if (pcVar2 <= __s) {
    bVar1 = pcVar2 + *(int *)(pcVar2 + -0xc) < __s;
  }
  return bVar1;
}



----------------------------------------

// Function: end @ 089c02ac

/* DWARF original prototype:
   __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   end(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::end
          (__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  return (__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(__return_storage_ptr__->_M_current +
            *(int *)(__return_storage_ptr__->_M_current + -0xc));
}



----------------------------------------

// Function: _M_refcopy @ 089c02bc

/* DWARF original prototype: char * _M_refcopy(_Rep * this) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_refcopy(_Rep *this)

{
  if (this != (_Rep *)_S_empty_rep_storage) {
                    /* try { // try from 089c02f0 to 089c02f7 has its CatchHandler @ 089c0300 */
    __gnu_cxx::__atomic_add(&(this->super__Rep_base)._M_refcount,1);
  }
  return (char *)(this + 1);
}



----------------------------------------

// Function: _M_dispose @ 089c031c

/* DWARF original prototype: void _M_dispose(_Rep * this, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_dispose
          (_Rep *this,allocator<char> *__a)

{
  _Atomic_word _Var1;
  
  if ((this != (_Rep *)_S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add(&(this->super__Rep_base)._M_refcount,-1), _Var1 < 1)) {
    _M_destroy(this,__a);
    return;
  }
  return;
}



----------------------------------------

// Function: compare @ 089c0384

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  int iVar1;
  char *m1;
  char *m2;
  size_t *psVar2;
  uint uVar3;
  uint uVar4;
  uint local_18;
  uint local_14;
  
                    /* Unresolved local var: size_t __size@[???]
                       Unresolved local var: size_t __osize@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar2 = &local_18;
  m1 = (this->_M_dataplus)._M_p;
  m2 = (__str->_M_dataplus)._M_p;
  uVar4 = *(uint *)(m1 + -0xc);
  uVar3 = *(uint *)(m2 + -0xc);
  local_18 = uVar4;
  local_14 = uVar3;
  if (uVar3 < uVar4) {
    psVar2 = &local_14;
  }
  iVar1 = memcmp(m1,m2,*psVar2);
  if (iVar1 == 0) {
    iVar1 = uVar4 - uVar3;
  }
  return iVar1;
}



----------------------------------------

// Function: find_last_of @ 089c03e0

/* DWARF original prototype: size_t
   find_last_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  void *pvVar1;
  uint uVar2;
  char *pcVar3;
  
                    /* Unresolved local var: size_t __size@[???] */
  pcVar3 = (this->_M_dataplus)._M_p;
  if ((*(int *)(pcVar3 + -0xc) != 0) && (uVar2 = *(int *)(pcVar3 + -0xc) - 1, __n != 0)) {
    if (uVar2 <= __pos) {
      __pos = uVar2;
    }
    while ((pvVar1 = memchr(__s,(int)pcVar3[__pos],__n), pvVar1 == (void *)0x0 &&
           (__pos = __pos - 1, __pos != 0xffffffff))) {
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    return __pos;
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_last_of @ 089c0490

/* DWARF original prototype: size_t
   find_last_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = find_last_of(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: find_first_of @ 089c049c

/* DWARF original prototype: size_t
   find_first_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  void *pvVar1;
  char *pcVar2;
  char *pcVar3;
  
  if ((__n != 0) && (pcVar2 = (this->_M_dataplus)._M_p, __pos < *(uint *)(pcVar2 + -0xc))) {
    pcVar2 = pcVar2 + __pos;
    do {
      pvVar1 = memchr(__s,(int)*pcVar2,__n);
      if (pvVar1 != (void *)0x0) {
        return __pos;
      }
      pcVar3 = (this->_M_dataplus)._M_p;
      __pos = __pos + 1;
      pcVar2 = pcVar3 + __pos;
    } while (__pos < *(uint *)(pcVar3 + -0xc));
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_first_of @ 089c053c

/* DWARF original prototype: size_t
   find_first_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = find_first_of(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: find @ 089c0548

/* DWARF original prototype: size_t
   find(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c, size_t
   __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  void *pvVar1;
  char *pcVar2;
  
                    /* Unresolved local var: size_t __ret@[DW_OP_reg4(a0)]
                       Unresolved local var: size_t __size@[???] */
  pcVar2 = (this->_M_dataplus)._M_p;
                    /* Unresolved local var: char * __data@[???]
                       Unresolved local var: size_t __n@[???]
                       Unresolved local var: char * __p@[???] */
  if (__pos < *(uint *)(pcVar2 + -0xc)) {
    pvVar1 = memchr(pcVar2 + __pos,(int)__c,*(uint *)(pcVar2 + -0xc) - __pos);
    if (pvVar1 != (void *)0x0) {
      return (int)pvVar1 - (int)pcVar2;
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_first_of @ 089c05b0

/* DWARF original prototype: size_t
   find_first_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c,
   size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c,
          size_t __pos)

{
  void *pvVar1;
  char *pcVar2;
  
  pcVar2 = (this->_M_dataplus)._M_p;
  if (__pos < *(uint *)(pcVar2 + -0xc)) {
    pvVar1 = memchr(pcVar2 + __pos,(int)__c,*(uint *)(pcVar2 + -0xc) - __pos);
    if (pvVar1 != (void *)0x0) {
      return (int)pvVar1 - (int)pcVar2;
    }
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_last_not_of @ 089c05b8

/* DWARF original prototype: size_t
   find_last_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char *
   __s, size_t __pos, size_t __n) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos,size_t __n)

{
  void *pvVar1;
  uint uVar2;
  char *pcVar3;
  
                    /* Unresolved local var: size_t __size@[???] */
  pcVar3 = (this->_M_dataplus)._M_p;
  if (*(int *)(pcVar3 + -0xc) != 0) {
    uVar2 = *(int *)(pcVar3 + -0xc) - 1;
    if (uVar2 <= __pos) {
      __pos = uVar2;
    }
    while ((pvVar1 = memchr(__s,(int)pcVar3[__pos],__n), pvVar1 != (void *)0x0 &&
           (__pos = __pos - 1, __pos != 0xffffffff))) {
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    return __pos;
  }
  return 0xffffffff;
}



----------------------------------------

// Function: find_last_not_of @ 089c0664

/* DWARF original prototype: size_t
   find_last_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos)

{
  size_t sVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  sVar1 = find_last_not_of(this,__s,__pos,*(size_t *)(__s + -0xc));
  return sVar1;
}



----------------------------------------

// Function: _M_check_length @ 089c0670

/* DWARF original prototype: void
   _M_check_length(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t
   __n1, size_t __n2, char * __s) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_check_length
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n1,
          size_t __n2,char *__s)

{
  if (__n2 <= 0x3ffffffc - (*(int *)((this->_M_dataplus)._M_p + -0xc) - __n1)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_length_error(__s);
}



----------------------------------------

// Function: compare @ 089c06b0

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  size_t sVar1;
  int iVar2;
  size_t *psVar3;
  uint uVar4;
  char *m1;
  uint local_20;
  size_t local_1c;
  
                    /* Unresolved local var: size_t __size@[???]
                       Unresolved local var: size_t __osize@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar3 = &local_20;
  m1 = (this->_M_dataplus)._M_p;
  uVar4 = *(uint *)(m1 + -0xc);
  local_20 = uVar4;
  sVar1 = strlen(__s);
  local_1c = sVar1;
  if (sVar1 < uVar4) {
    psVar3 = &local_1c;
  }
  iVar2 = memcmp(m1,__s,*psVar3);
  if (iVar2 == 0) {
    iVar2 = uVar4 - sVar1;
  }
  return iVar2;
}



----------------------------------------

// Function: find_last_not_of @ 089c072c

/* DWARF original prototype: size_t
   find_last_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char *
   __s, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = find_last_not_of(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: find_first_not_of @ 089c077c

/* DWARF original prototype: size_t
   find_first_not_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char *
   __s, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_not_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = find_first_not_of(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: find_last_of @ 089c07cc

/* DWARF original prototype: size_t
   find_last_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_last_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = find_last_of(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: find_first_of @ 089c081c

/* DWARF original prototype: size_t
   find_first_of(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find_first_of
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = find_first_of(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: rfind @ 089c086c

/* DWARF original prototype: size_t
   rfind(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rfind
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = rfind(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: find @ 089c08bc

/* DWARF original prototype: size_t
   find(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::find
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __pos)

{
  size_t __n;
  size_t sVar1;
  
  __n = strlen(__s);
  sVar1 = find(this,__s,__pos,__n);
  return sVar1;
}



----------------------------------------

// Function: rend @ 089c090c

/* DWARF original prototype:
   reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
   rend(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rend
          (reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  (__return_storage_ptr__->current)._M_current = (this->_M_dataplus)._M_p;
  return __return_storage_ptr__;
}



----------------------------------------

// Function: rbegin @ 089c091c

/* DWARF original prototype:
   reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
   rbegin(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rbegin
          (reverse_iterator<__gnu_cxx::__normal_iterator<const_char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  (__return_storage_ptr__->current)._M_current = pcVar1 + *(int *)(pcVar1 + -0xc);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: _S_construct @ 089c0934

char * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_construct
                 (size_t __n,char __c,allocator<char> *__a)

{
  _Rep *p_Var1;
  _Rep *m;
  
                    /* Unresolved local var: _Rep * __r@[???]
                       Unresolved local var: void * __p@[???] */
  if (__n == 0) {
    return (char *)(_Rep::_S_empty_rep_storage + 3);
  }
  p_Var1 = _Rep::_S_create(__n,0,__a);
  m = p_Var1 + 1;
  if (__n == 1) {
    *(char *)&p_Var1[1].super__Rep_base._M_length = __c;
  }
  else {
    memset(m,(int)__c,__n);
  }
  (p_Var1->super__Rep_base)._M_length = __n;
  (p_Var1->super__Rep_base)._M_refcount = 0;
  *(undefined1 *)((int)&(m->super__Rep_base)._M_length + __n) = 0;
  return (char *)m;
}



----------------------------------------

// Function: basic_string @ 089c09f0

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n,
   char __c, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n,char __c
          ,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct(__n,__c,__a);
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c0a24

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n,
   char __c, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n,char __c
          ,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct(__n,__c,__a);
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c0a58

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct(0,'\0',__a);
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c0a8c

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct(0,'\0',__a);
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: compare @ 089c0ac0

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n1, char * __s, size_t __n2) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n1,char *__s,size_t __n2)

{
  int iVar1;
  uint uVar2;
  char *pcVar3;
  size_t *psVar4;
  uint in_t0;
  uint local_18;
  size_t local_14;
  
                    /* Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar4 = &local_18;
  pcVar3 = (this->_M_dataplus)._M_p;
  uVar2 = *(uint *)(pcVar3 + -0xc);
  if (uVar2 < __pos) {
    local_18 = __n1;
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::compare");
  }
  uVar2 = uVar2 - __pos;
  if (__n1 <= uVar2) {
    uVar2 = __n1;
  }
  local_18 = uVar2;
  if (in_t0 < uVar2) {
    psVar4 = &local_14;
  }
  iVar1 = memcmp(pcVar3 + __pos,__s,*psVar4);
  if (iVar1 == 0) {
    iVar1 = uVar2 - in_t0;
  }
  return iVar1;
}



----------------------------------------

// Function: compare @ 089c0b4c

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n1, char * __s) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n1,char *__s)

{
  size_t sVar1;
  int iVar2;
  uint uVar3;
  size_t *psVar4;
  char *pcVar5;
  size_t local_28 [2];
  uint local_20 [2];
  
                    /* Unresolved local var: size_t __osize@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar4 = local_28;
  pcVar5 = (this->_M_dataplus)._M_p;
  uVar3 = *(uint *)(pcVar5 + -0xc);
  if (uVar3 < __pos) {
    local_20[0] = __n1;
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::compare");
  }
  uVar3 = uVar3 - __pos;
  if (__n1 <= uVar3) {
    uVar3 = __n1;
  }
  local_20[0] = uVar3;
  sVar1 = strlen(__s);
  local_28[0] = sVar1;
  if (uVar3 <= sVar1) {
    psVar4 = local_20;
  }
  iVar2 = memcmp(pcVar5 + __pos,__s,*psVar4);
  if (iVar2 == 0) {
    iVar2 = uVar3 - sVar1;
  }
  return iVar2;
}



----------------------------------------

// Function: compare @ 089c0c00

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos1,
   size_t __n1, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t
   __pos2, size_t __n2) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          size_t __n1,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,
          size_t __pos2,size_t __n2)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  size_t *psVar4;
  char *pcVar5;
  uint in_t0;
  uint in_t1;
  char *pcVar6;
  uint local_18;
  uint local_14;
  
                    /* Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar4 = &local_18;
  pcVar6 = (this->_M_dataplus)._M_p;
  uVar3 = *(uint *)(pcVar6 + -0xc);
  if (__pos1 <= uVar3) {
    pcVar5 = (__str->_M_dataplus)._M_p;
    uVar2 = *(uint *)(pcVar5 + -0xc);
    uVar3 = uVar3 - __pos1;
    if (in_t0 <= uVar2) {
      uVar2 = uVar2 - in_t0;
      if (__n1 <= uVar3) {
        uVar3 = __n1;
      }
      if (in_t1 <= uVar2) {
        uVar2 = in_t1;
      }
      local_18 = uVar3;
      local_14 = uVar2;
      if (uVar2 < uVar3) {
        psVar4 = &local_14;
      }
      iVar1 = memcmp(pcVar6 + __pos1,pcVar5 + in_t0,*psVar4);
      if (iVar1 == 0) {
        iVar1 = uVar3 - uVar2;
      }
      return iVar1;
    }
  }
  local_18 = __n1;
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::compare");
}



----------------------------------------

// Function: compare @ 089c0cb0

/* DWARF original prototype: int
   compare(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

int __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::compare
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  int iVar1;
  uint uVar2;
  uint uVar3;
  size_t *psVar4;
  char *m2;
  char *pcVar5;
  uint local_20 [2];
  uint local_18 [2];
  
                    /* Unresolved local var: size_t __osize@[???]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var: int __r@[???] */
  psVar4 = local_20;
  pcVar5 = (this->_M_dataplus)._M_p;
  uVar2 = *(uint *)(pcVar5 + -0xc);
  uVar3 = uVar2 - __pos;
  if (uVar2 < __pos) {
    local_18[0] = __n;
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::compare");
  }
  m2 = (__str->_M_dataplus)._M_p;
  uVar2 = *(uint *)(m2 + -0xc);
  if (__n <= uVar3) {
    uVar3 = __n;
  }
  local_18[0] = uVar3;
  local_20[0] = uVar2;
  if (uVar3 <= uVar2) {
    psVar4 = local_18;
  }
  iVar1 = memcmp(pcVar5 + __pos,m2,*psVar4);
  if (iVar1 == 0) {
    iVar1 = uVar3 - uVar2;
  }
  return iVar1;
}



----------------------------------------

// Function: _M_clone @ 089c0d40

/* DWARF original prototype: char * _M_clone(_Rep * this, allocator<char> * __alloc, size_t __res)
    */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_clone
          (_Rep *this,allocator<char> *__alloc,size_t __res)

{
  _Rep *p_Var1;
  size_t len0;
  size_t sVar2;
  _Rep *dst0;
  
                    /* Unresolved local var: size_t __requested_cap@[???]
                       Unresolved local var: _Rep * __r@[???] */
  p_Var1 = _S_create(__res + (this->super__Rep_base)._M_length,(this->super__Rep_base)._M_capacity,
                     __alloc);
  len0 = (this->super__Rep_base)._M_length;
  sVar2 = 0;
  if (len0 != 0) {
    dst0 = p_Var1 + 1;
    if (len0 == 1) {
      sVar2 = this[1].super__Rep_base._M_length;
      (p_Var1->super__Rep_base)._M_refcount = 0;
      *(char *)&p_Var1[1].super__Rep_base._M_length = (char)sVar2;
      sVar2 = (this->super__Rep_base)._M_length;
      (p_Var1->super__Rep_base)._M_length = sVar2;
      *(undefined1 *)((int)&(dst0->super__Rep_base)._M_length + sVar2) = 0;
      return (char *)dst0;
    }
    memcpy(dst0,this + 1,len0);
    sVar2 = (this->super__Rep_base)._M_length;
  }
  (p_Var1->super__Rep_base)._M_length = sVar2;
  (p_Var1->super__Rep_base)._M_refcount = 0;
  *(undefined1 *)((int)&p_Var1[1].super__Rep_base._M_length + sVar2) = 0;
  return (char *)(p_Var1 + 1);
}



----------------------------------------

// Function: _M_grab @ 089c0e08

/* DWARF original prototype: char * _M_grab(_Rep * this, allocator<char> * __alloc1, allocator<char>
   * __alloc2) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_grab
          (_Rep *this,allocator<char> *__alloc1,allocator<char> *__alloc2)

{
  char *pcVar1;
  
  if (-1 < (this->super__Rep_base)._M_refcount) {
    if (this != (_Rep *)_S_empty_rep_storage) {
                    /* try { // try from 089c0e58 to 089c0e5f has its CatchHandler @ 089c0e68 */
      __gnu_cxx::__atomic_add(&(this->super__Rep_base)._M_refcount,1);
    }
    return (char *)(this + 1);
  }
  pcVar1 = _M_clone(this,__alloc1,0);
  return pcVar1;
}



----------------------------------------

// Function: _S_copy_chars @ 089c0e84

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_copy_chars
               (char *__p,char *__k1,char *__k2)

{
  if ((int)__k2 - (int)__k1 != 1) {
    memcpy(__p,__k1,(int)__k2 - (int)__k1);
    return;
  }
  *__p = *__k1;
  return;
}



----------------------------------------

// Function: _S_copy_chars @ 089c0ea8

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_copy_chars
               (char *__p,char *__k1,char *__k2)

{
  if ((int)__k2 - (int)__k1 != 1) {
    memcpy(__p,__k1,(int)__k2 - (int)__k1);
    return;
  }
  *__p = *__k1;
  return;
}



----------------------------------------

// Function: copy @ 089c0ecc

/* DWARF original prototype: size_t
   copy(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __n, size_t __pos) */

size_t __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::copy
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __n,size_t __pos)

{
  uint uVar1;
  char *pcVar2;
  
  pcVar2 = (this->_M_dataplus)._M_p;
  uVar1 = *(uint *)(pcVar2 + -0xc);
  if (uVar1 < __pos) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::copy");
  }
  uVar1 = uVar1 - __pos;
  if (__n <= uVar1) {
    uVar1 = __n;
  }
  if (uVar1 != 0) {
    pcVar2 = pcVar2 + __pos;
    if (uVar1 == 1) {
      *__s = *pcVar2;
      return 1;
    }
    memcpy(__s,pcVar2,uVar1);
  }
  return uVar1;
}



----------------------------------------

// Function: _S_construct<char*> @ 089c0f54

char * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_construct<char*>
                 (char *__beg,char *__end,allocator<char> *__a,forward_iterator_tag param_4)

{
  _Rep *p_Var1;
  size_t __capacity;
  _Rep *dst0;
  
                    /* Unresolved local var: size_t __dnew@[???]
                       Unresolved local var: _Rep * __r@[???] */
  if (__beg == __end) {
    return (char *)(_Rep::_S_empty_rep_storage + 3);
  }
  __capacity = (int)__end - (int)__beg;
  if (__beg != (char *)0x0) {
    p_Var1 = _Rep::_S_create(__capacity,0,__a);
    dst0 = p_Var1 + 1;
    if (__capacity == 1) {
      *(char *)&p_Var1[1].super__Rep_base._M_length = *__beg;
    }
    else {
      memcpy(dst0,__beg,__capacity);
    }
    (p_Var1->super__Rep_base)._M_length = __capacity;
    (p_Var1->super__Rep_base)._M_refcount = 0;
    *(undefined1 *)((int)dst0 + __capacity) = 0;
    return (char *)dst0;
  }
                    /* WARNING: Subroutine does not return */
  __throw_logic_error("basic_string::_S_construct NULL not valid");
}



----------------------------------------

// Function: basic_string @ 089c101c

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n)

{
  char *pcVar1;
  uint uVar2;
  allocator<char> aaStack_10 [8];
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (__pos <= *(uint *)(pcVar1 + -0xc)) {
    uVar2 = *(uint *)(pcVar1 + -0xc) - __pos;
    if (__n <= uVar2) {
      uVar2 = __n;
    }
                    /* try { // try from 089c1054 to 089c105b has its CatchHandler @ 089c107c */
    pcVar1 = _S_construct<char*>(pcVar1 + __pos,pcVar1 + __pos + uVar2,aaStack_10,
                                 (forward_iterator_tag)SUB41(__n,0));
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::basic_string");
}



----------------------------------------

// Function: basic_string<char*> @ 089c1084

/* DWARF original prototype: void
   basic_string<char*>(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char
   * __beg, char * __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<char*>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__beg,
          char *__end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<char*>(__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string<char*> @ 089c10b8

/* DWARF original prototype: void
   basic_string<char*>(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char
   * __beg, char * __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<char*>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__beg,
          char *__end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<char*>(__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c10ec

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n,allocator<char> *__a)

{
  char *pcVar1;
  uint uVar2;
  allocator<char> *in_t0;
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (__pos <= *(uint *)(pcVar1 + -0xc)) {
    uVar2 = *(uint *)(pcVar1 + -0xc) - __pos;
    if (__n <= uVar2) {
      uVar2 = __n;
    }
    pcVar1 = _S_construct<char*>(pcVar1 + __pos,pcVar1 + __pos + uVar2,in_t0,
                                 (forward_iterator_tag)SUB41(__n,0));
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::basic_string");
}



----------------------------------------

// Function: basic_string @ 089c114c

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n,allocator<char> *__a)

{
  char *pcVar1;
  uint uVar2;
  allocator<char> *in_t0;
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (__pos <= *(uint *)(pcVar1 + -0xc)) {
    uVar2 = *(uint *)(pcVar1 + -0xc) - __pos;
    if (__n <= uVar2) {
      uVar2 = __n;
    }
    pcVar1 = _S_construct<char*>(pcVar1 + __pos,pcVar1 + __pos + uVar2,in_t0,
                                 (forward_iterator_tag)SUB41(__n,0));
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::basic_string");
}



----------------------------------------

// Function: basic_string @ 089c11ac

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n)

{
  char *pcVar1;
  uint uVar2;
  allocator<char> aaStack_10 [8];
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (__pos <= *(uint *)(pcVar1 + -0xc)) {
    uVar2 = *(uint *)(pcVar1 + -0xc) - __pos;
    if (__n <= uVar2) {
      uVar2 = __n;
    }
                    /* try { // try from 089c11e4 to 089c11eb has its CatchHandler @ 089c120c */
    pcVar1 = _S_construct<char*>(pcVar1 + __pos,pcVar1 + __pos + uVar2,aaStack_10,
                                 (forward_iterator_tag)SUB41(__n,0));
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::basic_string");
}



----------------------------------------

// Function: substr @ 089c1214

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_>
   substr(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::substr
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n)

{
  if (__pos <= *(uint *)((this->_M_dataplus)._M_p + -0xc)) {
    basic_string(__return_storage_ptr__,this,__pos,__n);
    return __return_storage_ptr__;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::substr");
}



----------------------------------------

// Function: _S_copy_chars @ 089c125c

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_copy_chars
               (char *__p,
               __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __k1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                    __k2)

{
  if ((int)__k2._M_current - (int)__k1._M_current != 1) {
    memcpy(__p,__k1._M_current,(int)__k2._M_current - (int)__k1._M_current);
    return;
  }
  *__p = *__k1._M_current;
  return;
}



----------------------------------------

// Function: _S_construct<const_char*> @ 089c1280

/* DWARF original name: _S_construct<const char*> */

char * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::
       _S_construct<const_char*>
                 (char *__beg,char *__end,allocator<char> *__a,forward_iterator_tag param_4)

{
  _Rep *p_Var1;
  size_t __capacity;
  _Rep *dst0;
  
                    /* Unresolved local var: size_t __dnew@[???]
                       Unresolved local var: _Rep * __r@[???] */
  if (__beg == __end) {
    return (char *)(_Rep::_S_empty_rep_storage + 3);
  }
  __capacity = (int)__end - (int)__beg;
  if (__beg != (char *)0x0) {
    p_Var1 = _Rep::_S_create(__capacity,0,__a);
    dst0 = p_Var1 + 1;
    if (__capacity == 1) {
      *(char *)&p_Var1[1].super__Rep_base._M_length = *__beg;
    }
    else {
      memcpy(dst0,__beg,__capacity);
    }
    (p_Var1->super__Rep_base)._M_length = __capacity;
    (p_Var1->super__Rep_base)._M_refcount = 0;
    *(undefined1 *)((int)dst0 + __capacity) = 0;
    return (char *)dst0;
  }
                    /* WARNING: Subroutine does not return */
  __throw_logic_error("basic_string::_S_construct NULL not valid");
}



----------------------------------------

// Function: basic_string @ 089c1348

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __n, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __n,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<const_char*>(__s,__s + __n,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string<const_char*> @ 089c137c

/* DWARF original name: basic_string<const char*>
   DWARF original prototype: void
   basic_string<const_char*>(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   char * __beg, char * __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<const_char*>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__beg,
          char *__end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<const_char*>(__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string<const_char*> @ 089c13b0

/* DWARF original name: basic_string<const char*>
   DWARF original prototype: void
   basic_string<const_char*>(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   char * __beg, char * __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string<const_char*>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__beg,
          char *__end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<const_char*>(__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c13e4

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          allocator<char> *__a)

{
  size_t sVar1;
  char *pcVar2;
  
  pcVar2 = (char *)0xffffffff;
  if (__s != (char *)0x0) {
    sVar1 = strlen(__s);
    pcVar2 = __s + sVar1;
  }
  pcVar2 = _S_construct<const_char*>(__s,pcVar2,__a,(forward_iterator_tag)SUB41(__s,0));
  (this->_M_dataplus)._M_p = pcVar2;
  return;
}



----------------------------------------

// Function: basic_string @ 089c1448

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          allocator<char> *__a)

{
  size_t sVar1;
  char *pcVar2;
  
  pcVar2 = (char *)0xffffffff;
  if (__s != (char *)0x0) {
    sVar1 = strlen(__s);
    pcVar2 = __s + sVar1;
  }
  pcVar2 = _S_construct<const_char*>(__s,pcVar2,__a,(forward_iterator_tag)SUB41(__s,0));
  (this->_M_dataplus)._M_p = pcVar2;
  return;
}



----------------------------------------

// Function: basic_string @ 089c14ac

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s,
   size_t __n, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __n,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<const_char*>(__s,__s + __n,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: _S_copy_chars @ 089c14e0

void std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_S_copy_chars
               (char *__p,
               __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __k1,__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                    __k2)

{
  if ((int)__k2._M_current - (int)__k1._M_current != 1) {
    memcpy(__p,__k1._M_current,(int)__k2._M_current - (int)__k1._M_current);
    return;
  }
  *__p = *__k1._M_current;
  return;
}



----------------------------------------

// Function: _S_construct<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_> @ 089c1504

/* DWARF original name: _S_construct<__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
   std::char_traits<char>, std::allocator<char> > > > */

char * std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::
       _S_construct<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
                 (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                  __beg,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                        __end,allocator<char> *__a,forward_iterator_tag param_4)

{
  _Rep *p_Var1;
  size_t __capacity;
  _Rep *dst0;
  
                    /* Unresolved local var: size_t __dnew@[???]
                       Unresolved local var: _Rep * __r@[???] */
  if (__end._M_current == __beg._M_current) {
    return (char *)(_Rep::_S_empty_rep_storage + 3);
  }
  __capacity = (int)__end._M_current - (int)__beg._M_current;
  p_Var1 = _Rep::_S_create(__capacity,0,__a);
  dst0 = p_Var1 + 1;
  if (__capacity == 1) {
    *(char *)&p_Var1[1].super__Rep_base._M_length = *__beg._M_current;
  }
  else {
    memcpy(dst0,__beg._M_current,__capacity);
  }
  (p_Var1->super__Rep_base)._M_length = __capacity;
  (p_Var1->super__Rep_base)._M_refcount = 0;
  *(undefined1 *)((int)dst0 + __capacity) = 0;
  return (char *)dst0;
}



----------------------------------------

// Function: basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_> @ 089c15bc

/* DWARF original name: basic_string<__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
   std::char_traits<char>, std::allocator<char> > > >
   DWARF original prototype: void
   basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>(basic_string<char,std::char_traits<char>,std::allocator<char>_>
   * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __beg, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::
basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __beg,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                __end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
                     (__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_> @ 089c15f0

/* DWARF original name: basic_string<__gnu_cxx::__normal_iterator<char*, std::basic_string<char,
   std::char_traits<char>, std::allocator<char> > > >
   DWARF original prototype: void
   basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>(basic_string<char,std::char_traits<char>,std::allocator<char>_>
   * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __beg, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __end, allocator<char> * __a) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::
basic_string<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __beg,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                __end,allocator<char> *__a)

{
  char *pcVar1;
  
  pcVar1 = _S_construct<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
                     (__beg,__end,__a,(forward_iterator_tag)SUB41(__a,0));
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c1624

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  char *pcVar1;
  allocator<char> aaStack_18 [8];
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (*(int *)(pcVar1 + -4) < 0) {
                    /* try { // try from 089c1674 to 089c167b has its CatchHandler @ 089c16a8 */
    pcVar1 = _Rep::_M_clone((_Rep *)(pcVar1 + -0xc),aaStack_18,0);
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
  if ((_Rep *)(pcVar1 + -0xc) != (_Rep *)_Rep::_S_empty_rep_storage) {
                    /* try { // try from 089c1698 to 089c169f has its CatchHandler @ 089c16b4 */
    __gnu_cxx::__atomic_add((_Atomic_word *)(pcVar1 + -4),1);
  }
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: basic_string @ 089c16c8

/* DWARF original prototype: void
   basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  char *pcVar1;
  allocator<char> aaStack_18 [8];
  
  pcVar1 = (__str->_M_dataplus)._M_p;
  if (*(int *)(pcVar1 + -4) < 0) {
                    /* try { // try from 089c1718 to 089c171f has its CatchHandler @ 089c174c */
    pcVar1 = _Rep::_M_clone((_Rep *)(pcVar1 + -0xc),aaStack_18,0);
    (this->_M_dataplus)._M_p = pcVar1;
    return;
  }
  if ((_Rep *)(pcVar1 + -0xc) != (_Rep *)_Rep::_S_empty_rep_storage) {
                    /* try { // try from 089c173c to 089c1743 has its CatchHandler @ 089c1758 */
    __gnu_cxx::__atomic_add((_Atomic_word *)(pcVar1 + -4),1);
  }
  (this->_M_dataplus)._M_p = pcVar1;
  return;
}



----------------------------------------

// Function: _M_mutate @ 089c176c

/* DWARF original prototype: void
   _M_mutate(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __len1, size_t __len2) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_mutate
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __len1,size_t __len2)

{
  size_t sVar1;
  char *pcVar2;
  _Atomic_word _Var3;
  undefined1 *dst_void;
  char *dst0;
  _Atomic_word *__mem;
  undefined1 *src_void;
  uint __old_capacity;
  _Rep *p_Var4;
  _Rep *p_Var5;
  uint __capacity;
  allocator<char> aaStack_28 [8];
  
                    /* Unresolved local var: size_t __old_size@[???]
                       Unresolved local var: size_t __new_size@[???]
                       Unresolved local var: size_t __how_much@[???] */
  p_Var4 = (_Rep *)(this->_M_dataplus)._M_p;
  sVar1 = p_Var4[-1].super__Rep_base._M_length;
  __old_capacity = p_Var4[-1].super__Rep_base._M_capacity;
  __capacity = (sVar1 + __len2) - __len1;
  sVar1 = (sVar1 - __pos) - __len1;
  if ((__old_capacity < __capacity) || (0 < p_Var4[-1].super__Rep_base._M_refcount)) {
                    /* Unresolved local var: allocator<char> __a@[???]
                       Unresolved local var: _Rep * __r@[???] */
                    /* try { // try from 089c17dc to 089c193f has its CatchHandler @ 089c195c */
    p_Var4 = _Rep::_S_create(__capacity,__old_capacity,aaStack_28);
    if (__pos == 0) {
      if (sVar1 != 0) {
        pcVar2 = (this->_M_dataplus)._M_p;
        goto LAB_089c1880;
      }
LAB_089c17f4:
      pcVar2 = (this->_M_dataplus)._M_p;
LAB_089c17f8:
      p_Var5 = (_Rep *)(pcVar2 + -0xc);
      if (p_Var5 != (_Rep *)_Rep::_S_empty_rep_storage) {
        __mem = (_Atomic_word *)(pcVar2 + -4);
        goto LAB_089c1938;
      }
    }
    else {
      pcVar2 = (this->_M_dataplus)._M_p;
      if (__pos == 1) {
        *(char *)&p_Var4[1].super__Rep_base._M_length = *pcVar2;
        if (sVar1 == 0) goto LAB_089c17f4;
        pcVar2 = (this->_M_dataplus)._M_p;
      }
      else {
        memcpy(p_Var4 + 1,pcVar2,__pos);
        if (sVar1 == 0) {
          pcVar2 = (this->_M_dataplus)._M_p;
          goto LAB_089c17f8;
        }
        pcVar2 = (this->_M_dataplus)._M_p;
      }
LAB_089c1880:
      dst0 = (char *)((int)&p_Var4[1].super__Rep_base._M_length + __len2 + __pos);
      if (sVar1 == 1) {
        *dst0 = pcVar2[__len1 + __pos];
        pcVar2 = (this->_M_dataplus)._M_p;
        p_Var5 = (_Rep *)(pcVar2 + -0xc);
        if (p_Var5 != (_Rep *)_Rep::_S_empty_rep_storage) {
          __mem = (_Atomic_word *)(pcVar2 + -4);
          goto LAB_089c1938;
        }
      }
      else {
        memcpy(dst0,pcVar2 + __len1 + __pos,sVar1);
        pcVar2 = (this->_M_dataplus)._M_p;
        p_Var5 = (_Rep *)(pcVar2 + -0xc);
        if (p_Var5 != (_Rep *)_Rep::_S_empty_rep_storage) {
          __mem = (_Atomic_word *)(pcVar2 + -4);
LAB_089c1938:
          _Var3 = __gnu_cxx::__exchange_and_add(__mem,-1);
          if (_Var3 < 1) {
            _Rep::_M_destroy(p_Var5,aaStack_28);
          }
        }
      }
    }
    p_Var4 = p_Var4 + 1;
    (this->_M_dataplus)._M_p = (char *)p_Var4;
  }
  else {
    p_Var5 = p_Var4 + -1;
    if ((sVar1 == 0) || (__len2 == __len1)) goto LAB_089c1818;
    src_void = (undefined1 *)((int)&(p_Var4->super__Rep_base)._M_length + __len1 + __pos);
    dst_void = (undefined1 *)((int)&(p_Var4->super__Rep_base)._M_length + __len2 + __pos);
    if (sVar1 == 1) {
      *dst_void = *src_void;
      p_Var4 = (_Rep *)(this->_M_dataplus)._M_p;
    }
    else {
      memmove(dst_void,src_void,sVar1);
      p_Var4 = (_Rep *)(this->_M_dataplus)._M_p;
    }
  }
  p_Var5 = p_Var4 + -1;
LAB_089c1818:
  p_Var4[-1].super__Rep_base._M_length = __capacity;
  (p_Var5->super__Rep_base)._M_refcount = 0;
  *(undefined1 *)((int)p_Var5 + __capacity + 0xc) = 0;
  return;
}



----------------------------------------

// Function: _M_replace_safe @ 089c1964

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   _M_replace_safe(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t
   __pos1, size_t __n1, char * __s, size_t __n2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_safe
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          size_t __n1,char *__s,size_t __n2)

{
  char *dst0;
  size_t in_t0;
  
  _M_mutate(this,__pos1,__n1,in_t0);
  if (in_t0 != 0) {
    dst0 = (this->_M_dataplus)._M_p + __pos1;
    if (in_t0 == 1) {
      *dst0 = *__s;
      return this;
    }
    memcpy(dst0,__s,in_t0);
  }
  return this;
}



----------------------------------------

// Function: assign @ 089c1a04

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   assign(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __n)

{
  char cVar1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar2;
  char *dst_void;
  size_t in_stack_00000010;
  
  if (0x3ffffffc < __n) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::assign");
  }
  dst_void = (this->_M_dataplus)._M_p;
  if (((__s < dst_void) || (dst_void + *(size_t *)(dst_void + -0xc) < __s)) ||
     (0 < *(int *)(dst_void + -4))) {
    pbVar2 = _M_replace_safe(this,0,*(size_t *)(dst_void + -0xc),__s,in_stack_00000010);
    return pbVar2;
  }
                    /* Unresolved local var: size_t __pos@[???] */
  if ((uint)((int)__s - (int)dst_void) < __n) {
    if (__s == dst_void) goto LAB_089c1aa8;
    if (__n != 1) {
      memmove(dst_void,__s,__n);
      dst_void = (this->_M_dataplus)._M_p;
      goto LAB_089c1aa8;
    }
    cVar1 = *__s;
  }
  else {
    if (__n != 1) {
      memcpy(dst_void,__s,__n);
      dst_void = (this->_M_dataplus)._M_p;
      goto LAB_089c1aa8;
    }
    cVar1 = *__s;
  }
  *dst_void = cVar1;
  dst_void = (this->_M_dataplus)._M_p;
LAB_089c1aa8:
  dst_void[-0xffffffff00000004] = '\0';
  dst_void[-0xffffffff00000003] = '\0';
  dst_void[-0xffffffff00000002] = '\0';
  dst_void[-0xffffffff00000001] = '\0';
  *(size_t *)(dst_void + -0xc) = __n;
  dst_void[__n] = '\0';
  return this;
}



----------------------------------------

// Function: assign @ 089c1b10

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   assign(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  size_t __n;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  __n = strlen(__s);
  pbVar1 = assign(this,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: assign @ 089c1b50

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   assign(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char *pcVar2;
  uint uVar3;
  uint __n_00;
  
  pcVar2 = (__str->_M_dataplus)._M_p;
  uVar3 = *(uint *)(pcVar2 + -0xc);
  __n_00 = uVar3 - __pos;
  if (__pos <= uVar3) {
    if (__n <= __n_00) {
      __n_00 = __n;
    }
    pbVar1 = assign(this,pcVar2 + __pos,__n_00);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::assign");
}



----------------------------------------

// Function: operator= @ 089c1b94

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  size_t __n;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  __n = strlen(__s);
  pbVar1 = assign(this,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: _M_replace_aux @ 089c1bd4

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   _M_replace_aux(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t
   __pos1, size_t __n1, size_t __n2, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_replace_aux
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          size_t __n1,size_t __n2,char __c)

{
  char *m;
  char in_t0;
  
  if (0x3ffffffc - (*(int *)((this->_M_dataplus)._M_p + -0xc) - __n1) < __n2) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::_M_replace_aux");
  }
  _M_mutate(this,__pos1,__n1,__n2);
  if (__n2 != 0) {
    m = (this->_M_dataplus)._M_p + __pos1;
    if (__n2 == 1) {
      *m = in_t0;
      return this;
    }
    memset(m,(int)in_t0,__n2);
  }
  return this;
}



----------------------------------------

// Function: replace @ 089c1c94

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, size_t __n, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,size_t __n,char __c)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = _M_replace_aux(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                          (int)__i2._M_current - (int)__i1._M_current,__n,__c);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c1ca8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n1, size_t __n2, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n1,size_t __n2,char __c)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  uint uVar2;
  
  uVar2 = *(uint *)((this->_M_dataplus)._M_p + -0xc);
  if (__pos <= uVar2) {
    uVar2 = uVar2 - __pos;
    if (__n1 <= uVar2) {
      uVar2 = __n1;
    }
    pbVar1 = _M_replace_aux(this,__pos,uVar2,__n2,__c);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::replace");
}



----------------------------------------

// Function: insert @ 089c1cec

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __p, char __c) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __p,char __c)

{
  char *pcVar1;
  size_t __pos1;
  char in_stack_00000000;
  
                    /* Unresolved local var: size_t __pos@[???] */
  __pos1 = (int)this - (int)__return_storage_ptr__->_M_current;
  _M_replace_aux((basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                 __return_storage_ptr__,__pos1,0,1,in_stack_00000000);
  pcVar1 = __return_storage_ptr__->_M_current;
  pcVar1[-0xffffffff00000004] = -1;
  pcVar1[-0xffffffff00000003] = -1;
  pcVar1[-0xffffffff00000002] = -1;
  pcVar1[-0xffffffff00000001] = -1;
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(pcVar1 + __pos1);
}



----------------------------------------

// Function: insert @ 089c1d44

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n,char __c)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char in_stack_00000010;
  
  if (__pos <= *(uint *)((this->_M_dataplus)._M_p + -0xc)) {
    pbVar1 = _M_replace_aux(this,__pos,0,__n,in_stack_00000010);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::insert");
}



----------------------------------------

// Function: assign @ 089c1d84

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   assign(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n, char
   __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n,char __c
          )

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char in_stack_00000010;
  
  pbVar1 = _M_replace_aux(this,0,*(size_t *)((this->_M_dataplus)._M_p + -0xc),__n,in_stack_00000010)
  ;
  return pbVar1;
}



----------------------------------------

// Function: operator= @ 089c1d9c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c)

{
  char in_stack_00000008;
  
  _M_replace_aux(this,0,*(size_t *)((this->_M_dataplus)._M_p + -0xc),1,in_stack_00000008);
  return this;
}



----------------------------------------

// Function: insert @ 089c1ddc

/* DWARF original prototype: void
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __p, size_t __n, char __c) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __p,size_t __n,char __c)

{
  char in_stack_00000010;
  
  _M_replace_aux(this,(int)__p._M_current - (int)(this->_M_dataplus)._M_p,0,__n,in_stack_00000010);
  return;
}



----------------------------------------

// Function: erase @ 089c1df4

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   erase(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __first,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __last) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::erase
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __first,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
                  __last)

{
  char *pcVar1;
  size_t __pos;
  
                    /* Unresolved local var: size_t __pos@[???] */
  __pos = (int)this - (int)__return_storage_ptr__->_M_current;
  _M_mutate((basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
            __return_storage_ptr__,__pos,(int)__first._M_current - (int)this,0);
  pcVar1 = __return_storage_ptr__->_M_current;
  pcVar1[-0xffffffff00000004] = -1;
  pcVar1[-0xffffffff00000003] = -1;
  pcVar1[-0xffffffff00000002] = -1;
  pcVar1[-0xffffffff00000001] = -1;
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(pcVar1 + __pos);
}



----------------------------------------

// Function: erase @ 089c1e44

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   erase(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __position) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::erase
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __position)

{
  char *pcVar1;
  size_t __pos;
  
                    /* Unresolved local var: size_t __pos@[???] */
  __pos = (int)this - (int)__return_storage_ptr__->_M_current;
  _M_mutate((basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
            __return_storage_ptr__,__pos,1,0);
  pcVar1 = __return_storage_ptr__->_M_current;
  pcVar1[-0xffffffff00000004] = -1;
  pcVar1[-0xffffffff00000003] = -1;
  pcVar1[-0xffffffff00000002] = -1;
  pcVar1[-0xffffffff00000001] = -1;
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(pcVar1 + __pos);
}



----------------------------------------

// Function: erase @ 089c1e94

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   erase(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::erase
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n)

{
  uint uVar1;
  
  uVar1 = *(uint *)((this->_M_dataplus)._M_p + -0xc);
  if (__pos <= uVar1) {
    uVar1 = uVar1 - __pos;
    if (__n <= uVar1) {
      uVar1 = __n;
    }
    _M_mutate(this,__pos,uVar1,0);
    return this;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::erase");
}



----------------------------------------

// Function: insert @ 089c1eec

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos, char
   * __s, size_t __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          char *__s,size_t __n)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char *pcVar2;
  uint uVar3;
  char *src0;
  char *pcVar4;
  size_t len0;
  size_t in_stack_00000010;
  
  pcVar4 = (this->_M_dataplus)._M_p;
  uVar3 = *(uint *)(pcVar4 + -0xc);
  if (uVar3 < __pos) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::insert");
  }
  if (__n <= 0x3ffffffc - uVar3) {
    if (((pcVar4 <= __s) && (__s <= pcVar4 + uVar3)) && (*(int *)(pcVar4 + -4) < 1)) {
                    /* Unresolved local var: size_t __off@[???]
                       Unresolved local var: char * __p@[???] */
      _M_mutate(this,__pos,0,__n);
      pcVar2 = (this->_M_dataplus)._M_p;
      src0 = __s + ((int)pcVar2 - (int)pcVar4);
      pcVar2 = pcVar2 + __pos;
      pcVar4 = src0 + __n;
      if (pcVar2 < pcVar4) {
        len0 = (int)pcVar2 - (int)src0;
        if (src0 < pcVar2) {
                    /* Unresolved local var: size_t __nleft@[???] */
          if (len0 == 1) {
            *pcVar2 = *src0;
          }
          else {
            memcpy(pcVar2,src0,len0);
          }
          if (__n - len0 == 1) {
            pcVar2[len0] = pcVar2[__n];
          }
          else {
            memcpy(pcVar2 + len0,pcVar2 + __n,__n - len0);
          }
        }
        else if (__n == 1) {
          *pcVar2 = *pcVar4;
        }
        else {
          memcpy(pcVar2,pcVar4,__n);
        }
      }
      else if (__n == 1) {
        *pcVar2 = *src0;
      }
      else {
        memcpy(pcVar2,src0,__n);
      }
      return this;
    }
    pbVar1 = _M_replace_safe(this,__pos,0,__s,in_stack_00000010);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_length_error("basic_string::insert");
}



----------------------------------------

// Function: insert @ 089c20ac

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos, char
   * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          char *__s)

{
  size_t __n;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  __n = strlen(__s);
  pbVar1 = insert(this,__pos,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: insert @ 089c20fc

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos1,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos2, size_t
   __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos2,
          size_t __n)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char *pcVar2;
  uint uVar3;
  uint __n_00;
  uint in_t0;
  
  pcVar2 = (__str->_M_dataplus)._M_p;
  uVar3 = *(uint *)(pcVar2 + -0xc);
  __n_00 = uVar3 - __pos2;
  if (__pos2 <= uVar3) {
    if (in_t0 <= __n_00) {
      __n_00 = in_t0;
    }
    pbVar1 = insert(this,__pos1,pcVar2 + __pos2,__n_00);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::insert");
}



----------------------------------------

// Function: insert @ 089c2140

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   insert(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos1,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::insert
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char *__s;
  
  __s = (__str->_M_dataplus)._M_p;
  pbVar1 = insert(this,__pos1,__s,*(size_t *)(__s + -0xc));
  return pbVar1;
}



----------------------------------------

// Function: clear @ 089c214c

/* DWARF original prototype: void
   clear(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::clear
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  _M_mutate(this,0,*(size_t *)((this->_M_dataplus)._M_p + -0xc),0);
  return;
}



----------------------------------------

// Function: _M_leak_hard @ 089c2160

/* DWARF original prototype: void
   _M_leak_hard(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak_hard
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  size_t *psVar1;
  
  psVar1 = (size_t *)(this->_M_dataplus)._M_p;
  if (psVar1 != _Rep::_S_empty_rep_storage + 3) {
    if (0 < (int)psVar1[-1]) {
      _M_mutate(this,0,0,0);
      psVar1 = (size_t *)(this->_M_dataplus)._M_p;
    }
    psVar1[-1] = 0xffffffff;
  }
  return;
}



----------------------------------------

// Function: _M_leak @ 089c21c0

/* DWARF original prototype: void
   _M_leak(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::_M_leak
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  if (*(int *)((this->_M_dataplus)._M_p + -4) < 0) {
    return;
  }
  _M_leak_hard(this);
  return;
}



----------------------------------------

// Function: at @ 089c21e0

/* DWARF original prototype: char *
   at(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n) */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::at
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  if (__n < *(uint *)(pcVar1 + -0xc)) {
    if (-1 < *(int *)(pcVar1 + -4)) {
      _M_leak_hard(this);
      pcVar1 = (this->_M_dataplus)._M_p;
    }
    return pcVar1 + __n;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::at");
}



----------------------------------------

// Function: operator[] @ 089c2248

/* DWARF original prototype: char *
   operator[](basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos)
    */

char * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator[]
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  if (-1 < *(int *)(pcVar1 + -4)) {
    _M_leak_hard(this);
    pcVar1 = (this->_M_dataplus)._M_p;
  }
  return pcVar1 + __pos;
}



----------------------------------------

// Function: end @ 089c2290

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   end(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::end
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  char *pcVar1;
  
  pcVar1 = __return_storage_ptr__->_M_current;
  if (-1 < *(int *)(pcVar1 + -4)) {
    _M_leak_hard((basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                 __return_storage_ptr__);
    pcVar1 = __return_storage_ptr__->_M_current;
  }
  return (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          *)(pcVar1 + *(int *)(pcVar1 + -0xc));
}



----------------------------------------

// Function: begin @ 089c22d0

/* DWARF original prototype:
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   begin(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_> *
__thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::begin
          (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
  *p_Var1;
  
  p_Var1 = (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
            *)__return_storage_ptr__->_M_current;
  if (-1 < (int)p_Var1[-1]._M_current) {
    _M_leak_hard((basic_string<char,std::char_traits<char>,std::allocator<char>_> *)
                 __return_storage_ptr__);
    p_Var1 = (__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
              *)__return_storage_ptr__->_M_current;
  }
  return p_Var1;
}



----------------------------------------

// Function: rend @ 089c230c

/* DWARF original prototype:
   reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
   rend(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rend
          (reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  if (-1 < *(int *)(pcVar1 + -4)) {
    _M_leak_hard(this);
    pcVar1 = (this->_M_dataplus)._M_p;
  }
  (__return_storage_ptr__->current)._M_current = pcVar1;
  return __return_storage_ptr__;
}



----------------------------------------

// Function: rbegin @ 089c235c

/* DWARF original prototype:
   reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
   rbegin(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this) */

reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
* __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::rbegin
          (reverse_iterator<__gnu_cxx::__normal_iterator<char*,_std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>_>
           *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *this)

{
  char *pcVar1;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  if (-1 < *(int *)(pcVar1 + -4)) {
    _M_leak_hard(this);
    pcVar1 = (this->_M_dataplus)._M_p;
  }
  (__return_storage_ptr__->current)._M_current = pcVar1 + *(int *)(pcVar1 + -0xc);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: assign @ 089c23b4

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   assign(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::assign
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  _Atomic_word _Var1;
  char *pcVar2;
  _Rep *this_00;
  char *pcVar3;
  allocator<char> aaStack_20 [8];
  
  pcVar2 = (this->_M_dataplus)._M_p;
  pcVar3 = (__str->_M_dataplus)._M_p;
  this_00 = (_Rep *)(pcVar3 + -0xc);
  if ((_Rep *)(pcVar2 + -0xc) != this_00) {
                    /* Unresolved local var: allocator<char> __a@[???]
                       Unresolved local var: char * __tmp@[???] */
    if (*(int *)(pcVar3 + -4) < 0) {
                    /* try { // try from 089c23f8 to 089c23ff has its CatchHandler @ 089c2490 */
      pcVar3 = _Rep::_M_clone(this_00,aaStack_20,0);
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    else {
                    /* Unresolved local var: void * __p@[???] */
      if (this_00 != (_Rep *)_Rep::_S_empty_rep_storage) {
                    /* try { // try from 089c247c to 089c2483 has its CatchHandler @ 089c249c */
        __gnu_cxx::__atomic_add((_Atomic_word *)(pcVar3 + -4),1);
        pcVar2 = (this->_M_dataplus)._M_p;
      }
    }
    if ((_Rep *)(pcVar2 + -0xc) == (_Rep *)_Rep::_S_empty_rep_storage) {
      (this->_M_dataplus)._M_p = pcVar3;
    }
    else {
                    /* try { // try from 089c2454 to 089c245b has its CatchHandler @ 089c2490 */
      _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
      if (_Var1 < 1) {
        _Rep::_M_destroy((_Rep *)(pcVar2 + -0xc),aaStack_20);
        (this->_M_dataplus)._M_p = pcVar3;
      }
      else {
        (this->_M_dataplus)._M_p = pcVar3;
      }
    }
  }
  return this;
}



----------------------------------------

// Function: operator= @ 089c24b0

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  _Atomic_word _Var1;
  char *pcVar2;
  _Rep *this_00;
  char *pcVar3;
  allocator<char> aaStack_20 [8];
  
  pcVar2 = (this->_M_dataplus)._M_p;
  pcVar3 = (__str->_M_dataplus)._M_p;
  this_00 = (_Rep *)(pcVar3 + -0xc);
  if ((_Rep *)(pcVar2 + -0xc) != this_00) {
    if (*(int *)(pcVar3 + -4) < 0) {
      pcVar3 = _Rep::_M_clone(this_00,aaStack_20,0);
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    else if (this_00 != (_Rep *)_Rep::_S_empty_rep_storage) {
      __gnu_cxx::__atomic_add((_Atomic_word *)(pcVar3 + -4),1);
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    if ((_Rep *)(pcVar2 + -0xc) == (_Rep *)_Rep::_S_empty_rep_storage) {
      (this->_M_dataplus)._M_p = pcVar3;
    }
    else {
      _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
      if (_Var1 < 1) {
        _Rep::_M_destroy((_Rep *)(pcVar2 + -0xc),aaStack_20);
        (this->_M_dataplus)._M_p = pcVar3;
      }
      else {
        (this->_M_dataplus)._M_p = pcVar3;
      }
    }
  }
  return this;
}



----------------------------------------

// Function: reserve @ 089c24b8

/* DWARF original prototype: void
   reserve(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __res) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __res)

{
  _Atomic_word _Var1;
  char *pcVar2;
  char *pcVar3;
  uint uVar4;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  pcVar3 = (this->_M_dataplus)._M_p;
  if (*(size_t *)(pcVar3 + -8) == __res) {
    if (*(int *)(pcVar3 + -4) < 1) {
      return;
    }
    uVar4 = *(uint *)(pcVar3 + -0xc);
  }
  else {
                    /* Unresolved local var: allocator<char> __a@[???]
                       Unresolved local var: char * __tmp@[???] */
    uVar4 = *(uint *)(pcVar3 + -0xc);
  }
  if (__res < uVar4) {
    __res = uVar4;
  }
                    /* try { // try from 089c24f4 to 089c255f has its CatchHandler @ 089c257c */
  pcVar3 = _Rep::_M_clone((_Rep *)(pcVar3 + -0xc),aaStack_18,__res - uVar4);
  pcVar2 = (this->_M_dataplus)._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  if (this_00 == (_Rep *)_Rep::_S_empty_rep_storage) {
    (this->_M_dataplus)._M_p = pcVar3;
  }
  else {
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      _Rep::_M_destroy(this_00,aaStack_18);
      (this->_M_dataplus)._M_p = pcVar3;
    }
    else {
      (this->_M_dataplus)._M_p = pcVar3;
    }
  }
  return;
}



----------------------------------------

// Function: push_back @ 089c2584

/* DWARF original prototype: void
   push_back(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::push_back
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c)

{
  char *pcVar1;
  uint __res;
  
                    /* Unresolved local var: size_t __len@[???] */
  pcVar1 = (this->_M_dataplus)._M_p;
  __res = *(int *)(pcVar1 + -0xc) + 1;
  if ((__res <= *(uint *)(pcVar1 + -8)) && (*(int *)(pcVar1 + -4) < 1)) {
    pcVar1[*(int *)(pcVar1 + -0xc)] = __c;
    pcVar1 = (this->_M_dataplus)._M_p;
    *(uint *)(pcVar1 + -0xc) = __res;
    pcVar1[-0xffffffff00000004] = '\0';
    pcVar1[-0xffffffff00000003] = '\0';
    pcVar1[-0xffffffff00000002] = '\0';
    pcVar1[-0xffffffff00000001] = '\0';
    pcVar1[__res] = '\0';
    return;
  }
  reserve(this,__res);
  pcVar1 = (this->_M_dataplus)._M_p;
  pcVar1[*(int *)(pcVar1 + -0xc)] = __c;
  pcVar1 = (this->_M_dataplus)._M_p;
  *(uint *)(pcVar1 + -0xc) = __res;
  pcVar1[-0xffffffff00000004] = '\0';
  pcVar1[-0xffffffff00000003] = '\0';
  pcVar1[-0xffffffff00000002] = '\0';
  pcVar1[-0xffffffff00000001] = '\0';
  pcVar1[__res] = '\0';
  return;
}



----------------------------------------

// Function: append @ 089c2650

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   append(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n, char
   __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n,char __c
          )

{
  int iVar1;
  char *pcVar2;
  uint __res;
  
  if (__n != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    pcVar2 = (this->_M_dataplus)._M_p;
    if (0x3ffffffcU - *(int *)(pcVar2 + -0xc) < __n) {
                    /* WARNING: Subroutine does not return */
      __throw_length_error("basic_string::append");
    }
    __res = __n + *(int *)(pcVar2 + -0xc);
    if ((*(uint *)(pcVar2 + -8) < __res) || (0 < *(int *)(pcVar2 + -4))) {
      reserve(this,__res);
      pcVar2 = (this->_M_dataplus)._M_p;
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    else {
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    if (__n == 1) {
      pcVar2[iVar1] = __c;
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    else {
      memset(pcVar2 + iVar1,(int)__c,__n);
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    *(uint *)(pcVar2 + -0xc) = __res;
    pcVar2[-0xffffffff00000004] = '\0';
    pcVar2[-0xffffffff00000003] = '\0';
    pcVar2[-0xffffffff00000002] = '\0';
    pcVar2[-0xffffffff00000001] = '\0';
    pcVar2[__res] = '\0';
  }
  return this;
}



----------------------------------------

// Function: resize @ 089c2730

/* DWARF original prototype: void
   resize(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n, char
   __c) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::resize
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n,char __c
          )

{
  uint uVar1;
  
                    /* Unresolved local var: size_t __size@[???] */
  uVar1 = *(uint *)((this->_M_dataplus)._M_p + -0xc);
  if (0x3ffffffc < __n) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::resize");
  }
  if (__n <= uVar1) {
    if (uVar1 <= __n) {
      return;
    }
    _M_mutate(this,__n,uVar1 - __n,0);
    return;
  }
  append(this,__n - uVar1,__c);
  return;
}



----------------------------------------

// Function: resize @ 089c27a0

/* DWARF original prototype: void
   resize(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __n) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::resize
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __n)

{
  uint uVar1;
  
  uVar1 = *(uint *)((this->_M_dataplus)._M_p + -0xc);
  if (0x3ffffffc < __n) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::resize");
  }
  if (__n <= uVar1) {
    if (uVar1 <= __n) {
      return;
    }
    _M_mutate(this,__n,uVar1 - __n,0);
    return;
  }
  append(this,__n - uVar1,'\0');
  return;
}



----------------------------------------

// Function: append @ 089c27a8

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   append(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s, size_t
   __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s,
          size_t __n)

{
  int iVar1;
  char *pcVar2;
  char *pcVar3;
  uint __res;
  
  if (__n == 0) {
    return this;
  }
                    /* Unresolved local var: size_t __len@[???] */
  pcVar2 = (this->_M_dataplus)._M_p;
  iVar1 = *(int *)(pcVar2 + -0xc);
  if (__n <= 0x3ffffffcU - iVar1) {
    __res = __n + iVar1;
    if ((*(uint *)(pcVar2 + -8) < __res) || (0 < *(int *)(pcVar2 + -4))) {
      if ((__s < pcVar2) || (pcVar2 + iVar1 < __s)) {
        reserve(this,__res);
        pcVar3 = (this->_M_dataplus)._M_p;
      }
      else {
                    /* Unresolved local var: size_t __off@[???] */
        reserve(this,__res);
        pcVar3 = (this->_M_dataplus)._M_p;
        __s = __s + ((int)pcVar3 - (int)pcVar2);
      }
      pcVar2 = pcVar3 + *(int *)(pcVar3 + -0xc);
    }
    else {
      pcVar2 = pcVar2 + *(int *)(pcVar2 + -0xc);
    }
    if (__n == 1) {
      *pcVar2 = *__s;
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    else {
      memcpy(pcVar2,__s,__n);
      pcVar2 = (this->_M_dataplus)._M_p;
    }
    *(uint *)(pcVar2 + -0xc) = __res;
    pcVar2[-0xffffffff00000004] = '\0';
    pcVar2[-0xffffffff00000003] = '\0';
    pcVar2[-0xffffffff00000002] = '\0';
    pcVar2[-0xffffffff00000001] = '\0';
    pcVar2[__res] = '\0';
    return this;
  }
                    /* WARNING: Subroutine does not return */
  __throw_length_error("basic_string::append");
}



----------------------------------------

// Function: append @ 089c28d0

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   append(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  size_t __n;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  __n = strlen(__s);
  pbVar1 = append(this,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: operator+= @ 089c2910

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator+=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator+=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char *__s)

{
  size_t __n;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  __n = strlen(__s);
  pbVar1 = append(this,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: append @ 089c2950

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   append(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t __pos, size_t
   __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,size_t __pos,
          size_t __n)

{
  uint len0;
  int iVar1;
  char *pcVar2;
  char *pcVar3;
  uint __res;
  
  pcVar2 = (__str->_M_dataplus)._M_p;
  if (__pos <= *(uint *)(pcVar2 + -0xc)) {
    len0 = *(uint *)(pcVar2 + -0xc) - __pos;
    if (__n <= len0) {
      len0 = __n;
    }
    if (len0 != 0) {
                    /* Unresolved local var: size_t __len@[???] */
      pcVar3 = (this->_M_dataplus)._M_p;
      iVar1 = *(int *)(pcVar3 + -0xc);
      __res = len0 + iVar1;
      if ((*(uint *)(pcVar3 + -8) < __res) || (0 < *(int *)(pcVar3 + -4))) {
        reserve(this,__res);
        pcVar2 = (__str->_M_dataplus)._M_p;
        pcVar3 = (this->_M_dataplus)._M_p;
        iVar1 = *(int *)(pcVar3 + -0xc);
      }
      if (len0 == 1) {
        pcVar3[iVar1] = pcVar2[__pos];
        pcVar2 = (this->_M_dataplus)._M_p;
      }
      else {
        memcpy(pcVar3 + iVar1,pcVar2 + __pos,len0);
        pcVar2 = (this->_M_dataplus)._M_p;
      }
      *(uint *)(pcVar2 + -0xc) = __res;
      pcVar2[-0xffffffff00000004] = '\0';
      pcVar2[-0xffffffff00000003] = '\0';
      pcVar2[-0xffffffff00000002] = '\0';
      pcVar2[-0xffffffff00000001] = '\0';
      pcVar2[__res] = '\0';
    }
    return this;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::append");
}



----------------------------------------

// Function: append @ 089c2a50

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   append(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  int iVar1;
  char *pcVar2;
  char *pcVar3;
  size_t len0;
  uint __res;
  
                    /* Unresolved local var: size_t __size@[???] */
  pcVar3 = (__str->_M_dataplus)._M_p;
  len0 = *(size_t *)(pcVar3 + -0xc);
  if (len0 != 0) {
                    /* Unresolved local var: size_t __len@[???] */
    pcVar2 = (this->_M_dataplus)._M_p;
    __res = len0 + *(int *)(pcVar2 + -0xc);
    if ((*(uint *)(pcVar2 + -8) < __res) || (0 < *(int *)(pcVar2 + -4))) {
      reserve(this,__res);
      pcVar3 = (__str->_M_dataplus)._M_p;
      pcVar2 = (this->_M_dataplus)._M_p;
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    else {
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    if (len0 == 1) {
      pcVar2[iVar1] = *pcVar3;
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    else {
      memcpy(pcVar2 + iVar1,pcVar3,len0);
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    *(uint *)(pcVar3 + -0xc) = __res;
    pcVar3[-0xffffffff00000004] = '\0';
    pcVar3[-0xffffffff00000003] = '\0';
    pcVar3[-0xffffffff00000002] = '\0';
    pcVar3[-0xffffffff00000001] = '\0';
    pcVar3[__res] = '\0';
  }
  return this;
}



----------------------------------------

// Function: operator+= @ 089c2b24

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator+=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator+=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  int iVar1;
  char *pcVar2;
  char *pcVar3;
  size_t len0;
  uint __res;
  
  pcVar3 = (__str->_M_dataplus)._M_p;
  len0 = *(size_t *)(pcVar3 + -0xc);
  if (len0 != 0) {
    pcVar2 = (this->_M_dataplus)._M_p;
    __res = len0 + *(int *)(pcVar2 + -0xc);
    if ((*(uint *)(pcVar2 + -8) < __res) || (0 < *(int *)(pcVar2 + -4))) {
      reserve(this,__res);
      pcVar3 = (__str->_M_dataplus)._M_p;
      pcVar2 = (this->_M_dataplus)._M_p;
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    else {
      iVar1 = *(int *)(pcVar2 + -0xc);
    }
    if (len0 == 1) {
      pcVar2[iVar1] = *pcVar3;
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    else {
      memcpy(pcVar2 + iVar1,pcVar3,len0);
      pcVar3 = (this->_M_dataplus)._M_p;
    }
    *(uint *)(pcVar3 + -0xc) = __res;
    pcVar3[-0xffffffff00000004] = '\0';
    pcVar3[-0xffffffff00000003] = '\0';
    pcVar3[-0xffffffff00000002] = '\0';
    pcVar3[-0xffffffff00000001] = '\0';
    pcVar3[__res] = '\0';
  }
  return this;
}



----------------------------------------

// Function: operator+= @ 089c2b2c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   operator+=(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, char __c) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::operator+=
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,char __c)

{
  char *pcVar1;
  uint __res;
  
                    /* Unresolved local var: size_t __len@[???] */
  pcVar1 = (this->_M_dataplus)._M_p;
  __res = *(int *)(pcVar1 + -0xc) + 1;
  if ((*(uint *)(pcVar1 + -8) < __res) || (0 < *(int *)(pcVar1 + -4))) {
    reserve(this,__res);
    pcVar1 = (this->_M_dataplus)._M_p;
  }
  pcVar1[*(int *)(pcVar1 + -0xc)] = __c;
  pcVar1 = (this->_M_dataplus)._M_p;
  *(uint *)(pcVar1 + -0xc) = __res;
  pcVar1[-0xffffffff00000004] = '\0';
  pcVar1[-0xffffffff00000003] = '\0';
  pcVar1[-0xffffffff00000002] = '\0';
  pcVar1[-0xffffffff00000001] = '\0';
  pcVar1[__res] = '\0';
  return this;
}



----------------------------------------

// Function: ~basic_string @ 089c2bc4

/* DWARF original prototype: void
   ~basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, int
   __in_chrg) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::~basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  _Rep *this_00;
  allocator<char> aaStack_10 [8];
  
  pcVar2 = (this->_M_dataplus)._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
                    /* try { // try from 089c2bf8 to 089c2bff has its CatchHandler @ 089c2c1c */
  if ((this_00 != (_Rep *)_Rep::_S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1), _Var1 < 1)) {
    _Rep::_M_destroy(this_00,aaStack_10);
  }
  return;
}



----------------------------------------

// Function: ~basic_string @ 089c2c24

/* DWARF original prototype: void
   ~basic_string(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, int
   __in_chrg) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::~basic_string
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  _Rep *this_00;
  allocator<char> aaStack_10 [8];
  
  pcVar2 = (this->_M_dataplus)._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
                    /* try { // try from 089c2c58 to 089c2c5f has its CatchHandler @ 089c2c7c */
  if ((this_00 != (_Rep *)_Rep::_S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1), _Var1 < 1)) {
    _Rep::_M_destroy(this_00,aaStack_10);
  }
  return;
}



----------------------------------------

// Function: operator+<char,_std::char_traits<char>,_std::allocator<char>_> @ 089c2c84

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator+<char, std::char_traits<char>, std::allocator<char> > */

basic_string<char,std::char_traits<char>,std::allocator<char>_> *
std::operator+<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__lhs,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__rhs)

{
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> *
                       __str@[DW_OP_reg17(s1)]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                        */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,__lhs);
                    /* try { // try from 089c2ca4 to 089c2cab has its CatchHandler @ 089c2cc4 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
            (__return_storage_ptr__,__rhs);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: operator+<char,_std::char_traits<char>,_std::allocator<char>_> @ 089c2d18

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator+<char, std::char_traits<char>, std::allocator<char> > */

basic_string<char,std::char_traits<char>,std::allocator<char>_> *
std::operator+<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          char *__lhs,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__rhs)

{
  size_t __n;
  
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> *
                       __str@[DW_OP_reg16(s0)]
                       Unresolved local var: size_t __len@[???]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                        */
  __n = strlen(__lhs);
                    /* Unresolved local var: void * __p@[???] */
  (__return_storage_ptr__->_M_dataplus)._M_p = (char *)0x8a1e514;
                    /* try { // try from 089c2d68 to 089c2d8b has its CatchHandler @ 089c2db0 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
            (__return_storage_ptr__,__n + *(int *)((__rhs->_M_dataplus)._M_p + -0xc));
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
            (__return_storage_ptr__,__lhs,__n);
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
            (__return_storage_ptr__,__rhs);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: operator+<char,_std::char_traits<char>,_std::allocator<char>_> @ 089c2dfc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: operator+<char, std::char_traits<char>, std::allocator<char> > */

basic_string<char,std::char_traits<char>,std::allocator<char>_> *
std::operator+<char,_std::char_traits<char>,_std::allocator<char>_>
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *__return_storage_ptr__,
          char __lhs,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__rhs)

{
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> *
                       __str@[DW_OP_reg16(s0)]
                       Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __str@[???]
                       Unresolved local var: size_t __len@[???] */
                    /* Unresolved local var: void * __p@[???] */
  (__return_storage_ptr__->_M_dataplus)._M_p = (char *)0x8a1e514;
                    /* try { // try from 089c2e38 to 089c2e5b has its CatchHandler @ 089c2e7c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::reserve
            (__return_storage_ptr__,*(int *)((__rhs->_M_dataplus)._M_p + -0xc) + 1);
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
            (__return_storage_ptr__,1,__lhs);
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::append
            (__return_storage_ptr__,__rhs);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: swap @ 089c2ec8

/* DWARF original prototype: void
   swap(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   basic_string<char,std::char_traits<char>,std::allocator<char>_> * __s) */

void __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::swap
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          basic_string<char,std::char_traits<char>,std::allocator<char>_> *__s)

{
  char *pcVar1;
  char *pcVar2;
  
  pcVar2 = (this->_M_dataplus)._M_p;
  if (*(int *)(pcVar2 + -4) < 0) {
    pcVar2[-0xffffffff00000004] = '\0';
    pcVar2[-0xffffffff00000003] = '\0';
    pcVar2[-0xffffffff00000002] = '\0';
    pcVar2[-0xffffffff00000001] = '\0';
  }
  pcVar1 = (__s->_M_dataplus)._M_p;
  if (*(int *)(pcVar1 + -4) < 0) {
    pcVar1[-0xffffffff00000004] = '\0';
    pcVar1[-0xffffffff00000003] = '\0';
    pcVar1[-0xffffffff00000002] = '\0';
    pcVar1[-0xffffffff00000001] = '\0';
  }
                    /* Unresolved local var: char * __tmp@[???] */
  (this->_M_dataplus)._M_p = pcVar1;
  (__s->_M_dataplus)._M_p = pcVar2;
  return;
}



----------------------------------------

// Function: replace @ 089c2efc

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n1, char * __s, size_t __n2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n1,char *__s,size_t __n2)

{
  int iVar1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar2;
  _Atomic_word _Var3;
  uint uVar4;
  char *src0;
  uint in_t0;
  char *pcVar5;
  size_t unaff_s2;
  uint __n1_00;
  allocator<char> aStackY_1f;
  allocator<char> aaStackY_1e [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_1c;
  
                    /* Unresolved local var: bool __left@[???] */
  pcVar5 = (this->_M_dataplus)._M_p;
  uVar4 = *(uint *)(pcVar5 + -0xc);
  if (uVar4 < __pos) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range("basic_string::replace");
  }
  __n1_00 = uVar4 - __pos;
  if (__n1 <= uVar4 - __pos) {
    __n1_00 = __n1;
  }
  if (0x3ffffffc - (uVar4 - __n1_00) < in_t0) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error("basic_string::replace");
  }
  if (((__s < pcVar5) || (pcVar5 + uVar4 < __s)) || (0 < *(int *)(pcVar5 + -4))) {
    this = _M_replace_safe(this,__pos,__n1_00,__s,unaff_s2);
  }
  else {
    if (pcVar5 + __pos < __s + in_t0) {
      if (__s < pcVar5 + __pos + __n1_00) {
                    /* Unresolved local var:
                       basic_string<char,std::char_traits<char>,std::allocator<char>_> __tmp@[???]
                        */
                    /* try { // try from 089c3040 to 089c3047 has its CatchHandler @ 089c30e4 */
        basic_string(&local_1c,__s,in_t0,aaStackY_1e);
                    /* try { // try from 089c3058 to 089c305f has its CatchHandler @ 089c30c4 */
        pbVar2 = _M_replace_safe(this,__pos,__n1_00,(char *)local_1c._M_dataplus._M_p,unaff_s2);
        if ((_Rep *)((int)local_1c._M_dataplus._M_p + -0xc) == (_Rep *)_Rep::_S_empty_rep_storage) {
          return pbVar2;
        }
                    /* try { // try from 089c3080 to 089c3087 has its CatchHandler @ 089c30bc */
        _Var3 = __gnu_cxx::__exchange_and_add
                          ((_Atomic_word *)((int)local_1c._M_dataplus._M_p + -4),-1);
        if (0 < _Var3) {
          return pbVar2;
        }
        _Rep::_M_destroy((_Rep *)((int)local_1c._M_dataplus._M_p + -0xc),&aStackY_1f);
        return pbVar2;
      }
      iVar1 = (in_t0 - __n1_00) - (int)pcVar5;
    }
    else {
      iVar1 = -(int)pcVar5;
    }
                    /* Unresolved local var: size_t __off@[???] */
    _M_mutate(this,__pos,__n1_00,in_t0);
    pcVar5 = (this->_M_dataplus)._M_p;
    src0 = pcVar5 + (int)(__s + iVar1);
    pcVar5 = pcVar5 + __pos;
    if (in_t0 == 1) {
      *pcVar5 = *src0;
    }
    else {
      memcpy(pcVar5,src0,in_t0);
    }
  }
  return this;
}



----------------------------------------

// Function: replace @ 089c311c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, 
   __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __k1, 
   __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __k2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,
          __normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __k1,__normal_iterator<const_char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __k2)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,__k1._M_current,
                   (size_t)__k2._M_current);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c3130

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __k1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __k2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __k1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __k2)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,__k1._M_current,
                   (size_t)__k2._M_current);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c3144

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, char * __k1, char * __k2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,char *__k1,char *__k2)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,__k1,(size_t)__k2);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c3158

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, char * __k1, char * __k2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,char *__k1,char *__k2)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,__k1,(size_t)__k2);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c316c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, char * __s, size_t __n) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,char *__s,size_t __n)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,__s,__n);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c317c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n1, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n1,char *__s)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  size_t in_stack_00000010;
  
  strlen(__s);
  pbVar1 = replace(this,__pos,__n1,__s,in_stack_00000010);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c31dc

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos1,
   size_t __n1, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str, size_t
   __pos2, size_t __n2) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos1,
          size_t __n1,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str,
          size_t __pos2,size_t __n2)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  char *pcVar2;
  uint in_t0;
  
  pcVar2 = (__str->_M_dataplus)._M_p;
  if (in_t0 <= *(uint *)(pcVar2 + -0xc)) {
    pbVar1 = replace(this,__pos1,__n1,pcVar2 + in_t0,__pos2);
    return pbVar1;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range("basic_string::replace");
}



----------------------------------------

// Function: replace @ 089c3220

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this, size_t __pos,
   size_t __n, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,size_t __pos,
          size_t __n,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  size_t in_stack_00000010;
  
  pbVar1 = replace(this,__pos,__n,(__str->_M_dataplus)._M_p,in_stack_00000010);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c322c

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, basic_string<char,std::char_traits<char>,std::allocator<char>_> * __str) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,basic_string<char,std::char_traits<char>,std::allocator<char>_> *__str)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar1;
  size_t in_stack_00000010;
  
  pbVar1 = replace(this,(int)__i1._M_current - (int)(this->_M_dataplus)._M_p,
                   (int)__i2._M_current - (int)__i1._M_current,(__str->_M_dataplus)._M_p,
                   in_stack_00000010);
  return pbVar1;
}



----------------------------------------

// Function: replace @ 089c3244

/* DWARF original prototype: basic_string<char,std::char_traits<char>,std::allocator<char>_> *
   replace(basic_string<char,std::char_traits<char>,std::allocator<char>_> * this,
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i1, 
   __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
   __i2, char * __s) */

basic_string<char,std::char_traits<char>,std::allocator<char>_> * __thiscall
std::basic_string<char,std::char_traits<char>,std::allocator<char>_>::replace
          (basic_string<char,std::char_traits<char>,std::allocator<char>_> *this,
          __normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
          __i1,__normal_iterator<char*,std::basic_string<char,_std::char_traits<char>,_std::allocator<char>_>_>
               __i2,char *__s)

{
  char *pcVar1;
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *pbVar2;
  size_t in_stack_00000010;
  
  pcVar1 = (this->_M_dataplus)._M_p;
  strlen(__s);
  pbVar2 = replace(this,(int)__i1._M_current - (int)pcVar1,
                   (int)__i2._M_current - (int)__i1._M_current,__s,in_stack_00000010);
  return pbVar2;
}



----------------------------------------

// Function: __exchange_and_add @ 089c32a8

_Atomic_word __gnu_cxx::__exchange_and_add(_Atomic_word *__mem,int __val)

{
  _Atomic_word _Var1;
  
                    /* Unresolved local var: _Atomic_word __result@[???] */
  _Var1 = *__mem;
  *__mem = *__mem + __val;
  return _Var1;
}



----------------------------------------

// Function: __atomic_add @ 089c32c0

void __gnu_cxx::__atomic_add(_Atomic_word *__mem,int __val)

{
  *__mem = *__mem + __val;
  return;
}



----------------------------------------

// Function: _M_transform @ 089c32c8

/* DWARF original prototype: size_t _M_transform(collate<char> * this, char * __to, char * __from,
   size_t __n) */

size_t __thiscall
std::collate<char>::_M_transform(collate<char> *this,char *__to,char *__from,size_t __n)

{
  size_t sVar1;
  
  sVar1 = strxfrm(__to,__from,__n);
  return sVar1;
}



----------------------------------------

// Function: _M_compare @ 089c32d8

/* DWARF original prototype: int _M_compare(collate<char> * this, char * __one, char * __two) */

int __thiscall std::collate<char>::_M_compare(collate<char> *this,char *__one,char *__two)

{
  int iVar1;
  
                    /* Unresolved local var: int __cmp@[???] */
  iVar1 = strcoll(__one,__two);
  return iVar1 >> 0x1e | (uint)(iVar1 != 0);
}



----------------------------------------

// Function: do_get @ 089c3304

/* DWARF original prototype: string do_get(messages<char> * this, int param_1, int param_2, int
   param_3, string * __dfault) */

string * __thiscall
std::messages<char>::do_get
          (string *__return_storage_ptr__,messages<char> *this,int param_1,int param_2,int param_3,
          string *__dfault)

{
  basic_string<char,std::char_traits<char>,std::allocator<char>_> *in_t1;
  
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (__return_storage_ptr__,in_t1);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: _S_construct_pattern @ 089c3330

pattern * std::money_base::_S_construct_pattern
                    (pattern *__return_storage_ptr__,char param_1,char param_2,char param_3)

{
  return (pattern *)_S_default_pattern.field;
}



----------------------------------------

// Function: ~moneypunct @ 089c3374

/* DWARF original prototype: void ~moneypunct(moneypunct<char,false> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,false>::~moneypunct(moneypunct<char,false> *this,int __in_chrg)

{
  __moneypunct_cache<char,false> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  if (p_Var1 != (__moneypunct_cache<char,false> *)0x0) {
                    /* try { // try from 089c33a4 to 089c33ab has its CatchHandler @ 089c33cc */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~moneypunct @ 089c33e0

/* DWARF original prototype: void ~moneypunct(moneypunct<char,false> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,false>::~moneypunct(moneypunct<char,false> *this,int __in_chrg)

{
  __moneypunct_cache<char,false> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  if (p_Var1 != (__moneypunct_cache<char,false> *)0x0) {
                    /* try { // try from 089c3410 to 089c3417 has its CatchHandler @ 089c3430 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct @ 089c3444

/* DWARF original prototype: void ~moneypunct(moneypunct<char,false> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,false>::~moneypunct(moneypunct<char,false> *this,int __in_chrg)

{
  __moneypunct_cache<char,false> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efb80;
  if (p_Var1 != (__moneypunct_cache<char,false> *)0x0) {
                    /* try { // try from 089c3474 to 089c347b has its CatchHandler @ 089c3494 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct @ 089c34a8

/* DWARF original prototype: void ~moneypunct(moneypunct<char,true> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,true>::~moneypunct(moneypunct<char,true> *this,int __in_chrg)

{
  __moneypunct_cache<char,true> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  if (p_Var1 != (__moneypunct_cache<char,true> *)0x0) {
                    /* try { // try from 089c34d8 to 089c34df has its CatchHandler @ 089c3500 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~moneypunct @ 089c3514

/* DWARF original prototype: void ~moneypunct(moneypunct<char,true> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,true>::~moneypunct(moneypunct<char,true> *this,int __in_chrg)

{
  __moneypunct_cache<char,true> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  if (p_Var1 != (__moneypunct_cache<char,true> *)0x0) {
                    /* try { // try from 089c3544 to 089c354b has its CatchHandler @ 089c3564 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~moneypunct @ 089c3578

/* DWARF original prototype: void ~moneypunct(moneypunct<char,true> * this, int __in_chrg) */

void __thiscall std::moneypunct<char,true>::~moneypunct(moneypunct<char,true> *this,int __in_chrg)

{
  __moneypunct_cache<char,true> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__moneypunct_089efbb8;
  if (p_Var1 != (__moneypunct_cache<char,true> *)0x0) {
                    /* try { // try from 089c35a8 to 089c35af has its CatchHandler @ 089c35c8 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: _M_initialize_moneypunct @ 089c35dc

/* DWARF original prototype: void _M_initialize_moneypunct(moneypunct<char,false> * this, __c_locale
   param_1, char * param_2) */

void __thiscall
std::moneypunct<char,false>::_M_initialize_moneypunct
          (moneypunct<char,false> *this,__c_locale param_1,char *param_2)

{
  pattern pVar1;
  __moneypunct_cache<char,false> *p_Var2;
  int iVar3;
  int iVar4;
  
  p_Var2 = this->_M_data;
  if (p_Var2 == (__moneypunct_cache<char,false> *)0x0) {
    p_Var2 = operator_new(0x44);
    p_Var2->_M_decimal_point = '\0';
    p_Var2->_M_thousands_sep = '\0';
    *(undefined4 *)(p_Var2->_M_pos_format).field = 0;
    (p_Var2->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef928;
    (p_Var2->super_facet)._M_refcount = 0;
    p_Var2->_M_grouping = (char *)0x0;
    p_Var2->_M_grouping_size = 0;
    p_Var2->_M_use_grouping = false;
    p_Var2->_M_curr_symbol = (char *)0x0;
    p_Var2->_M_curr_symbol_size = 0;
    p_Var2->_M_positive_sign = (char *)0x0;
    p_Var2->_M_positive_sign_size = 0;
    p_Var2->_M_negative_sign = (char *)0x0;
    p_Var2->_M_negative_sign_size = 0;
    p_Var2->_M_frac_digits = 0;
    *(undefined4 *)(p_Var2->_M_neg_format).field = 0;
    p_Var2->_M_allocated = false;
    this->_M_data = p_Var2;
  }
  p_Var2->_M_decimal_point = '.';
  this->_M_data->_M_thousands_sep = ',';
  pVar1 = money_base::_S_default_pattern;
  p_Var2 = this->_M_data;
  p_Var2->_M_grouping_size = 0;
  *&(p_Var2->_M_pos_format).field = pVar1.field;
  *&(this->_M_data->_M_neg_format).field = money_base::_S_default_pattern.field;
  p_Var2->_M_negative_sign = "";
  p_Var2->_M_grouping = "";
  p_Var2->_M_curr_symbol = "";
  p_Var2->_M_curr_symbol_size = 0;
  p_Var2->_M_positive_sign = "";
  p_Var2->_M_positive_sign_size = 0;
  p_Var2->_M_negative_sign_size = 0;
  p_Var2->_M_frac_digits = 0;
  iVar3 = 0;
  do {
                    /* Unresolved local var: size_t __i@[???] */
    iVar4 = iVar3 + 1;
    this->_M_data->_M_atoms[iVar3] = money_base::_S_atoms[iVar3];
    iVar3 = iVar4;
  } while (iVar4 != 0xb);
  return;
}



----------------------------------------

// Function: _M_initialize_moneypunct @ 089c3700

/* DWARF original prototype: void _M_initialize_moneypunct(moneypunct<char,true> * this, __c_locale
   param_1, char * param_2) */

void __thiscall
std::moneypunct<char,true>::_M_initialize_moneypunct
          (moneypunct<char,true> *this,__c_locale param_1,char *param_2)

{
  pattern pVar1;
  __moneypunct_cache<char,true> *p_Var2;
  int iVar3;
  int iVar4;
  
  p_Var2 = this->_M_data;
  if (p_Var2 == (__moneypunct_cache<char,true> *)0x0) {
    p_Var2 = operator_new(0x44);
    p_Var2->_M_decimal_point = '\0';
    p_Var2->_M_thousands_sep = '\0';
    *(undefined4 *)(p_Var2->_M_pos_format).field = 0;
    (p_Var2->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____moneypunct_cache_089ef918;
    (p_Var2->super_facet)._M_refcount = 0;
    p_Var2->_M_grouping = (char *)0x0;
    p_Var2->_M_grouping_size = 0;
    p_Var2->_M_use_grouping = false;
    p_Var2->_M_curr_symbol = (char *)0x0;
    p_Var2->_M_curr_symbol_size = 0;
    p_Var2->_M_positive_sign = (char *)0x0;
    p_Var2->_M_positive_sign_size = 0;
    p_Var2->_M_negative_sign = (char *)0x0;
    p_Var2->_M_negative_sign_size = 0;
    p_Var2->_M_frac_digits = 0;
    *(undefined4 *)(p_Var2->_M_neg_format).field = 0;
    p_Var2->_M_allocated = false;
    this->_M_data = p_Var2;
  }
  p_Var2->_M_decimal_point = '.';
  this->_M_data->_M_thousands_sep = ',';
  pVar1 = money_base::_S_default_pattern;
  p_Var2 = this->_M_data;
  p_Var2->_M_grouping_size = 0;
  *&(p_Var2->_M_pos_format).field = pVar1.field;
  *&(this->_M_data->_M_neg_format).field = money_base::_S_default_pattern.field;
  p_Var2->_M_negative_sign = "";
  p_Var2->_M_grouping = "";
  p_Var2->_M_curr_symbol = "";
  p_Var2->_M_curr_symbol_size = 0;
  p_Var2->_M_positive_sign = "";
  p_Var2->_M_positive_sign_size = 0;
  p_Var2->_M_negative_sign_size = 0;
  p_Var2->_M_frac_digits = 0;
  iVar3 = 0;
  do {
                    /* Unresolved local var: size_t __i@[???] */
    iVar4 = iVar3 + 1;
    this->_M_data->_M_atoms[iVar3] = money_base::_S_atoms[iVar3];
    iVar3 = iVar4;
  } while (iVar4 != 0xb);
  return;
}



----------------------------------------

// Function: ~numpunct @ 089c3824

/* DWARF original prototype: void ~numpunct(numpunct<char> * this, int __in_chrg) */

void __thiscall std::numpunct<char>::~numpunct(numpunct<char> *this,int __in_chrg)

{
  __numpunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  if (p_Var1 != (__numpunct_cache<char> *)0x0) {
                    /* try { // try from 089c3854 to 089c385b has its CatchHandler @ 089c387c */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~numpunct @ 089c3890

/* DWARF original prototype: void ~numpunct(numpunct<char> * this, int __in_chrg) */

void __thiscall std::numpunct<char>::~numpunct(numpunct<char> *this,int __in_chrg)

{
  __numpunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  if (p_Var1 != (__numpunct_cache<char> *)0x0) {
                    /* try { // try from 089c38c0 to 089c38c7 has its CatchHandler @ 089c38e0 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: ~numpunct @ 089c38f4

/* DWARF original prototype: void ~numpunct(numpunct<char> * this, int __in_chrg) */

void __thiscall std::numpunct<char>::~numpunct(numpunct<char> *this,int __in_chrg)

{
  __numpunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__numpunct_089efc30;
  if (p_Var1 != (__numpunct_cache<char> *)0x0) {
                    /* try { // try from 089c3924 to 089c392b has its CatchHandler @ 089c3944 */
    (*(p_Var1->super_facet)._vptr_facet[1])();
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: _M_initialize_numpunct @ 089c3958

/* DWARF original prototype: void _M_initialize_numpunct(numpunct<char> * this, __c_locale param_1)
    */

void __thiscall std::numpunct<char>::_M_initialize_numpunct(numpunct<char> *this,__c_locale param_1)

{
  __numpunct_cache<char> *p_Var1;
  __numpunct_cache<char> *p_Var2;
  int iVar3;
  int iVar4;
  
  p_Var2 = this->_M_data;
  if (p_Var2 == (__numpunct_cache<char> *)0x0) {
    p_Var2 = operator_new(0x68);
    p_Var2->_M_decimal_point = '\0';
    p_Var2->_M_thousands_sep = '\0';
    (p_Var2->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____numpunct_cache_089ef908;
    (p_Var2->super_facet)._M_refcount = 0;
    p_Var2->_M_grouping = (char *)0x0;
    p_Var2->_M_grouping_size = 0;
    p_Var2->_M_use_grouping = false;
    p_Var2->_M_truename = (char *)0x0;
    p_Var2->_M_truename_size = 0;
    p_Var2->_M_falsename = (char *)0x0;
    p_Var2->_M_falsename_size = 0;
    p_Var2->_M_allocated = false;
    this->_M_data = p_Var2;
  }
  p_Var2->_M_decimal_point = '.';
  p_Var1 = this->_M_data;
  p_Var2->_M_grouping = "";
  p_Var2->_M_grouping_size = 0;
  p_Var2->_M_use_grouping = false;
  p_Var1->_M_thousands_sep = ',';
  iVar4 = 0;
  do {
                    /* Unresolved local var: size_t __i@[???] */
    iVar3 = iVar4 + 1;
    this->_M_data->_M_atoms_out[iVar4] = __num_base::_S_atoms_out[iVar4];
    iVar4 = iVar3;
  } while (iVar3 != 0x24);
  iVar4 = 0;
  do {
                    /* Unresolved local var: size_t __i@[???] */
    iVar3 = iVar4 + 1;
    this->_M_data->_M_atoms_in[iVar4] = __num_base::_S_atoms_in[iVar4];
    iVar4 = iVar3;
  } while (iVar3 != 0x1a);
  p_Var2 = this->_M_data;
  p_Var2->_M_truename = "true";
  p_Var2->_M_falsename_size = 5;
  p_Var2->_M_truename_size = 4;
  p_Var2->_M_falsename = "false";
  return;
}



----------------------------------------

// Function: _M_initialize_timepunct @ 089c3a78

/* DWARF original prototype: void _M_initialize_timepunct(__timepunct<char> * this, __c_locale
   param_1) */

void __thiscall
std::__timepunct<char>::_M_initialize_timepunct(__timepunct<char> *this,__c_locale param_1)

{
  __timepunct_cache<char> *p_Var1;
  
  p_Var1 = this->_M_data;
  if (p_Var1 == (__timepunct_cache<char> *)0x0) {
    p_Var1 = operator_new(200);
    (p_Var1->super_facet)._vptr_facet = (_func_int_varargs **)&PTR____timepunct_cache_089efc00;
    (p_Var1->super_facet)._M_refcount = 0;
    p_Var1->_M_date_format = (char *)0x0;
    p_Var1->_M_date_era_format = (char *)0x0;
    p_Var1->_M_time_format = (char *)0x0;
    p_Var1->_M_time_era_format = (char *)0x0;
    p_Var1->_M_date_time_format = (char *)0x0;
    p_Var1->_M_date_time_era_format = (char *)0x0;
    p_Var1->_M_am = (char *)0x0;
    p_Var1->_M_pm = (char *)0x0;
    p_Var1->_M_am_pm_format = (char *)0x0;
    p_Var1->_M_day1 = (char *)0x0;
    p_Var1->_M_day2 = (char *)0x0;
    p_Var1->_M_day3 = (char *)0x0;
    p_Var1->_M_day4 = (char *)0x0;
    p_Var1->_M_day5 = (char *)0x0;
    p_Var1->_M_day6 = (char *)0x0;
    p_Var1->_M_day7 = (char *)0x0;
    p_Var1->_M_aday1 = (char *)0x0;
    p_Var1->_M_aday2 = (char *)0x0;
    p_Var1->_M_aday3 = (char *)0x0;
    p_Var1->_M_aday4 = (char *)0x0;
    p_Var1->_M_aday5 = (char *)0x0;
    p_Var1->_M_aday6 = (char *)0x0;
    p_Var1->_M_aday7 = (char *)0x0;
    p_Var1->_M_month01 = (char *)0x0;
    p_Var1->_M_month02 = (char *)0x0;
    p_Var1->_M_month03 = (char *)0x0;
    p_Var1->_M_month04 = (char *)0x0;
    p_Var1->_M_month05 = (char *)0x0;
    p_Var1->_M_month06 = (char *)0x0;
    p_Var1->_M_month07 = (char *)0x0;
    p_Var1->_M_month08 = (char *)0x0;
    p_Var1->_M_month09 = (char *)0x0;
    this->_M_data = p_Var1;
    p_Var1->_M_month10 = (char *)0x0;
    p_Var1->_M_month11 = (char *)0x0;
    p_Var1->_M_month12 = (char *)0x0;
    p_Var1->_M_amonth01 = (char *)0x0;
    p_Var1->_M_amonth02 = (char *)0x0;
    p_Var1->_M_amonth03 = (char *)0x0;
    p_Var1->_M_amonth04 = (char *)0x0;
    p_Var1->_M_amonth05 = (char *)0x0;
    p_Var1->_M_amonth06 = (char *)0x0;
    p_Var1->_M_amonth07 = (char *)0x0;
    p_Var1->_M_amonth08 = (char *)0x0;
    p_Var1->_M_amonth09 = (char *)0x0;
    p_Var1->_M_amonth10 = (char *)0x0;
    p_Var1->_M_amonth11 = (char *)0x0;
    p_Var1->_M_amonth12 = (char *)0x0;
    p_Var1->_M_allocated = false;
  }
  p_Var1->_M_am = "AM";
  p_Var1->_M_day1 = "Sunday";
  p_Var1->_M_pm = "PM";
  p_Var1->_M_day3 = "Tuesday";
  p_Var1->_M_day2 = "Monday";
  p_Var1->_M_day5 = "Thursday";
  p_Var1->_M_day4 = "Wednesday";
  p_Var1->_M_day7 = "Saturday";
  p_Var1->_M_day6 = "Friday";
  p_Var1->_M_aday2 = "Mon";
  p_Var1->_M_aday1 = "Sun";
  p_Var1->_M_aday4 = "Wed";
  p_Var1->_M_aday3 = "Tue";
  p_Var1->_M_aday6 = "Fri";
  p_Var1->_M_aday5 = "Thu";
  p_Var1->_M_month01 = "January";
  p_Var1->_M_aday7 = "Sat";
  p_Var1->_M_month03 = "March";
  p_Var1->_M_month02 = "February";
  p_Var1->_M_month06 = "June";
  p_Var1->_M_month04 = "April";
  p_Var1->_M_month08 = "August";
  p_Var1->_M_month07 = "July";
  p_Var1->_M_month10 = "October";
  p_Var1->_M_month09 = "September";
  p_Var1->_M_date_era_format = "%m/%d/%y";
  p_Var1->_M_time_era_format = "%H:%M:%S";
  p_Var1->_M_am_pm_format = "";
  p_Var1->_M_date_format = "%m/%d/%y";
  p_Var1->_M_time_format = "%H:%M:%S";
  p_Var1->_M_date_time_format = "";
  p_Var1->_M_date_time_era_format = "";
  p_Var1->_M_month05 = "May";
  p_Var1->_M_month11 = "November";
  p_Var1->_M_amonth12 = "Dec";
  p_Var1->_M_month12 = "December";
  p_Var1->_M_amonth01 = "Jan";
  p_Var1->_M_amonth02 = "Feb";
  p_Var1->_M_amonth03 = "Mar";
  p_Var1->_M_amonth04 = "Apr";
  p_Var1->_M_amonth06 = "Jun";
  p_Var1->_M_amonth07 = "Jul";
  p_Var1->_M_amonth08 = "Aug";
  p_Var1->_M_amonth09 = "Sep";
  p_Var1->_M_amonth05 = "May";
  p_Var1->_M_amonth10 = "Oct";
  p_Var1->_M_amonth11 = "Nov";
  return;
}



----------------------------------------

// Function: _M_put @ 089c3d90

/* DWARF original prototype: void _M_put(__timepunct<char> * this, char * __s, size_t __maxlen, char
   * __format, tm * __tm) */

void __thiscall
std::__timepunct<char>::_M_put
          (__timepunct<char> *this,char *__s,size_t __maxlen,char *__format,tm *__tm)

{
  char *pcVar1;
  size_t sVar2;
  tm *in_t0;
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: size_t __len@[???] */
  pcVar1 = setlocale(0,(char *)0x0);
  pcVar1 = strdup(pcVar1);
  setlocale(0,this->_M_name_timepunct);
  sVar2 = strftime(__s,__maxlen,__format,in_t0);
  setlocale(0,pcVar1);
  free(pcVar1);
  if (sVar2 == 0) {
    *__s = '\0';
  }
  return;
}



----------------------------------------

// Function: fopen_mode @ 089c3e40

char * __gnu_internal::fopen_mode(_Ios_Openmode mode)

{
  switch(mode & (_S_trunc|_S_out|_S_in|_S_bin|_S_app)) {
  case _S_in:
    return "r";
  default:
    return (char *)0x0;
  case _S_in|_S_bin:
    return "rb";
  case _S_out:
  case _S_trunc|_S_out:
    return "w";
  case _S_out|_S_app:
    return "a";
  case _S_out|_S_bin:
  case _S_trunc|_S_out|_S_bin:
    return "wb";
  case _S_out|_S_bin|_S_app:
    return "ab";
  case _S_out|_S_in:
    return "r+";
  case _S_out|_S_in|_S_bin:
    return "r+b";
  case _S_trunc|_S_out|_S_in:
    return "w+";
  case _S_trunc|_S_out|_S_in|_S_bin:
    return "w+b";
  }
}



----------------------------------------

// Function: __basic_file @ 089c3eec

/* DWARF original prototype: void __basic_file(__basic_file<char> * this, __c_lock * param_1) */

void __thiscall std::__basic_file<char>::__basic_file(__basic_file<char> *this,__c_lock *param_1)

{
  this->_M_cfile_created = false;
  this->_M_cfile = (__c_file *)0x0;
  return;
}



----------------------------------------

// Function: __basic_file @ 089c3ef8

/* DWARF original prototype: void __basic_file(__basic_file<char> * this, __c_lock * param_1) */

void __thiscall std::__basic_file<char>::__basic_file(__basic_file<char> *this,__c_lock *param_1)

{
  this->_M_cfile_created = false;
  this->_M_cfile = (__c_file *)0x0;
  return;
}



----------------------------------------

// Function: is_open @ 089c3f04

/* DWARF original prototype: bool is_open(__basic_file<char> * this) */

bool __thiscall std::__basic_file<char>::is_open(__basic_file<char> *this)

{
  return this->_M_cfile != (__c_file *)0x0;
}



----------------------------------------

// Function: file @ 089c3f10

/* DWARF original prototype: __c_file * file(__basic_file<char> * this) */

__c_file * __thiscall std::__basic_file<char>::file(__basic_file<char> *this)

{
  return this->_M_cfile;
}



----------------------------------------

// Function: sync @ 089c3f18

/* DWARF original prototype: int sync(__basic_file<char> * this) */

int __thiscall std::__basic_file<char>::sync(__basic_file<char> *this)

{
  _fpos_t _Var1;
  uchar *puVar2;
  int iVar3;
  _fpos_t _Var4;
  ushort uVar5;
  __c_file *p_Var6;
  int iVar7;
  uchar *puVar8;
  _func__fpos_t_void_ptr__fpos_t_int *p_Var9;
  
  p_Var6 = this->_M_cfile;
  if (p_Var6 == (__c_file *)0x0) {
    iVar7 = _fwalk(_global_impure_ptr,fflush);
    return iVar7;
  }
  if (_impure_ptr == (_reent *)0x0) {
    uVar5 = p_Var6->_flags;
  }
  else if (_impure_ptr->__sdidinit == 0) {
    __sinit(_impure_ptr);
    uVar5 = p_Var6->_flags;
  }
  else {
    uVar5 = p_Var6->_flags;
  }
  if ((uVar5 & 8) == 0) {
    p_Var6->_flags = uVar5 | 0x800;
    if (p_Var6->_r < 1) {
      if (p_Var6->_ur < 1) {
        return 0;
      }
      p_Var9 = p_Var6->_seek;
    }
    else {
      p_Var9 = p_Var6->_seek;
    }
    if (p_Var9 != (_func__fpos_t_void_ptr__fpos_t_int *)0x0) {
      if ((uVar5 & 0x1000) == 0) {
        _Var4 = (*p_Var9)(p_Var6->_cookie,0,1);
        if (_Var4 == -1) {
          return 0;
        }
        uVar5 = p_Var6->_flags;
      }
      else {
        _Var4 = p_Var6->_offset;
        uVar5 = p_Var6->_flags;
      }
      if (((uVar5 & 4) != 0) && (_Var4 = _Var4 - p_Var6->_r, (p_Var6->_ub)._base != (uchar *)0x0)) {
        _Var4 = _Var4 - p_Var6->_ur;
      }
      _Var1 = (*p_Var9)(p_Var6->_cookie,_Var4,0);
      if (_Var1 != -1) {
        uVar5 = p_Var6->_flags;
        puVar8 = (p_Var6->_bf)._base;
        p_Var6->_r = 0;
        p_Var6->_flags = uVar5 & 0xf7ff;
        p_Var6->_p = puVar8;
        if ((uVar5 & 0x1000) != 0) {
          p_Var6->_offset = _Var4;
          return 0;
        }
      }
    }
  }
  else {
    puVar8 = (p_Var6->_bf)._base;
    if (puVar8 != (uchar *)0x0) {
      puVar2 = p_Var6->_p;
      p_Var6->_p = puVar8;
      iVar7 = (int)puVar2 - (int)puVar8;
      if ((uVar5 & 3) == 0) {
        p_Var6->_w = (p_Var6->_bf)._size;
      }
      else {
        p_Var6->_w = 0;
      }
      while (0 < iVar7) {
        iVar3 = (*p_Var6->_write)(p_Var6->_cookie,(char *)puVar8,iVar7);
        puVar8 = puVar8 + iVar3;
        iVar7 = iVar7 - iVar3;
        if (iVar3 < 1) {
          p_Var6->_flags = p_Var6->_flags | 0x40;
          return -1;
        }
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: sys_open @ 089c3f20

/* DWARF original prototype: __basic_file<char> * sys_open(__basic_file<char> * this, __c_file *
   __file, _Ios_Openmode param_2) */

__basic_file<char> * __thiscall
std::__basic_file<char>::sys_open(__basic_file<char> *this,__c_file *__file,_Ios_Openmode param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int *piVar2;
  int iVar3;
  
                    /* Unresolved local var: __basic_file<char> * __ret@[???] */
  bVar1 = is_open(this);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (__file != (__c_file *)0x0)) {
                    /* Unresolved local var: int __err@[???] */
    piVar2 = __errno();
    *piVar2 = 0;
    do {
      iVar3 = sync(this);
      if (iVar3 == 0) {
        this->_M_cfile = __file;
        this->_M_cfile_created = false;
        return this;
      }
      piVar2 = __errno();
    } while (*piVar2 == 4);
  }
  return (__basic_file<char> *)0x0;
}



----------------------------------------

// Function: xwrite @ 089c3fbc

streamsize __gnu_internal::xwrite(int __fd,char *__s,streamsize __n)

{
  int iVar1;
  int *piVar2;
  size_t cnt;
  
  cnt = __n;
                    /* Unresolved local var: streamsize __nleft@[???] */
  do {
    while (iVar1 = write(__fd,__s,cnt), iVar1 != -1) {
      cnt = cnt - iVar1;
                    /* Unresolved local var: streamsize __ret@[???] */
      __s = __s + iVar1;
      if (cnt == 0) goto LAB_089c402c;
    }
    piVar2 = __errno();
  } while (*piVar2 == 4);
LAB_089c402c:
  return __n - cnt;
}



----------------------------------------

// Function: close @ 089c4054

/* DWARF original prototype: __basic_file<char> * close(__basic_file<char> * this) */

__basic_file<char> * __thiscall std::__basic_file<char>::close(__basic_file<char> *this)

{
  bool bVar1;
  undefined3 extraout_var;
  int *piVar2;
  int iVar3;
  
                    /* Unresolved local var: __basic_file<char> * __ret@[???] */
  bVar1 = is_open(this);
  if (CONCAT31(extraout_var,bVar1) != 0) {
                    /* Unresolved local var: int __err@[???] */
    if (this->_M_cfile_created == false) {
      this->_M_cfile = (__c_file *)0x0;
      return this;
    }
    piVar2 = __errno();
    *piVar2 = 0;
    do {
      iVar3 = fclose(this->_M_cfile);
      if (iVar3 == 0) {
        this->_M_cfile = (__c_file *)0x0;
        return this;
      }
      piVar2 = __errno();
    } while (*piVar2 == 4);
    this->_M_cfile = (__c_file *)0x0;
  }
  return (__basic_file<char> *)0x0;
}



----------------------------------------

// Function: ~__basic_file @ 089c40f0

/* DWARF original prototype: void ~__basic_file(__basic_file<char> * this, int __in_chrg) */

void __thiscall std::__basic_file<char>::~__basic_file(__basic_file<char> *this,int __in_chrg)

{
  bool bVar1;
  undefined3 extraout_var;
  int *piVar2;
  int iVar3;
  
  bVar1 = is_open(this);
  if (CONCAT31(extraout_var,bVar1) != 0) {
    if (this->_M_cfile_created == false) {
      this->_M_cfile = (__c_file *)0x0;
      return;
    }
    piVar2 = __errno();
    *piVar2 = 0;
    do {
      iVar3 = fclose(this->_M_cfile);
      if (iVar3 == 0) {
        this->_M_cfile = (__c_file *)0x0;
        return;
      }
      piVar2 = __errno();
    } while (*piVar2 == 4);
    this->_M_cfile = (__c_file *)0x0;
  }
  return;
}



----------------------------------------

// Function: ~__basic_file @ 089c40f8

/* DWARF original prototype: void ~__basic_file(__basic_file<char> * this, int __in_chrg) */

void __thiscall std::__basic_file<char>::~__basic_file(__basic_file<char> *this,int __in_chrg)

{
  bool bVar1;
  undefined3 extraout_var;
  int *piVar2;
  int iVar3;
  
  bVar1 = is_open(this);
  if (CONCAT31(extraout_var,bVar1) != 0) {
    if (this->_M_cfile_created == false) {
      this->_M_cfile = (__c_file *)0x0;
      return;
    }
    piVar2 = __errno();
    *piVar2 = 0;
    do {
      iVar3 = fclose(this->_M_cfile);
      if (iVar3 == 0) {
        this->_M_cfile = (__c_file *)0x0;
        return;
      }
      piVar2 = __errno();
    } while (*piVar2 == 4);
    this->_M_cfile = (__c_file *)0x0;
  }
  return;
}



----------------------------------------

// Function: fd @ 089c4100

/* DWARF original prototype: int fd(__basic_file<char> * this) */

int __thiscall std::__basic_file<char>::fd(__basic_file<char> *this)

{
  __c_file *p_Var1;
  
  p_Var1 = this->_M_cfile;
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
    return (int)p_Var1->_file;
  }
  return (int)p_Var1->_file;
}



----------------------------------------

// Function: showmanyc @ 089c4108

/* DWARF original prototype: streamsize showmanyc(__basic_file<char> * this) */

streamsize __thiscall std::__basic_file<char>::showmanyc(__basic_file<char> *this)

{
  int iVar1;
  off_t oVar2;
  stat asStack_48 [4];
  uint local_44;
  int local_38;
  
                    /* Unresolved local var: stat __buffer@[???]
                       Unresolved local var: int __err@[???] */
  iVar1 = fd(this);
  iVar1 = fstat(iVar1,asStack_48);
  if ((iVar1 == 0) && ((local_44 & 0xf000) == 0x8000)) {
    iVar1 = fd(this);
    oVar2 = lseek(iVar1,0,1);
    return local_38 - oVar2;
  }
  return 0;
}



----------------------------------------

// Function: seekoff @ 089c4180

/* DWARF original prototype: streamoff seekoff(__basic_file<char> * this, streamoff __off,
   _Ios_Seekdir __way) */

streamoff __thiscall
std::__basic_file<char>::seekoff(__basic_file<char> *this,streamoff __off,_Ios_Seekdir __way)

{
  int iVar1;
  off_t oVar2;
  uint pos;
  int in_t0;
  
  iVar1 = (int)((ulonglong)__off >> 0x20);
  pos = (uint)__off;
  if (((__off < 0x100000000) && (((iVar1 != 0 || (-1 < (int)pos)) && (-0x100000001 < __off)))) &&
     ((iVar1 != -1 || (0x7fffffff < pos)))) {
    iVar1 = fd(this);
    oVar2 = lseek(iVar1,pos,in_t0);
    return (streamoff)oVar2;
  }
  return -1;
}



----------------------------------------

// Function: xsputn_2 @ 089c4248

/* DWARF original prototype: streamsize xsputn_2(__basic_file<char> * this, char * __s1, streamsize
   __n1, char * __s2, streamsize __n2) */

streamsize __thiscall
std::__basic_file<char>::xsputn_2
          (__basic_file<char> *this,char *__s1,streamsize __n1,char *__s2,streamsize __n2)

{
  int iVar1;
  streamsize sVar2;
  streamsize in_t0;
  streamsize sVar3;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  sVar3 = 0;
  if (__n1 != 0) {
    iVar1 = fd(this);
    sVar3 = __gnu_internal::xwrite(iVar1,__s1,__n1);
    if (__n1 != sVar3) {
      return sVar3;
    }
  }
  iVar1 = fd(this);
  sVar2 = __gnu_internal::xwrite(iVar1,__s2,in_t0);
  return sVar3 + sVar2;
}



----------------------------------------

// Function: xsputn @ 089c4310

/* DWARF original prototype: streamsize xsputn(__basic_file<char> * this, char * __s, streamsize
   __n) */

streamsize __thiscall
std::__basic_file<char>::xsputn(__basic_file<char> *this,char *__s,streamsize __n)

{
  int __fd;
  streamsize sVar1;
  
  __fd = fd(this);
  sVar1 = __gnu_internal::xwrite(__fd,__s,__n);
  return sVar1;
}



----------------------------------------

// Function: xsgetn @ 089c434c

/* DWARF original prototype: streamsize xsgetn(__basic_file<char> * this, char * __s, streamsize
   __n) */

streamsize __thiscall
std::__basic_file<char>::xsgetn(__basic_file<char> *this,char *__s,streamsize __n)

{
  int *piVar1;
  int iVar2;
  
                    /* Unresolved local var: streamsize __ret@[???] */
  do {
    iVar2 = fd(this);
    iVar2 = read(iVar2,__s,__n);
    if (iVar2 != -1) {
      return iVar2;
    }
    piVar1 = __errno();
  } while (*piVar1 == 4);
  return -1;
}



----------------------------------------

// Function: open @ 089c43e0

/* DWARF original prototype: __basic_file<char> * open(__basic_file<char> * this, char * __name,
   _Ios_Openmode __mode, int param_3) */

__basic_file<char> * __thiscall
std::__basic_file<char>::open
          (__basic_file<char> *this,char *__name,_Ios_Openmode __mode,int param_3)

{
  bool bVar1;
  char *mode;
  undefined3 extraout_var;
  FILE *pFVar2;
  
                    /* Unresolved local var: __basic_file<char> * __ret@[???]
                       Unresolved local var: char * __c_mode@[???] */
  mode = __gnu_internal::fopen_mode(__mode);
  if ((mode != (char *)0x0) && (bVar1 = is_open(this), CONCAT31(extraout_var,bVar1) == 0)) {
    pFVar2 = fopen(__name,mode);
    this->_M_cfile = pFVar2;
    if (pFVar2 != (FILE *)0x0) {
      this->_M_cfile_created = true;
      return this;
    }
  }
  return (__basic_file<char> *)0x0;
}



----------------------------------------

// Function: sys_open @ 089c4464

/* DWARF original prototype: __basic_file<char> * sys_open(__basic_file<char> * this, int __fd,
   _Ios_Openmode __mode) */

__basic_file<char> * __thiscall
std::__basic_file<char>::sys_open(__basic_file<char> *this,int __fd,_Ios_Openmode __mode)

{
  bool bVar1;
  char *mode;
  undefined3 extraout_var;
  FILE *fp;
  
                    /* Unresolved local var: __basic_file<char> * __ret@[???]
                       Unresolved local var: char * __c_mode@[???] */
  mode = __gnu_internal::fopen_mode(__mode);
  if ((mode != (char *)0x0) && (bVar1 = is_open(this), CONCAT31(extraout_var,bVar1) == 0)) {
    fp = fdopen(__fd,mode);
    this->_M_cfile = fp;
    if (fp != (FILE *)0x0) {
      this->_M_cfile_created = true;
      if (__fd != 0) {
        return this;
      }
      setvbuf(fp,(char *)0x0,2,0);
      return this;
    }
  }
                    /* Unresolved local var: char * __buf@[???] */
  return (__basic_file<char> *)0x0;
}



----------------------------------------

// Function: _S_destroy_c_locale @ 089c4520

void std::locale::facet::_S_destroy_c_locale(__c_locale *__cloc)

{
  *__cloc = (__c_locale)0x0;
  return;
}



----------------------------------------

// Function: _S_clone_c_locale @ 089c4528

__c_locale std::locale::facet::_S_clone_c_locale(__c_locale *param_1)

{
  return (__c_locale)0x0;
}



----------------------------------------

// Function: _S_create_c_locale @ 089c4530

void std::locale::facet::_S_create_c_locale(__c_locale *__cloc,char *__s,__c_locale param_3)

{
  int iVar1;
  
  *__cloc = (__c_locale)0x0;
  iVar1 = strcmp(__s,"C");
  if (iVar1 == 0) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_runtime_error("locale::facet::_S_create_c_locale name not valid");
}



----------------------------------------

// Function: __convert_to_v<float> @ 089c4568

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__convert_to_v<float>(char *__s,float *__v,_Ios_Iostate *__err,__c_locale *param_4)

{
  int *piVar1;
  char *pcVar2;
  float fVar3;
  char *local_28 [2];
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: char * __sanity@[???]
                       Unresolved local var: float __f@[???] */
  piVar1 = __errno();
  *piVar1 = 0;
  pcVar2 = setlocale(0,(char *)0x0);
  pcVar2 = strdup(pcVar2);
  setlocale(0,"C");
  fVar3 = strtof(__s,local_28);
  if ((__s != local_28[0]) && (piVar1 = __errno(), *piVar1 != 0x22)) {
    *__v = fVar3;
    setlocale(0,pcVar2);
    free(pcVar2);
    return;
  }
  *__err = *__err | _S_failbit;
  setlocale(0,pcVar2);
  free(pcVar2);
  return;
}



----------------------------------------

// Function: __convert_to_v<long_double> @ 089c4664

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: __convert_to_v<long double> */

void std::__convert_to_v<long_double>
               (char *__s,longdouble *__v,_Ios_Iostate *__err,__c_locale *param_4)

{
  int *piVar1;
  char *pcVar2;
  int iVar3;
  _Ios_Iostate _Var4;
  undefined4 local_20;
  undefined4 local_1c;
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: longdouble __ld@[???]
                       Unresolved local var: int __p@[???] */
  piVar1 = __errno();
  *piVar1 = 0;
  pcVar2 = setlocale(0,(char *)0x0);
  pcVar2 = strdup(pcVar2);
  setlocale(0,"C");
  iVar3 = sscanf(__s,"%Lf",&local_20);
  if (iVar3 != 0) {
    if (iVar3 == -1) {
      _Var4 = *__err;
      goto LAB_089c4738;
    }
    piVar1 = __errno();
    if (*piVar1 != 0x22) {
      *(undefined4 *)((int)__v + 4) = local_1c;
      *(undefined4 *)__v = local_20;
      setlocale(0,pcVar2);
      free(pcVar2);
      return;
    }
  }
  _Var4 = *__err;
LAB_089c4738:
  *__err = _Var4 | _S_failbit;
  setlocale(0,pcVar2);
  free(pcVar2);
  return;
}



----------------------------------------

// Function: __convert_to_v<double> @ 089c4770

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__convert_to_v<double>(char *__s,double *__v,_Ios_Iostate *__err,__c_locale *param_4)

{
  int *piVar1;
  char *pcVar2;
  undefined4 extraout_v0;
  _Ios_Iostate _Var3;
  undefined4 extraout_v1;
  char *local_28 [2];
  
                    /* Unresolved local var: char * __old@[???]
                       Unresolved local var: char * __sanity@[???]
                       Unresolved local var: double __d@[???] */
  piVar1 = __errno();
  *piVar1 = 0;
  pcVar2 = setlocale(0,(char *)0x0);
  pcVar2 = strdup(pcVar2);
  setlocale(0,"C");
  strtod(__s,local_28);
  if (__s == local_28[0]) {
    _Var3 = *__err;
  }
  else {
    piVar1 = __errno();
    if (*piVar1 != 0x22) {
      *(undefined4 *)__v = extraout_v0;
      *(undefined4 *)((int)__v + 4) = extraout_v1;
      goto LAB_089c4818;
    }
    _Var3 = *__err;
  }
  *__err = _Var3 | _S_failbit;
LAB_089c4818:
  setlocale(0,pcVar2);
  free(pcVar2);
  return;
}



----------------------------------------

// Function: __cxa_get_exception_ptr @ 089c4850

void * __cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in)

{
  return *(void **)((int)exc_obj_in + -8);
}



----------------------------------------

// Function: uncaught_exception @ 089c4858

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

bool std::uncaught_exception(void)

{
  __cxa_eh_globals *p_Var1;
  
                    /* Unresolved local var: __cxa_eh_globals * globals@[???] */
  p_Var1 = __cxxabiv1::__cxa_get_globals();
  return p_Var1->uncaughtExceptions != 0;
}



----------------------------------------

// Function: __cxa_end_catch @ 089c487c

void __cxxabiv1::__cxa_end_catch(void)

{
  __cxa_eh_globals *p_Var1;
  int iVar2;
  int iVar3;
  __cxa_exception *p_Var4;
  
                    /* Unresolved local var: __cxa_eh_globals * globals@[???]
                       Unresolved local var: __cxa_exception * header@[???]
                       Unresolved local var: int count@[???] */
  p_Var1 = __cxa_get_globals_fast();
  p_Var4 = p_Var1->caughtExceptions;
  if (p_Var4 == (__cxa_exception *)0x0) {
    return;
  }
  if ((int)(p_Var4->unwindHeader).exception_class == 0x432b2b00) {
    if (*(int *)((int)&(p_Var4->unwindHeader).exception_class + 4) == 0x474e5543) {
      iVar2 = p_Var4->handlerCount;
      iVar3 = iVar2 + -1;
      if (iVar2 < 0) {
        if (iVar2 + 1 != 0) {
          p_Var4->handlerCount = iVar2 + 1;
          return;
        }
        p_Var4->handlerCount = 0;
        p_Var1->caughtExceptions = p_Var4->nextException;
        return;
      }
      if (iVar3 != 0) {
        if (-1 < iVar3) {
          p_Var4->handlerCount = iVar3;
          return;
        }
                    /* WARNING: Subroutine does not return */
        std::terminate();
      }
      p_Var1->caughtExceptions = p_Var4->nextException;
      _Unwind_DeleteException((_Unwind_Exception_conflict9 *)&p_Var4->unwindHeader);
      return;
    }
    p_Var1->caughtExceptions = (__cxa_exception *)0x0;
  }
  else {
    p_Var1->caughtExceptions = (__cxa_exception *)0x0;
  }
  _Unwind_DeleteException((_Unwind_Exception_conflict9 *)&p_Var4->unwindHeader);
  return;
}



----------------------------------------

// Function: __cxa_begin_catch @ 089c4934

void * __cxxabiv1::__cxa_begin_catch(void *exc_obj_in)

{
  __cxa_eh_globals *p_Var1;
  void *pvVar2;
  int iVar3;
  __cxa_exception *p_Var4;
  __cxa_exception *p_Var5;
  
                    /* Unresolved local var: _Unwind_Exception * exceptionObject@[???]
                       Unresolved local var: __cxa_eh_globals * globals@[???]
                       Unresolved local var: __cxa_exception * prev@[???]
                       Unresolved local var: __cxa_exception * header@[???]
                       Unresolved local var: void * objectp@[???]
                       Unresolved local var: int count@[???] */
  p_Var5 = (__cxa_exception *)((int)exc_obj_in + -0x30);
  p_Var1 = __cxa_get_globals();
  p_Var4 = p_Var1->caughtExceptions;
  if ((*(int *)exc_obj_in == 0x432b2b00) && (*(int *)((int)exc_obj_in + 4) == 0x474e5543)) {
    iVar3 = *(int *)((int)exc_obj_in + -0x1c);
    if (iVar3 < 0) {
      iVar3 = -iVar3;
    }
    *(int *)((int)exc_obj_in + -0x1c) = iVar3 + 1;
    p_Var1->uncaughtExceptions = p_Var1->uncaughtExceptions - 1;
    if (p_Var4 != p_Var5) {
      *(__cxa_exception **)((int)exc_obj_in + -0x20) = p_Var4;
      p_Var1->caughtExceptions = p_Var5;
    }
    pvVar2 = *(void **)((int)exc_obj_in + -8);
  }
  else {
    pvVar2 = (void *)0x0;
    if (p_Var4 != (__cxa_exception *)0x0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089c49d0 to 089c49d7 has its CatchHandler @ 089c49d8 */
      std::terminate();
    }
    p_Var1->caughtExceptions = p_Var5;
  }
  return pvVar2;
}



----------------------------------------

// Function: read_uleb128 @ 089c49f4

uchar * read_uleb128(uchar *p,_Unwind_Word *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg6(a2)]
                       Unresolved local var: uchar byte@[DW_OP_reg3(v1)]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg7(a3)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: read_sleb128 @ 089c4a28

uchar * read_sleb128(uchar *p,_Unwind_Sword *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg7(a3)]
                       Unresolved local var: uchar byte@[???]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg8(t0)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  if ((uVar2 < 0x20) && ((bVar1 & 0x40) != 0)) {
    uVar3 = uVar3 | -1 << (uVar2 & 0x1f);
  }
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: get_adjusted_ptr @ 089c4a80

bool get_adjusted_ptr(type_info *catch_type,type_info *throw_type,void **thrown_ptr_p)

{
  int iVar1;
  undefined4 *local_18 [2];
  
                    /* Unresolved local var: void * thrown_ptr@[???] */
  local_18[0] = *thrown_ptr_p;
  iVar1 = (*throw_type->_vptr_type_info[2])(throw_type);
  if (iVar1 != 0) {
    local_18[0] = (undefined4 *)*local_18[0];
  }
  iVar1 = (*catch_type->_vptr_type_info[4])(catch_type,throw_type,local_18,1);
  if (iVar1 != 0) {
    *thrown_ptr_p = local_18[0];
  }
  return iVar1 != 0;
}



----------------------------------------

// Function: read_encoded_value_with_base @ 089c4b18

uchar * read_encoded_value_with_base(uchar encoding,_Unwind_Ptr base,uchar *p,_Unwind_Ptr *val)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  uint *puVar5;
  uint local_20 [2];
  
                    /* Unresolved local var: unaligned * u@[???]
                       Unresolved local var: _Unwind_Internal_Ptr result@[???] */
  uVar3 = (uint)encoding;
  if (uVar3 == 0x50) {
                    /* Unresolved local var: _Unwind_Internal_Ptr a@[???] */
    local_20[0] = *(uint *)((uint)(p + 3) & 0xfffffffc);
    puVar5 = (uint *)((uint)(p + 3) & 0xfffffffc) + 1;
  }
  else {
    uVar4 = uVar3 & 0xf;
    if (0xc < uVar4) {
switchD_089c4b70_caseD_5:
                    /* WARNING: Subroutine does not return */
      abort();
    }
    switch(uVar4) {
    case 0:
    case 3:
    case 0xb:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 4);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089c4b70::switchdataD_089f0820)[uVar4] &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    case 1:
                    /* Unresolved local var: _Unwind_Word tmp@[???] */
      puVar5 = (uint *)read_uleb128(p,local_20);
      break;
    case 2:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(ushort *)p;
      break;
    case 4:
    case 0xc:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 8);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089c4b70::switchdataD_089f0820 + uVar4) &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    default:
      goto switchD_089c4b70_caseD_5;
    case 9:
                    /* Unresolved local var: _Unwind_Sword tmp@[???] */
      puVar5 = (uint *)read_sleb128(p,(_Unwind_Sword *)local_20);
      break;
    case 10:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(short *)p;
    }
    if (local_20[0] != 0) {
      if ((uVar3 & 0x70) == 0x10) {
        base = (_Unwind_Ptr)p;
      }
      local_20[0] = base + local_20[0];
      if ((char)encoding < '\0') {
        local_20[0] = *(uint *)local_20[0];
      }
    }
  }
  *val = local_20[0];
  return (uchar *)puVar5;
}



----------------------------------------

// Function: base_of_encoded_value @ 089c4c58

_Unwind_Ptr base_of_encoded_value(uchar encoding,_Unwind_Context *context)

{
  _Unwind_Ptr _Var1;
  byte bVar2;
  
  if (encoding != 0xff) {
    bVar2 = encoding & 0x70;
    if (bVar2 == 0x20) {
      _Var1 = _Unwind_GetTextRelBase(context);
      return _Var1;
    }
    if (bVar2 < 0x21) {
      if (((encoding & 0x70) != 0) && (bVar2 != 0x10)) {
                    /* WARNING: Subroutine does not return */
        abort();
      }
    }
    else {
      if (bVar2 == 0x40) {
        _Var1 = _Unwind_GetRegionStart(context);
        return _Var1;
      }
      if (bVar2 != 0x50) {
        if (bVar2 == 0x30) {
          _Var1 = _Unwind_GetDataRelBase(context);
          return _Var1;
        }
                    /* WARNING: Subroutine does not return */
        abort();
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: get_ttype_entry @ 089c4cf8

type_info * get_ttype_entry(lsda_header_info *info,_Unwind_Word i)

{
  byte encoding;
  int iVar1;
  byte bVar2;
  type_info *local_10 [2];
  
                    /* Unresolved local var: _Unwind_Ptr ptr@[???] */
  encoding = info->ttype_encoding;
  bVar2 = encoding & 7;
  if (encoding == 0xff) {
    iVar1 = 0;
  }
  else {
    if (bVar2 == 2) {
      read_encoded_value_with_base
                (encoding,info->ttype_base,info->TType + i * -2,(_Unwind_Ptr *)local_10);
      return local_10[0];
    }
    if (bVar2 < 3) {
      if ((encoding & 7) != 0) goto LAB_089c4d38;
    }
    else if (bVar2 != 3) {
      iVar1 = i << 3;
      if (bVar2 == 4) goto LAB_089c4d4c;
LAB_089c4d38:
                    /* WARNING: Subroutine does not return */
      abort();
    }
    iVar1 = i << 2;
  }
LAB_089c4d4c:
  read_encoded_value_with_base
            (encoding,info->ttype_base,info->TType + -iVar1,(_Unwind_Ptr *)local_10);
  return local_10[0];
}



----------------------------------------

// Function: check_exception_spec @ 089c4da8

bool check_exception_spec
               (lsda_header_info *info,_throw_typet *throw_type,void *thrown_ptr,
               _Unwind_Sword filter_value)

{
  bool bVar1;
  type_info *catch_type;
  undefined3 extraout_var;
  uchar *p;
  _Unwind_Word local_20 [2];
  void *local_18 [2];
  
                    /* Unresolved local var: uchar * e@[???] */
  p = info->TType + (-1 - filter_value);
                    /* Unresolved local var: type_info * catch_type@[???]
                       Unresolved local var: _Unwind_Word tmp@[???] */
  local_18[0] = thrown_ptr;
  do {
    p = read_uleb128(p,local_20);
    if (local_20[0] == 0) {
      return false;
    }
    catch_type = get_ttype_entry(info,local_20[0]);
    bVar1 = get_adjusted_ptr(catch_type,throw_type,local_18);
  } while (CONCAT31(extraout_var,bVar1) == 0);
  return true;
}



----------------------------------------

// Function: parse_lsda_header @ 089c4e30

uchar * parse_lsda_header(_Unwind_Context *context,uchar *p,lsda_header_info *info)

{
  uchar uVar1;
  uchar *puVar2;
  _Unwind_Ptr _Var3;
  _Unwind_Word local_18 [2];
  
                    /* Unresolved local var: _Unwind_Word tmp@[???]
                       Unresolved local var: uchar lpstart_encoding@[???] */
  _Var3 = 0;
  if (context != (_Unwind_Context *)0x0) {
    _Var3 = _Unwind_GetRegionStart(context);
  }
  info->Start = _Var3;
  uVar1 = *p;
  if (uVar1 == 0xff) {
    info->LPStart = _Var3;
    uVar1 = p[1];
    puVar2 = p + 2;
    info->ttype_encoding = uVar1;
  }
  else {
    _Var3 = base_of_encoded_value(uVar1,context);
    puVar2 = read_encoded_value_with_base(uVar1,_Var3,p + 1,&info->LPStart);
    uVar1 = *puVar2;
    puVar2 = puVar2 + 1;
    info->ttype_encoding = uVar1;
  }
  if (uVar1 != 0xff) {
    puVar2 = read_uleb128(puVar2,local_18);
    info->TType = puVar2 + local_18[0];
    info->call_site_encoding = *puVar2;
    puVar2 = read_uleb128(puVar2 + 1,local_18);
    info->action_table = puVar2 + local_18[0];
    return puVar2;
  }
  info->TType = (uchar *)0x0;
  info->call_site_encoding = *puVar2;
  puVar2 = read_uleb128(puVar2 + 1,local_18);
  info->action_table = puVar2 + local_18[0];
  return puVar2;
}



----------------------------------------

// Function: __cxa_call_unexpected @ 089c4f6c

/* DWARF original prototype: void __cxa_call_unexpected(void * exc_obj_in) */

void __cxa_call_unexpected(void *exc_obj_in)

{
                    /* Unresolved local var: _Unwind_Exception.conflict * exc_obj@[???]
                       Unresolved local var: end_catch_protect end_catch_protect_obj@[???]
                       Unresolved local var: lsda_header_info info@[???]
                       Unresolved local var: __cxa_exception * xh@[???]
                       Unresolved local var: uchar * xh_lsda@[???]
                       Unresolved local var: _Unwind_Sword xh_switch_value@[DW_OP_reg18(s2)]
                       Unresolved local var: terminate_handler xh_terminate_handler@[???] */
  __cxxabiv1::__cxa_begin_catch(exc_obj_in);
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089c4fa4 to 089c4fab has its CatchHandler @ 089c4fac */
  __cxxabiv1::__unexpected(*(unexpected_handler *)((int)exc_obj_in + -0x28));
}



----------------------------------------

// Function: __gxx_personality_v0 @ 089c5060

anon_enum_dwarf_17965e
__gxx_personality_v0
          (int version,_Unwind_Action actions,_Unwind_Exception_Class exception_class,
          _Unwind_Exception_conflict *ue_header,_Unwind_Context *context)

{
  uchar uVar1;
  bool bVar2;
  uchar *puVar3;
  _Unwind_Ptr _Var4;
  _Unwind_Ptr _Var5;
  uchar *p;
  type_info *catch_type;
  undefined3 extraout_var;
  int iVar6;
  _Unwind_Exception_conflict5 *in_t0;
  _Unwind_Context *in_t1;
  _Unwind_Word val;
  _throw_typet *throw_type;
  _Unwind_Exception_conflict5 *local_70;
  _Unwind_Ptr local_6c;
  _Unwind_Word local_68;
  _Unwind_Ptr local_64;
  _Unwind_Ptr local_60;
  lsda_header_info local_5c;
  int local_40;
  _Unwind_Exception_conflict5 *local_3c;
  _Unwind_Exception_Cleanup_Fn_conflict5 local_38;
  _Unwind_Exception_Cleanup_Fn_conflict5 local_34;
  int local_30;
  
                    /* Unresolved local var: found_handler_type found_type@[???]
                       Unresolved local var: lsda_header_info info@[???]
                       Unresolved local var: uchar * language_specific_data@[???]
                       Unresolved local var: uchar * action_record@[???]
                       Unresolved local var: uchar * p@[???]
                       Unresolved local var: _Unwind_Ptr landing_pad@[???]
                       Unresolved local var: _Unwind_Ptr ip@[???]
                       Unresolved local var: int handler_switch_value@[???]
                       Unresolved local var: void * thrown_ptr@[???]
                       Unresolved local var: bool foreign_exception@[???]
                       Unresolved local var: __cxa_exception * xh@[???] */
  if (version != 1) {
    return _URC_FATAL_PHASE1_ERROR;
  }
  local_70 = in_t0 + 1;
  local_3c = in_t0 + -2;
  local_30 = 0;
  if ((int)exception_class == 0x432b2b00) {
    if ((int)(exception_class >> 0x20) == 0x474e5543) {
      local_30 = 1;
    }
    else {
      local_30 = 0;
    }
  }
  if ((actions == 6) && (local_30 != 0)) {
                    /* Unresolved local var: __cxa_exception * xh@[???] */
    local_38 = in_t0[-1].exception_cleanup;
    _Var4 = in_t0[-1].private_1;
    val = (_Unwind_Word)in_t0[-1].exception_class;
    if (_Var4 == 0) {
      iVar6 = 1;
    }
    else {
      iVar6 = 3;
    }
LAB_089c52a4:
    if (iVar6 != 1) {
      if ((int)val < 0) {
        parse_lsda_header(in_t1,(uchar *)local_38,&local_5c);
        _Var5 = base_of_encoded_value(local_5c.ttype_encoding,in_t1);
        local_3c[1].private_1 = _Var5;
      }
LAB_089c52b8:
      _Unwind_SetGR(in_t1,4,(_Unwind_Word)in_t0);
      _Unwind_SetGR(in_t1,5,val);
      _Unwind_SetIP(in_t1,_Var4);
      return _URC_INSTALL_CONTEXT;
    }
    __cxa_call_terminate(in_t0);
LAB_089c551c:
                    /* WARNING: Subroutine does not return */
    std::terminate();
  }
  local_38 = _Unwind_GetLanguageSpecificData(in_t1);
  if (local_38 != (_Unwind_Exception_Cleanup_Fn_conflict5)0x0) {
    local_34 = local_38;
    puVar3 = parse_lsda_header(in_t1,(uchar *)local_38,&local_5c);
    local_5c.ttype_base = base_of_encoded_value(local_5c.ttype_encoding,in_t1);
    _Var4 = _Unwind_GetIP(in_t1);
    bVar2 = puVar3 < local_5c.action_table;
    while (uVar1 = local_5c.call_site_encoding, bVar2) {
                    /* Unresolved local var: _Unwind_Ptr cs_start@[???]
                       Unresolved local var: _Unwind_Ptr cs_len@[???]
                       Unresolved local var: _Unwind_Ptr cs_lp@[???]
                       Unresolved local var: _Unwind_Word cs_action@[???] */
      _Var5 = base_of_encoded_value(local_5c.call_site_encoding,(_Unwind_Context *)0x0);
      puVar3 = read_encoded_value_with_base(uVar1,_Var5,puVar3,&local_6c);
      uVar1 = local_5c.call_site_encoding;
      _Var5 = base_of_encoded_value(local_5c.call_site_encoding,(_Unwind_Context *)0x0);
      puVar3 = read_encoded_value_with_base(uVar1,_Var5,puVar3,&local_60);
      uVar1 = local_5c.call_site_encoding;
      _Var5 = base_of_encoded_value(local_5c.call_site_encoding,(_Unwind_Context *)0x0);
      puVar3 = read_encoded_value_with_base(uVar1,_Var5,puVar3,&local_64);
      puVar3 = read_uleb128(puVar3,&local_68);
      if (_Var4 - 1 < local_5c.Start + local_6c) break;
      if (_Var4 - 1 < local_5c.Start + local_6c + local_60) goto LAB_089c539c;
      bVar2 = puVar3 < local_5c.action_table;
    }
    iVar6 = 1;
    puVar3 = (uchar *)0x0;
    _Var4 = 0;
    val = 0;
LAB_089c522c:
    if ((actions & 1U) == 0) {
      if (((actions & 8U) != 0) || (local_30 == 0)) {
        if (iVar6 != 1) {
          if ((int)val < 0) {
                    /* try { // try from 089c5394 to 089c539b has its CatchHandler @ 089c5524 */
            std::unexpected();
LAB_089c539c:
            if (local_64 == 0) {
              _Var4 = 0;
            }
            else {
              _Var4 = local_64 + local_5c.LPStart;
            }
            puVar3 = (uchar *)0x0;
            if (local_68 != 0) {
              puVar3 = local_5c.action_table + (local_68 - 1);
            }
            if (_Var4 == 0) {
              return _URC_CONTINUE_UNWIND;
            }
            if (puVar3 != (uchar *)0x0) {
              throw_type = (_throw_typet *)0x0;
              if (((actions & 8U) == 0) && (local_30 != 0)) {
                throw_type = *(_throw_typet **)&local_3c->exception_class;
              }
              local_40 = 0;
              do {
                p = read_sleb128(puVar3,(_Unwind_Sword *)&local_68);
                read_sleb128(p,(_Unwind_Sword *)&local_64);
                if (local_68 == 0) {
                  local_40 = 1;
                }
                else if ((int)local_68 < 1) {
                  if (throw_type == (_throw_typet *)0x0) {
                    /* Unresolved local var: uchar * e@[???]
                       Unresolved local var: _Unwind_Word tmp@[???] */
                    read_uleb128(local_5c.TType + (-1 - local_68),&local_60);
                    if (local_60 == 0) goto LAB_089c54a8;
                  }
                  else {
                    bVar2 = check_exception_spec(&local_5c,throw_type,local_70,local_68);
                    if (!bVar2) {
LAB_089c54a8:
                      iVar6 = 3;
                      val = local_68;
                      goto LAB_089c522c;
                    }
                  }
                }
                else {
                  catch_type = get_ttype_entry(&local_5c,local_68);
                  if ((catch_type == (type_info *)0x0) ||
                     ((throw_type != (_throw_typet *)0x0 &&
                      (bVar2 = get_adjusted_ptr(catch_type,throw_type,&local_70),
                      CONCAT31(extraout_var,bVar2) != 0)))) {
                    iVar6 = 3;
                    val = local_68;
                    goto LAB_089c522c;
                  }
                }
                if (local_64 == 0) goto LAB_089c5318;
                puVar3 = p + local_64;
              } while( true );
            }
            goto LAB_089c54e8;
          }
          goto LAB_089c52b8;
        }
        goto LAB_089c551c;
      }
      goto LAB_089c52a4;
    }
    if (iVar6 != 2) {
      if (local_30 != 0) {
                    /* Unresolved local var: __cxa_exception * xh@[???] */
        local_3c[1].private_1 = _Var4;
        local_3c[1].exception_cleanup = local_34;
        *(_Unwind_Word *)&local_3c[1].exception_class = val;
        *(uchar **)((int)&local_3c[1].exception_class + 4) = puVar3;
        local_3c[1].private_2 = (_Unwind_Word)local_70;
        return _URC_HANDLER_FOUND;
      }
      return _URC_HANDLER_FOUND;
    }
  }
  return _URC_CONTINUE_UNWIND;
LAB_089c5318:
                    /* Unresolved local var: _Unwind_Sword ar_filter@[???]
                       Unresolved local var: _Unwind_Sword ar_disp@[???]
                       Unresolved local var: type_info * catch_type@[???]
                       Unresolved local var: _throw_typet * throw_type@[???]
                       Unresolved local var: bool saw_cleanup@[???]
                       Unresolved local var: bool saw_handler@[???] */
  if (local_40 == 0) {
    return _URC_CONTINUE_UNWIND;
  }
LAB_089c54e8:
  iVar6 = 2;
  val = 0;
  goto LAB_089c522c;
}



----------------------------------------

// Function: __cxa_rethrow @ 089c5544

void __cxxabiv1::__cxa_rethrow(void)

{
  __cxa_eh_globals *p_Var1;
  __cxa_exception *p_Var2;
  
                    /* Unresolved local var: __cxa_eh_globals * globals@[???]
                       Unresolved local var: __cxa_exception * header@[???] */
  p_Var1 = __cxa_get_globals();
  p_Var2 = p_Var1->caughtExceptions;
  p_Var1->uncaughtExceptions = p_Var1->uncaughtExceptions + 1;
  if (p_Var2 != (__cxa_exception *)0x0) {
    if ((int)(p_Var2->unwindHeader).exception_class == 0x432b2b00) {
      if (*(int *)((int)&(p_Var2->unwindHeader).exception_class + 4) == 0x474e5543) {
        p_Var2->handlerCount = -p_Var2->handlerCount;
      }
      else {
        p_Var1->caughtExceptions = (__cxa_exception *)0x0;
      }
    }
    else {
      p_Var1->caughtExceptions = (__cxa_exception *)0x0;
    }
    _Unwind_Resume_or_Rethrow((_Unwind_Exception_conflict9 *)&p_Var2->unwindHeader);
    __cxa_begin_catch(&p_Var2->unwindHeader);
  }
                    /* WARNING: Subroutine does not return */
  std::terminate();
}



----------------------------------------

// Function: __cxa_throw @ 089c55c4

/* DWARF original prototype: void __cxa_throw(void * obj, type_info * tinfo, _func_void_void_ptr *
   dest) */

void __cxxabiv1::__cxa_throw(void *obj,type_info *tinfo,_func_void_void_ptr *dest)

{
  terminate_handler p_Var1;
  unexpected_handler p_Var2;
  
  p_Var2 = __unexpected_handler;
                    /* Unresolved local var: __cxa_exception * header@[???] */
  p_Var1 = __terminate_handler;
  *(code **)((int)obj + -0x10) = __gxx_exception_cleanup;
  *(type_info **)((int)obj + -0x48) = tinfo;
  *(_func_void_void_ptr **)((int)obj + -0x44) = dest;
  *(unexpected_handler *)((int)obj + -0x40) = p_Var2;
  *(terminate_handler *)((int)obj + -0x3c) = p_Var1;
  *(undefined4 *)((int)obj + -0x18) = 0x432b2b00;
  *(undefined4 *)((int)obj + -0x14) = 0x474e5543;
  _Unwind_RaiseException((_Unwind_Exception_conflict9 *)((int)obj + -0x18));
  __cxa_begin_catch((_Unwind_Exception_conflict9 *)((int)obj + -0x18));
                    /* WARNING: Subroutine does not return */
  std::terminate();
}



----------------------------------------

// Function: __gxx_exception_cleanup @ 089c5634

void __gxx_exception_cleanup(anon_enum_dwarf_17a492 code,_Unwind_Exception_conflict1 *exc)

{
  code *pcVar1;
  _Unwind_Exception_conflict1 *vptr;
  
                    /* Unresolved local var: __cxa_exception * header@[???] */
  if (_URC_FOREIGN_EXCEPTION_CAUGHT < code) {
                    /* WARNING: Subroutine does not return */
    __cxxabiv1::__terminate((terminate_handler)exc[-2].private_1);
  }
  pcVar1 = *(code **)((int)&exc[-2].exception_class + 4);
  vptr = exc + 1;
  if (pcVar1 != (code *)0x0) {
    (*pcVar1)(vptr);
    __cxxabiv1::__cxa_free_exception(vptr);
    return;
  }
  __cxxabiv1::__cxa_free_exception(vptr);
  return;
}



----------------------------------------

// Function: __is_pointer_p @ 089c5690

/* DWARF original prototype: bool __is_pointer_p(type_info * this) */

bool __thiscall std::type_info::__is_pointer_p(type_info *this)

{
  return false;
}



----------------------------------------

// Function: __is_function_p @ 089c5698

/* DWARF original prototype: bool __is_function_p(type_info * this) */

bool __thiscall std::type_info::__is_function_p(type_info *this)

{
  return false;
}



----------------------------------------

// Function: __do_upcast @ 089c56a0

/* DWARF original prototype: bool __do_upcast(type_info * this, __class_type_info * param_1, void *
   * param_2) */

bool __thiscall
std::type_info::__do_upcast(type_info *this,__class_type_info *param_1,void **param_2)

{
  return false;
}



----------------------------------------

// Function: __do_catch @ 089c56a8

/* DWARF original prototype: bool __do_catch(__class_type_info * this, type_info * thr_type, void *
   * thr_obj, uint outer) */

bool __thiscall
__cxxabiv1::__class_type_info::__do_catch
          (__class_type_info *this,type_info *thr_type,void **thr_obj,uint outer)

{
  int iVar1;
  bool bVar2;
  
  bVar2 = true;
  if (((this->super_type_info).__name != thr_type->__name) && (bVar2 = false, outer < 4)) {
    iVar1 = (*thr_type->_vptr_type_info[5])(thr_type,this);
    return SUB41(iVar1,0);
  }
  return bVar2;
}



----------------------------------------

// Function: __do_upcast @ 089c570c

/* DWARF original prototype: bool __do_upcast(__class_type_info * this, __class_type_info *
   dst_type, void * * obj_ptr) */

bool __thiscall
__cxxabiv1::__class_type_info::__do_upcast
          (__class_type_info *this,__class_type_info *dst_type,void **obj_ptr)

{
  bool bVar1;
  void *local_18;
  uint local_14;
  undefined4 local_10;
  undefined4 local_c;
  
                    /* Unresolved local var: __upcast_result result@[???] */
  local_10 = 0x10;
  local_18 = (void *)0x0;
  local_14 = 0;
  local_c = 0;
  (*(this->super_type_info)._vptr_type_info[6])(this,dst_type,*obj_ptr,&local_18);
  bVar1 = (local_14 & 6) == 6;
  if (bVar1) {
    *obj_ptr = local_18;
  }
  return bVar1;
}



----------------------------------------

// Function: __do_find_public_src @ 089c5778

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: __sub_kind __do_find_public_src(__class_type_info * this, ptrdiff_t
   param_1, void * obj_ptr, __class_type_info * param_3, void * src_ptr) */

__sub_kind __thiscall
__cxxabiv1::__class_type_info::__do_find_public_src
          (__class_type_info *this,ptrdiff_t param_1,void *obj_ptr,__class_type_info *param_3,
          void *src_ptr)

{
  __sub_kind _Var1;
  void *in_t0;
  
  _Var1 = __contained_public;
  if (in_t0 != obj_ptr) {
    _Var1 = __contained_virtual_mask;
  }
  return _Var1;
}



----------------------------------------

// Function: ~type_info @ 089c578c

/* DWARF original prototype: void ~type_info(type_info * this, int __in_chrg) */

void __thiscall std::type_info::~type_info(type_info *this,int __in_chrg)

{
  this->_vptr_type_info = (_func_int_varargs **)&PTR__type_info_089f0920;
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~type_info @ 089c579c

/* DWARF original prototype: void ~type_info(type_info * this, int __in_chrg) */

void __thiscall std::type_info::~type_info(type_info *this,int __in_chrg)

{
  this->_vptr_type_info = (_func_int_varargs **)&PTR__type_info_089f0920;
  return;
}



----------------------------------------

// Function: ~type_info @ 089c57ac

/* DWARF original prototype: void ~type_info(type_info * this, int __in_chrg) */

void __thiscall std::type_info::~type_info(type_info *this,int __in_chrg)

{
  this->_vptr_type_info = (_func_int_varargs **)&PTR__type_info_089f0920;
  return;
}



----------------------------------------

// Function: ~__class_type_info @ 089c57bc

/* DWARF original prototype: void ~__class_type_info(__class_type_info * this, int __in_chrg) */

void __thiscall
__cxxabiv1::__class_type_info::~__class_type_info(__class_type_info *this,int __in_chrg)

{
  (this->super_type_info)._vptr_type_info = (_func_int_varargs **)&PTR____class_type_info_089f08c0;
  std::type_info::~type_info(&this->super_type_info,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__class_type_info @ 089c57f0

/* DWARF original prototype: void ~__class_type_info(__class_type_info * this, int __in_chrg) */

void __thiscall
__cxxabiv1::__class_type_info::~__class_type_info(__class_type_info *this,int __in_chrg)

{
  (this->super_type_info)._vptr_type_info = (_func_int_varargs **)&PTR____class_type_info_089f08c0;
  std::type_info::~type_info(&this->super_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__class_type_info @ 089c5800

/* DWARF original prototype: void ~__class_type_info(__class_type_info * this, int __in_chrg) */

void __thiscall
__cxxabiv1::__class_type_info::~__class_type_info(__class_type_info *this,int __in_chrg)

{
  (this->super_type_info)._vptr_type_info = (_func_int_varargs **)&PTR____class_type_info_089f08c0;
  std::type_info::~type_info(&this->super_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__vmi_class_type_info @ 089c5810

/* DWARF original prototype: void ~__vmi_class_type_info(__vmi_class_type_info * this, int
   __in_chrg) */

void __thiscall
__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info(__vmi_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____vmi_class_type_info_089f0860;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__vmi_class_type_info @ 089c5844

/* DWARF original prototype: void ~__vmi_class_type_info(__vmi_class_type_info * this, int
   __in_chrg) */

void __thiscall
__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info(__vmi_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____vmi_class_type_info_089f0860;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__vmi_class_type_info @ 089c5854

/* DWARF original prototype: void ~__vmi_class_type_info(__vmi_class_type_info * this, int
   __in_chrg) */

void __thiscall
__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info(__vmi_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____vmi_class_type_info_089f0860;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__si_class_type_info @ 089c5864

/* DWARF original prototype: void ~__si_class_type_info(__si_class_type_info * this, int __in_chrg)
    */

void __thiscall
__cxxabiv1::__si_class_type_info::~__si_class_type_info(__si_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____si_class_type_info_089f0890;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~__si_class_type_info @ 089c5898

/* DWARF original prototype: void ~__si_class_type_info(__si_class_type_info * this, int __in_chrg)
    */

void __thiscall
__cxxabiv1::__si_class_type_info::~__si_class_type_info(__si_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____si_class_type_info_089f0890;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~__si_class_type_info @ 089c58a8

/* DWARF original prototype: void ~__si_class_type_info(__si_class_type_info * this, int __in_chrg)
    */

void __thiscall
__cxxabiv1::__si_class_type_info::~__si_class_type_info(__si_class_type_info *this,int __in_chrg)

{
  (this->super___class_type_info).super_type_info._vptr_type_info =
       (_func_int_varargs **)&PTR____si_class_type_info_089f0890;
  __class_type_info::~__class_type_info(&this->super___class_type_info,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_typeid @ 089c58b8

/* DWARF original prototype: void ~bad_typeid(bad_typeid * this, int __in_chrg) */

void __thiscall std::bad_typeid::~bad_typeid(bad_typeid *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_typeid_089f08f0;
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~bad_typeid @ 089c58ec

/* DWARF original prototype: void ~bad_typeid(bad_typeid * this, int __in_chrg) */

void __thiscall std::bad_typeid::~bad_typeid(bad_typeid *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_typeid_089f08f0;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_typeid @ 089c58fc

/* DWARF original prototype: void ~bad_typeid(bad_typeid * this, int __in_chrg) */

void __thiscall std::bad_typeid::~bad_typeid(bad_typeid *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_typeid_089f08f0;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_cast @ 089c590c

/* DWARF original prototype: void ~bad_cast(bad_cast * this, int __in_chrg) */

void __thiscall std::bad_cast::~bad_cast(bad_cast *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_cast_089f0908;
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~bad_cast @ 089c5940

/* DWARF original prototype: void ~bad_cast(bad_cast * this, int __in_chrg) */

void __thiscall std::bad_cast::~bad_cast(bad_cast *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_cast_089f0908;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_cast @ 089c5950

/* DWARF original prototype: void ~bad_cast(bad_cast * this, int __in_chrg) */

void __thiscall std::bad_cast::~bad_cast(bad_cast *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_cast_089f0908;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: __do_catch @ 089c5960

/* DWARF original prototype: bool __do_catch(type_info * this, type_info * thr_type, void * *
   param_2, uint param_3) */

bool __thiscall
std::type_info::__do_catch(type_info *this,type_info *thr_type,void **param_2,uint param_3)

{
  return this->__name == thr_type->__name;
}



----------------------------------------

// Function: __do_upcast @ 089c5974

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_upcast(__class_type_info * this, __class_type_info * dst,
   void * obj, __upcast_result * result) */

bool __thiscall
__cxxabiv1::__class_type_info::__do_upcast
          (__class_type_info *this,__class_type_info *dst,void *obj,__upcast_result *result)

{
  bool bVar1;
  
  bVar1 = (this->super_type_info).__name == (dst->super_type_info).__name;
  if (bVar1) {
    result->part2dst = __contained_public;
    result->dst_ptr = obj;
    result->base_type = (__class_type_info *)0x8;
  }
  return bVar1;
}



----------------------------------------

// Function: __do_upcast @ 089c59a4

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_upcast(__si_class_type_info * this, __class_type_info * dst,
   void * obj_ptr, __upcast_result * result) */

bool __thiscall
__cxxabiv1::__si_class_type_info::__do_upcast
          (__si_class_type_info *this,__class_type_info *dst,void *obj_ptr,__upcast_result *result)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  undefined1 uVar3;
  
  bVar1 = __class_type_info::__do_upcast(&this->super___class_type_info,dst,obj_ptr,result);
  uVar3 = 1;
  if (CONCAT31(extraout_var,bVar1) == 0) {
    iVar2 = (*(this->__base_type->super_type_info)._vptr_type_info[6])
                      (this->__base_type,dst,obj_ptr,result);
    uVar3 = (undefined1)iVar2;
  }
  return (bool)uVar3;
}



----------------------------------------

// Function: __do_dyncast @ 089c5a1c

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_dyncast(__class_type_info * this, ptrdiff_t param_1,
   __sub_kind access_path, __class_type_info * dst_type, void * obj_ptr, __class_type_info *
   src_type, void * src_ptr, __dyncast_result * result) */

bool __thiscall
__cxxabiv1::__class_type_info::__do_dyncast
          (__class_type_info *this,ptrdiff_t param_1,__sub_kind access_path,
          __class_type_info *dst_type,void *obj_ptr,__class_type_info *src_type,void *src_ptr,
          __dyncast_result *result)

{
  char *pcVar1;
  char *pcVar2;
  int in_t0;
  int in_t1;
  int in_t2;
  int *in_t3;
  
  pcVar2 = (this->super_type_info).__name;
  if (in_t0 == in_t2) {
    if (pcVar2 == *(char **)(in_t1 + 4)) {
      in_t3[2] = access_path;
      return false;
    }
    pcVar1 = (dst_type->super_type_info).__name;
  }
  else {
    pcVar1 = (dst_type->super_type_info).__name;
  }
  if (pcVar2 == pcVar1) {
    in_t3[3] = 1;
    *in_t3 = in_t0;
    in_t3[1] = access_path;
  }
  return false;
}



----------------------------------------

// Function: __do_find_public_src @ 089c5a5c

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: __sub_kind __do_find_public_src(__si_class_type_info * this, ptrdiff_t
   src2dst, void * obj_ptr, __class_type_info * src_type, void * src_ptr) */

__sub_kind __thiscall
__cxxabiv1::__si_class_type_info::__do_find_public_src
          (__si_class_type_info *this,ptrdiff_t src2dst,void *obj_ptr,__class_type_info *src_type,
          void *src_ptr)

{
  __sub_kind _Var1;
  void *in_t0;
  
  if ((in_t0 == obj_ptr) &&
     ((this->super___class_type_info).super_type_info.__name == (src_type->super_type_info).__name))
  {
    return __contained_public;
  }
                    /* WARNING: Could not recover jumptable at 0x089c5a70. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  _Var1 = (*(this->__base_type->super_type_info)._vptr_type_info[8])();
  return _Var1;
}



----------------------------------------

// Function: __do_dyncast @ 089c5a90

/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_dyncast(__si_class_type_info * this, ptrdiff_t src2dst,
   __sub_kind access_path, __class_type_info * dst_type, void * obj_ptr, __class_type_info *
   src_type, void * src_ptr, __dyncast_result * result) */

bool __thiscall
__cxxabiv1::__si_class_type_info::__do_dyncast
          (__si_class_type_info *this,ptrdiff_t src2dst,__sub_kind access_path,
          __class_type_info *dst_type,void *obj_ptr,__class_type_info *src_type,void *src_ptr,
          __dyncast_result *result)

{
  char *pcVar1;
  int iVar2;
  __class_type_info *p_Var3;
  int in_t0;
  int in_t1;
  int in_t2;
  int *in_t3;
  
  pcVar1 = (this->super___class_type_info).super_type_info.__name;
  if (pcVar1 == (dst_type->super_type_info).__name) {
    in_t3[1] = access_path;
    *in_t3 = in_t0;
    if (src2dst < 0) {
      if (src2dst == -2) {
        in_t3[3] = 1;
      }
    }
    else {
      iVar2 = 6;
      if (in_t2 != in_t0 + src2dst) {
        iVar2 = 1;
      }
      in_t3[3] = iVar2;
    }
    return false;
  }
  if (in_t0 == in_t2) {
    if (pcVar1 == *(char **)(in_t1 + 4)) {
      in_t3[2] = access_path;
      return false;
    }
    p_Var3 = this->__base_type;
  }
  else {
    p_Var3 = this->__base_type;
  }
  iVar2 = (*(p_Var3->super_type_info)._vptr_type_info[7])();
  return SUB41(iVar2,0);
}



----------------------------------------

// Function: __do_find_public_src @ 089c5b44

/* WARNING: Type propagation algorithm not settling */
/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: __sub_kind __do_find_public_src(__vmi_class_type_info * this, ptrdiff_t
   src2dst, void * obj_ptr, __class_type_info * src_type, void * src_ptr) */

__sub_kind __thiscall
__cxxabiv1::__vmi_class_type_info::__do_find_public_src
          (__vmi_class_type_info *this,ptrdiff_t src2dst,void *obj_ptr,__class_type_info *src_type,
          void *src_ptr)

{
  __sub_kind _Var1;
  uint uVar2;
  int iVar3;
  __class_type_info *p_Var4;
  void *in_t0;
  long *plVar5;
  uint uVar6;
  
  if ((obj_ptr == in_t0) &&
     ((this->super___class_type_info).super_type_info.__name == (src_type->super_type_info).__name))
  {
    return __contained_public;
  }
                    /* Unresolved local var: size_t i@[???] */
  uVar6 = this->__base_count;
  plVar5 = &this->__base_info[uVar6 - 1].__offset_flags;
  do {
    uVar6 = uVar6 - 1;
    if (uVar6 == -1) {
      return __contained_virtual_mask;
    }
                    /* Unresolved local var: void * base@[???]
                       Unresolved local var: ptrdiff_t offset@[???]
                       Unresolved local var: bool is_virtual@[???]
                       Unresolved local var: __sub_kind base_kind@[???] */
    uVar2 = *plVar5;
    if ((uVar2 & 2) != 0) {
      iVar3 = (int)uVar2 >> 8;
      if ((uVar2 & 1) != 0) {
        if (src2dst == -3) goto LAB_089c5c04;
                    /* Unresolved local var: void * vtable@[???] */
        iVar3 = *(int *)(*(int *)obj_ptr + iVar3);
      }
      p_Var4 = ((__base_class_type_info *)((int)plVar5 + 0xfffffffc))->__base_type;
      _Var1 = (*(p_Var4->super_type_info)._vptr_type_info[8])
                        (p_Var4,src2dst,(int)obj_ptr + iVar3,src_type);
      if (3 < (int)_Var1) {
        if ((uVar2 & 1) == 0) {
          return _Var1;
        }
        return _Var1 | __contained_virtual_mask;
      }
    }
LAB_089c5c04:
    plVar5 = (long *)((int)plVar5 + 0xfffffff8);
  } while( true );
}



----------------------------------------

// Function: __do_upcast @ 089c5cb0

/* WARNING: Type propagation algorithm not settling */
/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_upcast(__vmi_class_type_info * this, __class_type_info * dst,
   void * obj_ptr, __upcast_result * result) */

bool __thiscall
__cxxabiv1::__vmi_class_type_info::__do_upcast
          (__vmi_class_type_info *this,__class_type_info *dst,void *obj_ptr,__upcast_result *result)

{
  bool bVar1;
  undefined3 extraout_var;
  __sub_kind _Var2;
  uint uVar3;
  __class_type_info *p_Var4;
  int iVar5;
  __base_class_type_info *p_Var6;
  int iVar7;
  uint uVar8;
  void *local_38;
  __sub_kind local_34;
  uint local_30;
  __class_type_info *local_2c;
  
                    /* Unresolved local var: int src_details@[???] */
  bVar1 = __class_type_info::__do_upcast(&this->super___class_type_info,dst,obj_ptr,result);
  if (CONCAT31(extraout_var,bVar1) != 0) {
    return true;
  }
  uVar8 = result->src_details;
  if ((uVar8 & 0x10) != 0) {
    uVar8 = this->__flags;
  }
                    /* Unresolved local var: size_t i@[???] */
  iVar7 = this->__base_count - 1;
  if (iVar7 == -1) {
    _Var2 = result->part2dst;
  }
  else {
                    /* Unresolved local var: __upcast_result result2@[???]
                       Unresolved local var: void * base@[???]
                       Unresolved local var: ptrdiff_t offset@[???]
                       Unresolved local var: bool is_virtual@[???]
                       Unresolved local var: bool is_public@[???] */
    uVar3 = this->__base_info[this->__base_count - 1].__offset_flags;
    p_Var6 = this->__base_info + (this->__base_count - 1);
    while( true ) {
      local_38 = (void *)0x0;
      local_34 = __unknown;
      local_2c = (__class_type_info *)0x0;
      if (((int)(uVar3 << 0x1e) < 0) || ((uVar8 & 1) != 0)) {
        if (obj_ptr == (void *)0x0) {
          iVar5 = 0;
        }
        else {
          iVar5 = (int)uVar3 >> 8;
          if ((uVar3 & 1) != 0) {
                    /* Unresolved local var: void * vtable@[???] */
            iVar5 = *(int *)(*(int *)obj_ptr + iVar5);
          }
          iVar5 = (int)obj_ptr + iVar5;
        }
        local_30 = uVar8;
        iVar5 = (*(p_Var6->__base_type->super_type_info)._vptr_type_info[6])
                          (p_Var6->__base_type,dst,iVar5,&local_38);
        if (iVar5 != 0) {
          if ((local_2c == (__class_type_info *)0x8) && ((uVar3 & 1) != 0)) {
            local_2c = p_Var6->__base_type;
          }
          if ((int)local_34 < 4) {
            p_Var4 = result->base_type;
          }
          else if ((int)(uVar3 << 0x1e) < 0) {
            p_Var4 = result->base_type;
          }
          else {
            local_34 = local_34 & ~__contained_ambig;
            p_Var4 = result->base_type;
          }
          if (p_Var4 == (__class_type_info *)0x0) {
            result->src_details = local_30;
            result->dst_ptr = local_38;
            result->base_type = local_2c;
            result->part2dst = local_34;
            if ((int)local_34 < 4) {
              return true;
            }
            if ((local_34 & __contained_ambig) == __unknown) {
              if ((local_34 & __contained_virtual_mask) == __unknown) {
                return true;
              }
              uVar3 = this->__flags & 2;
            }
            else {
              uVar3 = this->__flags & 1;
            }
            if (uVar3 == 0) {
              return true;
            }
          }
          else {
            if (result->dst_ptr != local_38) {
              result->part2dst = __contained_ambig;
              result->dst_ptr = (void *)0x0;
              return true;
            }
            if (result->dst_ptr == (void *)0x0) {
              if (((local_2c == (__class_type_info *)0x8) || (p_Var4 == (__class_type_info *)0x8))
                 || ((local_2c->super_type_info).__name != (p_Var4->super_type_info).__name)) {
                result->part2dst = __contained_ambig;
                return true;
              }
              _Var2 = result->part2dst;
            }
            else {
              _Var2 = result->part2dst;
            }
            result->part2dst = _Var2 | local_34;
          }
        }
      }
      iVar7 = iVar7 + -1;
      if (iVar7 == -1) break;
      uVar3 = *(uint *)((int)(p_Var6 + -1) + 4);
      p_Var6 = p_Var6 + -1;
    }
    _Var2 = result->part2dst;
  }
  return _Var2 != __unknown;
}



----------------------------------------

// Function: __dynamic_cast @ 089c5f6c

/* WARNING: Removing unreachable block (ram,0x089c6048) */
/* WARNING: Removing unreachable block (ram,0x089c5ff0) */
/* WARNING: Removing unreachable block (ram,0x089c6024) */
/* WARNING: Removing unreachable block (ram,0x089c6038) */
/* WARNING: Removing unreachable block (ram,0x089c6050) */
/* WARNING: Removing unreachable block (ram,0x089c6084) */
/* WARNING: Removing unreachable block (ram,0x089c6090) */
/* WARNING: Removing unreachable block (ram,0x089c60b4) */
/* WARNING: Removing unreachable block (ram,0x089c6058) */
/* WARNING: Removing unreachable block (ram,0x089c6040) */
/* WARNING: Removing unreachable block (ram,0x089c6000) */
/* WARNING: Removing unreachable block (ram,0x089c6004) */
/* WARNING: Removing unreachable block (ram,0x089c6008) */

void * __cxxabiv1::__dynamic_cast
                 (void *src_ptr,__class_type_info *src_type,__class_type_info *dst_type,
                 ptrdiff_t src2dst)

{
                    /* Unresolved local var: void * vtable@[???]
                       Unresolved local var: vtable_prefix * prefix@[???]
                       Unresolved local var: void * whole_ptr@[???]
                       Unresolved local var: __class_type_info * whole_type@[???]
                       Unresolved local var: __dyncast_result result@[???] */
  (**(code **)(**(int **)(*(int *)src_ptr + -4) + 0x1c))
            (*(int **)(*(int *)src_ptr + -4),src2dst,6,dst_type,0x10);
  return (void *)0x0;
}



----------------------------------------

// Function: __do_dyncast @ 089c60bc

/* WARNING: Removing unreachable block (ram,0x089c648c) */
/* WARNING: Removing unreachable block (ram,0x089c64a4) */
/* WARNING: Removing unreachable block (ram,0x089c6498) */
/* WARNING: Removing unreachable block (ram,0x089c649c) */
/* WARNING: Removing unreachable block (ram,0x089c645c) */
/* WARNING: Removing unreachable block (ram,0x089c6464) */
/* WARNING: Removing unreachable block (ram,0x089c6470) */
/* WARNING: Removing unreachable block (ram,0x089c6250) */
/* WARNING: Removing unreachable block (ram,0x089c6534) */
/* WARNING: Removing unreachable block (ram,0x089c6440) */
/* WARNING: Type propagation algorithm not settling */
/* WARNING: Enum "__sub_kind": Some values do not have unique names */
/* DWARF original prototype: bool __do_dyncast(__vmi_class_type_info * this, ptrdiff_t src2dst,
   __sub_kind access_path, __class_type_info * dst_type, void * obj_ptr, __class_type_info *
   src_type, void * src_ptr, __dyncast_result * result) */

bool __thiscall
__cxxabiv1::__vmi_class_type_info::__do_dyncast
          (__vmi_class_type_info *this,ptrdiff_t src2dst,__sub_kind access_path,
          __class_type_info *dst_type,void *obj_ptr,__class_type_info *src_type,void *src_ptr,
          __dyncast_result *result)

{
  uint uVar1;
  char *pcVar2;
  uint uVar3;
  uint uVar4;
  __sub_kind _Var5;
  int iVar6;
  int in_t0;
  int in_t1;
  int in_t2;
  int *in_t3;
  __base_class_type_info *p_Var7;
  int iVar8;
  uint local_40;
  
                    /* Unresolved local var: bool result_ambig@[???] */
  if ((in_t3[4] & 0x10U) != 0) {
    in_t3[4] = this->__flags;
  }
  if (in_t0 == in_t2) {
    pcVar2 = (this->super___class_type_info).super_type_info.__name;
    if (pcVar2 == *(char **)(in_t1 + 4)) {
      in_t3[2] = access_path;
      return false;
    }
  }
  else {
    pcVar2 = (this->super___class_type_info).super_type_info.__name;
  }
  if (pcVar2 == (dst_type->super_type_info).__name) {
    in_t3[1] = access_path;
    *in_t3 = in_t0;
    if (src2dst < 0) {
      if (src2dst != -2) {
        return false;
      }
      in_t3[3] = 1;
    }
    else {
      iVar8 = 6;
      if (in_t2 != in_t0 + src2dst) {
        iVar8 = 1;
      }
      in_t3[3] = iVar8;
    }
    return false;
  }
                    /* Unresolved local var: size_t i@[???] */
  local_40 = 0;
  iVar8 = this->__base_count - 1;
  if (iVar8 == -1) {
    return false;
  }
                    /* Unresolved local var: __dyncast_result result2@[???]
                       Unresolved local var: void * base@[???]
                       Unresolved local var: __sub_kind base_access@[???]
                       Unresolved local var: ptrdiff_t offset@[???]
                       Unresolved local var: bool is_virtual@[???]
                       Unresolved local var: bool result2_ambig@[???] */
  uVar3 = this->__base_info[this->__base_count - 1].__offset_flags;
  p_Var7 = this->__base_info + (this->__base_count - 1);
  do {
    _Var5 = access_path;
    if ((uVar3 & 1) != 0) {
                    /* Unresolved local var: void * vtable@[???] */
      _Var5 = access_path | __contained_virtual_mask;
    }
    if ((uVar3 & 2) == 0) {
      if ((src2dst != -2) || ((in_t3[4] & 3U) != 0)) {
        _Var5 = _Var5 & ~__contained_ambig;
        goto LAB_089c61ac;
      }
    }
    else {
LAB_089c61ac:
      uVar3 = (*(p_Var7->__base_type->super_type_info)._vptr_type_info[7])
                        (p_Var7->__base_type,src2dst,_Var5,dst_type,in_t3[4]);
      uVar4 = in_t3[2];
      in_t3[2] = uVar4;
      iVar6 = *in_t3;
      if (local_40 == 0) {
        if (iVar6 == 0) {
          *in_t3 = 0;
          in_t3[1] = 0;
          local_40 = uVar3;
        }
        else {
LAB_089c6214:
          if (iVar6 == 0) {
            in_t3[1] = in_t3[1];
          }
          else if ((iVar6 != 0 & uVar3) != 0) {
            uVar3 = in_t3[3];
            if ((3 < (int)uVar4) && (((uVar4 & 1) == 0 || ((in_t3[4] & 2U) == 0)))) {
              if (uVar3 == 0) {
                uVar3 = 1;
              }
              uVar4 = 1;
              goto LAB_089c628c;
            }
            if ((int)uVar3 < 1) {
              if (src2dst < 0) {
                if (src2dst == -2) goto LAB_089c64c4;
                uVar3 = (*(dst_type->super_type_info)._vptr_type_info[8])
                                  (dst_type,src2dst,iVar6,in_t1);
              }
              else if (in_t2 == iVar6 + src2dst) {
                uVar3 = 6;
              }
              else {
LAB_089c64c4:
                uVar3 = 1;
              }
            }
            if (((int)uVar3 < 4) || (((uVar3 & 1) != 0 && ((this->__flags & 2) != 0)))) {
              if (src2dst < 0) {
                if (src2dst != -2) {
                  uVar4 = (*(dst_type->super_type_info)._vptr_type_info[8])
                                    (dst_type,src2dst,0,in_t1);
                  goto LAB_089c628c;
                }
                goto LAB_089c63fc;
              }
              if (in_t2 != src2dst) goto LAB_089c63fc;
              uVar4 = 6;
LAB_089c628c:
              uVar1 = uVar3 & uVar4;
              if ((int)(uVar3 ^ uVar4) < 4) goto LAB_089c6410;
            }
            else {
LAB_089c63fc:
              uVar4 = 1;
              if ((int)(uVar3 ^ 1) < 4) {
                uVar1 = uVar3 & 1;
LAB_089c6410:
                if (3 < (int)uVar1) {
                  in_t3[3] = 2;
                  *in_t3 = 0;
                  return true;
                }
                uVar4 = in_t3[2];
                local_40 = 1;
                in_t3[3] = 1;
                *in_t3 = 0;
                goto LAB_089c62e4;
              }
            }
            if (3 < (int)uVar4) {
              *in_t3 = 0;
              in_t3[1] = 0;
              local_40 = 0;
              uVar3 = uVar4;
            }
            in_t3[3] = uVar3;
            if ((uVar3 & 2) != 0) {
              return false;
            }
            if ((uVar3 & 1) == 0) {
              return false;
            }
            uVar4 = in_t3[2];
          }
        }
      }
      else if (iVar6 != 0) goto LAB_089c6214;
LAB_089c62e4:
      if (uVar4 == 4) {
LAB_089c62fc:
        return (bool)(char)local_40;
      }
    }
    iVar8 = iVar8 + -1;
    if (iVar8 == -1) goto LAB_089c62fc;
    uVar3 = *(uint *)((int)(p_Var7 + -1) + 4);
    p_Var7 = p_Var7 + -1;
  } while( true );
}



----------------------------------------

// Function: do_out @ 089c6648

/* DWARF original prototype: result do_out(codecvt<char,char,_mbstate_t> * this, mbstate_t *
   param_1, char * __from, char * param_3, char * * __from_next, char * __to, char * param_6, char *
   * __to_next) */

result __thiscall
std::codecvt<char,char,_mbstate_t>::do_out
          (codecvt<char,char,_mbstate_t> *this,mbstate_t *param_1,char *__from,char *param_3,
          char **__from_next,char *__to,char *param_6,char **__to_next)

{
  undefined4 *in_t0;
  undefined4 in_t1;
  undefined4 *in_t3;
  
  *in_t0 = __from;
  *in_t3 = in_t1;
  return noconv;
}



----------------------------------------

// Function: do_unshift @ 089c6658

/* DWARF original prototype: result do_unshift(codecvt<char,char,_mbstate_t> * this, mbstate_t *
   param_1, char * __to, char * param_3, char * * __to_next) */

result __thiscall
std::codecvt<char,char,_mbstate_t>::do_unshift
          (codecvt<char,char,_mbstate_t> *this,mbstate_t *param_1,char *__to,char *param_3,
          char **__to_next)

{
  undefined4 *in_t0;
  
  *in_t0 = __to;
  return noconv;
}



----------------------------------------

// Function: do_in @ 089c6664

/* DWARF original prototype: result do_in(codecvt<char,char,_mbstate_t> * this, mbstate_t * param_1,
   char * __from, char * param_3, char * * __from_next, char * __to, char * param_6, char * *
   __to_next) */

result __thiscall
std::codecvt<char,char,_mbstate_t>::do_in
          (codecvt<char,char,_mbstate_t> *this,mbstate_t *param_1,char *__from,char *param_3,
          char **__from_next,char *__to,char *param_6,char **__to_next)

{
  undefined4 *in_t0;
  undefined4 in_t1;
  undefined4 *in_t3;
  
  *in_t0 = __from;
  *in_t3 = in_t1;
  return noconv;
}



----------------------------------------

// Function: do_encoding @ 089c6674

/* DWARF original prototype: int do_encoding(codecvt<char,char,_mbstate_t> * this) */

int __thiscall std::codecvt<char,char,_mbstate_t>::do_encoding(codecvt<char,char,_mbstate_t> *this)

{
  return 1;
}



----------------------------------------

// Function: do_always_noconv @ 089c667c

/* DWARF original prototype: bool do_always_noconv(codecvt<char,char,_mbstate_t> * this) */

bool __thiscall
std::codecvt<char,char,_mbstate_t>::do_always_noconv(codecvt<char,char,_mbstate_t> *this)

{
  return true;
}



----------------------------------------

// Function: do_max_length @ 089c6684

/* DWARF original prototype: int do_max_length(codecvt<char,char,_mbstate_t> * this) */

int __thiscall
std::codecvt<char,char,_mbstate_t>::do_max_length(codecvt<char,char,_mbstate_t> *this)

{
  return 1;
}



----------------------------------------

// Function: do_length @ 089c668c

/* DWARF original prototype: int do_length(codecvt<char,char,_mbstate_t> * this, mbstate_t *
   param_1, char * __from, char * __end, size_t __max) */

int __thiscall
std::codecvt<char,char,_mbstate_t>::do_length
          (codecvt<char,char,_mbstate_t> *this,mbstate_t *param_1,char *__from,char *__end,
          size_t __max)

{
  uint in_t0;
  
                    /* Unresolved local var: size_t __d@[???] */
  if ((uint)((int)__end - (int)__from) < in_t0) {
    return (int)__end - (int)__from;
  }
  return in_t0;
}



----------------------------------------

// Function: __static_initialization_and_destruction_0 @ 089c66c8

void __static_initialization_and_destruction_0(int __initialize_p,int __priority)

{
  return;
}



----------------------------------------

// Function: _GLOBAL__I__ZNSt7codecvtIcc10_mbstate_tE2idE @ 089c66d0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__I__ZNSt7codecvtIcc10_mbstate_tE2idE(void)

{
  return;
}



----------------------------------------

// Function: codecvt @ 089c66d8

/* DWARF original prototype: void codecvt(codecvt<char,char,_mbstate_t> * this, size_t __refs) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::codecvt(codecvt<char,char,_mbstate_t> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._M_refcount =
       (uint)(__refs != 0);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
                    /* try { // try from 089c66fc to 089c6703 has its CatchHandler @ 089c671c */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_codecvt = piVar1;
  return;
}



----------------------------------------

// Function: codecvt @ 089c673c

/* DWARF original prototype: void codecvt(codecvt<char,char,_mbstate_t> * this, size_t __refs) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::codecvt(codecvt<char,char,_mbstate_t> *this,size_t __refs)

{
  __c_locale piVar1;
  
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._M_refcount =
       (uint)(__refs != 0);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
                    /* try { // try from 089c6760 to 089c6767 has its CatchHandler @ 089c6780 */
  piVar1 = locale::facet::_S_get_c_locale();
  this->_M_c_locale_codecvt = piVar1;
  return;
}



----------------------------------------

// Function: ~codecvt @ 089c67a0

/* DWARF original prototype: void ~codecvt(codecvt<char,char,_mbstate_t> * this, int __in_chrg) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::~codecvt(codecvt<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
                    /* try { // try from 089c67c0 to 089c67c7 has its CatchHandler @ 089c67ec */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_codecvt);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR____codecvt_abstract_base_089efc58;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: codecvt @ 089c680c

/* DWARF original prototype: void codecvt(codecvt<char,char,_mbstate_t> * this, __c_locale __cloc,
   size_t __refs) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::codecvt
          (codecvt<char,char,_mbstate_t> *this,__c_locale __cloc,size_t __refs)

{
  __c_locale piVar1;
  __c_locale local_18 [2];
  
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._M_refcount =
       (uint)(__refs != 0);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
  local_18[0] = __cloc;
                    /* try { // try from 089c6838 to 089c683f has its CatchHandler @ 089c6858 */
  piVar1 = locale::facet::_S_clone_c_locale(local_18);
  this->_M_c_locale_codecvt = piVar1;
  return;
}



----------------------------------------

// Function: codecvt @ 089c6878

/* DWARF original prototype: void codecvt(codecvt<char,char,_mbstate_t> * this, __c_locale __cloc,
   size_t __refs) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::codecvt
          (codecvt<char,char,_mbstate_t> *this,__c_locale __cloc,size_t __refs)

{
  __c_locale piVar1;
  __c_locale local_18 [2];
  
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._M_refcount =
       (uint)(__refs != 0);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
  local_18[0] = __cloc;
                    /* try { // try from 089c68a4 to 089c68ab has its CatchHandler @ 089c68c4 */
  piVar1 = locale::facet::_S_clone_c_locale(local_18);
  this->_M_c_locale_codecvt = piVar1;
  return;
}



----------------------------------------

// Function: ~codecvt @ 089c68e4

/* DWARF original prototype: void ~codecvt(codecvt<char,char,_mbstate_t> * this, int __in_chrg) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::~codecvt(codecvt<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
                    /* try { // try from 089c6904 to 089c690b has its CatchHandler @ 089c6938 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_codecvt);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR____codecvt_abstract_base_089efc58;
  locale::facet::~facet((facet *)this,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~codecvt @ 089c6958

/* DWARF original prototype: void ~codecvt(codecvt<char,char,_mbstate_t> * this, int __in_chrg) */

void __thiscall
std::codecvt<char,char,_mbstate_t>::~codecvt(codecvt<char,char,_mbstate_t> *this,int __in_chrg)

{
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR__codecvt_089f0a28;
                    /* try { // try from 089c6978 to 089c697f has its CatchHandler @ 089c69a4 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_codecvt);
  (this->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet =
       (_func_int_varargs **)&PTR____codecvt_abstract_base_089efc58;
  locale::facet::~facet((facet *)this,__in_chrg);
  return;
}



----------------------------------------

// Function: ignore @ 089c69c4

/* DWARF original prototype: basic_istream<char,std::char_traits<char>_> *
   ignore(basic_istream<char,std::char_traits<char>_> * this, streamsize __n) */

basic_istream<char,std::char_traits<char>_> * __thiscall
std::basic_istream<char,std::char_traits<char>_>::ignore
          (basic_istream<char,std::char_traits<char>_> *this,streamsize __n)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  basic_istream<char,std::char_traits<char>_> *pbVar4;
  uint uVar5;
  int iVar6;
  basic_ios<char,std::char_traits<char>_> *this_00;
  byte *pbVar7;
  byte *pbVar8;
  int *piVar9;
  sentry local_28 [4];
  int local_24;
  int local_20;
  
                    /* Unresolved local var: sentry __cerb@[???] */
  if (__n == 1) {
    pbVar4 = ignore(this);
    return pbVar4;
  }
  this->_M_gcount = 0;
  sentry::sentry(local_28,this,true);
  if ((local_28[0]._M_ok != false) && (0 < __n)) {
                    /* Unresolved local var: _Ios_Iostate __err@[???]
                       Unresolved local var: int __eof@[???]
                       Unresolved local var: basic_streambuf<char,std::char_traits<char>_> *
                       __sb@[???]
                       Unresolved local var: int __c@[???]
                       Unresolved local var: bool __large_ignore@[???] */
    piVar9 = *(int **)(&this->field_0x78 + (int)this->_vptr_basic_istream[-3]);
                    /* Unresolved local var: int __ret@[???] */
    if ((byte *)piVar9[2] < (byte *)piVar9[3]) {
      uVar5 = (uint)*(byte *)piVar9[2];
    }
    else {
      uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
    }
    iVar6 = this->_M_gcount;
    bVar1 = false;
    while( true ) {
      while ((iVar6 < __n && (uVar5 != 0xffffffff))) {
                    /* Unresolved local var: streamsize __size@[???] */
        pbVar8 = (byte *)piVar9[3];
        pbVar7 = (byte *)piVar9[2];
        local_24 = __n - iVar6;
        local_20 = (int)pbVar8 - (int)pbVar7;
        if (local_24 < local_20) {
          iVar6 = this->_M_gcount;
          iVar2 = local_24;
        }
        else {
          iVar6 = this->_M_gcount;
          iVar2 = local_20;
        }
        if (iVar2 < 2) {
                    /* Unresolved local var: int __ret@[???] */
          uVar5 = 0xffffffff;
          this->_M_gcount = iVar6 + 1;
          if (pbVar7 < pbVar8) {
            uVar3 = (uint)*pbVar7;
            piVar9[2] = (int)(pbVar7 + 1);
          }
          else {
            uVar3 = (**(code **)(*piVar9 + 0x28))(piVar9);
          }
          if (uVar3 == 0xffffffff) {
            iVar6 = this->_M_gcount;
          }
          else {
                    /* Unresolved local var: int __ret@[???] */
            if ((byte *)piVar9[2] < (byte *)piVar9[3]) {
              uVar5 = (uint)*(byte *)piVar9[2];
              iVar6 = this->_M_gcount;
            }
            else {
              uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
              iVar6 = this->_M_gcount;
            }
          }
        }
        else {
          pbVar7 = pbVar7 + iVar2;
                    /* Unresolved local var: int __ret@[???] */
          iVar6 = iVar6 + iVar2;
          piVar9[2] = (int)pbVar7;
          this->_M_gcount = iVar6;
          if (pbVar7 < pbVar8) {
            uVar5 = (uint)*pbVar7;
          }
          else {
                    /* try { // try from 089c6c2c to 089c6c7f has its CatchHandler @ 089c6adc */
            uVar5 = (**(code **)(*piVar9 + 0x24))(piVar9);
            iVar6 = this->_M_gcount;
          }
        }
      }
      if ((__n != 0x7fffffff) || (iVar6 = -0x80000000, uVar5 == 0xffffffff)) break;
      bVar1 = true;
      this->_M_gcount = -0x80000000;
    }
    if (bVar1) {
      this->_M_gcount = 0x7fffffff;
    }
    if (uVar5 == 0xffffffff) {
      this_00 = (basic_ios<char,std::char_traits<char>_> *)
                ((int)&this->_vptr_basic_istream + (int)this->_vptr_basic_istream[-3]);
      basic_ios<char,std::char_traits<char>_>::clear
                (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_eofbit);
      return this;
    }
  }
  return this;
}



----------------------------------------

// Function: classic_table @ 089c6ca0

char * std::ctype<char>::classic_table(void)

{
  return (char *)0x89ec25d;
}



----------------------------------------

// Function: do_toupper @ 089c6cb0

/* DWARF original prototype: char do_toupper(ctype<char> * this, char __c) */

char __thiscall std::ctype<char>::do_toupper(ctype<char> *this,char __c)

{
  char cVar1;
  
                    /* Unresolved local var: int __x@[DW_OP_reg5(a1)] */
  cVar1 = __c + -0x20;
  if ((this->_M_table[(byte)__c] & 2U) == 0) {
    cVar1 = __c;
  }
  return cVar1;
}



----------------------------------------

// Function: do_toupper @ 089c6ce0

/* DWARF original prototype: char * do_toupper(ctype<char> * this, char * __low, char * __high) */

char * __thiscall std::ctype<char>::do_toupper(ctype<char> *this,char *__low,char *__high)

{
  int iVar1;
  _func_int_varargs **pp_Var2;
  
  if (__low < __high) {
    pp_Var2 = (this->super_facet)._vptr_facet;
    while( true ) {
      iVar1 = (*pp_Var2[2])(this,(int)*__low);
      *__low = (char)iVar1;
      __low = __low + 1;
      if (__low == __high) break;
      pp_Var2 = (this->super_facet)._vptr_facet;
    }
  }
  return __high;
}



----------------------------------------

// Function: do_tolower @ 089c6d54

/* DWARF original prototype: char * do_tolower(ctype<char> * this, char * __low, char * __high) */

char * __thiscall std::ctype<char>::do_tolower(ctype<char> *this,char *__low,char *__high)

{
  int iVar1;
  _func_int_varargs **pp_Var2;
  
  if (__low < __high) {
    pp_Var2 = (this->super_facet)._vptr_facet;
    while( true ) {
      iVar1 = (*pp_Var2[4])(this,(int)*__low);
      *__low = (char)iVar1;
      __low = __low + 1;
      if (__low == __high) break;
      pp_Var2 = (this->super_facet)._vptr_facet;
    }
  }
  return __high;
}



----------------------------------------

// Function: __static_initialization_and_destruction_0 @ 089c6dc8

void __static_initialization_and_destruction_0(int __initialize_p,int __priority)

{
  return;
}



----------------------------------------

// Function: _GLOBAL__I__ZNSt10ctype_base5spaceE @ 089c6dd0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__I__ZNSt10ctype_base5spaceE(void)

{
  return;
}



----------------------------------------

// Function: ~ctype @ 089c6dd8

/* DWARF original prototype: void ~ctype(ctype<char> * this, int __in_chrg) */

void __thiscall std::ctype<char>::~ctype(ctype<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
                    /* try { // try from 089c6df8 to 089c6dff has its CatchHandler @ 089c6e38 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_ctype);
  if ((this->_M_del != false) && (this->_M_table != (char *)0x0)) {
    operator_delete___(this->_M_table);
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: use_facet<std::ctype<char>_> @ 089c6e4c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original name: use_facet<std::ctype<char> > */

ctype<char> * std::use_facet<std::ctype<char>_>(locale *__loc)

{
  size_t sVar1;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: _Impl * __tmp@[???] */
  sVar1 = locale::id::_M_id(&ctype<char>::id);
  return (ctype<char> *)__loc->_M_impl->_M_facets[sVar1];
}



----------------------------------------

// Function: ctype @ 089c6e8c

/* DWARF original prototype: void ctype(ctype<char> * this, __c_locale param_1, char * __table, bool
   __del, size_t __refs) */

void __thiscall
std::ctype<char>::ctype(ctype<char> *this,__c_locale param_1,char *__table,bool __del,size_t __refs)

{
  int in_t0;
  
  (this->super_facet)._M_refcount = (uint)(in_t0 != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
  if (__table == (char *)0x0) {
    this->_M_del = false;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
    __table = classic_table();
  }
  else {
    this->_M_del = __del;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
  }
  this->_M_table = __table;
  memset(this->_M_widen,0,0x100);
  this->_M_widen_ok = '\0';
  memset(this->_M_narrow,0,0x100);
  this->_M_narrow_ok = '\0';
  return;
}



----------------------------------------

// Function: ctype @ 089c6f1c

/* DWARF original prototype: void ctype(ctype<char> * this, char * __table, bool __del, size_t
   __refs) */

void __thiscall std::ctype<char>::ctype(ctype<char> *this,char *__table,bool __del,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
  if (__table == (char *)0x0) {
    this->_M_del = false;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
    __table = classic_table();
  }
  else {
    this->_M_del = __del;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
  }
  this->_M_table = __table;
  memset(this->_M_widen,0,0x100);
  this->_M_widen_ok = '\0';
  memset(this->_M_narrow,0,0x100);
  this->_M_narrow_ok = '\0';
  return;
}



----------------------------------------

// Function: ctype @ 089c6fac

/* DWARF original prototype: void ctype(ctype<char> * this, char * __table, bool __del, size_t
   __refs) */

void __thiscall std::ctype<char>::ctype(ctype<char> *this,char *__table,bool __del,size_t __refs)

{
  (this->super_facet)._M_refcount = (uint)(__refs != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
  if (__table == (char *)0x0) {
    this->_M_del = false;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
    __table = classic_table();
  }
  else {
    this->_M_del = __del;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
  }
  this->_M_table = __table;
  memset(this->_M_widen,0,0x100);
  this->_M_widen_ok = '\0';
  memset(this->_M_narrow,0,0x100);
  this->_M_narrow_ok = '\0';
  return;
}



----------------------------------------

// Function: ctype @ 089c703c

/* DWARF original prototype: void ctype(ctype<char> * this, __c_locale param_1, char * __table, bool
   __del, size_t __refs) */

void __thiscall
std::ctype<char>::ctype(ctype<char> *this,__c_locale param_1,char *__table,bool __del,size_t __refs)

{
  int in_t0;
  
  (this->super_facet)._M_refcount = (uint)(in_t0 != 0);
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
  if (__table == (char *)0x0) {
    this->_M_del = false;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
    __table = classic_table();
  }
  else {
    this->_M_del = __del;
    this->_M_toupper = (int *)0x0;
    this->_M_tolower = (int *)0x0;
  }
  this->_M_table = __table;
  memset(this->_M_widen,0,0x100);
  this->_M_widen_ok = '\0';
  memset(this->_M_narrow,0,0x100);
  this->_M_narrow_ok = '\0';
  return;
}



----------------------------------------

// Function: ~ctype @ 089c70cc

/* DWARF original prototype: void ~ctype(ctype<char> * this, int __in_chrg) */

void __thiscall std::ctype<char>::~ctype(ctype<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
                    /* try { // try from 089c70ec to 089c70f3 has its CatchHandler @ 089c7134 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_ctype);
  if ((this->_M_del != false) && (this->_M_table != (char *)0x0)) {
    operator_delete___(this->_M_table);
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~ctype @ 089c7148

/* DWARF original prototype: void ~ctype(ctype<char> * this, int __in_chrg) */

void __thiscall std::ctype<char>::~ctype(ctype<char> *this,int __in_chrg)

{
  (this->super_facet)._vptr_facet = (_func_int_varargs **)&PTR__ctype_089f0a90;
                    /* try { // try from 089c7168 to 089c716f has its CatchHandler @ 089c71a8 */
  locale::facet::_S_destroy_c_locale(&this->_M_c_locale_ctype);
  if ((this->_M_del != false) && (this->_M_table != (char *)0x0)) {
    operator_delete___(this->_M_table);
  }
  locale::facet::~facet(&this->super_facet,__in_chrg);
  return;
}



----------------------------------------

// Function: do_tolower @ 089c71bc

/* DWARF original prototype: char do_tolower(ctype<char> * this, char __c) */

char __thiscall std::ctype<char>::do_tolower(ctype<char> *this,char __c)

{
  char cVar1;
  
                    /* Unresolved local var: int __x@[DW_OP_reg5(a1)] */
  cVar1 = __c + ' ';
  if ((this->_M_table[(byte)__c] & 1U) == 0) {
    cVar1 = __c;
  }
  return cVar1;
}



----------------------------------------

// Function: __throw_bad_exception @ 089c71ec

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_bad_exception(void)

{
  undefined4 *obj;
  
  obj = __cxxabiv1::__cxa_allocate_exception(4);
  *obj = &PTR__bad_exception_089f13d0;
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(obj,(type_info *)&bad_exception::typeinfo,bad_exception::~bad_exception);
}



----------------------------------------

// Function: __throw_bad_typeid @ 089c7220

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_bad_typeid(void)

{
  undefined4 *obj;
  
  obj = __cxxabiv1::__cxa_allocate_exception(4);
  *obj = &PTR__bad_typeid_089f08f0;
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(obj,(type_info *)&bad_typeid::typeinfo,bad_typeid::~bad_typeid);
}



----------------------------------------

// Function: __throw_bad_cast @ 089c7254

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_bad_cast(void)

{
  undefined4 *obj;
  
  obj = __cxxabiv1::__cxa_allocate_exception(4);
  *obj = &PTR__bad_cast_089f0908;
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(obj,(type_info *)&bad_cast::typeinfo,bad_cast::~bad_cast);
}



----------------------------------------

// Function: __throw_bad_alloc @ 089c7288

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_bad_alloc(void)

{
  undefined4 *obj;
  
  obj = __cxxabiv1::__cxa_allocate_exception(4);
  *obj = &PTR__bad_alloc_089f1440;
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(obj,(type_info *)&bad_alloc::typeinfo,bad_alloc::~bad_alloc);
}



----------------------------------------

// Function: __throw_underflow_error @ 089c72bc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_underflow_error(char *__s)

{
  underflow_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c72dc to 089c72e3 has its CatchHandler @ 089c737c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c72f4 to 089c72fb has its CatchHandler @ 089c7350 */
  underflow_error::underflow_error(this,&local_14);
                    /* try { // try from 089c732c to 089c7333 has its CatchHandler @ 089c7384 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw
            (this,(type_info *)&underflow_error::typeinfo,underflow_error::~underflow_error);
}



----------------------------------------

// Function: __throw_ios_failure @ 089c73bc

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_ios_failure(char *__s)

{
  failure *this;
  _Atomic_word _Var1;
  allocator<char> aStack_18;
  allocator<char> aaStack_17 [3];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c73d8 to 089c73df has its CatchHandler @ 089c744c */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_17);
  this = __cxxabiv1::__cxa_allocate_exception(8);
  ios_base::failure::failure(this,&local_14);
                    /* try { // try from 089c7428 to 089c742f has its CatchHandler @ 089c7454 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),&aStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw
            (this,(type_info *)&ios_base::failure::typeinfo,ios_base::failure::~failure);
}



----------------------------------------

// Function: __throw_overflow_error @ 089c7468

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_overflow_error(char *__s)

{
  overflow_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7488 to 089c748f has its CatchHandler @ 089c7528 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c74a0 to 089c74a7 has its CatchHandler @ 089c74fc */
  overflow_error::overflow_error(this,&local_14);
                    /* try { // try from 089c74d8 to 089c74df has its CatchHandler @ 089c7530 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw
            (this,(type_info *)&overflow_error::typeinfo,overflow_error::~overflow_error);
}



----------------------------------------

// Function: __throw_range_error @ 089c7568

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_range_error(char *__s)

{
  range_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7588 to 089c758f has its CatchHandler @ 089c7628 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c75a0 to 089c75a7 has its CatchHandler @ 089c75fc */
  range_error::range_error(this,&local_14);
                    /* try { // try from 089c75d8 to 089c75df has its CatchHandler @ 089c7630 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&range_error::typeinfo,range_error::~range_error);
}



----------------------------------------

// Function: __throw_runtime_error @ 089c7668

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_runtime_error(char *__s)

{
  runtime_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7688 to 089c768f has its CatchHandler @ 089c7728 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c76a0 to 089c76a7 has its CatchHandler @ 089c76fc */
  runtime_error::runtime_error(this,&local_14);
                    /* try { // try from 089c76d8 to 089c76df has its CatchHandler @ 089c7730 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&runtime_error::typeinfo,runtime_error::~runtime_error);
}



----------------------------------------

// Function: __throw_out_of_range @ 089c7768

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_out_of_range(char *__s)

{
  out_of_range *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7788 to 089c778f has its CatchHandler @ 089c7828 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c77a0 to 089c77a7 has its CatchHandler @ 089c77fc */
  out_of_range::out_of_range(this,&local_14);
                    /* try { // try from 089c77d8 to 089c77df has its CatchHandler @ 089c7830 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&out_of_range::typeinfo,out_of_range::~out_of_range);
}



----------------------------------------

// Function: __throw_length_error @ 089c7868

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_length_error(char *__s)

{
  length_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7888 to 089c788f has its CatchHandler @ 089c7928 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c78a0 to 089c78a7 has its CatchHandler @ 089c78fc */
  length_error::length_error(this,&local_14);
                    /* try { // try from 089c78d8 to 089c78df has its CatchHandler @ 089c7930 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&length_error::typeinfo,length_error::~length_error);
}



----------------------------------------

// Function: __throw_invalid_argument @ 089c7968

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_invalid_argument(char *__s)

{
  invalid_argument *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7988 to 089c798f has its CatchHandler @ 089c7a28 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c79a0 to 089c79a7 has its CatchHandler @ 089c79fc */
  invalid_argument::invalid_argument(this,&local_14);
                    /* try { // try from 089c79d8 to 089c79df has its CatchHandler @ 089c7a30 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw
            (this,(type_info *)&invalid_argument::typeinfo,invalid_argument::~invalid_argument);
}



----------------------------------------

// Function: __throw_domain_error @ 089c7a68

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_domain_error(char *__s)

{
  domain_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7a88 to 089c7a8f has its CatchHandler @ 089c7b28 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c7aa0 to 089c7aa7 has its CatchHandler @ 089c7afc */
  domain_error::domain_error(this,&local_14);
                    /* try { // try from 089c7ad8 to 089c7adf has its CatchHandler @ 089c7b30 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&domain_error::typeinfo,domain_error::~domain_error);
}



----------------------------------------

// Function: __throw_logic_error @ 089c7b68

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::__throw_logic_error(char *__s)

{
  logic_error *this;
  _Atomic_word _Var1;
  allocator<char> aaStack_18 [2];
  allocator<char> aaStack_16 [2];
  basic_string<char,std::char_traits<char>,std::allocator<char>_> local_14;
  
                    /* try { // try from 089c7b88 to 089c7b8f has its CatchHandler @ 089c7c28 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string
            (&local_14,__s,aaStack_16);
  this = __cxxabiv1::__cxa_allocate_exception(8);
                    /* try { // try from 089c7ba0 to 089c7ba7 has its CatchHandler @ 089c7bfc */
  logic_error::logic_error(this,&local_14);
                    /* try { // try from 089c7bd8 to 089c7bdf has its CatchHandler @ 089c7c30 */
  if (((_Rep *)((int)local_14._M_dataplus._M_p + -0xc) !=
       (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
               _S_empty_rep_storage) &&
     (_Var1 = __gnu_cxx::__exchange_and_add
                        ((_Atomic_word *)((int)local_14._M_dataplus._M_p + -4),-1), _Var1 < 1)) {
    basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
              ((_Rep *)((int)local_14._M_dataplus._M_p + -0xc),aaStack_18);
  }
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__cxa_throw(this,(type_info *)&logic_error::typeinfo,logic_error::~logic_error);
}



----------------------------------------

// Function: ~underflow_error @ 089c7c68

/* DWARF original prototype: void ~underflow_error(underflow_error * this, int __in_chrg) */

void __thiscall std::underflow_error::~underflow_error(underflow_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__underflow_error_089f0b10;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~underflow_error @ 089c7c9c

/* DWARF original prototype: void ~underflow_error(underflow_error * this, int __in_chrg) */

void __thiscall std::underflow_error::~underflow_error(underflow_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__underflow_error_089f0b10;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~overflow_error @ 089c7cac

/* DWARF original prototype: void ~overflow_error(overflow_error * this, int __in_chrg) */

void __thiscall std::overflow_error::~overflow_error(overflow_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__overflow_error_089f0b48;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~overflow_error @ 089c7ce0

/* DWARF original prototype: void ~overflow_error(overflow_error * this, int __in_chrg) */

void __thiscall std::overflow_error::~overflow_error(overflow_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__overflow_error_089f0b48;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~range_error @ 089c7cf0

/* DWARF original prototype: void ~range_error(range_error * this, int __in_chrg) */

void __thiscall std::range_error::~range_error(range_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__range_error_089f0b80;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~range_error @ 089c7d24

/* DWARF original prototype: void ~range_error(range_error * this, int __in_chrg) */

void __thiscall std::range_error::~range_error(range_error *this,int __in_chrg)

{
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__range_error_089f0b80;
  runtime_error::~runtime_error(&this->super_runtime_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~out_of_range @ 089c7d34

/* DWARF original prototype: void ~out_of_range(out_of_range * this, int __in_chrg) */

void __thiscall std::out_of_range::~out_of_range(out_of_range *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__out_of_range_089f0bb8;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~out_of_range @ 089c7d68

/* DWARF original prototype: void ~out_of_range(out_of_range * this, int __in_chrg) */

void __thiscall std::out_of_range::~out_of_range(out_of_range *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__out_of_range_089f0bb8;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~length_error @ 089c7d78

/* DWARF original prototype: void ~length_error(length_error * this, int __in_chrg) */

void __thiscall std::length_error::~length_error(length_error *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__length_error_089f0bf0;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~length_error @ 089c7dac

/* DWARF original prototype: void ~length_error(length_error * this, int __in_chrg) */

void __thiscall std::length_error::~length_error(length_error *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__length_error_089f0bf0;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~invalid_argument @ 089c7dbc

/* DWARF original prototype: void ~invalid_argument(invalid_argument * this, int __in_chrg) */

void __thiscall std::invalid_argument::~invalid_argument(invalid_argument *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__invalid_argument_089f0c30;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~invalid_argument @ 089c7df0

/* DWARF original prototype: void ~invalid_argument(invalid_argument * this, int __in_chrg) */

void __thiscall std::invalid_argument::~invalid_argument(invalid_argument *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__invalid_argument_089f0c30;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  return;
}



----------------------------------------

// Function: ~domain_error @ 089c7e00

/* DWARF original prototype: void ~domain_error(domain_error * this, int __in_chrg) */

void __thiscall std::domain_error::~domain_error(domain_error *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__domain_error_089f0c68;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~domain_error @ 089c7e34

/* DWARF original prototype: void ~domain_error(domain_error * this, int __in_chrg) */

void __thiscall std::domain_error::~domain_error(domain_error *this,int __in_chrg)

{
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__domain_error_089f0c68;
  logic_error::~logic_error(&this->super_logic_error,__in_chrg);
  return;
}



----------------------------------------

// Function: _M_dispose_callbacks @ 089c7e44

/* DWARF original prototype: void _M_dispose_callbacks(ios_base * this) */

void __thiscall std::ios_base::_M_dispose_callbacks(ios_base *this)

{
  _Atomic_word _Var1;
  _Callback_list *p_Var2;
  _Callback_list *ptr;
  
                    /* Unresolved local var: _Callback_list * __p@[???] */
  ptr = this->_M_callbacks;
  if (this->_M_callbacks == (_Callback_list *)0x0) {
    this->_M_callbacks = (_Callback_list *)0x0;
  }
  else {
    do {
      _Var1 = __gnu_cxx::__exchange_and_add(&ptr->_M_refcount,-1);
      if (_Var1 != 0) break;
                    /* Unresolved local var: _Callback_list * __next@[???] */
      p_Var2 = ptr->_M_next;
      operator_delete(ptr);
      ptr = p_Var2;
    } while (p_Var2 != (_Callback_list *)0x0);
    this->_M_callbacks = (_Callback_list *)0x0;
  }
  return;
}



----------------------------------------

// Function: _M_call_callbacks @ 089c7eac

/* DWARF original prototype: void _M_call_callbacks(ios_base * this, event __e) */

void __thiscall std::ios_base::_M_call_callbacks(ios_base *this,event __e)

{
  _func_void_event_ios_base_ptr_int *p_Var1;
  _Callback_list *p_Var2;
  
                    /* Unresolved local var: _Callback_list * __p@[???] */
  p_Var2 = this->_M_callbacks;
  if (p_Var2 != (_Callback_list *)0x0) {
    p_Var1 = p_Var2->_M_fn;
    while( true ) {
                    /* try { // try from 089c7edc to 089c7ee3 has its CatchHandler @ 089c7f08 */
      (*p_Var1)(__e,this,p_Var2->_M_index);
      p_Var2 = p_Var2->_M_next;
      if (p_Var2 == (_Callback_list *)0x0) break;
      p_Var1 = p_Var2->_M_fn;
    }
  }
  return;
}



----------------------------------------

// Function: xalloc @ 089c7f3c

int std::ios_base::xalloc(void)

{
  _Atomic_word _Var1;
  
                    /* try { // try from 089c7f4c to 089c7f53 has its CatchHandler @ 089c7f64 */
  _Var1 = __gnu_cxx::__exchange_and_add(&xalloc::_S_top,1);
  return _Var1 + 4;
}



----------------------------------------

// Function: register_callback @ 089c7f80

/* DWARF original prototype: void register_callback(ios_base * this,
   _func_void_event_ios_base_ptr_int * __fn, int __index) */

void __thiscall
std::ios_base::register_callback(ios_base *this,_func_void_event_ios_base_ptr_int *__fn,int __index)

{
  _Callback_list *p_Var1;
  _Callback_list *p_Var2;
  
  p_Var1 = operator_new(0x10);
  p_Var2 = this->_M_callbacks;
  p_Var1->_M_fn = __fn;
  p_Var1->_M_index = __index;
  p_Var1->_M_next = p_Var2;
  p_Var1->_M_refcount = 0;
  this->_M_callbacks = p_Var1;
  return;
}



----------------------------------------

// Function: ~ios_base @ 089c7fd8

/* DWARF original prototype: void ~ios_base(ios_base * this, int __in_chrg) */

void __thiscall std::ios_base::~ios_base(ios_base *this,int __in_chrg)

{
  _Words *ptr;
  int __in_chrg_00;
  
  this->_vptr_ios_base = (_func_int_varargs **)&PTR__ios_base_089f0d90;
  __in_chrg_00 = 0;
  _M_call_callbacks(this,erase_event);
                    /* try { // try from 089c8000 to 089c8007 has its CatchHandler @ 089c804c */
  _M_dispose_callbacks(this);
  ptr = this->_M_word;
  if (ptr != this->_M_local_word) {
    if (ptr == (_Words *)0x0) {
      this->_M_word = (_Words *)0x0;
    }
    else {
      operator_delete___(ptr);
      this->_M_word = (_Words *)0x0;
    }
  }
  locale::~locale(&this->_M_ios_locale,__in_chrg_00);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~ios_base @ 089c8060

/* DWARF original prototype: void ~ios_base(ios_base * this, int __in_chrg) */

void __thiscall std::ios_base::~ios_base(ios_base *this,int __in_chrg)

{
  _Words *ptr;
  int __in_chrg_00;
  
  this->_vptr_ios_base = (_func_int_varargs **)&PTR__ios_base_089f0d90;
  __in_chrg_00 = 0;
  _M_call_callbacks(this,erase_event);
                    /* try { // try from 089c8088 to 089c808f has its CatchHandler @ 089c80cc */
  _M_dispose_callbacks(this);
  ptr = this->_M_word;
  if (ptr != this->_M_local_word) {
    if (ptr == (_Words *)0x0) {
      this->_M_word = (_Words *)0x0;
    }
    else {
      operator_delete___(ptr);
      this->_M_word = (_Words *)0x0;
    }
  }
  locale::~locale(&this->_M_ios_locale,__in_chrg_00);
  return;
}



----------------------------------------

// Function: ~ios_base @ 089c80e0

/* DWARF original prototype: void ~ios_base(ios_base * this, int __in_chrg) */

void __thiscall std::ios_base::~ios_base(ios_base *this,int __in_chrg)

{
  _Words *ptr;
  int __in_chrg_00;
  
  this->_vptr_ios_base = (_func_int_varargs **)&PTR__ios_base_089f0d90;
  __in_chrg_00 = 0;
  _M_call_callbacks(this,erase_event);
                    /* try { // try from 089c8108 to 089c810f has its CatchHandler @ 089c814c */
  _M_dispose_callbacks(this);
  ptr = this->_M_word;
  if (ptr != this->_M_local_word) {
    if (ptr == (_Words *)0x0) {
      this->_M_word = (_Words *)0x0;
    }
    else {
      operator_delete___(ptr);
      this->_M_word = (_Words *)0x0;
    }
  }
  locale::~locale(&this->_M_ios_locale,__in_chrg_00);
  return;
}



----------------------------------------

// Function: ios_base @ 089c8160

/* DWARF original prototype: void ios_base(ios_base * this) */

void __thiscall std::ios_base::ios_base(ios_base *this)

{
  _Words *p_Var1;
  _Words *p_Var2;
  
  p_Var2 = this->_M_local_word;
  this->_vptr_ios_base = (_func_int_varargs **)&PTR__ios_base_089f0d90;
  this->_M_precision = 0;
  this->_M_width = 0;
  this->_M_flags = 0;
  this->_M_exception = _S_goodbit;
  this->_M_streambuf_state = _S_goodbit;
  this->_M_callbacks = (_Callback_list *)0x0;
  (this->_M_word_zero)._M_pword = (void *)0x0;
  (this->_M_word_zero)._M_iword = 0;
  p_Var2->_M_pword = (void *)0x0;
  p_Var1 = p_Var2;
  while( true ) {
    p_Var1->_M_iword = 0;
    p_Var1 = p_Var1 + 1;
    if (p_Var1 == (_Words *)&this->_M_word_size) break;
    p_Var1->_M_pword = (void *)0x0;
  }
  this->_M_word_size = 8;
  this->_M_word = p_Var2;
  locale::locale(&this->_M_ios_locale);
  return;
}



----------------------------------------

// Function: ios_base @ 089c81c0

/* DWARF original prototype: void ios_base(ios_base * this) */

void __thiscall std::ios_base::ios_base(ios_base *this)

{
  _Words *p_Var1;
  _Words *p_Var2;
  
  p_Var2 = this->_M_local_word;
  this->_vptr_ios_base = (_func_int_varargs **)&PTR__ios_base_089f0d90;
  this->_M_precision = 0;
  this->_M_width = 0;
  this->_M_flags = 0;
  this->_M_exception = _S_goodbit;
  this->_M_streambuf_state = _S_goodbit;
  this->_M_callbacks = (_Callback_list *)0x0;
  (this->_M_word_zero)._M_pword = (void *)0x0;
  (this->_M_word_zero)._M_iword = 0;
  p_Var2->_M_pword = (void *)0x0;
  p_Var1 = p_Var2;
  while( true ) {
    p_Var1->_M_iword = 0;
    p_Var1 = p_Var1 + 1;
    if (p_Var1 == (_Words *)&this->_M_word_size) break;
    p_Var1->_M_pword = (void *)0x0;
  }
  this->_M_word_size = 8;
  this->_M_word = p_Var2;
  locale::locale(&this->_M_ios_locale);
  return;
}



----------------------------------------

// Function: _M_grow_words @ 089c8220

/* DWARF original prototype: _Words * _M_grow_words(ios_base * this, int __ix, bool __iword) */

_Words * __thiscall std::ios_base::_M_grow_words(ios_base *this,int __ix,bool __iword)

{
  _Words *p_Var1;
  undefined4 *puVar2;
  undefined4 *puVar3;
  _Ios_Iostate _Var4;
  undefined4 uVar5;
  int iVar6;
  int iVar7;
  _Words *p_Var8;
  int iVar9;
  int iVar10;
  
                    /* Unresolved local var: int __newsize@[???]
                       Unresolved local var: _Words * __words@[???] */
  if (__ix < 8) {
    iVar10 = 8;
    p_Var1 = this->_M_local_word;
  }
  else {
    iVar10 = __ix + 1;
    if (__ix == 0x7fffffff) {
      _Var4 = this->_M_streambuf_state | _S_badbit;
      this->_M_streambuf_state = _Var4;
      if ((_Var4 & this->_M_exception) != _S_goodbit) {
                    /* WARNING: Subroutine does not return */
        __throw_ios_failure("ios_base::_M_grow_words is not valid");
      }
      if (__iword) {
        (this->_M_word_zero)._M_iword = 0;
      }
      else {
        (this->_M_word_zero)._M_pword = (void *)0x0;
      }
      return &this->_M_word_zero;
    }
                    /* try { // try from 089c8264 to 089c826b has its CatchHandler @ 089c838c */
    p_Var1 = operator_new___(iVar10 * 8);
    if (__ix == -1) {
      iVar9 = this->_M_word_size;
    }
    else {
      iVar9 = 0;
      p_Var8 = p_Var1;
      do {
        iVar9 = iVar9 + 1;
        p_Var8->_M_pword = (void *)0x0;
        p_Var8->_M_iword = 0;
        p_Var8 = p_Var8 + 1;
      } while (iVar9 != iVar10);
                    /* Unresolved local var: int __i@[???] */
      iVar9 = this->_M_word_size;
    }
    p_Var8 = this->_M_word;
    if (0 < iVar9) {
      iVar7 = 0;
      iVar6 = 0;
      do {
        puVar2 = (undefined4 *)((int)&p_Var8->_M_pword + iVar6);
        uVar5 = *puVar2;
        iVar7 = iVar7 + 1;
        puVar3 = (undefined4 *)((int)&p_Var1->_M_pword + iVar6);
        puVar3[1] = puVar2[1];
        *puVar3 = uVar5;
        iVar6 = iVar6 + 8;
      } while (iVar7 < iVar9);
    }
    if (p_Var8 != (_Words *)0x0) {
      if (this->_M_local_word == p_Var8) {
        this->_M_word_size = iVar10;
        goto LAB_089c8304;
      }
      operator_delete___(p_Var8);
      this->_M_word = (_Words *)0x0;
    }
  }
  this->_M_word_size = iVar10;
LAB_089c8304:
  this->_M_word = p_Var1;
  return p_Var1 + __ix;
}



----------------------------------------

// Function: what @ 089c83e4

/* DWARF original prototype: char * what(failure * this) */

char * __thiscall std::ios_base::failure::what(failure *this)

{
  return (this->_M_msg)._M_dataplus._M_p;
}



----------------------------------------

// Function: failure @ 089c83ec

/* DWARF original prototype: void failure(failure * this, string * __str) */

void __thiscall std::ios_base::failure::failure(failure *this,string *__str)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__failure_089f0db8;
                    /* try { // try from 089c840c to 089c8413 has its CatchHandler @ 089c8428 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__str)
  ;
  return;
}



----------------------------------------

// Function: ~failure @ 089c8454

/* DWARF original prototype: void ~failure(failure * this, int __in_chrg) */

void __thiscall std::ios_base::failure::~failure(failure *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__failure_089f0db8;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c84a8 to 089c84af has its CatchHandler @ 089c84c8 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: failure @ 089c84f4

/* DWARF original prototype: void failure(failure * this, string * __str) */

void __thiscall std::ios_base::failure::failure(failure *this,string *__str)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__failure_089f0db8;
                    /* try { // try from 089c8514 to 089c851b has its CatchHandler @ 089c8530 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__str)
  ;
  return;
}



----------------------------------------

// Function: ~failure @ 089c855c

/* DWARF original prototype: void ~failure(failure * this, int __in_chrg) */

void __thiscall std::ios_base::failure::~failure(failure *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__failure_089f0db8;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c85b8 to 089c85bf has its CatchHandler @ 089c85d8 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~failure @ 089c8604

/* DWARF original prototype: void ~failure(failure * this, int __in_chrg) */

void __thiscall std::ios_base::failure::~failure(failure *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__failure_089f0db8;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8658 to 089c865f has its CatchHandler @ 089c8678 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: imbue @ 089c86a4

/* DWARF original prototype: locale imbue(ios_base * this, locale * __loc) */

locale * __thiscall
std::ios_base::imbue(locale *__return_storage_ptr__,ios_base *this,locale *__loc)

{
                    /* Unresolved local var: locale * __old@[DW_OP_reg19(s3)]
                       Unresolved local var: locale __old@[???] */
  locale::locale(__return_storage_ptr__,&this->_M_ios_locale);
  locale::operator=(&this->_M_ios_locale,__loc);
  _M_call_callbacks(this,imbue_event);
  return __return_storage_ptr__;
}



----------------------------------------

// Function: _M_init @ 089c870c

/* DWARF original prototype: void _M_init(ios_base * this) */

void __thiscall std::ios_base::_M_init(ios_base *this)

{
  locale *__in_chrg;
  locale alStack_10 [2];
  
  __in_chrg = alStack_10;
  this->_M_flags = _S_skipws|_S_dec;
  this->_M_precision = 6;
  this->_M_width = 0;
  locale::locale(alStack_10);
  locale::operator=(&this->_M_ios_locale,alStack_10);
  locale::~locale(alStack_10,(int)__in_chrg);
  return;
}



----------------------------------------

// Function: _S_format_float @ 089c875c

void std::__num_base::_S_format_float(ios_base *__io,char *__fptr,char __mod)

{
  char cVar1;
  char *pcVar2;
  char *pcVar3;
  _Ios_Fmtflags _Var4;
  
                    /* Unresolved local var: _Ios_Fmtflags __flags@[DW_OP_reg7(a3)]
                       Unresolved local var: _Ios_Fmtflags __fltfield@[???] */
  _Var4 = __io->_M_flags;
  *__fptr = '%';
  pcVar2 = __fptr + 1;
  if ((_Var4 & _S_showpos) != 0) {
    __fptr[1] = '+';
    pcVar2 = __fptr + 2;
  }
  if ((_Var4 & _S_showpoint) != 0) {
    *pcVar2 = '#';
    pcVar2 = pcVar2 + 1;
  }
  *pcVar2 = '.';
  pcVar2[1] = '*';
  pcVar3 = pcVar2 + 2;
  if (__mod != '\0') {
    pcVar2[2] = __mod;
    pcVar3 = pcVar2 + 3;
  }
  if ((_Var4 & _S_floatfield) != _S_fixed) {
    if ((_Var4 & _S_floatfield) != _S_scientific) {
      cVar1 = 'G';
      if ((_Var4 & _S_uppercase) == 0) {
        cVar1 = 'g';
      }
      *pcVar3 = cVar1;
      pcVar3[1] = '\0';
      return;
    }
    cVar1 = 'E';
    if ((_Var4 & _S_uppercase) == 0) {
      cVar1 = 'e';
    }
    *pcVar3 = cVar1;
    pcVar3[1] = '\0';
    return;
  }
  *pcVar3 = 'f';
  pcVar3[1] = '\0';
  return;
}



----------------------------------------

// Function: what @ 089c8824

/* DWARF original prototype: char * what(logic_error * this) */

char * __thiscall std::logic_error::what(logic_error *this)

{
  return (this->_M_msg)._M_dataplus._M_p;
}



----------------------------------------

// Function: logic_error @ 089c882c

/* DWARF original prototype: void logic_error(logic_error * this, string * __arg) */

void __thiscall std::logic_error::logic_error(logic_error *this,string *__arg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__logic_error_089f0e98;
                    /* try { // try from 089c884c to 089c8853 has its CatchHandler @ 089c8868 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__arg)
  ;
  return;
}



----------------------------------------

// Function: logic_error @ 089c887c

/* DWARF original prototype: void logic_error(logic_error * this, string * __arg) */

void __thiscall std::logic_error::logic_error(logic_error *this,string *__arg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__logic_error_089f0e98;
                    /* try { // try from 089c889c to 089c88a3 has its CatchHandler @ 089c88b8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__arg)
  ;
  return;
}



----------------------------------------

// Function: out_of_range @ 089c88cc

/* DWARF original prototype: void out_of_range(out_of_range * this, string * __arg) */

void __thiscall std::out_of_range::out_of_range(out_of_range *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__out_of_range_089f0bb8;
  return;
}



----------------------------------------

// Function: out_of_range @ 089c88fc

/* DWARF original prototype: void out_of_range(out_of_range * this, string * __arg) */

void __thiscall std::out_of_range::out_of_range(out_of_range *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__out_of_range_089f0bb8;
  return;
}



----------------------------------------

// Function: length_error @ 089c892c

/* DWARF original prototype: void length_error(length_error * this, string * __arg) */

void __thiscall std::length_error::length_error(length_error *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__length_error_089f0bf0;
  return;
}



----------------------------------------

// Function: length_error @ 089c895c

/* DWARF original prototype: void length_error(length_error * this, string * __arg) */

void __thiscall std::length_error::length_error(length_error *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__length_error_089f0bf0;
  return;
}



----------------------------------------

// Function: invalid_argument @ 089c898c

/* DWARF original prototype: void invalid_argument(invalid_argument * this, string * __arg) */

void __thiscall std::invalid_argument::invalid_argument(invalid_argument *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__invalid_argument_089f0c30;
  return;
}



----------------------------------------

// Function: invalid_argument @ 089c89bc

/* DWARF original prototype: void invalid_argument(invalid_argument * this, string * __arg) */

void __thiscall std::invalid_argument::invalid_argument(invalid_argument *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__invalid_argument_089f0c30;
  return;
}



----------------------------------------

// Function: domain_error @ 089c89ec

/* DWARF original prototype: void domain_error(domain_error * this, string * __arg) */

void __thiscall std::domain_error::domain_error(domain_error *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__domain_error_089f0c68;
  return;
}



----------------------------------------

// Function: domain_error @ 089c8a1c

/* DWARF original prototype: void domain_error(domain_error * this, string * __arg) */

void __thiscall std::domain_error::domain_error(domain_error *this,string *__arg)

{
  logic_error::logic_error(&this->super_logic_error,__arg);
  (this->super_logic_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__domain_error_089f0c68;
  return;
}



----------------------------------------

// Function: runtime_error @ 089c8a4c

/* DWARF original prototype: void runtime_error(runtime_error * this, string * __arg) */

void __thiscall std::runtime_error::runtime_error(runtime_error *this,string *__arg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__runtime_error_089f0e80;
                    /* try { // try from 089c8a6c to 089c8a73 has its CatchHandler @ 089c8a88 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__arg)
  ;
  return;
}



----------------------------------------

// Function: runtime_error @ 089c8a9c

/* DWARF original prototype: void runtime_error(runtime_error * this, string * __arg) */

void __thiscall std::runtime_error::runtime_error(runtime_error *this,string *__arg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__runtime_error_089f0e80;
                    /* try { // try from 089c8abc to 089c8ac3 has its CatchHandler @ 089c8ad8 */
  basic_string<char,std::char_traits<char>,std::allocator<char>_>::basic_string(&this->_M_msg,__arg)
  ;
  return;
}



----------------------------------------

// Function: underflow_error @ 089c8aec

/* DWARF original prototype: void underflow_error(underflow_error * this, string * __arg) */

void __thiscall std::underflow_error::underflow_error(underflow_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__underflow_error_089f0b10;
  return;
}



----------------------------------------

// Function: underflow_error @ 089c8b1c

/* DWARF original prototype: void underflow_error(underflow_error * this, string * __arg) */

void __thiscall std::underflow_error::underflow_error(underflow_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__underflow_error_089f0b10;
  return;
}



----------------------------------------

// Function: overflow_error @ 089c8b4c

/* DWARF original prototype: void overflow_error(overflow_error * this, string * __arg) */

void __thiscall std::overflow_error::overflow_error(overflow_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__overflow_error_089f0b48;
  return;
}



----------------------------------------

// Function: overflow_error @ 089c8b7c

/* DWARF original prototype: void overflow_error(overflow_error * this, string * __arg) */

void __thiscall std::overflow_error::overflow_error(overflow_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__overflow_error_089f0b48;
  return;
}



----------------------------------------

// Function: range_error @ 089c8bac

/* DWARF original prototype: void range_error(range_error * this, string * __arg) */

void __thiscall std::range_error::range_error(range_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__range_error_089f0b80;
  return;
}



----------------------------------------

// Function: range_error @ 089c8bdc

/* DWARF original prototype: void range_error(range_error * this, string * __arg) */

void __thiscall std::range_error::range_error(range_error *this,string *__arg)

{
  runtime_error::runtime_error(&this->super_runtime_error,__arg);
  (this->super_runtime_error).super_exception._vptr_exception =
       (_func_int_varargs **)&PTR__range_error_089f0b80;
  return;
}



----------------------------------------

// Function: what @ 089c8c0c

/* DWARF original prototype: char * what(runtime_error * this) */

char * __thiscall std::runtime_error::what(runtime_error *this)

{
  return (this->_M_msg)._M_dataplus._M_p;
}



----------------------------------------

// Function: ~logic_error @ 089c8c14

/* DWARF original prototype: void ~logic_error(logic_error * this, int __in_chrg) */

void __thiscall std::logic_error::~logic_error(logic_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__logic_error_089f0e98;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8c70 to 089c8c77 has its CatchHandler @ 089c8c90 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~runtime_error @ 089c8cbc

/* DWARF original prototype: void ~runtime_error(runtime_error * this, int __in_chrg) */

void __thiscall std::runtime_error::~runtime_error(runtime_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__runtime_error_089f0e80;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8d10 to 089c8d17 has its CatchHandler @ 089c8d30 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~logic_error @ 089c8d5c

/* DWARF original prototype: void ~logic_error(logic_error * this, int __in_chrg) */

void __thiscall std::logic_error::~logic_error(logic_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__logic_error_089f0e98;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8db0 to 089c8db7 has its CatchHandler @ 089c8dd0 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~logic_error @ 089c8dfc

/* DWARF original prototype: void ~logic_error(logic_error * this, int __in_chrg) */

void __thiscall std::logic_error::~logic_error(logic_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__logic_error_089f0e98;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8e50 to 089c8e57 has its CatchHandler @ 089c8e70 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~runtime_error @ 089c8e9c

/* DWARF original prototype: void ~runtime_error(runtime_error * this, int __in_chrg) */

void __thiscall std::runtime_error::~runtime_error(runtime_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__runtime_error_089f0e80;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8ef8 to 089c8eff has its CatchHandler @ 089c8f18 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~runtime_error @ 089c8f44

/* DWARF original prototype: void ~runtime_error(runtime_error * this, int __in_chrg) */

void __thiscall std::runtime_error::~runtime_error(runtime_error *this,int __in_chrg)

{
  _Atomic_word _Var1;
  char *pcVar2;
  allocator<char> *paVar3;
  _Rep *this_00;
  allocator<char> aaStack_18 [8];
  
  paVar3 = aaStack_18;
  pcVar2 = (this->_M_msg)._M_dataplus._M_p;
  this_00 = (_Rep *)(pcVar2 + -0xc);
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__runtime_error_089f0e80;
  if (this_00 !=
      (_Rep *)basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::
              _S_empty_rep_storage) {
                    /* try { // try from 089c8f98 to 089c8f9f has its CatchHandler @ 089c8fb8 */
    __in_chrg = -1;
    _Var1 = __gnu_cxx::__exchange_and_add((_Atomic_word *)(pcVar2 + -4),-1);
    if (_Var1 < 1) {
      basic_string<char,std::char_traits<char>,std::allocator<char>_>::_Rep::_M_destroy
                (this_00,aaStack_18);
      __in_chrg = (int)paVar3;
    }
  }
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: rdbuf @ 089c8fe4

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: basic_filebuf<char,std::char_traits<char>_> *
   rdbuf(basic_ifstream<char,std::char_traits<char>_> * this) */

basic_filebuf<char,std::char_traits<char>_> * __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::rdbuf
          (basic_ifstream<char,std::char_traits<char>_> *this)

{
  return (basic_filebuf<char,std::char_traits<char>_> *)
         &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8;
}



----------------------------------------

// Function: rdbuf @ 089c8fec

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: basic_filebuf<char,std::char_traits<char>_> *
   rdbuf(basic_ofstream<char,std::char_traits<char>_> * this) */

basic_filebuf<char,std::char_traits<char>_> * __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::rdbuf
          (basic_ofstream<char,std::char_traits<char>_> *this)

{
  return (basic_filebuf<char,std::char_traits<char>_> *)
         &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4;
}



----------------------------------------

// Function: rdbuf @ 089c8ff4

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: basic_filebuf<char,std::char_traits<char>_> *
   rdbuf(basic_fstream<char,std::char_traits<char>_> * this) */

basic_filebuf<char,std::char_traits<char>_> * __thiscall
std::basic_fstream<char,std::char_traits<char>_>::rdbuf
          (basic_fstream<char,std::char_traits<char>_> *this)

{
  return (basic_filebuf<char,std::char_traits<char>_> *)
         &(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>.field_0xc;
}



----------------------------------------

// Function: _M_allocate_internal_buffer @ 089c8ffc

/* DWARF original prototype: void
   _M_allocate_internal_buffer(basic_filebuf<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_allocate_internal_buffer
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  char *pcVar1;
  
  if ((this->_M_buf_allocated == false) && (this->_M_buf == (char *)0x0)) {
    pcVar1 = operator_new___(this->_M_buf_size);
    this->_M_buf_allocated = true;
    this->_M_buf = pcVar1;
    return;
  }
  return;
}



----------------------------------------

// Function: _M_destroy_internal_buffer @ 089c9054

/* DWARF original prototype: void
   _M_destroy_internal_buffer(basic_filebuf<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_destroy_internal_buffer
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  if (this->_M_buf_allocated != false) {
    if (this->_M_buf != (char *)0x0) {
      operator_delete___(this->_M_buf);
    }
    this->_M_buf = (char *)0x0;
    this->_M_buf_allocated = false;
  }
  if (this->_M_ext_buf != (char *)0x0) {
    operator_delete___(this->_M_ext_buf);
  }
  this->_M_ext_end = (char *)0x0;
  this->_M_ext_buf = (char *)0x0;
  this->_M_ext_buf_size = 0;
  this->_M_ext_next = (char *)0x0;
  return;
}



----------------------------------------

// Function: is_open @ 089c90bc

/* DWARF original prototype: bool is_open(basic_filebuf<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::is_open
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089c90c4 to 089c90cb has its CatchHandler @ 089c90d8 */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  return bVar1;
}



----------------------------------------

// Function: basic_filebuf @ 089c90f4

/* DWARF original prototype: void basic_filebuf(basic_filebuf<char,std::char_traits<char>_> * this)
    */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  size_t sVar1;
  codecvt<char,char,_mbstate_t> *pcVar2;
  _Impl *p_Var3;
  locale *this_00;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  this_00 = &(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
  locale::locale(this_00);
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  this->_M_lock = 0;
                    /* try { // try from 089c915c to 089c9163 has its CatchHandler @ 089c9298 */
  __basic_file<char>::__basic_file(&this->_M_file,&this->_M_lock);
  this->_M_buf_size = 0x400;
  this->_M_mode = 0;
  (this->_M_state_beg).__count = 0;
  (this->_M_state_beg).__value.__wch = 0;
  (this->_M_state_cur).__count = 0;
  (this->_M_state_cur).__value.__wch = 0;
  (this->_M_state_last).__count = 0;
  (this->_M_state_last).__value.__wch = 0;
  this->_M_buf = (char *)0x0;
  this->_M_buf_allocated = false;
  this->_M_reading = false;
  this->_M_writing = false;
  this->_M_pback = '\0';
  this->_M_pback_cur_save = (char *)0x0;
  this->_M_pback_end_save = (char *)0x0;
  this->_M_pback_init = false;
  this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
  this->_M_ext_buf = (char *)0x0;
  this->_M_ext_buf_size = 0;
  this->_M_ext_next = (char *)0x0;
  this->_M_ext_end = (char *)0x0;
                    /* try { // try from 089c91c8 to 089c91cf has its CatchHandler @ 089c9284 */
  sVar1 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
  p_Var3 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale._M_impl;
  if ((sVar1 < p_Var3->_M_facets_size) && (p_Var3->_M_facets[sVar1] != (facet *)0x0)) {
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???]
                       try { // try from 089c91fc to 089c925b has its CatchHandler @ 089c925c */
    sVar1 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
    p_Var3 = this_00->_M_impl;
    if ((p_Var3->_M_facets_size <= sVar1) ||
       (pcVar2 = (codecvt<char,char,_mbstate_t> *)p_Var3->_M_facets[sVar1],
       pcVar2 == (codecvt<char,char,_mbstate_t> *)0x0)) {
                    /* WARNING: Subroutine does not return */
      __throw_bad_cast();
    }
    this->_M_codecvt = pcVar2;
  }
  return;
}



----------------------------------------

// Function: sync @ 089c92a0

/* DWARF original prototype: int sync(basic_filebuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::sync
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  int iVar1;
  
                    /* Unresolved local var: int __ret@[???] */
  if (((this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg <
       (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur) &&
     (iVar1 = (*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf
                [0xd])(this,0xffffffff), iVar1 == -1)) {
    return -1;
  }
                    /* Unresolved local var: int __tmp@[???] */
  return 0;
}



----------------------------------------

// Function: _M_destroy_pback @ 089c92f4

/* DWARF original prototype: void _M_destroy_pback(basic_filebuf<char,std::char_traits<char>_> *
   this) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_destroy_pback
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  char *pcVar4;
  
  if (this->_M_pback_init != false) {
    pcVar1 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
    pcVar2 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
    pcVar3 = this->_M_pback_cur_save;
    pcVar4 = this->_M_pback_end_save;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = this->_M_buf;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur =
         pcVar3 + (pcVar1 != pcVar2);
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar4;
    this->_M_pback_init = false;
    this->_M_pback_cur_save = pcVar3 + (pcVar1 != pcVar2);
  }
  return;
}



----------------------------------------

// Function: _M_create_pback @ 089c933c

/* DWARF original prototype: void _M_create_pback(basic_filebuf<char,std::char_traits<char>_> *
   this) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_create_pback
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  char *pcVar1;
  char *pcVar2;
  
  if (this->_M_pback_init == false) {
    pcVar1 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
    pcVar2 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end;
    this->_M_pback_init = true;
    this->_M_pback_cur_save = pcVar1;
    this->_M_pback_end_save = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = &this->_M_pback;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end =
         (char *)&this->_M_pback_cur_save;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = &this->_M_pback;
  }
  return;
}



----------------------------------------

// Function: _M_set_buffer @ 089c937c

/* DWARF original prototype: void _M_set_buffer(basic_filebuf<char,std::char_traits<char>_> * this,
   streamsize __off) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_set_buffer
          (basic_filebuf<char,std::char_traits<char>_> *this,streamsize __off)

{
  _Ios_Openmode _Var1;
  char *pcVar2;
  
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
  _Var1 = this->_M_mode;
  pcVar2 = this->_M_buf;
  if (((_Var1 & _S_in) == 0) || (__off < 1)) {
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar2;
  }
  else {
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar2 + __off;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
  }
  if ((_Var1 & _S_out) != 0) {
    if (__off != 0) {
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
      goto LAB_089c93b0;
    }
    if (1 < this->_M_buf_size) {
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end =
           pcVar2 + (this->_M_buf_size - 1);
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar2;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = pcVar2;
      return;
    }
  }
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
LAB_089c93b0:
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
  return;
}



----------------------------------------

// Function: pbackfail @ 089c93fc

/* DWARF original prototype: int pbackfail(basic_filebuf<char,std::char_traits<char>_> * this, int
   __i) */

int __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::pbackfail
          (basic_filebuf<char,std::char_traits<char>_> *this,int __i)

{
  bool bVar1;
  char *pcVar2;
  int iVar3;
  uint uVar4;
  _func_int_varargs **pp_Var5;
  char *pcVar6;
  int local_28;
  int local_24;
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: bool __testin@[???] */
  if (((this->_M_mode & _S_in) == 0) || (this->_M_writing != false)) {
                    /* Unresolved local var: bool __testpb@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: int __tmp@[???] */
    iVar3 = -1;
  }
  else {
    pcVar2 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
    bVar1 = this->_M_pback_init;
    if ((this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg < pcVar2) {
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2 + -1;
      uVar4 = (uint)(byte)pcVar2[-1];
    }
    else {
      (*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf[4])
                (&local_28,this,0xffffffff,0xffffffff);
      if (local_28 == -1) {
        if (local_24 == -1) {
          return -1;
        }
        pp_Var5 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf;
      }
      else {
        pp_Var5 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf;
      }
      uVar4 = (*pp_Var5[9])(this);
      if (uVar4 == 0xffffffff) {
        return -1;
      }
    }
    if (__i == -1) {
      return 0;
    }
    iVar3 = __i;
    if ((__i != uVar4) && (iVar3 = -1, bVar1 == false)) {
      pcVar6 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
      pcVar2 = pcVar6;
      if (this->_M_pback_init == false) {
        pcVar2 = &this->_M_pback;
        this->_M_pback_end_save =
             (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end;
        this->_M_pback_cur_save = pcVar6;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end =
             (char *)&this->_M_pback_cur_save;
        this->_M_pback_init = true;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
      }
      this->_M_reading = true;
      *pcVar2 = (char)__i;
      iVar3 = __i;
    }
  }
  return iVar3;
}



----------------------------------------

// Function: _M_terminate_output @ 089c9560

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: bool _M_terminate_output(basic_filebuf<char,std::char_traits<char>_> *
   this) */

bool __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_terminate_output
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  streamsize sVar4;
  codecvt<char,char,_mbstate_t> *pcVar5;
  int local_b0;
  char acStack_ac [128];
  undefined1 auStack_2c [4];
  
                    /* Unresolved local var: bool __testvalid@[???] */
  if ((this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg <
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur) {
    iVar2 = (*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf[0xd]
            )(this,0xffffffff);
    if (iVar2 == -1) {
      bVar1 = false;
    }
    else {
      bVar1 = true;
    }
  }
  else {
                    /* Unresolved local var: int __tmp@[???] */
    bVar1 = true;
  }
  if (this->_M_writing != false) {
    if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
      __throw_bad_cast();
    }
    iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[6])();
    if ((iVar2 == 0) && (bVar1)) {
      pcVar5 = this->_M_codecvt;
      bVar1 = true;
                    /* Unresolved local var: size_t __blen@[???]
                       Unresolved local var: char[128] __buf@[???]
                       Unresolved local var: result __r@[???]
                       Unresolved local var: streamsize __ilen@[???]
                       Unresolved local var: char * __next@[???] */
      while (uVar3 = (*(pcVar5->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
                       _vptr_facet[3])(pcVar5,&this->_M_state_cur,acStack_ac,auStack_2c), uVar3 != 2
            ) {
        if (1 < uVar3) {
LAB_089c96bc:
          if (!bVar1) {
            return false;
          }
                    /* Unresolved local var: int __tmp@[???] */
          iVar2 = (*(this->super_basic_streambuf<char,std::char_traits<char>_>).
                    _vptr_basic_streambuf[0xd])(this,0xffffffff);
          return iVar2 != -1;
        }
        iVar2 = local_b0 - (int)acStack_ac;
                    /* Unresolved local var: streamsize __elen@[???] */
        if ((0 < iVar2) &&
           (sVar4 = __basic_file<char>::xsputn(&this->_M_file,acStack_ac,iVar2), iVar2 != sVar4)) {
          bVar1 = false;
        }
        if ((uVar3 != 1) || (iVar2 < 1)) goto LAB_089c96bc;
        if (!bVar1) {
          return bVar1;
        }
        pcVar5 = this->_M_codecvt;
      }
      bVar1 = false;
    }
  }
  return bVar1;
}



----------------------------------------

// Function: _M_convert_to_external @ 089c96ec

/* DWARF original prototype: bool _M_convert_to_external(basic_filebuf<char,std::char_traits<char>_>
   * this, char * __ibuf, streamsize __ilen) */

bool __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_convert_to_external
          (basic_filebuf<char,std::char_traits<char>_> *this,char *__ibuf,streamsize __ilen)

{
  int iVar1;
  uint uVar2;
  streamsize sVar3;
  int iVar4;
  int local_40;
  undefined4 local_3c;
  
                    /* Unresolved local var: streamsize __elen@[???]
                       Unresolved local var: streamsize __plen@[???] */
  if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  iVar1 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
            _vptr_facet[6])();
  if (iVar1 == 0) {
                    /* Unresolved local var: streamsize __blen@[???]
                       Unresolved local var: char * __buf@[???]
                       Unresolved local var: char * __bend@[???]
                       Unresolved local var: char * __iend@[???]
                       Unresolved local var: result __r@[???] */
    iVar1 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[8])();
    iVar1 = -(iVar1 * __ilen + 0xeU & 0xfffffff8);
    uVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[2])(this->_M_codecvt,&this->_M_state_cur,__ibuf,__ibuf + __ilen);
    if (uVar2 < 2) {
      __ilen = local_40 - ((int)&local_40 + iVar1);
      sVar3 = __basic_file<char>::xsputn(&this->_M_file,(char *)((int)&local_40 + iVar1),__ilen);
      if ((uVar2 == 1) && (sVar3 == __ilen)) {
        iVar4 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).
                  super_facet._vptr_facet[2])
                          (this->_M_codecvt,&this->_M_state_cur,local_3c,
                           (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur);
        if (iVar4 == 2) goto LAB_089c9898;
        __ilen = local_40 - ((int)&local_40 + iVar1);
        sVar3 = __basic_file<char>::xsputn(&this->_M_file,(char *)((int)&local_40 + iVar1),__ilen);
      }
      goto LAB_089c97d4;
    }
    if (uVar2 != 3) {
LAB_089c9898:
                    /* WARNING: Subroutine does not return */
      __throw_ios_failure("basic_filebuf::_M_convert_to_external conversion error");
    }
  }
  sVar3 = __basic_file<char>::xsputn(&this->_M_file,__ibuf,__ilen);
LAB_089c97d4:
                    /* Unresolved local var: char * __iresume@[???]
                       Unresolved local var: streamsize __rlen@[???] */
  return sVar3 == __ilen;
}



----------------------------------------

// Function: basic_filebuf @ 089c98a8

/* DWARF original prototype: void basic_filebuf(basic_filebuf<char,std::char_traits<char>_> * this)
    */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  size_t sVar1;
  codecvt<char,char,_mbstate_t> *pcVar2;
  _Impl *p_Var3;
  locale *this_00;
  
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
  this_00 = &(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
  locale::locale(this_00);
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  this->_M_lock = 0;
                    /* try { // try from 089c9910 to 089c9917 has its CatchHandler @ 089c9a4c */
  __basic_file<char>::__basic_file(&this->_M_file,&this->_M_lock);
  this->_M_buf_size = 0x400;
  this->_M_mode = 0;
  (this->_M_state_beg).__count = 0;
  (this->_M_state_beg).__value.__wch = 0;
  (this->_M_state_cur).__count = 0;
  (this->_M_state_cur).__value.__wch = 0;
  (this->_M_state_last).__count = 0;
  (this->_M_state_last).__value.__wch = 0;
  this->_M_buf = (char *)0x0;
  this->_M_buf_allocated = false;
  this->_M_reading = false;
  this->_M_writing = false;
  this->_M_pback = '\0';
  this->_M_pback_cur_save = (char *)0x0;
  this->_M_pback_end_save = (char *)0x0;
  this->_M_pback_init = false;
  this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
  this->_M_ext_buf = (char *)0x0;
  this->_M_ext_buf_size = 0;
  this->_M_ext_next = (char *)0x0;
  this->_M_ext_end = (char *)0x0;
                    /* try { // try from 089c997c to 089c9983 has its CatchHandler @ 089c9a38 */
  sVar1 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
  p_Var3 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale._M_impl;
  if ((sVar1 < p_Var3->_M_facets_size) && (p_Var3->_M_facets[sVar1] != (facet *)0x0)) {
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???]
                       try { // try from 089c99b0 to 089c9a0f has its CatchHandler @ 089c9a10 */
    sVar1 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
    p_Var3 = this_00->_M_impl;
    if ((p_Var3->_M_facets_size <= sVar1) ||
       (pcVar2 = (codecvt<char,char,_mbstate_t> *)p_Var3->_M_facets[sVar1],
       pcVar2 == (codecvt<char,char,_mbstate_t> *)0x0)) {
                    /* WARNING: Subroutine does not return */
      __throw_bad_cast();
    }
    this->_M_codecvt = pcVar2;
  }
  return;
}



----------------------------------------

// Function: xsputn @ 089c9a54

/* DWARF original prototype: streamsize xsputn(basic_filebuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::xsputn
          (basic_filebuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  int iVar1;
  streamsize sVar2;
  int *piVar3;
  streamsize sVar4;
  char *__s1;
  char *pcVar5;
  _Ios_Openmode _Var6;
  streamsize unaff_s2;
  int local_20;
  int local_1c;
  
                    /* Unresolved local var: streamsize __ret@[???]
                       Unresolved local var: bool __testout@[???] */
  piVar3 = &local_20;
  _Var6 = this->_M_mode;
  if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  iVar1 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
            _vptr_facet[6])();
  if (((iVar1 != 0) && ((_Var6 & _S_out) != 0)) && (this->_M_reading == false)) {
                    /* Unresolved local var: streamsize __chunk@[???]
                       Unresolved local var: streamsize __bufavail@[???]
                       Unresolved local var: streamsize __limit@[???] */
    pcVar5 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur;
    local_20 = 0x400;
    local_1c = (int)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end -
               (int)pcVar5;
    if ((this->_M_writing == false) && (1 < this->_M_buf_size)) {
      local_1c = this->_M_buf_size - 1;
    }
    if (local_1c < 0x400) {
      piVar3 = &local_1c;
    }
    if (*piVar3 <= __n) {
                    /* Unresolved local var: streamsize __buffill@[???]
                       Unresolved local var: char * __buf@[???] */
      __s1 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg;
      iVar1 = (int)pcVar5 - (int)__s1;
      sVar4 = __basic_file<char>::xsputn_2(&this->_M_file,__s1,iVar1,__s,unaff_s2);
      if (sVar4 == __n + iVar1) {
        _Var6 = this->_M_mode;
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
        pcVar5 = this->_M_buf;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar5;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar5;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5;
        if (((_Var6 & _S_out) == 0) || (this->_M_buf_size < 2)) {
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
          this->_M_writing = true;
        }
        else {
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end =
               pcVar5 + (this->_M_buf_size - 1);
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar5;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = pcVar5;
          this->_M_writing = true;
        }
      }
      if (sVar4 <= iVar1) {
        return 0;
      }
      return sVar4 - iVar1;
    }
  }
  sVar2 = basic_streambuf<char,std::char_traits<char>_>::xsputn
                    (&this->super_basic_streambuf<char,std::char_traits<char>_>,__s,__n);
  return sVar2;
}



----------------------------------------

// Function: xsgetn @ 089c9bd4

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: streamsize xsgetn(basic_filebuf<char,std::char_traits<char>_> * this,
   char * __s, streamsize __n) */

streamsize __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::xsgetn
          (basic_filebuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  bool bVar1;
  int iVar2;
  streamsize sVar3;
  char *pcVar4;
  streamsize sVar5;
  uint uVar6;
  char *pcVar7;
  char *pcVar8;
  _Ios_Openmode _Var9;
  size_t len0;
  int iVar10;
  size_t sVar11;
  
                    /* Unresolved local var: streamsize __ret@[???]
                       Unresolved local var: bool __testin@[???]
                       Unresolved local var: streamsize __buflen@[???] */
  if (this->_M_pback_init == false) {
    iVar10 = 0;
LAB_089c9c0c:
    uVar6 = this->_M_buf_size;
    _Var9 = this->_M_mode;
    goto joined_r0x089c9cd8;
  }
  pcVar8 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
  if (__n < 1) {
    pcVar7 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
LAB_089c9ca0:
    iVar10 = 0;
  }
  else {
    pcVar7 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
    if (pcVar8 != pcVar7) goto LAB_089c9ca0;
    __n = __n + -1;
    *__s = *pcVar8;
    bVar1 = this->_M_pback_init;
    __s = __s + 1;
    pcVar8 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur + 1;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar8;
    if (bVar1 == false) {
      iVar10 = 1;
      goto LAB_089c9c0c;
    }
    pcVar7 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
    iVar10 = 1;
  }
  pcVar4 = this->_M_pback_cur_save;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur =
       pcVar4 + (pcVar8 != pcVar7);
  this->_M_pback_cur_save = pcVar4 + (pcVar8 != pcVar7);
  uVar6 = this->_M_buf_size;
  pcVar8 = this->_M_buf;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = this->_M_pback_end_save;
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar8;
  this->_M_pback_init = false;
  _Var9 = this->_M_mode;
joined_r0x089c9cd8:
  if (uVar6 < 2) {
    iVar2 = 1;
  }
  else {
    iVar2 = uVar6 - 1;
  }
  if (iVar2 < __n) {
    if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
      __throw_bad_cast();
    }
    iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[6])();
    if (((iVar2 != 0) && ((_Var9 & _S_in) != 0)) && (this->_M_writing == false)) {
                    /* Unresolved local var: streamsize __avail@[???]
                       Unresolved local var: streamsize __len@[???] */
      pcVar8 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
      len0 = (int)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end -
             (int)pcVar8;
      if (len0 != 0) {
        if (len0 == 1) {
          *__s = *pcVar8;
          pcVar8 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
          sVar11 = 1;
        }
        else {
          memcpy(__s,pcVar8,len0);
          pcVar8 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
          sVar11 = len0;
        }
        __n = __n - len0;
        iVar10 = iVar10 + len0;
        __s = __s + sVar11;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar8 + sVar11;
      }
      while( true ) {
        sVar5 = __basic_file<char>::xsgetn(&this->_M_file,__s,__n);
        if (sVar5 == -1) {
                    /* WARNING: Subroutine does not return */
          __throw_ios_failure("basic_filebuf::xsgetn error reading the file");
        }
        if (sVar5 == 0) break;
        __n = __n - sVar5;
        iVar10 = iVar10 + sVar5;
        if (__n == 0) {
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
          _Var9 = this->_M_mode;
          goto LAB_089c9de8;
        }
        __s = __s + sVar5;
      }
      if (__n != 0) {
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
        pcVar8 = this->_M_buf;
        this->_M_reading = false;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar8;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar8;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar8;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
        return iVar10;
      }
      _Var9 = this->_M_mode;
LAB_089c9de8:
      pcVar8 = this->_M_buf;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar8;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar8;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar8;
      if (((_Var9 & _S_out) != 0) && (1 < this->_M_buf_size)) {
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end =
             pcVar8 + (this->_M_buf_size - 1);
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar8;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = pcVar8;
        this->_M_reading = true;
        return iVar10;
      }
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
      this->_M_reading = true;
      return iVar10;
    }
  }
  sVar3 = basic_streambuf<char,std::char_traits<char>_>::xsgetn
                    (&this->super_basic_streambuf<char,std::char_traits<char>_>,__s,__n);
  return iVar10 + sVar3;
}



----------------------------------------

// Function: _M_seek @ 089c9e68

/* DWARF original prototype: streampos _M_seek(basic_filebuf<char,std::char_traits<char>_> * this,
   streamoff __off, _Ios_Seekdir __way, mbstate_t __state) */

streampos * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::_M_seek
          (streampos *__return_storage_ptr__,basic_filebuf<char,std::char_traits<char>_> *this,
          streamoff __off,_Ios_Seekdir __way,mbstate_t __state)

{
  bool bVar1;
  undefined3 extraout_var;
  char *pcVar2;
  char *pcVar3;
  _Ios_Seekdir *in_t1;
  _Ios_Seekdir __way_00;
  anon_union_dwarf_10287a aVar4;
  streamoff sVar5;
  
                    /* Unresolved local var: streampos __ret@[???] */
  aVar4 = *(anon_union_dwarf_10287a *)(in_t1 + 1);
  __way_00 = *in_t1;
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
  bVar1 = _M_terminate_output(this);
  if (CONCAT31(extraout_var,bVar1) != 0) {
    sVar5 = __basic_file<char>::seekoff(&this->_M_file,__off,__way_00);
    (__return_storage_ptr__->_M_state).__count = 0;
    (__return_storage_ptr__->_M_state).__value.__wch = 0;
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
    pcVar2 = this->_M_buf;
    pcVar3 = this->_M_ext_buf;
    __return_storage_ptr__->_M_off = sVar5;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar2;
    this->_M_ext_next = pcVar3;
    (this->_M_state_cur).__value = (anon_union_dwarf_77a)aVar4;
    this->_M_reading = false;
    this->_M_writing = false;
    this->_M_ext_end = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
    (this->_M_state_cur).__count = __way_00;
    (__return_storage_ptr__->_M_state).__count = __way_00;
    (__return_storage_ptr__->_M_state).__value = aVar4;
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: overflow @ 089c9f88

/* DWARF original prototype: int overflow(basic_filebuf<char,std::char_traits<char>_> * this, int
   __c) */

int __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::overflow
          (basic_filebuf<char,std::char_traits<char>_> *this,int __c)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  undefined3 extraout_var_01;
  _Ios_Openmode _Var2;
  char *pcVar3;
  char *pcVar4;
  char local_18 [8];
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: bool __testeof@[???]
                       Unresolved local var: bool __testout@[???] */
  if (((this->_M_mode & _S_out) == 0) || (this->_M_reading != false)) {
    return -1;
  }
  pcVar4 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur;
  pcVar3 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg;
  bVar1 = __c == -1;
  local_18[0] = (char)__c;
  if (pcVar3 < pcVar4) {
    if (bVar1) {
      bVar1 = _M_convert_to_external(this,pcVar3,(int)pcVar4 - (int)pcVar3);
      if (CONCAT31(extraout_var,bVar1) == 0) {
        return -1;
      }
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
      _Var2 = this->_M_mode;
    }
    else {
      *pcVar4 = local_18[0];
      pcVar3 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg;
      pcVar4 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur + 1;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar4;
      bVar1 = _M_convert_to_external(this,pcVar3,(int)pcVar4 - (int)pcVar3);
      if (CONCAT31(extraout_var_01,bVar1) == 0) {
        return -1;
      }
      _Var2 = this->_M_mode;
    }
    pcVar3 = this->_M_buf;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar3;
    if (((_Var2 & _S_out) == 0) || (this->_M_buf_size < 2)) {
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
    }
    else {
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end =
           pcVar3 + (this->_M_buf_size - 1);
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar3;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = pcVar3;
    }
  }
  else {
    if (this->_M_buf_size < 2) {
                    /* Unresolved local var: char __conv@[???] */
      if ((!bVar1) &&
         (bVar1 = _M_convert_to_external(this,local_18,1), CONCAT31(extraout_var_00,bVar1) == 0)) {
        return -1;
      }
      if (__c == -1) {
        __c = 0;
      }
      this->_M_writing = true;
      return __c;
    }
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
    pcVar3 = this->_M_buf;
    this->_M_writing = true;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end =
         pcVar3 + (this->_M_buf_size - 1);
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = pcVar3;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = pcVar3;
    if (!bVar1) {
      *pcVar3 = local_18[0];
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur =
           (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur + 1;
    }
  }
  if (__c == -1) {
    __c = 0;
  }
  return __c;
}



----------------------------------------

// Function: underflow @ 089ca114

/* WARNING: Type propagation algorithm not settling */
/* DWARF original prototype: int underflow(basic_filebuf<char,std::char_traits<char>_> * this) */

int __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::underflow
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  int iVar2;
  size_t *psVar3;
  anon_union_dwarf_77a aVar4;
  char *ptr;
  char *pcVar5;
  size_t sVar6;
  byte *pbVar7;
  size_t len0;
  size_t sVar8;
  streamsize sVar9;
  size_t local_28;
  int local_24;
  uint local_20 [2];
  
                    /* Unresolved local var: int __ret@[???]
                       Unresolved local var: bool __testin@[???] */
  if ((this->_M_mode & _S_in) == 0) {
                    /* Unresolved local var: size_t __buflen@[???]
                       Unresolved local var: bool __got_eof@[???]
                       Unresolved local var: streamsize __ilen@[???]
                       Unresolved local var: result __r@[???] */
    return -1;
  }
  if (this->_M_writing != false) {
    return -1;
  }
  pbVar7 = (byte *)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
  if (this->_M_pback_init != false) {
    pcVar5 = this->_M_pback_end_save;
    pbVar7 = (byte *)(this->_M_pback_cur_save +
                     (pbVar7 !=
                     (byte *)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg))
    ;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = this->_M_buf;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5;
    this->_M_pback_cur_save = (char *)pbVar7;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = (char *)pbVar7;
    this->_M_pback_init = false;
  }
  if (pbVar7 < (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end) {
    return (uint)*pbVar7;
  }
  local_28 = 1;
  if (1 < this->_M_buf_size) {
    local_28 = this->_M_buf_size - 1;
  }
  if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
    __throw_bad_cast();
  }
  iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
            _vptr_facet[6])();
  if (iVar2 != 0) {
    sVar8 = __basic_file<char>::xsgetn
                      (&this->_M_file,
                       (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg,
                       local_28);
    if (sVar8 == 0) {
      iVar2 = 0;
LAB_089ca218:
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
      pcVar5 = this->_M_buf;
    }
    else {
      bVar1 = false;
      iVar2 = 0;
LAB_089ca398:
      if (0 < (int)sVar8) {
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
        if ((this->_M_mode & _S_in) == 0) {
          pcVar5 = this->_M_buf;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar5;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar5;
        }
        else {
          pcVar5 = this->_M_buf;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5 + sVar8;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar5;
          (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar5;
        }
        pbVar7 = (byte *)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
        this->_M_reading = true;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
        return (uint)*pbVar7;
      }
      if (!bVar1) {
LAB_089ca410:
        if (iVar2 == 2) {
                    /* WARNING: Subroutine does not return */
          __throw_ios_failure("basic_filebuf::underflow invalid byte sequence in file");
        }
                    /* WARNING: Subroutine does not return */
        __throw_ios_failure("basic_filebuf::underflow error reading the file");
      }
      pcVar5 = this->_M_buf;
    }
    this->_M_reading = false;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar5;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar5;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
    if (iVar2 != 1) {
      return -1;
    }
                    /* WARNING: Subroutine does not return */
    __throw_ios_failure("basic_filebuf::underflow incomplete character in file");
  }
                    /* Unresolved local var: int __enc@[???]
                       Unresolved local var: streamsize __blen@[???]
                       Unresolved local var: streamsize __rlen@[???]
                       Unresolved local var: streamsize __remainder@[???] */
  iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
            _vptr_facet[5])();
  if (iVar2 < 1) {
    iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[8])();
    sVar8 = (iVar2 + local_28) - 1;
    sVar6 = local_28;
  }
  else {
    sVar8 = iVar2 * local_28;
    sVar6 = sVar8;
  }
  len0 = (int)this->_M_ext_end - (int)this->_M_ext_next;
  sVar9 = sVar6 - len0;
  if ((int)sVar6 <= (int)len0) {
    sVar9 = 0;
  }
  if (this->_M_reading == false) {
    iVar2 = this->_M_ext_buf_size;
  }
  else {
    if (((this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end ==
         (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg) && (len0 != 0)) {
      sVar9 = 0;
    }
    iVar2 = this->_M_ext_buf_size;
  }
  if (iVar2 < (int)sVar8) {
                    /* Unresolved local var: char * __buf@[???] */
    pcVar5 = operator_new___(sVar8);
    if (len0 == 0) {
      ptr = this->_M_ext_buf;
    }
    else {
      memcpy(pcVar5,this->_M_ext_next,len0);
      ptr = this->_M_ext_buf;
    }
    if (ptr == (char *)0x0) {
      this->_M_ext_buf = pcVar5;
    }
    else {
      operator_delete___(ptr);
      this->_M_ext_buf = pcVar5;
    }
    this->_M_ext_buf_size = sVar8;
  }
  else if (len0 != 0) {
    memmove(this->_M_ext_buf,this->_M_ext_next,len0);
    pcVar5 = this->_M_ext_buf;
    goto LAB_089ca2c8;
  }
  pcVar5 = this->_M_ext_buf;
LAB_089ca2c8:
  aVar4 = (this->_M_state_cur).__value;
  (this->_M_state_last).__count = (this->_M_state_cur).__count;
  (this->_M_state_last).__value = aVar4;
  this->_M_ext_next = pcVar5;
                    /* Unresolved local var: char * __iend@[???] */
  this->_M_ext_end = pcVar5 + len0;
  if (sVar9 < 1) {
    bVar1 = false;
    goto LAB_089ca32c;
  }
  iVar2 = 0;
  do {
                    /* Unresolved local var: streamsize __elen@[???] */
    if (this->_M_ext_buf_size < (int)(this->_M_ext_end + (sVar9 - (int)pcVar5))) {
                    /* WARNING: Subroutine does not return */
      __throw_ios_failure("basic_filebuf::underflow codecvt::max_length() is not valid");
    }
    sVar9 = __basic_file<char>::xsgetn(&this->_M_file,this->_M_ext_end,sVar9);
    if (sVar9 == 0) {
      bVar1 = true;
      pcVar5 = this->_M_ext_end;
    }
    else {
      bVar1 = false;
      if (sVar9 == -1) goto LAB_089ca410;
      pcVar5 = this->_M_ext_end;
    }
    this->_M_ext_end = pcVar5 + sVar9;
LAB_089ca32c:
    iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
              _vptr_facet[4])(this->_M_codecvt,&this->_M_state_cur,this->_M_ext_next);
    if (iVar2 == 3) {
                    /* Unresolved local var: size_t __avail@[???] */
      local_20[0] = (int)this->_M_ext_end - (int)this->_M_ext_buf;
      psVar3 = &local_28;
      if (local_20[0] <= local_28) {
        psVar3 = local_20;
      }
      sVar8 = *psVar3;
      memcpy((this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg,this->_M_ext_buf,
             sVar8);
      this->_M_ext_next = this->_M_ext_buf + sVar8;
    }
    else {
      sVar8 = local_24 - (int)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
      if (iVar2 == 2) goto LAB_089ca398;
    }
    if (sVar8 != 0) goto LAB_089ca398;
    sVar9 = 1;
    if (bVar1) goto LAB_089ca218;
    pcVar5 = this->_M_ext_buf;
  } while( true );
}



----------------------------------------

// Function: is_open @ 089ca514

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_fstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_fstream<char,std::char_traits<char>_>::is_open
          (basic_fstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089ca51c to 089ca523 has its CatchHandler @ 089ca534 */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_iostream<char,std::char_traits<char>_>).
                      super_basic_istream<char,std::char_traits<char>_>.field_0x30);
  return bVar1;
}



----------------------------------------

// Function: is_open @ 089ca550

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_fstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_fstream<char,std::char_traits<char>_>::is_open
          (basic_fstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089ca558 to 089ca55f has its CatchHandler @ 089ca570 */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_iostream<char,std::char_traits<char>_>).
                      super_basic_istream<char,std::char_traits<char>_>.field_0x30);
  return bVar1;
}



----------------------------------------

// Function: is_open @ 089ca58c

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_ofstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::is_open
          (basic_ofstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089ca594 to 089ca59b has its CatchHandler @ 089ca5ac */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x28);
  return bVar1;
}



----------------------------------------

// Function: is_open @ 089ca5c8

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_ofstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::is_open
          (basic_ofstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089ca5d0 to 089ca5d7 has its CatchHandler @ 089ca5e8 */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x28);
  return bVar1;
}



----------------------------------------

// Function: is_open @ 089ca604

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_ifstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::is_open
          (basic_ifstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089ca60c to 089ca613 has its CatchHandler @ 089ca624 */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x2c);
  return bVar1;
}



----------------------------------------

// Function: setbuf @ 089ca640

/* DWARF original prototype: basic_streambuf<char,std::char_traits<char>_> *
   setbuf(basic_filebuf<char,std::char_traits<char>_> * this, char * __s, streamsize __n) */

basic_streambuf<char,std::char_traits<char>_> * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::setbuf
          (basic_filebuf<char,std::char_traits<char>_> *this,char *__s,streamsize __n)

{
  bool bVar1;
  undefined3 extraout_var;
  
                    /* try { // try from 089ca660 to 089ca667 has its CatchHandler @ 089ca6b4 */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    if (__s == (char *)0x0) {
      if (__n == 0) {
        this->_M_buf_size = 1;
      }
    }
    else if (0 < __n) {
      this->_M_buf = __s;
      this->_M_buf_size = __n;
    }
  }
  return &this->super_basic_streambuf<char,std::char_traits<char>_>;
}



----------------------------------------

// Function: showmanyc @ 089ca6d0

/* DWARF original prototype: streamsize showmanyc(basic_filebuf<char,std::char_traits<char>_> *
   this) */

streamsize __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::showmanyc
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  streamsize sVar3;
  int iVar4;
  
                    /* Unresolved local var: streamsize __ret@[???]
                       Unresolved local var: bool __testin@[???] */
  if ((this->_M_mode & _S_in) != 0) {
                    /* try { // try from 089ca6f8 to 089ca6ff has its CatchHandler @ 089ca7ac */
    bVar1 = __basic_file<char>::is_open(&this->_M_file);
    if (CONCAT31(extraout_var,bVar1) != 0) {
      if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) {
                    /* WARNING: Subroutine does not return */
        __throw_bad_cast();
      }
      iVar4 = (int)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end -
              (int)(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
      iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
                _vptr_facet[5])();
      if (iVar2 < 0) {
        return iVar4;
      }
      sVar3 = __basic_file<char>::showmanyc(&this->_M_file);
      iVar2 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
                _vptr_facet[8])();
      if (iVar2 == 0) {
        trap(7);
      }
      return iVar4 + sVar3 / iVar2;
    }
  }
  return -1;
}



----------------------------------------

// Function: close @ 089ca7c8

/* DWARF original prototype: basic_filebuf<char,std::char_traits<char>_> *
   close(basic_filebuf<char,std::char_traits<char>_> * this) */

basic_filebuf<char,std::char_traits<char>_> * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::close
          (basic_filebuf<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  char *pcVar2;
  __basic_file<char> *p_Var3;
  int iVar4;
  anon_union_dwarf_77a aVar5;
  
                    /* Unresolved local var: basic_filebuf<char,std::char_traits<char>_> *
                       __ret@[???] */
                    /* try { // try from 089ca7e4 to 089ca7eb has its CatchHandler @ 089ca8ac */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  if (CONCAT31(extraout_var,bVar1) != 0) {
                    /* try { // try from 089ca80c to 089ca813 has its CatchHandler @ 089ca894 */
    bVar1 = _M_terminate_output(this);
    this->_M_mode = 0;
    this->_M_pback_init = false;
    _M_destroy_internal_buffer(this);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
    pcVar2 = this->_M_buf;
    aVar5 = (this->_M_state_beg).__value;
    iVar4 = (this->_M_state_beg).__count;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar2;
    (this->_M_state_last).__value = aVar5;
    (this->_M_state_cur).__value = aVar5;
    (this->_M_state_last).__count = iVar4;
    this->_M_reading = false;
    this->_M_writing = false;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
    (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
    (this->_M_state_cur).__count = iVar4;
                    /* try { // try from 089ca864 to 089ca8a3 has its CatchHandler @ 089ca8ac */
    p_Var3 = __basic_file<char>::close(&this->_M_file);
    if ((p_Var3 != (__basic_file<char> *)0x0) && (CONCAT31(extraout_var_00,bVar1) != 0)) {
      return this;
    }
  }
                    /* Unresolved local var: bool __testfail@[???] */
  return (basic_filebuf<char,std::char_traits<char>_> *)0x0;
}



----------------------------------------

// Function: close @ 089ca8c8

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void close(basic_fstream<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::close
          (basic_fstream<char,std::char_traits<char>_> *this)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::close
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>.field_0xc);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                   super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
            (int)(this->super_basic_iostream<char,std::char_traits<char>_>).
                 super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: close @ 089ca914

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void close(basic_ofstream<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::close
          (basic_ofstream<char,std::char_traits<char>_> *this)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::close
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
            (int)(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: close @ 089ca960

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void close(basic_ifstream<char,std::char_traits<char>_> * this) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::close
          (basic_ifstream<char,std::char_traits<char>_> *this)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::close
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
            (int)(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: ~basic_filebuf @ 089ca9ac

/* DWARF original prototype: void ~basic_filebuf(basic_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
          (basic_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  close(this);
                    /* try { // try from 089ca9d0 to 089ca9d7 has its CatchHandler @ 089caa04 */
  __basic_file<char>::~__basic_file(&this->_M_file,__in_chrg);
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale,
                  __in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~basic_filebuf @ 089caa24

/* DWARF original prototype: void ~basic_filebuf(basic_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
          (basic_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  close(this);
                    /* try { // try from 089caa48 to 089caa4f has its CatchHandler @ 089caa74 */
  __basic_file<char>::~__basic_file(&this->_M_file,__in_chrg);
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale,
                  __in_chrg);
  return;
}



----------------------------------------

// Function: ~basic_filebuf @ 089caa94

/* DWARF original prototype: void ~basic_filebuf(basic_filebuf<char,std::char_traits<char>_> * this,
   int __in_chrg) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
          (basic_filebuf<char,std::char_traits<char>_> *this,int __in_chrg)

{
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_filebuf_089f11e8;
  close(this);
                    /* try { // try from 089caab8 to 089caabf has its CatchHandler @ 089caae4 */
  __basic_file<char>::~__basic_file(&this->_M_file,__in_chrg);
  (this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf =
       (_func_int_varargs **)&PTR__basic_streambuf_089f03b0;
  locale::~locale(&(this->super_basic_streambuf<char,std::char_traits<char>_>)._M_buf_locale,
                  __in_chrg);
  return;
}



----------------------------------------

// Function: open @ 089cab04

/* DWARF original prototype: basic_filebuf<char,std::char_traits<char>_> *
   open(basic_filebuf<char,std::char_traits<char>_> * this, char * __s, _Ios_Openmode __mode) */

basic_filebuf<char,std::char_traits<char>_> * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::open
          (basic_filebuf<char,std::char_traits<char>_> *this,char *__s,_Ios_Openmode __mode)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  char *pcVar2;
  int iVar3;
  anon_union_dwarf_77a aVar4;
  __basic_file<char> *this_00;
  int local_28;
  int local_24;
  
                    /* Unresolved local var: basic_filebuf<char,std::char_traits<char>_> *
                       __ret@[???] */
  this_00 = &this->_M_file;
                    /* try { // try from 089cab2c to 089cab33 has its CatchHandler @ 089cac3c */
  bVar1 = __basic_file<char>::is_open(this_00);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    __basic_file<char>::open(this_00,__s,__mode,0x1b4);
                    /* try { // try from 089cab6c to 089cab73 has its CatchHandler @ 089cac3c */
    bVar1 = __basic_file<char>::is_open(this_00);
    if (CONCAT31(extraout_var_00,bVar1) != 0) {
      _M_allocate_internal_buffer(this);
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
      pcVar2 = this->_M_buf;
      iVar3 = (this->_M_state_beg).__count;
      aVar4 = (this->_M_state_beg).__value;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar2;
      (this->_M_state_last).__count = iVar3;
      (this->_M_state_last).__value = aVar4;
      this->_M_mode = __mode;
      this->_M_reading = false;
      this->_M_writing = false;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar2;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar2;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
      (this->_M_state_cur).__count = iVar3;
      (this->_M_state_cur).__value = aVar4;
      if ((((__mode & _S_ate) == 0) ||
          ((*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf[4])
                     (&local_28,this,0,0), local_28 != -1)) || (local_24 != -1)) {
        return this;
      }
      close(this);
    }
  }
  return (basic_filebuf<char,std::char_traits<char>_> *)0x0;
}



----------------------------------------

// Function: open @ 089cac58

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void open(basic_fstream<char,std::char_traits<char>_> * this, char *
   __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::open
          (basic_fstream<char,std::char_traits<char>_> *this,char *__s,_Ios_Openmode __mode)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>.field_0xc,__s,__mode);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                      super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
               (int)(this->super_basic_iostream<char,std::char_traits<char>_>).
                    super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3]),
               _S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                   super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
            (int)(this->super_basic_iostream<char,std::char_traits<char>_>).
                 super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: open @ 089cacb8

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void open(basic_ofstream<char,std::char_traits<char>_> * this, char *
   __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::open
          (basic_ofstream<char,std::char_traits<char>_> *this,char *__s,_Ios_Openmode __mode)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4,__s,
                      __mode | _S_out);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream
               + (int)(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream
                      [-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
            (int)(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: open @ 089cad1c

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void open(basic_ifstream<char,std::char_traits<char>_> * this, char *
   __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::open
          (basic_ifstream<char,std::char_traits<char>_> *this,char *__s,_Ios_Openmode __mode)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  basic_ios<char,std::char_traits<char>_> *this_00;
  
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8,__s,
                      __mode | _S_in);
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream
               + (int)(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream
                      [-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
            (int)(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: is_open @ 089cad80

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: bool is_open(basic_ifstream<char,std::char_traits<char>_> * this) */

bool __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::is_open
          (basic_ifstream<char,std::char_traits<char>_> *this)

{
  bool bVar1;
  
                    /* try { // try from 089cad88 to 089cad8f has its CatchHandler @ 089cada0 */
  bVar1 = __basic_file<char>::is_open
                    ((__basic_file<char> *)
                     &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x2c);
  return bVar1;
}



----------------------------------------

// Function: imbue @ 089cadbc

/* DWARF original prototype: void imbue(basic_filebuf<char,std::char_traits<char>_> * this, locale *
   __loc) */

void __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::imbue
          (basic_filebuf<char,std::char_traits<char>_> *this,locale *__loc)

{
  bool bVar1;
  size_t sVar2;
  undefined3 extraout_var;
  int iVar3;
  undefined3 extraout_var_00;
  char *pcVar4;
  char *pcVar5;
  codecvt<char,char,_mbstate_t> *pcVar6;
  anon_union_dwarf_77a aVar7;
  codecvt<char,char,_mbstate_t> *pcVar8;
  int local_20;
  int local_1c;
  
                    /* Unresolved local var: bool __testvalid@[???]
                       Unresolved local var: codecvt<char,char,_mbstate_t> * _M_codecvt_tmp@[???]
                       Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
                    /* try { // try from 089caddc to 089cade3 has its CatchHandler @ 089cb054 */
  sVar2 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
  if (sVar2 < __loc->_M_impl->_M_facets_size) {
    if (__loc->_M_impl->_M_facets[sVar2] == (facet *)0x0) {
      pcVar8 = (codecvt<char,char,_mbstate_t> *)0x0;
    }
    else {
                    /* Unresolved local var: size_t __i@[???]
                       Unresolved local var: facet * * __facets@[???] */
      sVar2 = locale::id::_M_id(&codecvt<char,char,_mbstate_t>::id);
      if ((__loc->_M_impl->_M_facets_size <= sVar2) ||
         (pcVar8 = (codecvt<char,char,_mbstate_t> *)__loc->_M_impl->_M_facets[sVar2],
         pcVar8 == (codecvt<char,char,_mbstate_t> *)0x0)) goto LAB_089caf3c;
    }
  }
  else {
    pcVar8 = (codecvt<char,char,_mbstate_t> *)0x0;
  }
                    /* try { // try from 089cae50 to 089cae57 has its CatchHandler @ 089cb054 */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    this->_M_codecvt = pcVar8;
    return;
  }
  if (this->_M_reading == false) {
    if (this->_M_writing == false) {
      this->_M_codecvt = pcVar8;
      return;
    }
    pcVar6 = this->_M_codecvt;
  }
  else {
    pcVar6 = this->_M_codecvt;
  }
  if (pcVar6 != (codecvt<char,char,_mbstate_t> *)0x0) {
    iVar3 = (*(pcVar6->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet
              [5])();
    if (iVar3 == -1) {
      this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
      return;
    }
    if (this->_M_reading == false) {
      if (this->_M_writing == false) {
        this->_M_codecvt = pcVar8;
        return;
      }
      bVar1 = _M_terminate_output(this);
      if (CONCAT31(extraout_var_00,bVar1) == 0) {
        this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
        return;
      }
      pcVar4 = this->_M_buf;
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar4;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar4;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar4;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
    }
    else {
      if (this->_M_codecvt == (codecvt<char,char,_mbstate_t> *)0x0) goto LAB_089caf3c;
      iVar3 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
                _vptr_facet[6])();
      if (iVar3 == 0) {
                    /* Unresolved local var: streamsize __remainder@[???] */
        pcVar4 = this->_M_ext_buf;
        iVar3 = (*(this->_M_codecvt->super___codecvt_abstract_base<char,char,_mbstate_t>).
                  super_facet._vptr_facet[7])
                          (this->_M_codecvt,&this->_M_state_last,pcVar4,this->_M_ext_next);
        pcVar4 = pcVar4 + iVar3;
        sVar2 = (int)this->_M_ext_end - (int)pcVar4;
        this->_M_ext_next = pcVar4;
        if (sVar2 == 0) {
          sVar2 = 0;
          pcVar4 = this->_M_ext_buf;
        }
        else {
          memmove(this->_M_ext_buf,pcVar4,sVar2);
          pcVar4 = this->_M_ext_buf;
        }
                    /* Unresolved local var: bool __testin@[???]
                       Unresolved local var: bool __testout@[???] */
        pcVar5 = this->_M_buf;
        iVar3 = (this->_M_state_beg).__count;
        aVar7 = (this->_M_state_beg).__value;
        this->_M_ext_end = pcVar4 + sVar2;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar5;
        (this->_M_state_last).__count = iVar3;
        (this->_M_state_last).__value = aVar7;
        this->_M_ext_next = pcVar4;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = pcVar5;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur = pcVar5;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_cur = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_beg = (char *)0x0;
        (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_out_end = (char *)0x0;
        (this->_M_state_cur).__count = iVar3;
        (this->_M_state_cur).__value = aVar7;
      }
      else {
        if (pcVar8 == (codecvt<char,char,_mbstate_t> *)0x0) {
          this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
          return;
        }
        iVar3 = (*(pcVar8->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet.
                  _vptr_facet[6])(pcVar8);
        if (iVar3 == 0) {
          (*(this->super_basic_streambuf<char,std::char_traits<char>_>)._vptr_basic_streambuf[4])
                    (&local_20,this,0,0);
          if ((local_20 == -1) && (local_1c == -1)) {
            bVar1 = false;
          }
          else {
            bVar1 = true;
          }
          if (bVar1) {
            this->_M_codecvt = pcVar8;
            return;
          }
          this->_M_codecvt = (codecvt<char,char,_mbstate_t> *)0x0;
          return;
        }
      }
    }
    this->_M_codecvt = pcVar8;
    return;
  }
LAB_089caf3c:
                    /* WARNING: Subroutine does not return */
  __throw_bad_cast();
}



----------------------------------------

// Function: seekpos @ 089cb070

/* DWARF original prototype: streampos seekpos(basic_filebuf<char,std::char_traits<char>_> * this,
   streampos __pos, _Ios_Openmode param_2) */

streampos * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::seekpos
          (streampos *__return_storage_ptr__,basic_filebuf<char,std::char_traits<char>_> *this,
          streampos __pos,_Ios_Openmode param_2)

{
  mbstate_t __state;
  streamoff __off;
  bool bVar1;
  anon_union_dwarf_77a aVar2;
  undefined3 extraout_var;
  char *pcVar3;
  char *pcVar4;
  char *pcVar5;
  char *pcVar6;
  _Ios_Seekdir __way;
  wint_t wVar7;
  streampos local_28;
  
                    /* Unresolved local var: fpos<_mbstate_t> __ret@[DW_OP_breg17(s1): 0]
                       Unresolved local var: streampos __ret@[???] */
  aVar2 = (anon_union_dwarf_77a)((anon_union_dwarf_77a *)__pos._M_off)->__wch;
  __off = *(streamoff *)(anon_union_dwarf_77a *)__pos._M_off;
  wVar7 = ((anon_union_dwarf_77a *)__pos._M_off)[3].__wch;
  __way = ((anon_union_dwarf_77a *)__pos._M_off)[2].__wch;
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
                    /* try { // try from 089cb0d8 to 089cb0df has its CatchHandler @ 089cb1a4 */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  if (CONCAT31(extraout_var,bVar1) != 0) {
    if (this->_M_pback_init != false) {
      pcVar3 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
      pcVar4 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
      pcVar5 = this->_M_pback_cur_save;
      pcVar6 = this->_M_pback_end_save;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = this->_M_buf;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur =
           pcVar5 + (pcVar3 != pcVar4);
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar6;
      this->_M_pback_cur_save = pcVar5 + (pcVar3 != pcVar4);
      this->_M_pback_init = false;
    }
    __state.__value.__wch = aVar2.__wch;
    __state.__count = wVar7;
    _M_seek(&local_28,this,__off,__way,__state);
    *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = local_28._M_off._4_4_;
    (__return_storage_ptr__->_M_state).__count = local_28._M_state.__count;
    *(undefined4 *)&__return_storage_ptr__->_M_off = (undefined4)local_28._M_off;
    (__return_storage_ptr__->_M_state).__value = local_28._M_state.__value;
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: seekoff @ 089cb1c0

/* WARNING: Control flow encountered bad instruction data */
/* DWARF original prototype: streampos seekoff(basic_filebuf<char,std::char_traits<char>_> * this,
   streamoff __off, _Ios_Seekdir __way, _Ios_Openmode param_3) */

streampos * __thiscall
std::basic_filebuf<char,std::char_traits<char>_>::seekoff
          (streampos *__return_storage_ptr__,basic_filebuf<char,std::char_traits<char>_> *this,
          streamoff __off,_Ios_Seekdir __way,_Ios_Openmode param_3)

{
  bool bVar1;
  codecvt<char,char,_mbstate_t> *pcVar2;
  int iVar3;
  undefined3 extraout_var;
  char *pcVar4;
  char *pcVar5;
  char *pcVar6;
  char *pcVar7;
  
                    /* Unresolved local var: fpos<_mbstate_t> __ret@[DW_OP_breg19(s3): 0]
                       Unresolved local var: int __width@[???]
                       Unresolved local var: streampos __ret@[???]
                       Unresolved local var: bool __testfail@[???] */
  pcVar2 = this->_M_codecvt;
  if (pcVar2 == (codecvt<char,char,_mbstate_t> *)0x0) {
    iVar3 = 0;
  }
  else {
    iVar3 = (*(pcVar2->super___codecvt_abstract_base<char,char,_mbstate_t>).super_facet._vptr_facet
              [5])(pcVar2);
  }
  *(undefined4 *)&__return_storage_ptr__->_M_off = 0xffffffff;
  *(undefined4 *)((int)&__return_storage_ptr__->_M_off + 4) = 0xffffffff;
  (__return_storage_ptr__->_M_state).__count = 0;
  (__return_storage_ptr__->_M_state).__value.__wch = 0;
                    /* try { // try from 089cb24c to 089cb253 has its CatchHandler @ 089cb444 */
  bVar1 = __basic_file<char>::is_open(&this->_M_file);
  if ((CONCAT31(extraout_var,bVar1) != 0) && (__off == 0 || iVar3 != 0)) {
                    /* Unresolved local var: mbstate_t __state@[???]
                       Unresolved local var: streamoff __computed_off@[???] */
    if (this->_M_pback_init != false) {
      pcVar4 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur;
      pcVar5 = (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg;
      pcVar6 = this->_M_pback_cur_save;
      pcVar7 = this->_M_pback_end_save;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_beg = this->_M_buf;
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_cur =
           pcVar6 + (pcVar4 != pcVar5);
      (this->super_basic_streambuf<char,std::char_traits<char>_>)._M_in_end = pcVar7;
      this->_M_pback_cur_save = pcVar6 + (pcVar4 != pcVar5);
      this->_M_pback_init = false;
    }
                    /* WARNING: Bad instruction - Truncating control flow here */
    halt_baddata();
  }
  return __return_storage_ptr__;
}



----------------------------------------

// Function: basic_fstream @ 089cb460

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  undefined *puVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  undefined1 *this_00;
  undefined1 *this_01;
  
  this_01 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0x80;
  ios_base::ios_base((ios_base *)this_01);
  puVar3 = PTR_PTR_089f1078;
  puVar2 = PTR_PTR_089f1070;
  puVar1 = PTR_PTR_089f106c;
  this->field_0xf4 = 0;
  iVar7 = *(int *)(puVar2 + -0xc);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  puVar4 = PTR_PTR_089f1080;
  puVar2 = PTR_PTR_089f107c;
  iVar5 = *(int *)(puVar3 + -0xc);
  iVar6 = *(int *)(puVar1 + -0xc);
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar7) =
       PTR_PTR_089f1074;
  *(undefined **)
   (&(this->super_basic_iostream<char,std::char_traits<char>_>).
     super_basic_istream<char,std::char_traits<char>_>.field_0x8 + iVar5) = puVar2;
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar6) = puVar4;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_fstream_089f1034;
  this_00 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0xc;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__fstream_089f105c;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = &PTR__fstream_089f1048;
  *(undefined4 *)&this->field_0xf0 = 0;
  this->field_0xf5 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
  *(undefined4 *)&this->field_0x100 = 0;
  *(undefined4 *)&this->field_0x104 = 0;
                    /* try { // try from 089cb514 to 089cb51b has its CatchHandler @ 089cb544 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_00);
                    /* try { // try from 089cb520 to 089cb527 has its CatchHandler @ 089cb574 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_01,
             (basic_streambuf<char,std::char_traits<char>_> *)this_00);
  return;
}



----------------------------------------

// Function: ~ofstream @ 089cb588

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::ofstream::~ofstream() */

void __thiscall std::ofstream::~ofstream(ofstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ofstream<char,std::char_traits<char>_>::~basic_ofstream
            ((basic_ofstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ofstream @ 089cb59c

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::~basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *__in_chrg_00;
  int iVar1;
  
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)&PTR__basic_ofstream_089f112c;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__ofstream_089f1140;
                    /* try { // try from 089cb5c8 to 089cb5cf has its CatchHandler @ 089cb61c */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4,__in_chrg);
  __in_chrg_00 = PTR_PTR_089f1150;
  iVar1 = *(int *)(PTR_PTR_089f114c + -0xc);
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)PTR_PTR_089f114c;
  *(undefined **)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream + iVar1) =
       __in_chrg_00;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78,
                      (int)__in_chrg_00);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: basic_ofstream @ 089cb65c

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  _func_int_varargs **pp_Var2;
  undefined4 uVar3;
  undefined1 *this_00;
  
  pp_Var2 = *(_func_int_varargs ***)__in_chrg;
  uVar3 = *(undefined4 *)(__in_chrg + 0xc);
  p_Var1 = pp_Var2[-3];
  *(undefined4 *)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   *(int *)(*(int *)(__in_chrg + 4) + -0xc)) = *(undefined4 *)(__in_chrg + 8);
  this_00 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4;
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream = pp_Var2;
  *(undefined4 *)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   (int)p_Var1) = uVar3;
                    /* try { // try from 089cb6b4 to 089cb6bb has its CatchHandler @ 089cb6f0 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_00);
                    /* try { // try from 089cb6c8 to 089cb6cf has its CatchHandler @ 089cb714 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
             (int)(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream[-3])
             ,(basic_streambuf<char,std::char_traits<char>_> *)this_00);
  return;
}



----------------------------------------

// Function: ~ofstream @ 089cb728

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::ofstream::~ofstream() */

void __thiscall std::ofstream::~ofstream(ofstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ofstream<char,std::char_traits<char>_>::~basic_ofstream
            ((basic_ofstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ofstream @ 089cb73c

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::~basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *__in_chrg_00;
  int iVar1;
  
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)&PTR__basic_ofstream_089f112c;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__ofstream_089f1140;
                    /* try { // try from 089cb768 to 089cb76f has its CatchHandler @ 089cb7b4 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4,__in_chrg);
  __in_chrg_00 = PTR_PTR_089f1150;
  iVar1 = *(int *)(PTR_PTR_089f114c + -0xc);
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)PTR_PTR_089f114c;
  *(undefined **)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream + iVar1) =
       __in_chrg_00;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78,
                      (int)__in_chrg_00);
  return;
}



----------------------------------------

// Function: basic_ofstream @ 089cb7f4

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  _func_int_varargs *p_Var2;
  basic_ios<char,std::char_traits<char>_> *this_00;
  _func_int_varargs **pp_Var3;
  undefined4 uVar4;
  undefined1 *this_01;
  
  pp_Var3 = *(_func_int_varargs ***)__in_chrg;
  uVar4 = *(undefined4 *)(__in_chrg + 0xc);
  p_Var2 = pp_Var3[-3];
  *(undefined4 *)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   *(int *)(*(int *)(__in_chrg + 4) + -0xc)) = *(undefined4 *)(__in_chrg + 8);
  this_01 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4;
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream = pp_Var3;
  *(undefined4 *)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   (int)p_Var2) = uVar4;
                    /* try { // try from 089cb858 to 089cb85f has its CatchHandler @ 089cb8f8 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089cb86c to 089cb8d3 has its CatchHandler @ 089cb91c */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
             (int)(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream[-3])
             ,(basic_streambuf<char,std::char_traits<char>_> *)this_01);
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_01,(char *)__vtt_parm,
                      (uint)__s | _S_out);
  pp_Var3 = (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream;
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream
               + (int)pp_Var3[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
            (int)pp_Var3[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: basic_ofstream @ 089cb930

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined1 *this_00;
  undefined1 *this_01;
  
  this_00 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78;
  ios_base::ios_base((ios_base *)this_00);
  puVar1 = PTR_PTR_089f114c;
  this->field_0xec = 0;
  *(undefined **)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   *(int *)(puVar1 + -0xc)) = PTR_PTR_089f1150;
  this_01 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4;
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)&PTR__basic_ofstream_089f112c;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__ofstream_089f1140;
  *(undefined4 *)&this->field_0xe8 = 0;
  this->field_0xed = 0;
  *(undefined4 *)&this->field_0xf0 = 0;
  *(undefined4 *)&this->field_0xf4 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
                    /* try { // try from 089cb9bc to 089cb9c3 has its CatchHandler @ 089cb9f8 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089cb9c8 to 089cb9cf has its CatchHandler @ 089cba28 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_00,
             (basic_streambuf<char,std::char_traits<char>_> *)this_01);
  return;
}



----------------------------------------

// Function: ~basic_ofstream @ 089cba3c

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::~basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  int __in_chrg_00;
  
  __in_chrg_00 = *(int *)(__in_chrg + 0xc);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       *(_func_int_varargs ***)__in_chrg;
  *(int *)((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
          (int)p_Var1) = __in_chrg_00;
                    /* try { // try from 089cba6c to 089cba73 has its CatchHandler @ 089cbaa0 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4,__in_chrg_00);
  uVar2 = *(undefined4 *)(__in_chrg + 8);
  p_Var1 = (*(_func_int_varargs ***)(__in_chrg + 4))[-3];
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       *(_func_int_varargs ***)(__in_chrg + 4);
  *(undefined4 *)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: basic_ofstream @ 089cbabc

/* WARNING: Struct "basic_ofstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ofstream(basic_ofstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ofstream<char,std::char_traits<char>_>::basic_ofstream
          (basic_ofstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  undefined *puVar1;
  basic_filebuf<char,std::char_traits<char>_> *pbVar2;
  _func_int_varargs **pp_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  undefined1 *this_01;
  undefined1 *this_02;
  
  this_01 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78;
  ios_base::ios_base((ios_base *)this_01);
  puVar1 = PTR_PTR_089f114c;
  this->field_0xec = 0;
  *(undefined **)
   ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
   *(int *)(puVar1 + -0xc)) = PTR_PTR_089f1150;
  this_02 = &(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x4;
  (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream =
       (_func_int_varargs **)&PTR__basic_ofstream_089f112c;
  *(undefined ***)&(this->super_basic_ostream<char,std::char_traits<char>_>).field_0x78 =
       &PTR__ofstream_089f1140;
  *(undefined4 *)&this->field_0xe8 = 0;
  this->field_0xed = 0;
  *(undefined4 *)&this->field_0xf0 = 0;
  *(undefined4 *)&this->field_0xf4 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
                    /* try { // try from 089cbb48 to 089cbb4f has its CatchHandler @ 089cbbe0 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_02);
                    /* try { // try from 089cbb54 to 089cbbbb has its CatchHandler @ 089cbc1c */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_01,
             (basic_streambuf<char,std::char_traits<char>_> *)this_02);
  pbVar2 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_02,(char *)__in_chrg,
                      (uint)__vtt_parm | _S_out);
  pp_Var3 = (this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream;
  if (pbVar2 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream
               + (int)pp_Var3[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_ostream<char,std::char_traits<char>_>)._vptr_basic_ostream +
            (int)pp_Var3[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: basic_ifstream @ 089cbc30

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  int iVar1;
  _func_int_varargs *p_Var2;
  undefined4 uVar3;
  _func_int_varargs **pp_Var4;
  undefined1 *this_00;
  
  pp_Var4 = *(_func_int_varargs ***)__in_chrg;
  iVar1 = *(int *)(*(int *)(__in_chrg + 4) + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  p_Var2 = pp_Var4[-3];
  uVar3 = *(undefined4 *)(__in_chrg + 0xc);
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       *(undefined4 *)(__in_chrg + 8);
  this_00 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream = pp_Var4;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var2) = uVar3;
                    /* try { // try from 089cbc8c to 089cbc93 has its CatchHandler @ 089cbcc8 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_00);
                    /* try { // try from 089cbca0 to 089cbca7 has its CatchHandler @ 089cbcf0 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
             (int)(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream[-3])
             ,(basic_streambuf<char,std::char_traits<char>_> *)this_00);
  return;
}



----------------------------------------

// Function: basic_ifstream @ 089cbd04

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  int iVar1;
  basic_filebuf<char,std::char_traits<char>_> *pbVar2;
  _func_int_varargs *p_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  undefined4 uVar4;
  _func_int_varargs **pp_Var5;
  undefined1 *this_01;
  
  pp_Var5 = *(_func_int_varargs ***)__in_chrg;
  iVar1 = *(int *)(*(int *)(__in_chrg + 4) + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  p_Var3 = pp_Var5[-3];
  uVar4 = *(undefined4 *)(__in_chrg + 0xc);
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       *(undefined4 *)(__in_chrg + 8);
  this_01 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream = pp_Var5;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var3) = uVar4;
                    /* try { // try from 089cbd6c to 089cbd73 has its CatchHandler @ 089cbe0c */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089cbd80 to 089cbde7 has its CatchHandler @ 089cbe34 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
             (int)(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream[-3])
             ,(basic_streambuf<char,std::char_traits<char>_> *)this_01);
  pbVar2 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_01,(char *)__vtt_parm,
                      (uint)__s | _S_in);
  pp_Var5 = (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream;
  if (pbVar2 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream
               + (int)pp_Var5[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
            (int)pp_Var5[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: basic_ifstream @ 089cbe48

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  undefined *puVar1;
  basic_filebuf<char,std::char_traits<char>_> *pbVar2;
  _func_int_varargs **pp_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  undefined1 *this_01;
  undefined1 *this_02;
  
  this_01 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c;
  ios_base::ios_base((ios_base *)this_01);
  puVar1 = PTR_PTR_089f11ac;
  this->field_0xf0 = 0;
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   *(int *)(puVar1 + -0xc)) = PTR_PTR_089f11b0;
  this_02 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_ifstream_089f118c;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__ifstream_089f11a0;
  *(undefined4 *)&this->field_0xec = 0;
  this->field_0xf1 = 0;
  *(undefined4 *)&this->field_0xf4 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
  *(undefined4 *)&this->field_0x100 = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
                    /* try { // try from 089cbed8 to 089cbedf has its CatchHandler @ 089cbf70 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_02);
                    /* try { // try from 089cbee4 to 089cbf4b has its CatchHandler @ 089cbfb0 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_01,
             (basic_streambuf<char,std::char_traits<char>_> *)this_02);
  pbVar2 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_02,(char *)__in_chrg,
                      (uint)__vtt_parm | _S_in);
  pp_Var3 = (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream;
  if (pbVar2 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream
               + (int)pp_Var3[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
            (int)pp_Var3[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: basic_ifstream @ 089cbfc4

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined1 *this_00;
  undefined1 *this_01;
  
  this_00 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c;
  ios_base::ios_base((ios_base *)this_00);
  puVar1 = PTR_PTR_089f11ac;
  this->field_0xf0 = 0;
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   *(int *)(puVar1 + -0xc)) = PTR_PTR_089f11b0;
  this_01 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_ifstream_089f118c;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__ifstream_089f11a0;
  *(undefined4 *)&this->field_0xec = 0;
  this->field_0xf1 = 0;
  *(undefined4 *)&this->field_0xf4 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
  *(undefined4 *)&this->field_0x100 = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
                    /* try { // try from 089cc054 to 089cc05b has its CatchHandler @ 089cc090 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089cc060 to 089cc067 has its CatchHandler @ 089cc0c4 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_00,
             (basic_streambuf<char,std::char_traits<char>_> *)this_01);
  return;
}



----------------------------------------

// Function: basic_fstream @ 089cc0d8

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  int iVar1;
  int iVar2;
  _func_int_varargs *p_Var3;
  int iVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  _func_int_varargs **pp_Var9;
  undefined1 *this_00;
  
  pp_Var9 = *(_func_int_varargs ***)__in_chrg;
  iVar2 = *(int *)(__in_chrg + 0x10);
  iVar4 = *(int *)(__in_chrg + 4);
  iVar1 = *(int *)(*(int *)(__in_chrg + 8) + -0xc);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  iVar2 = *(int *)(iVar2 + -0xc);
  iVar4 = *(int *)(iVar4 + -0xc);
  p_Var3 = pp_Var9[-3];
  uVar8 = *(undefined4 *)(__in_chrg + 0x24);
  uVar5 = *(undefined4 *)(__in_chrg + 0x14);
  uVar6 = *(undefined4 *)(__in_chrg + 0x18);
  uVar7 = *(undefined4 *)(__in_chrg + 0x20);
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar1) =
       *(undefined4 *)(__in_chrg + 0xc);
  this_00 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0xc;
  *(undefined4 *)
   (&(this->super_basic_iostream<char,std::char_traits<char>_>).
     super_basic_istream<char,std::char_traits<char>_>.field_0x8 + iVar2) = uVar5;
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar4) = uVar6;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream = pp_Var9;
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + (int)p_Var3) =
       uVar7;
  *(undefined4 *)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = uVar8;
                    /* try { // try from 089cc15c to 089cc163 has its CatchHandler @ 089cc194 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_00);
                    /* try { // try from 089cc170 to 089cc177 has its CatchHandler @ 089cc1ac */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                    super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
             (int)(this->super_basic_iostream<char,std::char_traits<char>_>).
                  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3]),
             (basic_streambuf<char,std::char_traits<char>_> *)this_00);
  return;
}



----------------------------------------

// Function: ~ifstream @ 089cc1c0

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::ifstream::~ifstream() */

void __thiscall std::ifstream::~ifstream(ifstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ifstream<char,std::char_traits<char>_>::~basic_ifstream
            ((basic_ifstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ifstream @ 089cc1d4

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::~basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *__in_chrg_00;
  int iVar1;
  
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_ifstream_089f118c;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__ifstream_089f11a0;
                    /* try { // try from 089cc200 to 089cc207 has its CatchHandler @ 089cc250 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8,__in_chrg);
  __in_chrg_00 = PTR_PTR_089f11b0;
  iVar1 = *(int *)(PTR_PTR_089f11ac + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)PTR_PTR_089f11ac;
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       __in_chrg_00;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c,
                      (int)__in_chrg_00);
  return;
}



----------------------------------------

// Function: ~ifstream @ 089cc294

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::ifstream::~ifstream() */

void __thiscall std::ifstream::~ifstream(ifstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_ifstream<char,std::char_traits<char>_>::~basic_ifstream
            ((basic_ifstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_ifstream @ 089cc2a8

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::~basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *__in_chrg_00;
  int iVar1;
  
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_ifstream_089f118c;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__ifstream_089f11a0;
                    /* try { // try from 089cc2d4 to 089cc2db has its CatchHandler @ 089cc32c */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8,__in_chrg);
  __in_chrg_00 = PTR_PTR_089f11b0;
  iVar1 = *(int *)(PTR_PTR_089f11ac + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)PTR_PTR_089f11ac;
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       __in_chrg_00;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c,
                      (int)__in_chrg_00);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~basic_ifstream @ 089cc370

/* WARNING: Struct "basic_ifstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_ifstream(basic_ifstream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_ifstream<char,std::char_traits<char>_>::~basic_ifstream
          (basic_ifstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  undefined4 uVar2;
  int __in_chrg_00;
  
  __in_chrg_00 = *(int *)(__in_chrg + 0xc);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       *(_func_int_varargs ***)__in_chrg;
  *(int *)((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
          (int)p_Var1) = __in_chrg_00;
                    /* try { // try from 089cc3a0 to 089cc3a7 has its CatchHandler @ 089cc3d8 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8,__in_chrg_00);
  uVar2 = *(undefined4 *)(__in_chrg + 8);
  p_Var1 = (*(_func_int_varargs ***)(__in_chrg + 4))[-3];
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       *(_func_int_varargs ***)(__in_chrg + 4);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var1) = uVar2;
  return;
}



----------------------------------------

// Function: ~fstream @ 089cc3f8

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::fstream::~fstream() */

void __thiscall std::fstream::~fstream(fstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_fstream<char,std::char_traits<char>_>::~basic_fstream
            ((basic_fstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~fstream @ 089cc40c

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* non-virtual thunk to std::fstream::~fstream() */

void __thiscall std::fstream::~fstream(fstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_fstream<char,std::char_traits<char>_>::~basic_fstream
            ((basic_fstream<char,std::char_traits<char>_> *)(this + -8),in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_fstream @ 089cc418

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::~basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  undefined *puVar4;
  int __in_chrg_00;
  int iVar5;
  
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_fstream_089f1034;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__fstream_089f105c;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = &PTR__fstream_089f1048;
                    /* try { // try from 089cc450 to 089cc457 has its CatchHandler @ 089cc4d4 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_iostream<char,std::char_traits<char>_>).
              super_basic_istream<char,std::char_traits<char>_>.field_0xc,__in_chrg);
  puVar4 = PTR_PTR_089f107c;
  puVar3 = PTR_PTR_089f1078;
  puVar2 = PTR_PTR_089f1074;
  puVar1 = PTR_PTR_089f1070;
  iVar5 = *(int *)(PTR_PTR_089f1070 + -0xc);
  __in_chrg_00 = (int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
                 *(int *)(PTR_PTR_089f1078 + -0xc);
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
   *(int *)(PTR_PTR_089f106c + -0xc)) = PTR_PTR_089f1080;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  *(undefined **)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = puVar3;
  *(undefined **)(__in_chrg_00 + 8) = puVar4;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)puVar1;
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar5) = puVar2;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>.field_0x80,__in_chrg_00);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~fstream @ 089cc544

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* virtual thunk to std::fstream::~fstream() */

void __thiscall std::fstream::~fstream(fstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_fstream<char,std::char_traits<char>_>::~basic_fstream
            ((basic_fstream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~fstream @ 089cc558

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* non-virtual thunk to std::fstream::~fstream() */

void __thiscall std::fstream::~fstream(fstream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_fstream<char,std::char_traits<char>_>::~basic_fstream
            ((basic_fstream<char,std::char_traits<char>_> *)(this + -8),in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_fstream @ 089cc564

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::~basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  undefined *puVar4;
  int __in_chrg_00;
  int iVar5;
  
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_fstream_089f1034;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__fstream_089f105c;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = &PTR__fstream_089f1048;
                    /* try { // try from 089cc59c to 089cc5a3 has its CatchHandler @ 089cc618 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_iostream<char,std::char_traits<char>_>).
              super_basic_istream<char,std::char_traits<char>_>.field_0xc,__in_chrg);
  puVar4 = PTR_PTR_089f107c;
  puVar3 = PTR_PTR_089f1078;
  puVar2 = PTR_PTR_089f1074;
  puVar1 = PTR_PTR_089f1070;
  iVar5 = *(int *)(PTR_PTR_089f1070 + -0xc);
  __in_chrg_00 = (int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
                 *(int *)(PTR_PTR_089f1078 + -0xc);
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
   *(int *)(PTR_PTR_089f106c + -0xc)) = PTR_PTR_089f1080;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  *(undefined **)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = puVar3;
  *(undefined **)(__in_chrg_00 + 8) = puVar4;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)puVar1;
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar5) = puVar2;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_iostream<char,std::char_traits<char>_>).
                       super_basic_istream<char,std::char_traits<char>_>.field_0x80,__in_chrg_00);
  return;
}



----------------------------------------

// Function: ~basic_fstream @ 089cc688

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void ~basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::~basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  _func_int_varargs *p_Var1;
  int iVar2;
  undefined4 uVar3;
  int iVar4;
  _func_int_varargs **pp_Var5;
  undefined4 uVar6;
  
  uVar3 = *(undefined4 *)(__in_chrg + 0x24);
  p_Var1 = (*(_func_int_varargs ***)__in_chrg)[-3];
  iVar2 = *(int *)(__in_chrg + 0x20);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       *(_func_int_varargs ***)__in_chrg;
  *(int *)((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                 super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + (int)p_Var1
          ) = iVar2;
  *(undefined4 *)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = uVar3;
                    /* try { // try from 089cc6c0 to 089cc6c7 has its CatchHandler @ 089cc724 */
  basic_filebuf<char,std::char_traits<char>_>::~basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)
             &(this->super_basic_iostream<char,std::char_traits<char>_>).
              super_basic_istream<char,std::char_traits<char>_>.field_0xc,iVar2);
  iVar4 = *(int *)(__in_chrg + 0x10);
  pp_Var5 = *(_func_int_varargs ***)(__in_chrg + 8);
  iVar2 = *(int *)(iVar4 + -0xc);
  p_Var1 = pp_Var5[-3];
  uVar6 = *(undefined4 *)(__in_chrg + 0xc);
  uVar3 = *(undefined4 *)(__in_chrg + 0x14);
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
   *(int *)(*(int *)(__in_chrg + 4) + -0xc)) = *(undefined4 *)(__in_chrg + 0x18);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  *(int *)&(this->super_basic_iostream<char,std::char_traits<char>_>).
           super_basic_istream<char,std::char_traits<char>_>.field_0x8 = iVar4;
  *(undefined4 *)
   (&(this->super_basic_iostream<char,std::char_traits<char>_>).
     super_basic_istream<char,std::char_traits<char>_>.field_0x8 + iVar2) = uVar3;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream = pp_Var5;
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + (int)p_Var1) =
       uVar6;
  return;
}



----------------------------------------

// Function: basic_fstream @ 089cc770

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  undefined *puVar4;
  undefined *puVar5;
  _func_int_varargs **pp_Var6;
  basic_filebuf<char,std::char_traits<char>_> *pbVar7;
  int iVar8;
  _func_int_varargs *p_Var9;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int iVar10;
  int iVar11;
  undefined1 *this_01;
  undefined1 *this_02;
  
  this_02 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0x80;
  ios_base::ios_base((ios_base *)this_02);
  puVar3 = PTR_PTR_089f1078;
  puVar2 = PTR_PTR_089f1070;
  puVar1 = PTR_PTR_089f106c;
  this->field_0xf4 = 0;
  iVar10 = *(int *)(puVar2 + -0xc);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  puVar5 = PTR_PTR_089f1080;
  puVar4 = PTR_PTR_089f107c;
  puVar2 = PTR_PTR_089f1074;
  iVar11 = *(int *)(puVar1 + -0xc);
  iVar8 = *(int *)(puVar3 + -0xc);
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__basic_ios_089ef6d0;
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar10) = puVar2;
  *(undefined **)
   (&(this->super_basic_iostream<char,std::char_traits<char>_>).
     super_basic_istream<char,std::char_traits<char>_>.field_0x8 + iVar8) = puVar4;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)puVar1;
  *(undefined **)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar11) = puVar5;
  puVar1 = PTR_PTR_089f1084;
  pp_Var6 = (this->super_basic_iostream<char,std::char_traits<char>_>).
            super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream;
  *(undefined4 *)&this->field_0xf0 = 0;
  p_Var9 = pp_Var6[-3];
  *(undefined **)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = puVar1;
  this->field_0xf5 = 0;
  *(undefined4 *)&this->field_0xf8 = 0;
  *(undefined4 *)&this->field_0xfc = 0;
  *(undefined4 *)&this->field_0x100 = 0;
  *(undefined4 *)&this->field_0x104 = 0;
                    /* try { // try from 089cc848 to 089cc84f has its CatchHandler @ 089cc928 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                    super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
             (int)p_Var9),(basic_streambuf<char,std::char_traits<char>_> *)0x0);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       (_func_int_varargs **)&PTR__basic_fstream_089f1034;
  this_01 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0xc;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x80 = &PTR__fstream_089f105c;
  *(undefined ***)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = &PTR__fstream_089f1048;
                    /* try { // try from 089cc878 to 089cc87f has its CatchHandler @ 089cc9cc */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089cc884 to 089cc8f7 has its CatchHandler @ 089cc96c */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_02,
             (basic_streambuf<char,std::char_traits<char>_> *)this_01);
  pbVar7 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_01,(char *)__in_chrg,
                      (_Ios_Openmode)__vtt_parm);
  pp_Var6 = (this->super_basic_iostream<char,std::char_traits<char>_>).
            super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream;
  if (pbVar7 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                      super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
               (int)pp_Var6[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                   super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
            (int)pp_Var6[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: basic_fstream @ 089cc9d4

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* WARNING: Struct "basic_fstream<char,std::char_traits<char>_>": ignoring overlapping field
   "_M_filebuf" */
/* DWARF original prototype: void basic_fstream(basic_fstream<char,std::char_traits<char>_> * this,
   int __in_chrg, void * * __vtt_parm, char * __s, _Ios_Openmode __mode) */

void __thiscall
std::basic_fstream<char,std::char_traits<char>_>::basic_fstream
          (basic_fstream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          char *__s,_Ios_Openmode __mode)

{
  basic_filebuf<char,std::char_traits<char>_> *pbVar1;
  int iVar2;
  _func_int_varargs *p_Var3;
  basic_ios<char,std::char_traits<char>_> *this_00;
  int iVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  _func_int_varargs **pp_Var7;
  undefined1 *this_01;
  
  pp_Var7 = *(_func_int_varargs ***)(__in_chrg + 4);
  iVar4 = *(int *)(__in_chrg + 0x10);
  iVar2 = *(int *)(*(int *)(__in_chrg + 8) + -0xc);
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._M_gcount = 0;
  iVar4 = *(int *)(iVar4 + -0xc);
  p_Var3 = pp_Var7[-3];
  uVar5 = *(undefined4 *)(__in_chrg + 0x14);
  uVar6 = *(undefined4 *)(__in_chrg + 0x18);
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + iVar2) =
       *(undefined4 *)(__in_chrg + 0xc);
  *(undefined4 *)
   (&(this->super_basic_iostream<char,std::char_traits<char>_>).
     super_basic_istream<char,std::char_traits<char>_>.field_0x8 + iVar4) = uVar5;
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream = pp_Var7;
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + (int)p_Var3) =
       uVar6;
  p_Var3 = (this->super_basic_iostream<char,std::char_traits<char>_>).
           super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3];
  *(undefined4 *)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = *(undefined4 *)(__in_chrg + 0x1c);
                    /* try { // try from 089cca8c to 089cca93 has its CatchHandler @ 089ccb70 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                    super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
             (int)p_Var3),(basic_streambuf<char,std::char_traits<char>_> *)0x0);
  uVar5 = *(undefined4 *)(__in_chrg + 0x20);
  uVar6 = *(undefined4 *)(__in_chrg + 0x24);
  p_Var3 = (*(_func_int_varargs ***)__in_chrg)[-3];
  (this->super_basic_iostream<char,std::char_traits<char>_>).
  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream =
       *(_func_int_varargs ***)__in_chrg;
  this_01 = &(this->super_basic_iostream<char,std::char_traits<char>_>).
             super_basic_istream<char,std::char_traits<char>_>.field_0xc;
  *(undefined4 *)
   ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
          super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream + (int)p_Var3) =
       uVar5;
  *(undefined4 *)
   &(this->super_basic_iostream<char,std::char_traits<char>_>).
    super_basic_istream<char,std::char_traits<char>_>.field_0x8 = uVar6;
                    /* try { // try from 089ccab8 to 089ccabf has its CatchHandler @ 089ccc14 */
  basic_filebuf<char,std::char_traits<char>_>::basic_filebuf
            ((basic_filebuf<char,std::char_traits<char>_> *)this_01);
                    /* try { // try from 089ccacc to 089ccb3f has its CatchHandler @ 089ccbb0 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                    super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
             (int)(this->super_basic_iostream<char,std::char_traits<char>_>).
                  super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream[-3]),
             (basic_streambuf<char,std::char_traits<char>_> *)this_01);
  pbVar1 = basic_filebuf<char,std::char_traits<char>_>::open
                     ((basic_filebuf<char,std::char_traits<char>_> *)this_01,(char *)__vtt_parm,
                      (_Ios_Openmode)__s);
  pp_Var7 = (this->super_basic_iostream<char,std::char_traits<char>_>).
            super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream;
  if (pbVar1 != (basic_filebuf<char,std::char_traits<char>_> *)0x0) {
    basic_ios<char,std::char_traits<char>_>::clear
              ((basic_ios<char,std::char_traits<char>_> *)
               ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                      super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
               (int)pp_Var7[-3]),_S_goodbit);
    return;
  }
  this_00 = (basic_ios<char,std::char_traits<char>_> *)
            ((int)&(this->super_basic_iostream<char,std::char_traits<char>_>).
                   super_basic_istream<char,std::char_traits<char>_>._vptr_basic_istream +
            (int)pp_Var7[-3]);
  basic_ios<char,std::char_traits<char>_>::clear
            (this_00,(this_00->super_ios_base)._M_streambuf_state | _S_failbit);
  return;
}



----------------------------------------

// Function: __static_initialization_and_destruction_0 @ 089ccc1c

void __static_initialization_and_destruction_0(int __initialize_p,int __priority)

{
  if (__initialize_p == 1) {
    if (__priority == 0xffff) {
      std::ios_base::Init::Init(&std::__ioinit);
      return;
    }
  }
  else if ((__initialize_p == 0) && (__priority == 0xffff)) {
    std::ios_base::Init::~Init(&std::__ioinit,0xffff);
    return;
  }
  return;
}



----------------------------------------

// Function: _GLOBAL__D_.._.._.._.._libstdc___v3_src_iostream_inst.cc_8D2A3925_20339BE4 @ 089ccc60

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__D_____________libstdc___v3_src_iostream_inst_cc_8D2A3925_20339BE4(void)

{
  __static_initialization_and_destruction_0(0,0xffff);
  return;
}



----------------------------------------

// Function: _GLOBAL__I_.._.._.._.._libstdc___v3_src_iostream_inst.cc_8D2A3925_20339BE4 @ 089ccc6c

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void _GLOBAL__I_____________libstdc___v3_src_iostream_inst_cc_8D2A3925_20339BE4(void)

{
  __static_initialization_and_destruction_0(1,0xffff);
  return;
}



----------------------------------------

// Function: setfill<char> @ 089ccc78

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

_Setfill<char> * std::setfill<char>(_Setfill<char> *__return_storage_ptr__,char __c)

{
  return __return_storage_ptr__;
}



----------------------------------------

// Function: ~iostream @ 089ccc80

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* virtual thunk to std::iostream::~iostream() */

void __thiscall std::iostream::~iostream(iostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_iostream<char,std::char_traits<char>_>::~basic_iostream
            ((basic_iostream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~iostream @ 089ccc94

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* non-virtual thunk to std::iostream::~iostream() */

void __thiscall std::iostream::~iostream(iostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_iostream<char,std::char_traits<char>_>::~basic_iostream
            ((basic_iostream<char,std::char_traits<char>_> *)(this + -8),in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_iostream @ 089ccca0

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void ~basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::~basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  int iVar4;
  undefined4 *__in_chrg_00;
  
  puVar3 = PTR_PTR_089f1340;
  puVar2 = PTR_PTR_089f1338;
  puVar1 = PTR_PTR_089f1334;
  iVar4 = *(int *)(PTR_PTR_089f133c + -0xc);
  __in_chrg_00 = (undefined4 *)
                 ((int)&(this->super_basic_istream<char,std::char_traits<char>_>).
                        _vptr_basic_istream + *(int *)(PTR_PTR_089f1334 + -0xc));
  *(undefined **)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 =
       PTR_PTR_089f133c;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  *(undefined **)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar4) =
       puVar3;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)puVar1;
  *__in_chrg_00 = puVar2;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc,
                      (int)__in_chrg_00);
  return;
}



----------------------------------------

// Function: ~basic_iostream @ 089cccf0

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void ~basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::~basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  int iVar1;
  _func_int_varargs *p_Var2;
  undefined4 uVar3;
  int iVar4;
  _func_int_varargs **pp_Var5;
  undefined4 uVar6;
  
  iVar4 = *(int *)(__in_chrg + 0xc);
  pp_Var5 = *(_func_int_varargs ***)(__in_chrg + 4);
  iVar1 = *(int *)(iVar4 + -0xc);
  p_Var2 = pp_Var5[-3];
  uVar6 = *(undefined4 *)(__in_chrg + 8);
  uVar3 = *(undefined4 *)(__in_chrg + 0x10);
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   *(int *)(*(int *)__in_chrg + -0xc)) = *(undefined4 *)(__in_chrg + 0x14);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  *(int *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 = iVar4;
  *(undefined4 *)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar1) =
       uVar3;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream = pp_Var5;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var2) = uVar6;
  return;
}



----------------------------------------

// Function: basic_iostream @ 089ccd3c

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb)
    */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  undefined *puVar1;
  undefined *puVar2;
  int iVar3;
  int iVar4;
  undefined1 *this_00;
  
  this_00 = &(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc;
  ios_base::ios_base((ios_base *)this_00);
  puVar2 = PTR_PTR_089f133c;
  puVar1 = PTR_PTR_089f1334;
  (this->super_basic_istream<char,std::char_traits<char>_>).field_0x80 = 0;
  iVar4 = *(int *)(puVar1 + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  puVar1 = PTR_PTR_089f1340;
  iVar3 = *(int *)(puVar2 + -0xc);
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar4) =
       PTR_PTR_089f1338;
  *(undefined **)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar3) =
       puVar1;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)0x89f12fc;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc = 0x89f1324;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 = 0x89f1310;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>).field_0x81 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x84 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x88 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8c = 0;
  *(undefined4 *)&this->field_0x90 = 0;
                    /* try { // try from 089cce00 to 089cce07 has its CatchHandler @ 089cce38 */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)this_00,
             (basic_streambuf<char,std::char_traits<char>_> *)__in_chrg);
  return;
}



----------------------------------------

// Function: basic_iostream @ 089cce7c

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  int iVar1;
  _func_int_varargs *p_Var2;
  int iVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  _func_int_varargs **pp_Var6;
  undefined4 uVar7;
  
  pp_Var6 = *(_func_int_varargs ***)__in_chrg;
  iVar3 = *(int *)(__in_chrg + 0xc);
  iVar1 = *(int *)(*(int *)(__in_chrg + 4) + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  iVar3 = *(int *)(iVar3 + -0xc);
  p_Var2 = pp_Var6[-3];
  uVar7 = *(undefined4 *)(__in_chrg + 0x18);
  uVar4 = *(undefined4 *)(__in_chrg + 0x10);
  uVar5 = *(undefined4 *)(__in_chrg + 0x14);
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       *(undefined4 *)(__in_chrg + 8);
  *(undefined4 *)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar3) =
       uVar4;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream = pp_Var6;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var2) = uVar5;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 = uVar7;
  return;
}



----------------------------------------

// Function: basic_iostream @ 089ccecc

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm, basic_streambuf<char,std::char_traits<char>_> * __sb)
    */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm,
          basic_streambuf<char,std::char_traits<char>_> *__sb)

{
  int iVar1;
  _func_int_varargs *p_Var2;
  int iVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  _func_int_varargs **pp_Var6;
  
  iVar3 = *(int *)(__in_chrg + 0xc);
  pp_Var6 = *(_func_int_varargs ***)__in_chrg;
  iVar1 = *(int *)(*(int *)(__in_chrg + 4) + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  iVar3 = *(int *)(iVar3 + -0xc);
  p_Var2 = pp_Var6[-3];
  uVar4 = *(undefined4 *)(__in_chrg + 0x10);
  uVar5 = *(undefined4 *)(__in_chrg + 0x14);
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar1) =
       *(undefined4 *)(__in_chrg + 8);
  *(undefined4 *)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar3) =
       uVar4;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream = pp_Var6;
  *(undefined4 *)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
   (int)p_Var2) = uVar5;
  p_Var2 = (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream[-3];
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 =
       *(undefined4 *)(__in_chrg + 0x18);
                    /* try { // try from 089ccf60 to 089ccf67 has its CatchHandler @ 089ccf8c */
  basic_ios<char,std::char_traits<char>_>::init
            ((basic_ios<char,std::char_traits<char>_> *)
             ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream +
             (int)p_Var2),(basic_streambuf<char,std::char_traits<char>_> *)__vtt_parm);
  return;
}



----------------------------------------

// Function: ~iostream @ 089ccfc4

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* virtual thunk to std::iostream::~iostream() */

void __thiscall std::iostream::~iostream(iostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_iostream<char,std::char_traits<char>_>::~basic_iostream
            ((basic_iostream<char,std::char_traits<char>_> *)(this + *(int *)(*(int *)this + -0xc)),
             in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~iostream @ 089ccfd8

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* non-virtual thunk to std::iostream::~iostream() */

void __thiscall std::iostream::~iostream(iostream *this)

{
  int in_a1;
  void **in_a2;
  
  basic_iostream<char,std::char_traits<char>_>::~basic_iostream
            ((basic_iostream<char,std::char_traits<char>_> *)(this + -8),in_a1,in_a2);
  return;
}



----------------------------------------

// Function: ~basic_iostream @ 089ccfe4

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void ~basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::~basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  undefined *puVar3;
  int iVar4;
  undefined4 *__in_chrg_00;
  
  puVar3 = PTR_PTR_089f1340;
  puVar2 = PTR_PTR_089f1338;
  puVar1 = PTR_PTR_089f1334;
  iVar4 = *(int *)(PTR_PTR_089f133c + -0xc);
  __in_chrg_00 = (undefined4 *)
                 ((int)&(this->super_basic_istream<char,std::char_traits<char>_>).
                        _vptr_basic_istream + *(int *)(PTR_PTR_089f1334 + -0xc));
  *(undefined **)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 =
       PTR_PTR_089f133c;
  *(undefined **)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar4) =
       puVar3;
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)puVar1;
  *__in_chrg_00 = puVar2;
  *(undefined ***)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc =
       &PTR__basic_ios_089ef6d0;
  ios_base::~ios_base((ios_base *)
                      &(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc,
                      (int)__in_chrg_00);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: basic_iostream @ 089cd058

/* WARNING: Struct "basic_iostream<char,std::char_traits<char>_>": ignoring overlapping field
   "super_basic_ostream<char,std::char_traits<char>_>" */
/* DWARF original prototype: void basic_iostream(basic_iostream<char,std::char_traits<char>_> *
   this, int __in_chrg, void * * __vtt_parm) */

void __thiscall
std::basic_iostream<char,std::char_traits<char>_>::basic_iostream
          (basic_iostream<char,std::char_traits<char>_> *this,int __in_chrg,void **__vtt_parm)

{
  undefined *puVar1;
  undefined *puVar2;
  int iVar3;
  int iVar4;
  
  ios_base::ios_base((ios_base *)
                     &(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc);
  puVar2 = PTR_PTR_089f133c;
  puVar1 = PTR_PTR_089f1334;
  (this->super_basic_istream<char,std::char_traits<char>_>).field_0x80 = 0;
  iVar4 = *(int *)(puVar1 + -0xc);
  (this->super_basic_istream<char,std::char_traits<char>_>)._M_gcount = 0;
  puVar1 = PTR_PTR_089f1340;
  iVar3 = *(int *)(puVar2 + -0xc);
  *(undefined **)
   ((int)&(this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream + iVar4) =
       PTR_PTR_089f1338;
  *(undefined **)(&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 + iVar3) =
       puVar1;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8 = 0x89f1310;
  *(undefined4 *)&this->field_0x90 = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>)._vptr_basic_istream =
       (_func_int_varargs **)0x89f12fc;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0xc = 0x89f1324;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x7c = 0;
  (this->super_basic_istream<char,std::char_traits<char>_>).field_0x81 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x84 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x88 = 0;
  *(undefined4 *)&(this->super_basic_istream<char,std::char_traits<char>_>).field_0x8c = 0;
  return;
}



----------------------------------------

// Function: __cxa_get_globals_fast @ 089cd100

__cxa_eh_globals * __cxxabiv1::__cxa_get_globals_fast(void)

{
  return &::::eh_globals;
}



----------------------------------------

// Function: __cxa_get_globals @ 089cd10c

__cxa_eh_globals * __cxxabiv1::__cxa_get_globals(void)

{
  return &::::eh_globals;
}



----------------------------------------

// Function: what @ 089cd118

/* DWARF original prototype: char * what(exception * this) */

char * __thiscall std::exception::what(exception *this)

{
  return *(char **)(this->_vptr_exception[-1] + 4);
}



----------------------------------------

// Function: ~exception @ 089cd128

/* DWARF original prototype: void ~exception(exception * this, int __in_chrg) */

void __thiscall std::exception::~exception(exception *this,int __in_chrg)

{
  this->_vptr_exception = (_func_int_varargs **)&PTR__exception_089f13e8;
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~exception @ 089cd138

/* DWARF original prototype: void ~exception(exception * this, int __in_chrg) */

void __thiscall std::exception::~exception(exception *this,int __in_chrg)

{
  this->_vptr_exception = (_func_int_varargs **)&PTR__exception_089f13e8;
  return;
}



----------------------------------------

// Function: ~exception @ 089cd148

/* DWARF original prototype: void ~exception(exception * this, int __in_chrg) */

void __thiscall std::exception::~exception(exception *this,int __in_chrg)

{
  this->_vptr_exception = (_func_int_varargs **)&PTR__exception_089f13e8;
  return;
}



----------------------------------------

// Function: ~bad_exception @ 089cd158

/* DWARF original prototype: void ~bad_exception(bad_exception * this, int __in_chrg) */

void __thiscall std::bad_exception::~bad_exception(bad_exception *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_exception_089f13d0;
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~bad_exception @ 089cd18c

/* DWARF original prototype: void ~bad_exception(bad_exception * this, int __in_chrg) */

void __thiscall std::bad_exception::~bad_exception(bad_exception *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_exception_089f13d0;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_exception @ 089cd19c

/* DWARF original prototype: void ~bad_exception(bad_exception * this, int __in_chrg) */

void __thiscall std::bad_exception::~bad_exception(bad_exception *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_exception_089f13d0;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: __cxa_free_exception @ 089cd1ac

void __cxxabiv1::__cxa_free_exception(void *vptr)

{
                    /* Unresolved local var: char * ptr@[???] */
                    /* Unresolved local var: uint which@[???] */
  if (((void *)0x8a1ee57 < vptr) && (vptr < &::::emergency_used)) {
    ::::emergency_used = ~(1 << ((int)vptr + 0xf75e11a8U >> 9 & 0x1f)) & ::::emergency_used;
    return;
  }
  free((void *)((int)vptr + -0x48));
  return;
}



----------------------------------------

// Function: __cxa_allocate_exception @ 089cd204

void * __cxxabiv1::__cxa_allocate_exception(size_t thrown_size)

{
  one_buffer *m;
  __cxa_eh_globals *p_Var1;
  bitmask_type bVar2;
  uint uVar3;
  
                    /* Unresolved local var: void * ret@[???]
                       Unresolved local var: __cxa_eh_globals * globals@[???] */
  m = malloc(thrown_size + 0x48);
  if (m != (one_buffer *)0x0) {
LAB_089cd284:
    p_Var1 = __cxa_get_globals();
    p_Var1->uncaughtExceptions = p_Var1->uncaughtExceptions + 1;
    memset(m,0,0x48);
    return *m + 0x48;
  }
                    /* Unresolved local var: bitmask_type used@[???]
                       Unresolved local var: uint which@[???] */
  if (thrown_size + 0x48 < 0x201) {
    uVar3 = 0;
    if ((::::emergency_used & 1) == 0) {
LAB_089cd264:
      ::::emergency_used = ::::emergency_used | 1 << (uVar3 & 0x1f);
      m = ::::emergency_buffer + uVar3;
      goto LAB_089cd284;
    }
    bVar2 = ::::emergency_used;
    for (uVar3 = 1; bVar2 = bVar2 >> 1, uVar3 != 4; uVar3 = uVar3 + 1) {
      if ((bVar2 & 1) == 0) goto LAB_089cd264;
    }
  }
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089cd2c0 to 089cd2c7 has its CatchHandler @ 089cd2c8 */
  std::terminate();
}



----------------------------------------

// Function: __cxa_call_terminate @ 089cd2e4

void __cxa_call_terminate(_Unwind_Exception_conflict5 *ue_header)

{
  if (((ue_header != (_Unwind_Exception_conflict5 *)0x0) &&
      (__cxxabiv1::__cxa_begin_catch(ue_header), (int)ue_header->exception_class == 0x432b2b00)) &&
     (*(int *)((int)&ue_header->exception_class + 4) == 0x474e5543)) {
                    /* WARNING: Subroutine does not return */
                    /* Unresolved local var: __cxa_exception * xh@[???] */
    __cxxabiv1::__terminate((terminate_handler)ue_header[-2].private_1);
  }
                    /* WARNING: Subroutine does not return */
  std::terminate();
}



----------------------------------------

// Function: set_new_handler @ 089cd334

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

new_handler std::set_new_handler(new_handler handler)

{
  new_handler p_Var1;
  
  p_Var1 = ::::__new_handler;
                    /* Unresolved local var: new_handler prev_handler@[???] */
  ::::__new_handler = handler;
  return p_Var1;
}



----------------------------------------

// Function: ~bad_alloc @ 089cd344

/* DWARF original prototype: void ~bad_alloc(bad_alloc * this, int __in_chrg) */

void __thiscall std::bad_alloc::~bad_alloc(bad_alloc *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_alloc_089f1440;
  exception::~exception(&this->super_exception,__in_chrg);
  operator_delete(this);
  return;
}



----------------------------------------

// Function: ~bad_alloc @ 089cd378

/* DWARF original prototype: void ~bad_alloc(bad_alloc * this, int __in_chrg) */

void __thiscall std::bad_alloc::~bad_alloc(bad_alloc *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_alloc_089f1440;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: ~bad_alloc @ 089cd388

/* DWARF original prototype: void ~bad_alloc(bad_alloc * this, int __in_chrg) */

void __thiscall std::bad_alloc::~bad_alloc(bad_alloc *this,int __in_chrg)

{
  (this->super_exception)._vptr_exception = (_func_int_varargs **)&PTR__bad_alloc_089f1440;
  exception::~exception(&this->super_exception,__in_chrg);
  return;
}



----------------------------------------

// Function: set_terminate @ 089cd398

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

terminate_handler std::set_terminate(terminate_handler func)

{
  terminate_handler p_Var1;
  
  p_Var1 = __cxxabiv1::__terminate_handler;
                    /* Unresolved local var: terminate_handler old@[???] */
  __cxxabiv1::__terminate_handler = func;
  return p_Var1;
}



----------------------------------------

// Function: set_unexpected @ 089cd3a8

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

unexpected_handler std::set_unexpected(unexpected_handler func)

{
  unexpected_handler p_Var1;
  
  p_Var1 = __cxxabiv1::__unexpected_handler;
                    /* Unresolved local var: unexpected_handler old@[???] */
  __cxxabiv1::__unexpected_handler = func;
  return p_Var1;
}



----------------------------------------

// Function: __terminate @ 089cd3b8

/* DWARF original prototype: void __terminate(terminate_handler handler) */

void __cxxabiv1::__terminate(terminate_handler handler)

{
                    /* try { // try from 089cd3c0 to 089cd3cf has its CatchHandler @ 089cd3d0 */
  (*handler)();
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: terminate @ 089cd3f0

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* DWARF original prototype: void terminate(void) */

void std::terminate(void)

{
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__terminate(__cxxabiv1::__terminate_handler);
}



----------------------------------------

// Function: __unexpected @ 089cd408

void __cxxabiv1::__unexpected(unexpected_handler handler)

{
  (*handler)();
                    /* WARNING: Subroutine does not return */
  std::terminate();
}



----------------------------------------

// Function: unexpected @ 089cd420

/* WARNING: Unknown calling convention -- yet parameter storage is locked */

void std::unexpected(void)

{
                    /* WARNING: Subroutine does not return */
  __cxxabiv1::__unexpected(__cxxabiv1::__unexpected_handler);
}



----------------------------------------

// Function: __verbose_terminate_handler @ 089cd438

void __gnu_cxx::__verbose_terminate_handler(void)

{
  type_info *ptVar1;
  char *s;
  char *mangled_name;
  int local_18 [2];
  
                    /* Unresolved local var: type_info * t@[???] */
  if (__verbose_terminate_handler::terminating) {
    fwrite("terminate called recursively\n",1,0x1d,_impure_ptr->_stderr);
                    /* WARNING: Subroutine does not return */
    abort();
  }
  __verbose_terminate_handler::terminating = true;
  ptVar1 = __cxxabiv1::__cxa_current_exception_type();
  if (ptVar1 != (type_info *)0x0) {
                    /* Unresolved local var: char * name@[???] */
    mangled_name = ptVar1->__name;
                    /* Unresolved local var: int status@[???]
                       Unresolved local var: char * dem@[???] */
    local_18[0] = -1;
    s = __cxa_demangle(mangled_name,(char *)0x0,(size_t *)0x0,local_18);
    fwrite("terminate called after throwing an instance of \'",1,0x30,_impure_ptr->_stderr);
    if (local_18[0] == 0) {
      fputs(s,_impure_ptr->_stderr);
      fwrite(&DAT_089f14c0,1,2,_impure_ptr->_stderr);
    }
    else {
      fputs(mangled_name,_impure_ptr->_stderr);
      fwrite(&DAT_089f14c0,1,2,_impure_ptr->_stderr);
    }
    if (local_18[0] != 0) {
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089cd4e4 to 089cd4eb has its CatchHandler @ 089cd578 */
      __cxxabiv1::__cxa_rethrow();
    }
    free(s);
                    /* WARNING: Subroutine does not return */
                    /* try { // try from 089cd528 to 089cd52f has its CatchHandler @ 089cd578 */
    __cxxabiv1::__cxa_rethrow();
  }
  fwrite("terminate called without an active exception\n",1,0x2d,_impure_ptr->_stderr);
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: d_make_empty @ 089cd610

demangle_component * d_make_empty(d_info *di)

{
  int iVar1;
  demangle_component *pdVar2;
  
                    /* Unresolved local var: demangle_component * p@[DW_OP_reg6(a2)] */
  iVar1 = di->next_comp;
  pdVar2 = (demangle_component *)0x0;
  if (iVar1 < di->num_comps) {
    di->next_comp = iVar1 + 1;
    pdVar2 = di->comps + iVar1;
  }
  return pdVar2;
}



----------------------------------------

// Function: d_make_comp @ 089cd648

demangle_component *
d_make_comp(d_info *di,demangle_component_type type,demangle_component *left,
           demangle_component *right)

{
  demangle_component *pdVar1;
  
                    /* Unresolved local var: demangle_component * p@[???] */
  switch(type) {
  case DEMANGLE_COMPONENT_QUAL_NAME:
  case DEMANGLE_COMPONENT_LOCAL_NAME:
  case DEMANGLE_COMPONENT_TYPED_NAME:
  case DEMANGLE_COMPONENT_TEMPLATE:
  case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
  case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
  case DEMANGLE_COMPONENT_PTRMEM_TYPE:
  case DEMANGLE_COMPONENT_UNARY:
  case DEMANGLE_COMPONENT_BINARY:
  case DEMANGLE_COMPONENT_BINARY_ARGS:
  case DEMANGLE_COMPONENT_TRINARY:
  case DEMANGLE_COMPONENT_TRINARY_ARG1:
  case DEMANGLE_COMPONENT_TRINARY_ARG2:
  case DEMANGLE_COMPONENT_LITERAL:
  case DEMANGLE_COMPONENT_LITERAL_NEG:
    if (left != (demangle_component *)0x0) goto switchD_089cd688_caseD_24;
  default:
    break;
  case DEMANGLE_COMPONENT_VTABLE:
  case DEMANGLE_COMPONENT_VTT:
  case DEMANGLE_COMPONENT_TYPEINFO:
  case DEMANGLE_COMPONENT_TYPEINFO_NAME:
  case DEMANGLE_COMPONENT_TYPEINFO_FN:
  case DEMANGLE_COMPONENT_THUNK:
  case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
  case DEMANGLE_COMPONENT_COVARIANT_THUNK:
  case DEMANGLE_COMPONENT_JAVA_CLASS:
  case DEMANGLE_COMPONENT_GUARD:
  case DEMANGLE_COMPONENT_REFTEMP:
  case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
  case DEMANGLE_COMPONENT_POINTER:
  case DEMANGLE_COMPONENT_REFERENCE:
  case DEMANGLE_COMPONENT_COMPLEX:
  case DEMANGLE_COMPONENT_IMAGINARY:
  case DEMANGLE_COMPONENT_VENDOR_TYPE:
  case DEMANGLE_COMPONENT_ARGLIST:
  case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
  case DEMANGLE_COMPONENT_CAST:
    pdVar1 = left;
    goto joined_r0x089cd6f0;
  case DEMANGLE_COMPONENT_RESTRICT:
  case DEMANGLE_COMPONENT_VOLATILE:
  case DEMANGLE_COMPONENT_CONST:
  case DEMANGLE_COMPONENT_RESTRICT_THIS:
  case DEMANGLE_COMPONENT_VOLATILE_THIS:
  case DEMANGLE_COMPONENT_CONST_THIS:
  case DEMANGLE_COMPONENT_FUNCTION_TYPE:
    goto switchD_089cd688_caseD_16;
  case DEMANGLE_COMPONENT_ARRAY_TYPE:
switchD_089cd688_caseD_24:
    pdVar1 = right;
joined_r0x089cd6f0:
    if (pdVar1 != (demangle_component *)0x0) {
switchD_089cd688_caseD_16:
      pdVar1 = d_make_empty(di);
      if (pdVar1 != (demangle_component *)0x0) {
        pdVar1->type = type;
        (pdVar1->u).s_binary.left = left;
        (pdVar1->u).s_extended_operator.name = right;
        return pdVar1;
      }
    }
  }
  return (demangle_component *)0x0;
}



----------------------------------------

// Function: d_make_name @ 089cd700

demangle_component * d_make_name(d_info *di,char *s,int len)

{
  demangle_component *pdVar1;
  
                    /* Unresolved local var: demangle_component * p@[???] */
  pdVar1 = d_make_empty(di);
  if (((pdVar1 != (demangle_component *)0x0) && (s != (char *)0x0)) && (len != 0)) {
    (pdVar1->u).s_name.s = s;
    (pdVar1->u).s_name.len = len;
    pdVar1->type = DEMANGLE_COMPONENT_NAME;
    return pdVar1;
  }
  return (demangle_component *)0x0;
}



----------------------------------------

// Function: d_make_sub @ 089cd768

demangle_component * d_make_sub(d_info *di,char *name,int len)

{
  demangle_component *pdVar1;
  
                    /* Unresolved local var: demangle_component * p@[???] */
  pdVar1 = d_make_empty(di);
  if (pdVar1 != (demangle_component *)0x0) {
    (pdVar1->u).s_name.len = len;
    pdVar1->type = DEMANGLE_COMPONENT_SUB_STD;
    (pdVar1->u).s_name.s = name;
  }
  return pdVar1;
}



----------------------------------------

// Function: is_ctor_dtor_or_conversion @ 089cd7ac

int is_ctor_dtor_or_conversion(demangle_component *dc)

{
  demangle_component_type dVar1;
  
  if (dc != (demangle_component *)0x0) {
    dVar1 = dc->type;
    do {
      switch(dVar1) {
      default:
        goto switchD_089cd7d8_caseD_0;
      case DEMANGLE_COMPONENT_QUAL_NAME:
      case DEMANGLE_COMPONENT_LOCAL_NAME:
        dc = (dc->u).s_extended_operator.name;
        if (dc == (demangle_component *)0x0) {
          return 0;
        }
        dVar1 = dc->type;
        break;
      case DEMANGLE_COMPONENT_CTOR:
      case DEMANGLE_COMPONENT_DTOR:
      case DEMANGLE_COMPONENT_CAST:
        return 1;
      }
    } while( true );
  }
switchD_089cd7d8_caseD_0:
  return 0;
}



----------------------------------------

// Function: has_return_type @ 089cd7fc

int has_return_type(demangle_component *dc)

{
  demangle_component_type dVar1;
  int iVar2;
  
  if (dc != (demangle_component *)0x0) {
    dVar1 = dc->type;
    while( true ) {
      if (dVar1 == DEMANGLE_COMPONENT_TEMPLATE) {
        iVar2 = is_ctor_dtor_or_conversion((dc->u).s_binary.left);
        return (uint)(iVar2 == 0);
      }
      if (((dVar1 < DEMANGLE_COMPONENT_TEMPLATE) || (2 < dVar1 - DEMANGLE_COMPONENT_RESTRICT_THIS))
         || (dc = (dc->u).s_binary.left, dc == (demangle_component *)0x0)) break;
      dVar1 = dc->type;
    }
  }
  return 0;
}



----------------------------------------

// Function: d_number @ 089cd878

long d_number(d_info *di)

{
  bool bVar1;
  int iVar2;
  char *pcVar3;
  int iVar4;
  
                    /* Unresolved local var: int negative@[???]
                       Unresolved local var: char peek@[DW_OP_reg6(a2)]
                       Unresolved local var: long ret@[???] */
  pcVar3 = di->n;
  iVar4 = (int)*pcVar3;
  bVar1 = iVar4 == 0x6e;
  if (bVar1) {
    di->n = pcVar3 + 1;
    iVar4 = (int)pcVar3[1];
  }
  if ((iVar4 - 0x30U & 0xff) < 10) {
    iVar2 = 0;
    pcVar3 = di->n;
    do {
      di->n = pcVar3 + 1;
      iVar2 = iVar2 * 10 + iVar4;
      iVar4 = (int)pcVar3[1];
      iVar2 = iVar2 + -0x30;
      pcVar3 = pcVar3 + 1;
    } while ((iVar4 - 0x30U & 0xff) < 10);
  }
  else {
    iVar2 = 0;
  }
  if (bVar1) {
    iVar2 = -iVar2;
  }
  return iVar2;
}



----------------------------------------

// Function: d_call_offset @ 089cd91c

int d_call_offset(d_info *di,int c)

{
  char cVar1;
  
  if (c == 0) {
    c = (int)*di->n;
    di->n = di->n + 1;
  }
  if (c != 0x68) {
    if (c == 0x76) {
      d_number(di);
      cVar1 = *di->n;
      di->n = di->n + 1;
      if (cVar1 == '_') goto LAB_089cd98c;
    }
    return 0;
  }
LAB_089cd98c:
  d_number(di);
  cVar1 = *di->n;
  di->n = di->n + 1;
  return (uint)(cVar1 == '_');
}



----------------------------------------

// Function: d_cv_qualifiers @ 089cd9bc

demangle_component ** d_cv_qualifiers(d_info *di,demangle_component **pret,int member_fn)

{
  char cVar1;
  demangle_component *pdVar2;
  char *pcVar3;
  demangle_component_type dVar4;
  
                    /* Unresolved local var: char peek@[???] */
  pcVar3 = di->n;
  cVar1 = *pcVar3;
  if (cVar1 == 'r') goto LAB_089cda54;
  do {
    if (cVar1 == 'V') {
      di->n = pcVar3 + 1;
      if (member_fn == 0) {
        dVar4 = DEMANGLE_COMPONENT_VOLATILE;
      }
      else {
        dVar4 = DEMANGLE_COMPONENT_VOLATILE_THIS;
      }
      di->expansion = di->expansion + 9;
    }
    else {
      if (cVar1 != 'K') {
        return (demangle_component **)(anon_union_8_9_088cd03e_for_u *)pret;
      }
                    /* Unresolved local var: demangle_component_type t@[???] */
      di->n = pcVar3 + 1;
      if (member_fn == 0) {
        dVar4 = DEMANGLE_COMPONENT_CONST;
      }
      else {
        dVar4 = DEMANGLE_COMPONENT_CONST_THIS;
      }
      di->expansion = di->expansion + 6;
    }
    pdVar2 = d_make_comp(di,dVar4,(demangle_component *)0x0,(demangle_component *)0x0);
    ((anon_struct_8_2_2465f1bc_for_s_binary *)pret)->left = pdVar2;
    while( true ) {
      if (pdVar2 == (demangle_component *)0x0) {
        return (demangle_component **)0x0;
      }
      pcVar3 = di->n;
      pret = (demangle_component **)&pdVar2->u;
      cVar1 = *pcVar3;
      if (cVar1 != 'r') break;
LAB_089cda54:
      dVar4 = DEMANGLE_COMPONENT_RESTRICT_THIS;
      di->n = pcVar3 + 1;
      if (member_fn == 0) {
        dVar4 = DEMANGLE_COMPONENT_RESTRICT;
      }
      di->expansion = di->expansion + 9;
      pdVar2 = d_make_comp(di,dVar4,(demangle_component *)0x0,(demangle_component *)0x0);
      ((anon_struct_8_2_2465f1bc_for_s_binary *)pret)->left = pdVar2;
    }
  } while( true );
}



----------------------------------------

// Function: d_template_param @ 089cdae4

demangle_component * d_template_param(d_info *di)

{
  char cVar1;
  int iVar2;
  demangle_component *pdVar3;
  long lVar4;
  char *pcVar5;
  char *pcVar6;
  
                    /* Unresolved local var: long param@[???] */
  pcVar5 = di->n;
  cVar1 = *pcVar5;
  di->n = pcVar5 + 1;
  if (cVar1 != 'T') {
    return (demangle_component *)0x0;
  }
  pcVar6 = (char *)0x0;
  if (pcVar5[1] == '_') {
    di->n = pcVar5 + 2;
    iVar2 = di->did_subs;
  }
  else {
    lVar4 = d_number(di);
    if (lVar4 < 0) {
      return (demangle_component *)0x0;
    }
    pcVar6 = (char *)(lVar4 + 1);
    cVar1 = *di->n;
    di->n = di->n + 1;
    if (cVar1 != '_') {
      return (demangle_component *)0x0;
    }
    iVar2 = di->did_subs;
  }
  di->did_subs = iVar2 + 1;
  pdVar3 = d_make_empty(di);
  if (pdVar3 == (demangle_component *)0x0) {
    return (demangle_component *)0x0;
  }
  pdVar3->type = DEMANGLE_COMPONENT_TEMPLATE_PARAM;
  (pdVar3->u).s_name.s = pcVar6;
  return pdVar3;
}



----------------------------------------

// Function: d_discriminator @ 089cdbc0

int d_discriminator(d_info *di)

{
  uint uVar1;
  
                    /* Unresolved local var: long discrim@[???] */
  if (*di->n != '_') {
    return 1;
  }
  di->n = di->n + 1;
  uVar1 = d_number(di);
  return uVar1 >> 0x1f ^ 1;
}



----------------------------------------

// Function: d_add_substitution @ 089cdc10

int d_add_substitution(d_info *di,demangle_component *dc)

{
  int iVar1;
  
  if (dc != (demangle_component *)0x0) {
    iVar1 = di->next_sub;
    if (iVar1 < di->num_subs) {
      di->next_sub = iVar1 + 1;
      di->subs[iVar1] = dc;
      return 1;
    }
  }
  return 0;
}



----------------------------------------

// Function: d_substitution @ 089cdc54

demangle_component * d_substitution(d_info *di,int prefix)

{
  demangle_component *pdVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  d_standard_sub_info *pdVar6;
  uint uVar7;
  
                    /* Unresolved local var: char c@[???] */
  pcVar5 = di->n;
  cVar2 = *pcVar5;
  di->n = pcVar5 + 1;
  if (cVar2 == 'S') {
    cVar2 = pcVar5[1];
    iVar4 = (int)cVar2;
    di->n = pcVar5 + 2;
    if (iVar4 == 0x5f) {
      iVar3 = 0;
    }
    else {
      if ((byte)(cVar2 - 0x30U) < 10) {
        iVar3 = 0;
      }
      else {
        if (0x19 < (byte)(cVar2 + 0xbfU)) {
          uVar7 = -((di->options << 0x1c) >> 0x1f);
          if ((uVar7 == 0) && (prefix != 0)) {
            uVar7 = (uint)((byte)(pcVar5[2] + 0xbdU) < 2);
          }
          pdVar6 = standard_subs;
          cVar2 = standard_subs[0].code;
          while( true ) {
            if (cVar2 == iVar4) {
                    /* Unresolved local var: char * s@[???]
                       Unresolved local var: int len@[???] */
              if (pdVar6->set_last_name != (char *)0x0) {
                pdVar1 = d_make_sub(di,pdVar6->set_last_name,pdVar6->set_last_name_len);
                di->last_name = pdVar1;
              }
              if (uVar7 == 0) {
                iVar4 = pdVar6->simple_len;
                pcVar5 = pdVar6->simple_expansion;
              }
              else {
                iVar4 = pdVar6->full_len;
                pcVar5 = pdVar6->full_expansion;
              }
              di->expansion = di->expansion + iVar4;
              pdVar1 = d_make_sub(di,pcVar5,iVar4);
              return pdVar1;
            }
            pdVar6 = pdVar6 + 1;
            if ((d_standard_sub_info *)((int)&standard_subs[6].set_last_name_len + 3) < pdVar6)
            break;
            cVar2 = pdVar6->code;
          }
          return (demangle_component *)0x0;
        }
        iVar3 = 0;
      }
      do {
                    /* Unresolved local var: int id@[???] */
        if ((byte)(cVar2 - 0x30U) < 10) {
          iVar3 = iVar3 * 0x24 + iVar4 + -0x30;
        }
        else {
          if (0x19 < (byte)(cVar2 + 0xbfU)) {
            return (demangle_component *)0x0;
          }
          iVar3 = iVar3 * 0x24 + iVar4 + -0x37;
        }
        cVar2 = *di->n;
        iVar4 = (int)cVar2;
        di->n = di->n + 1;
      } while (iVar4 != 0x5f);
      iVar3 = iVar3 + 1;
    }
    if (iVar3 < di->next_sub) {
      di->did_subs = di->did_subs + 1;
      return di->subs[iVar3];
    }
  }
                    /* Unresolved local var: int verbose@[???]
                       Unresolved local var: d_standard_sub_info * p@[???]
                       Unresolved local var: d_standard_sub_info * pend@[???] */
  return (demangle_component *)0x0;
}



----------------------------------------

// Function: d_print_error @ 089cde4c

void d_print_error(d_print_info *dpi)

{
  free(dpi->buf);
  dpi->buf = (char *)0x0;
  return;
}



----------------------------------------

// Function: d_source_name @ 089cde78

demangle_component * d_source_name(d_info *di)

{
  long len;
  demangle_component *pdVar1;
  int iVar2;
  char cVar3;
  char *pcVar4;
  char *s;
  
                    /* Unresolved local var: long len@[???]
                       Unresolved local var: demangle_component * ret@[???] */
  len = d_number(di);
  if (len < 1) {
    return (demangle_component *)0x0;
  }
                    /* Unresolved local var: char * name@[???] */
  s = di->n;
  pdVar1 = (demangle_component *)0x0;
  if ((int)di->send - (int)s < len) goto LAB_089cdf34;
  pcVar4 = s + len;
  di->n = pcVar4;
  if (((di->options & 4U) != 0) && (*pcVar4 == '$')) {
    di->n = pcVar4 + 1;
  }
  if ((9 < len) && (iVar2 = memcmp(s,"_GLOBAL_",8), iVar2 == 0)) {
                    /* Unresolved local var: char * s@[???] */
    cVar3 = s[8];
    if ((cVar3 == '.') || (cVar3 == '_')) {
      cVar3 = s[9];
    }
    else {
      if (cVar3 != '$') goto LAB_089cdf28;
      cVar3 = s[9];
    }
    if (cVar3 == 'N') {
      di->expansion = (di->expansion - len) + 0x16;
      pdVar1 = d_make_name(di,"(anonymous namespace)",0x15);
      di->last_name = pdVar1;
      return pdVar1;
    }
  }
LAB_089cdf28:
  pdVar1 = d_make_name(di,s,len);
LAB_089cdf34:
  di->last_name = pdVar1;
  return pdVar1;
}



----------------------------------------

// Function: d_expression @ 089cdfb0

demangle_component * d_expression(d_info *di)

{
  char cVar1;
  demangle_component *pdVar2;
  int iVar3;
  demangle_component *pdVar4;
  demangle_component *right;
  demangle_component_type dVar5;
  char *pcVar6;
  demangle_component *pdVar7;
  
                    /* Unresolved local var: char peek@[???] */
  pcVar6 = di->n;
  cVar1 = *pcVar6;
  if (cVar1 == 'L') {
    pdVar2 = d_expr_primary(di);
    return pdVar2;
  }
  if (cVar1 == 'T') {
    pdVar2 = d_template_param(di);
    return pdVar2;
  }
  if ((cVar1 == 's') && (pcVar6[1] == 'r')) {
    di->n = pcVar6 + 2;
    pdVar2 = d_type(di);
    pdVar7 = d_unqualified_name(di);
    if (*di->n == 'I') {
      pdVar4 = d_template_args(di);
      pdVar7 = d_make_comp(di,DEMANGLE_COMPONENT_TEMPLATE,pdVar7,pdVar4);
      dVar5 = DEMANGLE_COMPONENT_QUAL_NAME;
    }
    else {
      dVar5 = DEMANGLE_COMPONENT_QUAL_NAME;
    }
    goto LAB_089ce088;
  }
                    /* Unresolved local var: demangle_component * op@[???]
                       Unresolved local var: int args@[???] */
  pdVar2 = d_operator_name(di);
  if (pdVar2 == (demangle_component *)0x0) {
    return (demangle_component *)0x0;
  }
  dVar5 = pdVar2->type;
  if (dVar5 == DEMANGLE_COMPONENT_OPERATOR) {
    di->expansion =
         (int)(((pdVar2->u).s_binary.left)->u).s_extended_operator.name + di->expansion + -2;
    pdVar7 = (pdVar2->u).s_binary.left;
    iVar3 = strcmp((char *)pdVar7->type,"st");
    if (iVar3 == 0) {
      pdVar7 = d_type(di);
      pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_UNARY,pdVar2,pdVar7);
      return pdVar2;
    }
LAB_089ce04c:
    pcVar6 = (char *)pdVar7[1].type;
  }
  else if (dVar5 == DEMANGLE_COMPONENT_EXTENDED_OPERATOR) {
    pcVar6 = (pdVar2->u).s_name.s;
  }
  else {
    if (dVar5 != DEMANGLE_COMPONENT_CAST) {
      if (dVar5 != DEMANGLE_COMPONENT_OPERATOR) {
        return (demangle_component *)0x0;
      }
      pdVar7 = (demangle_component *)(pdVar2->u).s_extended_operator.args;
      goto LAB_089ce04c;
    }
    pcVar6 = (char *)0x1;
  }
  if (pcVar6 == (char *)0x2) {
                    /* Unresolved local var: demangle_component * left@[???] */
    pdVar7 = d_expression(di);
    pdVar4 = d_expression(di);
    pdVar7 = d_make_comp(di,DEMANGLE_COMPONENT_BINARY_ARGS,pdVar7,pdVar4);
    pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_BINARY,pdVar2,pdVar7);
    return pdVar2;
  }
  if (pcVar6 == (char *)0x3) {
                    /* Unresolved local var: demangle_component * first@[???]
                       Unresolved local var: demangle_component * second@[???] */
    pdVar7 = d_expression(di);
    pdVar4 = d_expression(di);
    right = d_expression(di);
    pdVar4 = d_make_comp(di,DEMANGLE_COMPONENT_TRINARY_ARG2,pdVar4,right);
    pdVar7 = d_make_comp(di,DEMANGLE_COMPONENT_TRINARY_ARG1,pdVar7,pdVar4);
    dVar5 = DEMANGLE_COMPONENT_TRINARY;
  }
  else {
    if (pcVar6 != (char *)0x1) {
      return (demangle_component *)0x0;
    }
    pdVar7 = d_expression(di);
    dVar5 = DEMANGLE_COMPONENT_UNARY;
  }
LAB_089ce088:
                    /* Unresolved local var: demangle_component * type@[???]
                       Unresolved local var: demangle_component * name@[???] */
  pdVar2 = d_make_comp(di,dVar5,pdVar2,pdVar7);
  return pdVar2;
}



----------------------------------------

// Function: d_type @ 089ce274

/* WARNING: Type propagation algorithm not settling */

demangle_component * d_type(d_info *di)

{
  char cVar1;
  demangle_component **ppdVar2;
  demangle_component *pdVar3;
  demangle_component *pdVar4;
  char *pcVar5;
  int iVar6;
  char *pcVar7;
  char *pcVar8;
  demangle_component *local_18;
  demangle_component *local_14;
  char *pcVar9;
  
                    /* Unresolved local var: char peek@[???]
                       Unresolved local var: demangle_component * ret@[???]
                       Unresolved local var: int can_subst@[???] */
  pcVar7 = di->n;
  iVar6 = (int)*pcVar7;
  if (((iVar6 == 0x72) || (iVar6 == 0x56)) || (iVar6 == 0x4b)) {
                    /* Unresolved local var: demangle_component * * pret@[???] */
    ppdVar2 = d_cv_qualifiers(di,&local_18,0);
    if (ppdVar2 == (demangle_component **)0x0) {
      return (demangle_component *)0x0;
    }
    pdVar3 = d_type(di);
    *ppdVar2 = pdVar3;
    iVar6 = d_add_substitution(di,local_18);
  }
  else {
    switch(iVar6 - 0x30U & 0xff) {
    case 0:
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:
    case 0x1e:
    case 0x2a:
      local_18 = d_class_enum_type(di);
      break;
    case 10:
    case 0xb:
    case 0xc:
    case 0xd:
    case 0xe:
    case 0xf:
    case 0x10:
    case 0x12:
    case 0x14:
    case 0x15:
    case 0x18:
    case 0x19:
    case 0x1a:
    case 0x1b:
    case 0x1c:
    case 0x1f:
    case 0x21:
    case 0x26:
    case 0x27:
    case 0x28:
    case 0x29:
    case 0x2b:
    case 0x2c:
    case 0x2d:
    case 0x2e:
    case 0x2f:
    case 0x30:
    case 0x3b:
    case 0x40:
    case 0x41:
    case 0x42:
      return (demangle_component *)0x0;
    case 0x11:
                    /* Unresolved local var: char peek@[???]
                       Unresolved local var: demangle_component * dim@[???] */
      pcVar5 = pcVar7 + 1;
      di->n = pcVar5;
      if (pcVar7[1] == 0x5f) {
        pdVar3 = (demangle_component *)0x0;
        di->n = pcVar7 + 2;
      }
      else {
        pcVar9 = pcVar5;
        if (((int)pcVar7[1] - 0x30U & 0xff) < 10) {
          do {
                    /* Unresolved local var: char * s@[???] */
            pcVar8 = pcVar9 + 1;
            di->n = pcVar8;
            pcVar7 = pcVar9 + 1;
            pcVar9 = pcVar8;
          } while ((byte)(*pcVar7 - 0x30U) < 10);
          pdVar3 = d_make_name(di,pcVar5,(int)pcVar8 - (int)pcVar5);
        }
        else {
          pdVar3 = d_expression(di);
        }
        if ((pdVar3 == (demangle_component *)0x0) ||
           (cVar1 = *di->n, di->n = di->n + 1, cVar1 != '_')) goto LAB_089ce3cc;
      }
      pdVar4 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_ARRAY_TYPE,pdVar3,pdVar4);
      break;
    case 0x13:
      di->n = pcVar7 + 1;
      pdVar3 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_COMPLEX,pdVar3,(demangle_component *)0x0);
      break;
    case 0x16:
                    /* Unresolved local var: demangle_component * ret@[???] */
      di->n = pcVar7 + 1;
      if (pcVar7[1] == 'Y') {
        di->n = pcVar7 + 2;
      }
      local_18 = d_bare_function_type(di,1);
      cVar1 = *di->n;
      di->n = di->n + 1;
      if (cVar1 != 'E') {
        local_18 = (demangle_component *)0x0;
      }
      break;
    case 0x17:
      di->n = pcVar7 + 1;
      pdVar3 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_IMAGINARY,pdVar3,(demangle_component *)0x0);
      break;
    case 0x1d:
      di->n = pcVar7 + 1;
      pdVar3 = d_type(di);
      ppdVar2 = d_cv_qualifiers(di,&local_14,1);
      if (ppdVar2 == (demangle_component **)0x0) {
LAB_089ce3cc:
        local_18 = (demangle_component *)0x0;
      }
      else {
        pdVar4 = d_type(di);
        *ppdVar2 = pdVar4;
        local_18 = d_make_comp(di,DEMANGLE_COMPONENT_PTRMEM_TYPE,pdVar3,local_14);
      }
      break;
    case 0x20:
      di->n = pcVar7 + 1;
      pdVar3 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_POINTER,pdVar3,(demangle_component *)0x0);
      break;
    case 0x22:
      di->n = pcVar7 + 1;
      pdVar3 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_REFERENCE,pdVar3,(demangle_component *)0x0);
      break;
    case 0x23:
                    /* Unresolved local var: char peek_next@[???] */
      cVar1 = pcVar7[1];
      if ((((byte)(cVar1 - 0x30U) < 10) || (cVar1 == '_')) || ((byte)(cVar1 + 0xbfU) < 0x1a)) {
        local_18 = d_substitution(di,0);
        if (*di->n != 'I') {
          return local_18;
        }
LAB_089ce644:
        pdVar3 = local_18;
        pdVar4 = d_template_args(di);
        local_18 = d_make_comp(di,DEMANGLE_COMPONENT_TEMPLATE,pdVar3,pdVar4);
      }
      else {
        local_18 = d_class_enum_type(di);
        if ((local_18 != (demangle_component *)0x0) &&
           (local_18->type == DEMANGLE_COMPONENT_SUB_STD)) {
          return local_18;
        }
      }
      break;
    case 0x24:
      local_18 = d_template_param(di);
      if (*di->n == 'I') {
        iVar6 = d_add_substitution(di,local_18);
        if (iVar6 == 0) {
          return (demangle_component *)0x0;
        }
        goto LAB_089ce644;
      }
      break;
    case 0x25:
      di->n = pcVar7 + 1;
      local_18 = d_source_name(di);
      pdVar3 = d_type(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,pdVar3,local_18);
      break;
    case 0x31:
    case 0x32:
    case 0x33:
    case 0x34:
    case 0x35:
    case 0x36:
    case 0x37:
    case 0x38:
    case 0x39:
    case 0x3a:
    case 0x3c:
    case 0x3d:
    case 0x3e:
    case 0x3f:
    case 0x43:
    case 0x44:
    case 0x46:
    case 0x47:
    case 0x48:
    case 0x49:
    case 0x4a:
                    /* Unresolved local var: demangle_component * p@[???] */
      pdVar3 = (demangle_component *)0x0;
      if (&PTR_caseD_0_089f1638 + iVar6 * 5 != (undefined **)0x0) {
        pdVar3 = d_make_empty(di);
        if (pdVar3 == (demangle_component *)0x0) {
          pcVar7 = di->n;
        }
        else {
          (pdVar3->u).s_name.s = (char *)(&PTR_caseD_0_089f1638 + iVar6 * 5);
          pcVar7 = di->n;
          pdVar3->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
        }
      }
      pcVar5 = (((pdVar3->u).s_binary.left)->u).s_name.s;
      di->n = pcVar7 + 1;
      di->expansion = (int)(pcVar5 + di->expansion);
      return pdVar3;
    case 0x45:
      di->n = pcVar7 + 1;
      pdVar3 = d_source_name(di);
      local_18 = d_make_comp(di,DEMANGLE_COMPONENT_VENDOR_TYPE,pdVar3,(demangle_component *)0x0);
      break;
    default:
      goto switchD_089ce348_default;
    }
    iVar6 = d_add_substitution(di,local_18);
  }
  if (iVar6 != 0) {
    return local_18;
  }
switchD_089ce348_default:
  return (demangle_component *)0x0;
}



----------------------------------------

// Function: d_bare_function_type @ 089ce750

demangle_component * d_bare_function_type(d_info *di,int has_return_type)

{
  char cVar1;
  demangle_component *pdVar2;
  demangle_component *pdVar3;
  demangle_component *pdVar4;
  demangle_component **ppdVar5;
  demangle_component *local_20 [2];
  
                    /* Unresolved local var: demangle_component * return_type@[???]
                       Unresolved local var: demangle_component * tl@[???]
                       Unresolved local var: demangle_component * * ptl@[???] */
  ppdVar5 = local_20;
                    /* Unresolved local var: char peek@[???]
                       Unresolved local var: demangle_component * type@[???] */
  local_20[0] = (demangle_component *)0x0;
  cVar1 = *di->n;
  pdVar3 = (demangle_component *)0x0;
  while ((cVar1 != '\0' && (cVar1 != 'E'))) {
    pdVar2 = d_type(di);
    if (pdVar2 == (demangle_component *)0x0) {
      return (demangle_component *)0x0;
    }
    if (has_return_type == 0) {
      pdVar4 = d_make_comp(di,DEMANGLE_COMPONENT_ARGLIST,pdVar2,(demangle_component *)0x0);
      *ppdVar5 = pdVar4;
      ppdVar5 = &(pdVar4->u).s_extended_operator.name;
      pdVar2 = pdVar3;
      if (pdVar4 == (demangle_component *)0x0) {
        return (demangle_component *)0x0;
      }
    }
    has_return_type = 0;
    pdVar3 = pdVar2;
    cVar1 = *di->n;
  }
  if (local_20[0] == (demangle_component *)0x0) {
    return (demangle_component *)0x0;
  }
  if ((((local_20[0]->u).s_name.len == 0) &&
      (pdVar2 = (local_20[0]->u).s_binary.left, pdVar2->type == DEMANGLE_COMPONENT_BUILTIN_TYPE)) &&
     (pdVar2 = (pdVar2->u).s_binary.left, pdVar2[1].u.s_name.s == (char *)0x9)) {
    local_20[0] = (demangle_component *)0x0;
    di->expansion = di->expansion - (pdVar2->u).s_extended_operator.args;
  }
  pdVar3 = d_make_comp(di,DEMANGLE_COMPONENT_FUNCTION_TYPE,pdVar3,local_20[0]);
  return pdVar3;
}



----------------------------------------

// Function: d_operator_name @ 089ce898

/* WARNING: Removing unreachable block (ram,0x089ce8fc) */

demangle_component * d_operator_name(d_info *di)

{
  char cVar1;
  char cVar2;
  char *pcVar3;
  int iVar4;
  demangle_component *pdVar5;
  demangle_component *pdVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  int iVar10;
  uint uVar11;
  
                    /* Unresolved local var: char c1@[???]
                       Unresolved local var: char c2@[???] */
  pcVar3 = di->n;
  cVar1 = *pcVar3;
  di->n = pcVar3 + 1;
  iVar10 = (int)pcVar3[1];
  di->n = pcVar3 + 2;
  if (cVar1 == 'v') {
    uVar11 = iVar10 - 0x30;
    if ((uVar11 & 0xff) < 10) {
      pdVar6 = d_source_name(di);
      pdVar5 = d_make_empty(di);
                    /* Unresolved local var: demangle_component * p@[???] */
      if (pdVar5 == (demangle_component *)0x0) {
        return (demangle_component *)0x0;
      }
      if (-1 < (int)uVar11) {
        if (pdVar6 == (demangle_component *)0x0) {
          return (demangle_component *)0x0;
        }
        pdVar5->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR;
        (pdVar5->u).s_extended_operator.args = uVar11;
        (pdVar5->u).s_extended_operator.name = pdVar6;
        return pdVar5;
      }
      return (demangle_component *)0x0;
    }
  }
  else if ((cVar1 == 'c') && (iVar10 == 0x76)) {
    pdVar6 = d_type(di);
    pdVar6 = d_make_comp(di,DEMANGLE_COMPONENT_CAST,pdVar6,(demangle_component *)0x0);
    return pdVar6;
  }
  iVar8 = 0;
                    /* Unresolved local var: int low@[???]
                       Unresolved local var: int high@[???]
                       Unresolved local var: int i@[???]
                       Unresolved local var: demangle_operator_info * p@[???] */
  iVar4 = 0x31;
  iVar9 = 0x31;
  do {
    while( true ) {
      iVar7 = iVar8 + iVar4 / 2;
      pcVar3 = cplus_demangle_operators[iVar7].code;
      cVar2 = *pcVar3;
      if (cVar1 != cVar2) break;
      iVar4 = (int)pcVar3[1];
      if (iVar10 == iVar4) {
        pdVar6 = d_make_empty(di);
                    /* Unresolved local var: demangle_component * p@[???] */
        if (pdVar6 != (demangle_component *)0x0) {
          pdVar6->type = DEMANGLE_COMPONENT_OPERATOR;
          (pdVar6->u).s_binary.left = (demangle_component *)(cplus_demangle_operators + iVar7);
          return pdVar6;
        }
        return (demangle_component *)0x0;
      }
      if (iVar10 < iVar4) goto LAB_089ce938;
LAB_089ce96c:
      iVar8 = iVar7 + 1;
      iVar4 = iVar9 - iVar8;
      if (iVar9 == iVar8) {
        return (demangle_component *)0x0;
      }
    }
    if (cVar2 <= cVar1) goto LAB_089ce96c;
LAB_089ce938:
    iVar4 = iVar7 - iVar8;
    iVar9 = iVar7;
    if (iVar7 == iVar8) {
      return (demangle_component *)0x0;
    }
  } while( true );
}



----------------------------------------

// Function: d_unqualified_name @ 089cea3c

demangle_component * d_unqualified_name(d_info *di)

{
  demangle_component *pdVar1;
  demangle_component *pdVar2;
  char cVar3;
  char *pcVar4;
  int iVar5;
  
                    /* Unresolved local var: char peek@[???] */
  pcVar4 = di->n;
  cVar3 = *pcVar4;
  if ((byte)(cVar3 - 0x30U) < 10) {
    pdVar1 = d_source_name(di);
    return pdVar1;
  }
  if ((byte)(cVar3 + 0x9fU) < 0x1a) {
                    /* Unresolved local var: demangle_component * ret@[???] */
    pdVar1 = d_operator_name(di);
    if (pdVar1 == (demangle_component *)0x0) {
      return (demangle_component *)0x0;
    }
    if (pdVar1->type != DEMANGLE_COMPONENT_OPERATOR) {
      return pdVar1;
    }
    di->expansion =
         (int)&((((pdVar1->u).s_binary.left)->u).s_extended_operator.name)->u + di->expansion + 3;
    return pdVar1;
  }
  if (1 < (byte)(cVar3 + 0xbdU)) {
    return (demangle_component *)0x0;
  }
  pdVar1 = di->last_name;
  if (pdVar1 == (demangle_component *)0x0) {
    cVar3 = *pcVar4;
    goto LAB_089ceb40;
  }
  if (pdVar1->type == DEMANGLE_COMPONENT_NAME) {
    iVar5 = di->expansion;
LAB_089cebb4:
    di->expansion = (int)&((pdVar1->u).s_extended_operator.name)->type + iVar5;
  }
  else if (pdVar1->type == DEMANGLE_COMPONENT_SUB_STD) {
    iVar5 = di->expansion;
    goto LAB_089cebb4;
  }
  cVar3 = *pcVar4;
LAB_089ceb40:
  di->n = pcVar4 + 1;
  if (cVar3 == 'C') {
                    /* Unresolved local var: gnu_v3_ctor_kinds kind@[???] */
    cVar3 = pcVar4[1];
    di->n = pcVar4 + 2;
    if (cVar3 == '2') {
      iVar5 = 2;
    }
    else if (cVar3 == '3') {
      iVar5 = 3;
    }
    else {
      if (cVar3 != '1') {
        return (demangle_component *)0x0;
      }
      iVar5 = 1;
    }
    pdVar2 = d_make_empty(di);
                    /* Unresolved local var: demangle_component * p@[???] */
    if (pdVar2 != (demangle_component *)0x0) {
      if (pdVar1 == (demangle_component *)0x0) {
        return (demangle_component *)0x0;
      }
      pdVar2->type = DEMANGLE_COMPONENT_CTOR;
      (pdVar2->u).s_extended_operator.args = iVar5;
      (pdVar2->u).s_extended_operator.name = pdVar1;
    }
  }
  else {
    if (cVar3 != 'D') {
                    /* Unresolved local var: gnu_v3_dtor_kinds kind@[???]
                       Unresolved local var: demangle_component * p@[???] */
      return (demangle_component *)0x0;
    }
    cVar3 = pcVar4[1];
    di->n = pcVar4 + 2;
    if (cVar3 == '1') {
      iVar5 = 2;
    }
    else if (cVar3 == '2') {
      iVar5 = 3;
    }
    else {
      if (cVar3 != '0') {
        return (demangle_component *)0x0;
      }
      iVar5 = 1;
    }
    pdVar2 = d_make_empty(di);
    if (pdVar2 != (demangle_component *)0x0) {
      if (pdVar1 == (demangle_component *)0x0) {
        return (demangle_component *)0x0;
      }
      pdVar2->type = DEMANGLE_COMPONENT_DTOR;
      (pdVar2->u).s_extended_operator.args = iVar5;
      (pdVar2->u).s_extended_operator.name = pdVar1;
    }
  }
  return pdVar2;
}



----------------------------------------

// Function: d_name @ 089cec38

demangle_component * d_name(d_info *di)

{
  char cVar1;
  demangle_component *pdVar2;
  demangle_component *pdVar3;
  demangle_component **ppdVar4;
  int iVar5;
  char *pcVar6;
  demangle_component_type type;
  demangle_component *local_28 [2];
  
                    /* Unresolved local var: char peek@[???]
                       Unresolved local var: demangle_component * dc@[???] */
  pcVar6 = di->n;
  cVar1 = *pcVar6;
  if (cVar1 == 'S') {
                    /* Unresolved local var: int subst@[???] */
    cVar1 = pcVar6[1];
    if (cVar1 == 't') {
      di->n = pcVar6 + 2;
      pdVar2 = d_make_name(di,"std",3);
      pdVar3 = d_unqualified_name(di);
      pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_QUAL_NAME,pdVar2,pdVar3);
      di->expansion = di->expansion + 3;
    }
    else {
      pdVar2 = d_substitution(di,0);
    }
    if (*di->n != 'I') {
      return pdVar2;
    }
    if (cVar1 != 't') goto LAB_089ced0c;
  }
  else {
    if (cVar1 == 'Z') {
                    /* Unresolved local var: demangle_component * function@[???] */
      di->n = pcVar6 + 1;
      pdVar2 = d_encoding(di,0);
      pcVar6 = di->n;
      cVar1 = *pcVar6;
      di->n = pcVar6 + 1;
      if (cVar1 != 'E') {
        return (demangle_component *)0x0;
      }
      if (pcVar6[1] == 's') {
        di->n = pcVar6 + 2;
        iVar5 = d_discriminator(di);
        if (iVar5 == 0) {
          return (demangle_component *)0x0;
        }
        pdVar3 = d_make_name(di,"string literal",0xe);
        pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_LOCAL_NAME,pdVar2,pdVar3);
      }
      else {
        pdVar3 = d_name(di);
        iVar5 = d_discriminator(di);
                    /* Unresolved local var: demangle_component * name@[???] */
        if (iVar5 == 0) {
          return (demangle_component *)0x0;
        }
        pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_LOCAL_NAME,pdVar2,pdVar3);
      }
      return pdVar2;
    }
    if (cVar1 == 'N') {
      di->n = pcVar6 + 1;
      ppdVar4 = d_cv_qualifiers(di,local_28,1);
      if (ppdVar4 == (demangle_component **)0x0) {
        return (demangle_component *)0x0;
      }
      pcVar6 = di->n;
      pdVar2 = (demangle_component *)0x0;
      do {
                    /* Unresolved local var: demangle_component * ret@[???]
                       Unresolved local var: char peek@[???]
                       Unresolved local var: demangle_component_type comb_type@[???]
                       Unresolved local var: demangle_component * dc@[???] */
        cVar1 = *pcVar6;
        if (cVar1 == '\0') {
LAB_089ceed8:
          *ppdVar4 = (demangle_component *)0x0;
          return (demangle_component *)0x0;
        }
        if (((((byte)(cVar1 - 0x30U) < 10) || ((byte)(cVar1 + 0x9fU) < 0x1a)) || (cVar1 == 'C')) ||
           (cVar1 == 'D')) {
          pdVar3 = d_unqualified_name(di);
LAB_089cee40:
          type = DEMANGLE_COMPONENT_QUAL_NAME;
          if (pdVar2 != (demangle_component *)0x0) goto LAB_089cee48;
        }
        else {
          if (cVar1 == 'S') {
            pdVar3 = d_substitution(di,1);
            goto LAB_089cee40;
          }
          if (cVar1 != 'I') {
            if (cVar1 == 'T') {
              pdVar3 = d_template_param(di);
              goto LAB_089cee40;
            }
            if (cVar1 == 'E') {
              *ppdVar4 = pdVar2;
              if (pdVar2 == (demangle_component *)0x0) {
                return (demangle_component *)0x0;
              }
              cVar1 = *pcVar6;
              di->n = pcVar6 + 1;
              if (cVar1 == 'E') {
                return local_28[0];
              }
              return (demangle_component *)0x0;
            }
            goto LAB_089ceed8;
          }
          if (pdVar2 == (demangle_component *)0x0) goto LAB_089ceed8;
          pdVar3 = d_template_args(di);
          type = DEMANGLE_COMPONENT_TEMPLATE;
LAB_089cee48:
          pdVar3 = d_make_comp(di,type,pdVar2,pdVar3);
        }
        pcVar6 = di->n;
        pdVar2 = pdVar3;
        if ((cVar1 != 'S') && (*pcVar6 != 'E')) {
          iVar5 = d_add_substitution(di,pdVar3);
          if (iVar5 == 0) goto LAB_089ceed8;
          pcVar6 = di->n;
        }
      } while( true );
    }
    pdVar2 = d_unqualified_name(di);
    if (*di->n != 'I') {
      return pdVar2;
    }
  }
  iVar5 = d_add_substitution(di,pdVar2);
  if (iVar5 == 0) {
    return (demangle_component *)0x0;
  }
LAB_089ced0c:
  pdVar3 = d_template_args(di);
  pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_TEMPLATE,pdVar2,pdVar3);
  return pdVar2;
}



----------------------------------------

// Function: d_class_enum_type @ 089ceff4

demangle_component * d_class_enum_type(d_info *di)

{
  char cVar1;
  demangle_component *pdVar2;
  demangle_component *pdVar3;
  demangle_component **ppdVar4;
  int iVar5;
  char *pcVar6;
  demangle_component_type type;
  demangle_component *apdStack_28 [2];
  
  pcVar6 = di->n;
  cVar1 = *pcVar6;
  if (cVar1 == 'S') {
    cVar1 = pcVar6[1];
    if (cVar1 == 't') {
      di->n = pcVar6 + 2;
      pdVar2 = d_make_name(di,"std",3);
      pdVar3 = d_unqualified_name(di);
      pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_QUAL_NAME,pdVar2,pdVar3);
      di->expansion = di->expansion + 3;
    }
    else {
      pdVar2 = d_substitution(di,0);
    }
    if (*di->n != 'I') {
      return pdVar2;
    }
    if (cVar1 != 't') goto LAB_089ced0c;
  }
  else {
    if (cVar1 == 'Z') {
      di->n = pcVar6 + 1;
      pdVar2 = d_encoding(di,0);
      pcVar6 = di->n;
      cVar1 = *pcVar6;
      di->n = pcVar6 + 1;
      if (cVar1 != 'E') {
        return (demangle_component *)0x0;
      }
      if (pcVar6[1] == 's') {
        di->n = pcVar6 + 2;
        iVar5 = d_discriminator(di);
        if (iVar5 == 0) {
          return (demangle_component *)0x0;
        }
        pdVar3 = d_make_name(di,"string literal",0xe);
        pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_LOCAL_NAME,pdVar2,pdVar3);
      }
      else {
        pdVar3 = d_name(di);
        iVar5 = d_discriminator(di);
        if (iVar5 == 0) {
          return (demangle_component *)0x0;
        }
        pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_LOCAL_NAME,pdVar2,pdVar3);
      }
      return pdVar2;
    }
    if (cVar1 == 'N') {
      di->n = pcVar6 + 1;
      ppdVar4 = d_cv_qualifiers(di,apdStack_28,1);
      if (ppdVar4 == (demangle_component **)0x0) {
        return (demangle_component *)0x0;
      }
      pcVar6 = di->n;
      pdVar2 = (demangle_component *)0x0;
      do {
        cVar1 = *pcVar6;
        if (cVar1 == '\0') {
LAB_089ceed8:
          *ppdVar4 = (demangle_component *)0x0;
          return (demangle_component *)0x0;
        }
        if (((((byte)(cVar1 - 0x30U) < 10) || ((byte)(cVar1 + 0x9fU) < 0x1a)) || (cVar1 == 'C')) ||
           (cVar1 == 'D')) {
          pdVar3 = d_unqualified_name(di);
LAB_089cee40:
          type = DEMANGLE_COMPONENT_QUAL_NAME;
          if (pdVar2 != (demangle_component *)0x0) goto LAB_089cee48;
        }
        else {
          if (cVar1 == 'S') {
            pdVar3 = d_substitution(di,1);
            goto LAB_089cee40;
          }
          if (cVar1 != 'I') {
            if (cVar1 == 'T') {
              pdVar3 = d_template_param(di);
              goto LAB_089cee40;
            }
            if (cVar1 == 'E') {
              *ppdVar4 = pdVar2;
              if (pdVar2 == (demangle_component *)0x0) {
                return (demangle_component *)0x0;
              }
              cVar1 = *pcVar6;
              di->n = pcVar6 + 1;
              if (cVar1 == 'E') {
                return apdStack_28[0];
              }
              return (demangle_component *)0x0;
            }
            goto LAB_089ceed8;
          }
          if (pdVar2 == (demangle_component *)0x0) goto LAB_089ceed8;
          pdVar3 = d_template_args(di);
          type = DEMANGLE_COMPONENT_TEMPLATE;
LAB_089cee48:
          pdVar3 = d_make_comp(di,type,pdVar2,pdVar3);
        }
        pcVar6 = di->n;
        pdVar2 = pdVar3;
        if ((cVar1 != 'S') && (*pcVar6 != 'E')) {
          iVar5 = d_add_substitution(di,pdVar3);
          if (iVar5 == 0) goto LAB_089ceed8;
          pcVar6 = di->n;
        }
      } while( true );
    }
    pdVar2 = d_unqualified_name(di);
    if (*di->n != 'I') {
      return pdVar2;
    }
  }
  iVar5 = d_add_substitution(di,pdVar2);
  if (iVar5 == 0) {
    return (demangle_component *)0x0;
  }
LAB_089ced0c:
  pdVar3 = d_template_args(di);
  pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_TEMPLATE,pdVar2,pdVar3);
  return pdVar2;
}



----------------------------------------

// Function: d_encoding @ 089ceffc

demangle_component * d_encoding(d_info *di,int top_level)

{
  char cVar1;
  demangle_component *pdVar2;
  long lVar3;
  demangle_component_type dVar4;
  char *pcVar5;
  int iVar6;
  demangle_component *pdVar7;
  
                    /* Unresolved local var: char peek@[???] */
  pcVar5 = di->n;
  if (*pcVar5 == 'G') {
                    /* Unresolved local var: char c@[???] */
    iVar6 = di->expansion;
  }
  else {
    if (*pcVar5 != 'T') {
                    /* Unresolved local var: demangle_component * dc@[???] */
      pdVar2 = d_name(di);
      if (pdVar2 == (demangle_component *)0x0) {
        pcVar5 = di->n;
      }
      else if (top_level == 0) {
        pcVar5 = di->n;
      }
      else {
        if ((di->options & 1U) == 0) {
          dVar4 = pdVar2->type;
          while (dVar4 - DEMANGLE_COMPONENT_RESTRICT_THIS < 3) {
            pdVar2 = (pdVar2->u).s_binary.left;
            dVar4 = pdVar2->type;
          }
          if (dVar4 != DEMANGLE_COMPONENT_LOCAL_NAME) {
            return pdVar2;
          }
                    /* Unresolved local var: demangle_component * dcr@[???] */
          pdVar7 = (pdVar2->u).s_extended_operator.name;
          if (2 < pdVar7->type - DEMANGLE_COMPONENT_RESTRICT_THIS) {
            (pdVar2->u).s_extended_operator.name = pdVar7;
            return pdVar2;
          }
          for (pdVar7 = (pdVar7->u).s_binary.left;
              pdVar7->type - DEMANGLE_COMPONENT_RESTRICT_THIS < 3;
              pdVar7 = (pdVar7->u).s_binary.left) {
          }
          (pdVar2->u).s_extended_operator.name = pdVar7;
          return pdVar2;
        }
        pcVar5 = di->n;
      }
      if (*pcVar5 == '\0') {
        return pdVar2;
      }
      if (*pcVar5 == 'E') {
        return pdVar2;
      }
      iVar6 = has_return_type(pdVar2);
      pdVar7 = d_bare_function_type(di,iVar6);
      dVar4 = DEMANGLE_COMPONENT_TYPED_NAME;
      goto LAB_089cf140;
    }
    iVar6 = di->expansion;
  }
  di->expansion = iVar6 + 0x14;
  cVar1 = *pcVar5;
  di->n = pcVar5 + 1;
  if (cVar1 == 'T') {
    cVar1 = pcVar5[1];
    di->n = pcVar5 + 2;
    switch(cVar1 + -0x43) {
    case '\0':
      pdVar7 = d_type(di);
      lVar3 = d_number(di);
                    /* Unresolved local var: demangle_component * derived_type@[???]
                       Unresolved local var: long offset@[???]
                       Unresolved local var: demangle_component * base_type@[???] */
      if (lVar3 < 0) {
        return (demangle_component *)0x0;
      }
      cVar1 = *di->n;
      di->n = di->n + 1;
      if (cVar1 != '_') {
        return (demangle_component *)0x0;
      }
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE;
      di->expansion = di->expansion + 5;
      break;
    case '\x01':
    case '\x02':
    case '\x04':
    case '\x05':
    case '\b':
    case '\t':
    case '\n':
    case '\v':
    case '\f':
    case '\r':
    case '\x0e':
    case '\x0f':
    case '\x12':
    case '\x14':
    case '\x15':
    case '\x16':
    case '\x17':
    case '\x18':
    case '\x19':
    case '\x1a':
    case '\x1b':
    case '\x1c':
    case '\x1d':
    case '\x1e':
    case '\x1f':
    case '!':
    case '\"':
    case '#':
    case '$':
    case '&':
    case '\'':
    case '(':
    case ')':
    case '*':
    case '+':
    case ',':
    case '-':
    case '.':
    case '/':
    case '0':
    case '1':
    case '2':
      return (demangle_component *)0x0;
    case '\x03':
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_TYPEINFO_FN;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '\x06':
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_TYPEINFO;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '\a':
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_JAVA_CLASS;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '\x10':
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_TYPEINFO_NAME;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '\x11':
      di->expansion = iVar6 + 10;
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_VTT;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '\x13':
      di->expansion = iVar6 + 0xf;
      pdVar2 = d_type(di);
      dVar4 = DEMANGLE_COMPONENT_VTABLE;
      pdVar7 = (demangle_component *)0x0;
      break;
    case ' ':
      iVar6 = d_call_offset(di,0);
      if (iVar6 == 0) {
        return (demangle_component *)0x0;
      }
      iVar6 = d_call_offset(di,0);
      if (iVar6 == 0) {
        return (demangle_component *)0x0;
      }
      pdVar2 = d_encoding(di,0);
      dVar4 = DEMANGLE_COMPONENT_COVARIANT_THUNK;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '%':
      iVar6 = d_call_offset(di,0x68);
      if (iVar6 == 0) {
        return (demangle_component *)0x0;
      }
      pdVar2 = d_encoding(di,0);
      dVar4 = DEMANGLE_COMPONENT_THUNK;
      pdVar7 = (demangle_component *)0x0;
      break;
    case '3':
      iVar6 = d_call_offset(di,0x76);
      if (iVar6 == 0) {
        return (demangle_component *)0x0;
      }
      pdVar2 = d_encoding(di,0);
      dVar4 = DEMANGLE_COMPONENT_VIRTUAL_THUNK;
      pdVar7 = (demangle_component *)0x0;
      break;
    default:
      return (demangle_component *)0x0;
    }
  }
  else {
    if (cVar1 != 'G') {
      return (demangle_component *)0x0;
    }
    cVar1 = pcVar5[1];
    di->n = pcVar5 + 2;
    if (cVar1 == 'R') {
      pdVar2 = d_name(di);
      dVar4 = DEMANGLE_COMPONENT_REFTEMP;
      pdVar7 = (demangle_component *)0x0;
    }
    else if (cVar1 == 'V') {
      pdVar2 = d_name(di);
      dVar4 = DEMANGLE_COMPONENT_GUARD;
      pdVar7 = (demangle_component *)0x0;
    }
    else {
      if (cVar1 != 'A') {
        return (demangle_component *)0x0;
      }
      pdVar2 = d_encoding(di,0);
      dVar4 = DEMANGLE_COMPONENT_HIDDEN_ALIAS;
      pdVar7 = (demangle_component *)0x0;
    }
  }
LAB_089cf140:
  pdVar2 = d_make_comp(di,dVar4,pdVar2,pdVar7);
  return pdVar2;
}



----------------------------------------

// Function: d_mangled_name @ 089cf3d0

demangle_component * d_mangled_name(d_info *di,int top_level)

{
  char cVar1;
  demangle_component *pdVar2;
  char *pcVar3;
  
  pcVar3 = di->n;
  cVar1 = *pcVar3;
  di->n = pcVar3 + 1;
  if ((cVar1 == '_') && (cVar1 = pcVar3[1], di->n = pcVar3 + 2, cVar1 == 'Z')) {
    pdVar2 = d_encoding(di,top_level);
    return pdVar2;
  }
  return (demangle_component *)0x0;
}



----------------------------------------

// Function: d_expr_primary @ 089cf40c

demangle_component * d_expr_primary(d_info *di)

{
  char cVar1;
  demangle_component *pdVar2;
  demangle_component *pdVar3;
  char *pcVar4;
  char *pcVar5;
  int len;
  demangle_component_type type;
  
                    /* Unresolved local var: demangle_component * ret@[???] */
  pcVar4 = di->n;
  cVar1 = *pcVar4;
  di->n = pcVar4 + 1;
  if (cVar1 != 'L') {
    return (demangle_component *)0x0;
  }
  if (pcVar4[1] == '_') {
    pdVar2 = d_mangled_name(di,0);
    goto LAB_089cf504;
  }
                    /* Unresolved local var: demangle_component * type@[???]
                       Unresolved local var: demangle_component_type t@[???]
                       Unresolved local var: char * s@[???] */
  pdVar2 = d_type(di);
  if (pdVar2 == (demangle_component *)0x0) {
    return (demangle_component *)0x0;
  }
  if (pdVar2->type == DEMANGLE_COMPONENT_BUILTIN_TYPE) {
    pdVar3 = (pdVar2->u).s_binary.left;
    if (pdVar3[1].u.s_name.s != (char *)0x0) {
      di->expansion = di->expansion - (pdVar3->u).s_extended_operator.args;
      goto LAB_089cf48c;
    }
    pcVar4 = di->n;
  }
  else {
LAB_089cf48c:
    pcVar4 = di->n;
  }
  if (*pcVar4 == 'n') {
    pcVar4 = pcVar4 + 1;
    type = DEMANGLE_COMPONENT_LITERAL_NEG;
    di->n = pcVar4;
  }
  else {
    type = DEMANGLE_COMPONENT_LITERAL;
  }
  cVar1 = *pcVar4;
  pcVar5 = pcVar4;
  if (cVar1 == 'E') {
    len = 0;
  }
  else {
    do {
      if (cVar1 == '\0') {
        return (demangle_component *)0x0;
      }
      pcVar5 = pcVar5 + 1;
      di->n = pcVar5;
      cVar1 = *pcVar5;
    } while (cVar1 != 'E');
    len = (int)pcVar5 - (int)pcVar4;
  }
  pdVar3 = d_make_name(di,pcVar4,len);
  pdVar2 = d_make_comp(di,type,pdVar2,pdVar3);
LAB_089cf504:
  cVar1 = *di->n;
  di->n = di->n + 1;
  if (cVar1 != 'E') {
    return (demangle_component *)0x0;
  }
  return pdVar2;
}



----------------------------------------

// Function: d_template_args @ 089cf57c

demangle_component * d_template_args(d_info *di)

{
  char cVar1;
  demangle_component *pdVar2;
  char *pcVar3;
  demangle_component **ppdVar4;
  demangle_component *pdVar5;
  demangle_component *local_28 [2];
  
                    /* Unresolved local var: demangle_component * hold_last_name@[???]
                       Unresolved local var: demangle_component * al@[???]
                       Unresolved local var: demangle_component * * pal@[???] */
  ppdVar4 = local_28;
  cVar1 = *di->n;
  pcVar3 = di->n + 1;
  pdVar5 = di->last_name;
  di->n = pcVar3;
  if (cVar1 != 'I') {
    return (demangle_component *)0x0;
  }
  local_28[0] = (demangle_component *)0x0;
  do {
    if (*pcVar3 == 'L') {
      pdVar2 = d_expr_primary(di);
    }
    else {
                    /* Unresolved local var: demangle_component * a@[???]
                       Unresolved local var: demangle_component * ret@[???] */
      if (*pcVar3 == 'X') {
        di->n = pcVar3 + 1;
        pdVar2 = d_expression(di);
        cVar1 = *di->n;
        di->n = di->n + 1;
        if (cVar1 != 'E') {
          return (demangle_component *)0x0;
        }
      }
      else {
        pdVar2 = d_type(di);
      }
    }
    if (pdVar2 == (demangle_component *)0x0) {
      return (demangle_component *)0x0;
    }
    pdVar2 = d_make_comp(di,DEMANGLE_COMPONENT_TEMPLATE_ARGLIST,pdVar2,(demangle_component *)0x0);
    *ppdVar4 = pdVar2;
    ppdVar4 = &(pdVar2->u).s_extended_operator.name;
    if (pdVar2 == (demangle_component *)0x0) {
      return (demangle_component *)0x0;
    }
    pcVar3 = di->n;
  } while (*pcVar3 != 'E');
  di->n = pcVar3 + 1;
  di->last_name = pdVar5;
  return local_28[0];
}



----------------------------------------

// Function: d_print_resize @ 089cf6c4

void d_print_resize(d_print_info *dpi,size_t add)

{
  size_t sVar1;
  char *ap;
  uint nbytes;
  
                    /* Unresolved local var: size_t need@[???] */
  ap = dpi->buf;
  if (ap != (char *)0x0) {
    sVar1 = dpi->len;
    nbytes = dpi->alc;
    while (nbytes < add + sVar1) {
      nbytes = nbytes << 1;
      ap = realloc(ap,nbytes);
      if (ap == (char *)0x0) {
        free(dpi->buf);
        dpi->allocation_failure = 1;
        dpi->buf = (char *)0x0;
        return;
      }
                    /* Unresolved local var: size_t newalc@[???]
                       Unresolved local var: char * newbuf@[???] */
      dpi->buf = ap;
      dpi->alc = nbytes;
    }
  }
  return;
}



----------------------------------------

// Function: d_print_append_buffer @ 089cf758

void d_print_append_buffer(d_print_info *dpi,char *s,size_t l)

{
  size_t sVar1;
  char *pcVar2;
  
  pcVar2 = dpi->buf;
  if (pcVar2 != (char *)0x0) {
    sVar1 = dpi->len;
    if (dpi->alc < l + sVar1) {
      d_print_resize(dpi,l);
      pcVar2 = dpi->buf;
      if (pcVar2 == (char *)0x0) {
        return;
      }
      sVar1 = dpi->len;
    }
    memcpy(pcVar2 + sVar1,s,l);
    dpi->len = dpi->len + l;
  }
  return;
}



----------------------------------------

// Function: d_print_append_char @ 089cf7e8

void d_print_append_char(d_print_info *dpi,int c)

{
  uint uVar1;
  char *pcVar2;
  
  pcVar2 = dpi->buf;
  if (pcVar2 != (char *)0x0) {
    uVar1 = dpi->len;
    if (dpi->alc <= uVar1) {
      d_print_resize(dpi,1);
      pcVar2 = dpi->buf;
      if (pcVar2 == (char *)0x0) {
        return;
      }
      uVar1 = dpi->len;
    }
    pcVar2[uVar1] = (char)c;
    dpi->len = dpi->len + 1;
  }
  return;
}



----------------------------------------

// Function: d_print_comp @ 089cf860

/* WARNING: Type propagation algorithm not settling */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

void d_print_comp(d_print_info *dpi,demangle_component *dc)

{
  bool bVar1;
  undefined1 uVar2;
  char cVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  undefined4 uVar9;
  undefined4 uVar10;
  undefined4 uVar11;
  undefined4 uVar12;
  undefined4 uVar13;
  undefined4 uVar14;
  undefined4 uVar15;
  undefined4 uVar16;
  undefined4 uVar17;
  undefined4 uVar18;
  undefined4 uVar19;
  undefined4 uVar20;
  undefined4 uVar21;
  undefined4 uVar22;
  undefined4 uVar23;
  undefined4 uVar24;
  undefined4 uVar25;
  undefined4 uVar26;
  undefined4 uVar27;
  undefined4 uVar28;
  undefined4 uVar29;
  undefined4 uVar30;
  undefined4 uVar31;
  undefined4 uVar32;
  undefined4 uVar33;
  undefined4 uVar34;
  undefined4 uVar35;
  demangle_component_type *in_zero;
  int iVar36;
  demangle_component_type dVar37;
  d_print_mod *pdVar38;
  demangle_component *pdVar39;
  int iVar40;
  undefined4 uVar41;
  demangle_component *pdVar42;
  uint uVar43;
  undefined4 uVar44;
  d_print_template *pdVar45;
  char *pcVar46;
  demangle_component *pdVar47;
  demangle_component_type dVar48;
  undefined4 uVar49;
  size_t l;
  d_print_mod *pdVar50;
  gnu_v3_ctor_kinds l_00;
  size_t sVar51;
  undefined4 uVar52;
  d_print_mod *pdVar53;
  char *pcVar54;
  demangle_component **ppdVar55;
  uint uVar56;
  int *piVar57;
  d_print_template local_70;
  d_print_mod local_68;
  d_print_mod local_58;
  d_print_mod local_48 [3];
  
  uVar35 = s_operator_089f2120._4_4_;
  uVar34 = s_operator_089f2114._4_4_;
  uVar33 = s_reference_temporary_for_089f20dc._20_4_;
  uVar32 = s_reference_temporary_for_089f20dc._16_4_;
  uVar31 = s_reference_temporary_for_089f20dc._12_4_;
  uVar30 = s_reference_temporary_for_089f20dc._8_4_;
  uVar29 = s_reference_temporary_for_089f20dc._4_4_;
  uVar28 = s_guard_variable_for_089f20c8._12_4_;
  uVar27 = s_guard_variable_for_089f20c8._8_4_;
  uVar26 = s_guard_variable_for_089f20c8._4_4_;
  uVar25 = s_java_Class_for_089f20b8._8_4_;
  uVar24 = s_java_Class_for_089f20b8._4_4_;
  uVar23 = s_covariant_return_thunk_to_089f209c._20_4_;
  uVar22 = s_covariant_return_thunk_to_089f209c._16_4_;
  uVar21 = s_covariant_return_thunk_to_089f209c._12_4_;
  uVar20 = s_covariant_return_thunk_to_089f209c._8_4_;
  uVar19 = s_covariant_return_thunk_to_089f209c._4_4_;
  uVar18 = s_non_virtual_thunk_to_089f2084._16_4_;
  uVar17 = s_non_virtual_thunk_to_089f2084._12_4_;
  uVar16 = s_non_virtual_thunk_to_089f2084._8_4_;
  uVar15 = s_non_virtual_thunk_to_089f2084._4_4_;
  uVar14 = s_typeinfo_fn_for_089f2070._12_4_;
  uVar13 = s_typeinfo_fn_for_089f2070._8_4_;
  uVar12 = s_typeinfo_fn_for_089f2070._4_4_;
  uVar11 = s_typeinfo_name_for_089f205c._12_4_;
  uVar10 = s_typeinfo_name_for_089f205c._8_4_;
  uVar9 = s_typeinfo_name_for_089f205c._4_4_;
  uVar8 = s_typeinfo_for_089f204c._8_4_;
  uVar7 = s_typeinfo_for_089f204c._4_4_;
  uVar6 = s_construction_vtable_for_089f2028._20_4_;
  uVar5 = s_construction_vtable_for_089f2028._16_4_;
  uVar4 = s_construction_vtable_for_089f2028._12_4_;
  uVar52 = s_construction_vtable_for_089f2028._8_4_;
  uVar49 = s_construction_vtable_for_089f2028._4_4_;
  uVar44 = s_VTT_for_089f201c._4_4_;
  uVar41 = s_vtable_for_089f2010._4_4_;
  if (dc == (demangle_component *)0x0) {
switchD_089cf8dc_default:
                    /* Unresolved local var: d_print_mod * hold_modifiers@[???]
                       Unresolved local var: demangle_component * typed_name@[???]
                       Unresolved local var: d_print_mod[4] adpm@[???]
                       Unresolved local var: uint i@[???]
                       Unresolved local var: d_print_template dpt@[???] */
    d_print_error(dpi);
    return;
  }
  pcVar54 = dpi->buf;
  if (pcVar54 == (char *)0x0) {
    return;
  }
  dVar48 = dc->type;
  switch(dVar48) {
  case DEMANGLE_COMPONENT_NAME:
    if ((dpi->options & 4U) != 0) {
                    /* Unresolved local var: char * p@[???]
                       Unresolved local var: char * end@[???] */
      pdVar42 = (dc->u).s_binary.left;
      pdVar47 = (demangle_component *)((int)&pdVar42->type + (dc->u).s_name.len);
      if (pdVar47 <= pdVar42) {
        return;
      }
      do {
                    /* Unresolved local var: ulong c@[???]
                       Unresolved local var: char * q@[???] */
        if ((((3 < (int)pdVar47 - (int)pdVar42) && ((char)pdVar42->type == 0x5f)) &&
            (*(byte *)((int)&pdVar42->type + 1) == 0x5f)) &&
           ((pdVar39 = (demangle_component *)((int)&pdVar42->type + 3),
            *(byte *)((int)&pdVar42->type + 2) == 0x55 && (uVar56 = 0, pdVar39 < pdVar47)))) {
          uVar2 = (undefined1)pdVar39->type;
          do {
            iVar36 = (int)(char)uVar2;
            if ((byte)(uVar2 - DEMANGLE_COMPONENT_TRINARY_ARG2) < 10) {
              iVar40 = iVar36 + -0x30;
            }
            else if ((byte)(uVar2 + 0xbf) < 6) {
              iVar40 = iVar36 + -0x37;
            }
            else {
              iVar40 = iVar36 + -0x57;
              if (5 < (byte)(uVar2 + 0x9f)) {
                if ((iVar36 == 0x5f) && (uVar56 < 0x100)) {
                  if ((pcVar54 == (char *)0x0) || (uVar43 = dpi->len, dpi->alc <= uVar43)) {
                    d_print_append_char(dpi,uVar56);
                    pdVar39 = (demangle_component *)((int)&pdVar39->type + 1);
                  }
                  else {
                    pdVar39 = (demangle_component *)((int)&pdVar39->type + 1);
                    pcVar54[uVar43] = (char)uVar56;
                    dpi->len = uVar43 + 1;
                  }
                  goto LAB_089d0934;
                }
                break;
              }
            }
            pdVar39 = (demangle_component *)((int)&pdVar39->type + 1);
            if (pdVar47 <= pdVar39) break;
                    /* Unresolved local var: int dig@[???] */
            uVar56 = uVar56 * 0x10 + iVar40;
            uVar2 = (undefined1)pdVar39->type;
          } while( true );
        }
        pdVar39 = (demangle_component *)((int)&pdVar42->type + 1);
        if (pcVar54 == (char *)0x0) {
          uVar2 = (undefined1)pdVar42->type;
LAB_089d0e48:
          d_print_append_char(dpi,(int)(char)uVar2);
        }
        else {
          uVar56 = dpi->len;
          if (dpi->alc <= uVar56) {
            uVar2 = (undefined1)pdVar42->type;
            goto LAB_089d0e48;
          }
          pcVar54[uVar56] = (char)pdVar42->type;
          dpi->len = uVar56 + 1;
        }
LAB_089d0934:
        if (pdVar47 <= pdVar39) {
          return;
        }
        pcVar54 = dpi->buf;
        pdVar42 = pdVar39;
      } while( true );
    }
    sVar51 = dpi->len;
    goto LAB_089cfae8;
  case DEMANGLE_COMPONENT_QUAL_NAME:
  case DEMANGLE_COMPONENT_LOCAL_NAME:
    d_print_comp(dpi,(dc->u).s_binary.left);
    if ((dpi->options & 4U) == 0) {
      if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
        d_print_append_buffer(dpi,"::",2);
        pdVar42 = (dc->u).s_extended_operator.name;
        goto LAB_089cfa5c;
      }
      pcVar54 = dpi->buf + dpi->len;
      *pcVar54 = DAT_089f200c;
      pcVar54[1] = DAT_089f200d;
      dpi->len = dpi->len + 2;
    }
    else {
      if ((dpi->buf == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
        d_print_append_char(dpi,0x2e);
        pdVar42 = (dc->u).s_extended_operator.name;
        goto LAB_089cfa5c;
      }
      dpi->buf[uVar56] = '.';
      dpi->len = uVar56 + 1;
    }
    goto switchD_089cf8dc_caseD_6;
  case DEMANGLE_COMPONENT_TYPED_NAME:
    pdVar42 = (dc->u).s_binary.left;
    pdVar53 = dpi->modifiers;
    if (pdVar42 == (demangle_component *)0x0) {
      uVar56 = 0;
      dVar48 = *in_zero;
    }
    else {
      dVar48 = pdVar42->type;
      local_58.templates = dpi->templates;
      dpi->modifiers = &local_58;
      local_58.mod = pdVar42;
      local_58.next = pdVar53;
      local_58.printed = 0;
      if (dVar48 - DEMANGLE_COMPONENT_RESTRICT_THIS < 3) {
        uVar56 = 1;
        pdVar50 = local_48;
        do {
          pdVar42 = (pdVar42->u).s_binary.left;
          dVar48 = _LAB_00000000;
          if (pdVar42 == (demangle_component *)0x0) break;
          bVar1 = uVar56 == 4;
          uVar56 = uVar56 + 1;
          if (bVar1) goto switchD_089cf8dc_default;
          dVar48 = pdVar42->type;
          pdVar38 = dpi->modifiers;
          pdVar50->mod = pdVar42;
          pdVar50->next = pdVar38;
          pdVar50->printed = 0;
          dpi->modifiers = pdVar50;
          pdVar50->templates = local_58.templates;
          pdVar50 = pdVar50 + 1;
        } while (dVar48 - DEMANGLE_COMPONENT_RESTRICT_THIS < 3);
      }
      else {
        uVar56 = 1;
      }
    }
    if (dVar48 == DEMANGLE_COMPONENT_TEMPLATE) {
      local_70.next = dpi->templates;
      dpi->templates = &local_70;
      local_70.template_decl = pdVar42;
    }
    if (dVar48 == DEMANGLE_COMPONENT_LOCAL_NAME) {
                    /* Unresolved local var: demangle_component * local_name@[???] */
      pdVar47 = (pdVar42->u).s_extended_operator.name;
      if (pdVar47->type - DEMANGLE_COMPONENT_RESTRICT_THIS < 3) {
        if (uVar56 < 4) {
          pdVar38 = &local_58 + uVar56;
          pdVar50 = &local_68 + uVar56;
          do {
            pdVar39 = pdVar50->mod;
            iVar36 = pdVar50->printed;
            pdVar45 = pdVar50->templates;
            pdVar50[1].next = pdVar50->next;
            pdVar50[1].mod = pdVar39;
            pdVar50[1].printed = iVar36;
            pdVar50[1].templates = pdVar45;
            pdVar45 = dpi->templates;
            pdVar50[1].next = pdVar38 + -1;
            pdVar50->templates = pdVar45;
            dpi->modifiers = pdVar38;
            pdVar50->mod = pdVar47;
            pdVar50->printed = 0;
            pdVar47 = (pdVar47->u).s_binary.left;
            uVar56 = uVar56 + 1;
            if (2 < pdVar47->type - DEMANGLE_COMPONENT_RESTRICT_THIS) goto LAB_089d0cfc;
            pdVar50 = pdVar50 + 1;
            pdVar38 = pdVar38 + 1;
          } while (uVar56 != 4);
        }
        goto switchD_089cf8dc_caseD_2d;
      }
LAB_089d0cfc:
      pdVar47 = (dc->u).s_extended_operator.name;
    }
    else {
      pdVar47 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,pdVar47);
    if (pdVar42->type == DEMANGLE_COMPONENT_TEMPLATE) {
      dpi->templates = local_70.next;
    }
    if (uVar56 != 0) {
      piVar57 = &(&local_68)[uVar56].printed;
      do {
        uVar56 = uVar56 - 1;
        if (*piVar57 == 0) {
          if (dpi->buf == (char *)0x0) {
LAB_089d0d80:
            d_print_append_char(dpi,0x20);
            pdVar42 = (demangle_component *)piVar57[-1];
          }
          else {
            uVar43 = dpi->len;
            if (dpi->alc <= uVar43) goto LAB_089d0d80;
            dpi->buf[uVar43] = ' ';
            dpi->len = uVar43 + 1;
            pdVar42 = (demangle_component *)piVar57[-1];
          }
          d_print_mod(dpi,pdVar42);
        }
        piVar57 = piVar57 + -4;
      } while (uVar56 != 0);
    }
    dpi->modifiers = pdVar53;
    return;
  case DEMANGLE_COMPONENT_TEMPLATE:
                    /* Unresolved local var: d_print_mod * hold_dpm@[???] */
    pdVar53 = dpi->modifiers;
    dpi->modifiers = (d_print_mod *)0x0;
    d_print_comp(dpi,(dc->u).s_binary.left);
    pcVar54 = dpi->buf;
    if (pcVar54 == (char *)0x0) {
LAB_089d0e80:
      d_print_append_char(dpi,0x3c);
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    else {
      uVar56 = dpi->len;
      if (uVar56 == 0) {
        uVar43 = dpi->alc;
      }
      else {
        if ((pcVar54 + uVar56)[-1] == '<') {
          if (uVar56 < dpi->alc) {
            pcVar54[uVar56] = ' ';
            dpi->len = uVar56 + 1;
            pcVar54 = dpi->buf;
          }
          else {
            d_print_append_char(dpi,0x20);
            pcVar54 = dpi->buf;
          }
          if (pcVar54 == (char *)0x0) goto LAB_089d0e80;
          uVar56 = dpi->len;
        }
        uVar43 = dpi->alc;
      }
      if (uVar43 <= uVar56) goto LAB_089d0e80;
      pcVar54[uVar56] = '<';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,pdVar42);
    pcVar54 = dpi->buf;
    if (pcVar54 != (char *)0x0) {
      uVar56 = dpi->len;
      if (uVar56 == 0) {
        uVar43 = dpi->alc;
      }
      else {
        if ((pcVar54 + uVar56)[-1] == '>') {
          if (uVar56 < dpi->alc) {
            pcVar54[uVar56] = ' ';
            dpi->len = uVar56 + 1;
            pcVar54 = dpi->buf;
          }
          else {
            d_print_append_char(dpi,0x20);
            pcVar54 = dpi->buf;
          }
          if (pcVar54 == (char *)0x0) goto LAB_089d0e70;
          uVar56 = dpi->len;
        }
        uVar43 = dpi->alc;
      }
      if (uVar56 < uVar43) {
        pcVar54[uVar56] = '>';
        dpi->len = uVar56 + 1;
        dpi->modifiers = pdVar53;
        return;
      }
    }
LAB_089d0e70:
    d_print_append_char(dpi,0x3e);
    dpi->modifiers = pdVar53;
    return;
  case DEMANGLE_COMPONENT_TEMPLATE_PARAM:
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: demangle_component * a@[???]
                       Unresolved local var: d_print_template * hold_dpt@[???] */
    pdVar45 = dpi->templates;
    if (pdVar45 != (d_print_template *)0x0) {
      pdVar42 = (pdVar45->template_decl->u).s_extended_operator.name;
      iVar36 = (dc->u).s_extended_operator.args;
      if (pdVar42 != (demangle_component *)0x0) {
        if (pdVar42->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) goto switchD_089cf8dc_caseD_2d;
        if (0 < iVar36) {
          for (pdVar42 = (pdVar42->u).s_extended_operator.name; iVar36 = iVar36 + -1,
              pdVar42 != (demangle_component *)0x0; pdVar42 = (pdVar42->u).s_extended_operator.name)
          {
            if (pdVar42->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
            goto switchD_089cf8dc_caseD_2d;
            if (iVar36 == 0) goto LAB_089d0e20;
          }
        }
      }
      if (iVar36 == 0) {
LAB_089d0e20:
        if (pdVar42 != (demangle_component *)0x0) {
          dpi->templates = pdVar45->next;
          d_print_comp(dpi,(pdVar42->u).s_binary.left);
          dpi->templates = pdVar45;
          return;
        }
      }
    }
  case DEMANGLE_COMPONENT_BINARY_ARGS:
  case DEMANGLE_COMPONENT_TRINARY_ARG1:
  case DEMANGLE_COMPONENT_TRINARY_ARG2:
switchD_089cf8dc_caseD_2d:
                    /* Unresolved local var: d_print_mod * hold_modifiers@[???]
                       Unresolved local var: d_print_mod[4] adpm@[???]
                       Unresolved local var: uint i@[???]
                       Unresolved local var: d_print_mod * pdpm@[???] */
    d_print_error(dpi);
    return;
  case DEMANGLE_COMPONENT_CTOR:
    goto switchD_089cf8dc_caseD_6;
  case DEMANGLE_COMPONENT_DTOR:
    uVar56 = dpi->len;
    if (dpi->alc <= uVar56) {
      d_print_append_char(dpi,0x7e);
      pdVar42 = (dc->u).s_extended_operator.name;
      goto LAB_089cfa5c;
    }
    pcVar54[uVar56] = '~';
    dpi->len = uVar56 + 1;
    goto switchD_089cf8dc_caseD_6;
  case DEMANGLE_COMPONENT_VTABLE:
    if (dpi->alc < dpi->len + 0xb) {
      d_print_append_buffer(dpi,"vtable for ",0xb);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_vtable_for_089f2010._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar41;
    pcVar54[8] = s_vtable_for_089f2010[8];
    pcVar54[9] = s_vtable_for_089f2010[9];
    pcVar54[10] = s_vtable_for_089f2010[10];
    dpi->len = dpi->len + 0xb;
    break;
  case DEMANGLE_COMPONENT_VTT:
    sVar51 = dpi->len;
    if (dpi->alc < sVar51 + 8) {
      d_print_append_buffer(dpi,"VTT for ",8);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    *(undefined4 *)(pcVar54 + sVar51) = s_VTT_for_089f201c._0_4_;
    *(undefined4 *)(pcVar54 + sVar51 + 4) = uVar44;
    dpi->len = dpi->len + 8;
    break;
  case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE:
    if (dpi->alc < dpi->len + 0x18) {
      d_print_append_buffer(dpi,"construction vtable for ",0x18);
      pdVar42 = (dc->u).s_binary.left;
    }
    else {
      pcVar54 = pcVar54 + dpi->len;
      *(undefined4 *)pcVar54 = s_construction_vtable_for_089f2028._0_4_;
      *(undefined4 *)(pcVar54 + 4) = uVar49;
      *(undefined4 *)(pcVar54 + 8) = uVar52;
      *(undefined4 *)(pcVar54 + 0xc) = uVar4;
      *(undefined4 *)(pcVar54 + 0x10) = uVar5;
      *(undefined4 *)(pcVar54 + 0x14) = uVar6;
      dpi->len = dpi->len + 0x18;
      pdVar42 = (dc->u).s_binary.left;
    }
    d_print_comp(dpi,pdVar42);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 4)) {
      d_print_append_buffer(dpi,"-in-",4);
    }
    else {
      *(undefined4 *)(dpi->buf + dpi->len) = DAT_089f2044;
      dpi->len = dpi->len + 4;
    }
    goto switchD_089cf8dc_caseD_6;
  case DEMANGLE_COMPONENT_TYPEINFO:
    if (dpi->alc < dpi->len + 0xd) {
      d_print_append_buffer(dpi,"typeinfo for ",0xd);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_typeinfo_for_089f204c._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar7;
    *(undefined4 *)(pcVar54 + 8) = uVar8;
    pcVar54[0xc] = s_typeinfo_for_089f204c[0xc];
    dpi->len = dpi->len + 0xd;
    break;
  case DEMANGLE_COMPONENT_TYPEINFO_NAME:
    if (dpi->alc < dpi->len + 0x12) {
      d_print_append_buffer(dpi,"typeinfo name for ",0x12);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_typeinfo_name_for_089f205c._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar9;
    *(undefined4 *)(pcVar54 + 8) = uVar10;
    *(undefined4 *)(pcVar54 + 0xc) = uVar11;
    pcVar54[0x10] = s_typeinfo_name_for_089f205c[0x10];
    pcVar54[0x11] = s_typeinfo_name_for_089f205c[0x11];
    dpi->len = dpi->len + 0x12;
    break;
  case DEMANGLE_COMPONENT_TYPEINFO_FN:
    if (dpi->alc < dpi->len + 0x10) {
      d_print_append_buffer(dpi,"typeinfo fn for ",0x10);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_typeinfo_fn_for_089f2070._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar12;
    *(undefined4 *)(pcVar54 + 8) = uVar13;
    *(undefined4 *)(pcVar54 + 0xc) = uVar14;
    dpi->len = dpi->len + 0x10;
    break;
  case DEMANGLE_COMPONENT_THUNK:
    if (dpi->alc < dpi->len + 0x15) {
      d_print_append_buffer(dpi,"non-virtual thunk to ",0x15);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_non_virtual_thunk_to_089f2084._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar15;
    *(undefined4 *)(pcVar54 + 8) = uVar16;
    *(undefined4 *)(pcVar54 + 0xc) = uVar17;
    *(undefined4 *)(pcVar54 + 0x10) = uVar18;
    pcVar54[0x14] = s_non_virtual_thunk_to_089f2084[0x14];
    dpi->len = dpi->len + 0x15;
    break;
  case DEMANGLE_COMPONENT_VIRTUAL_THUNK:
    sVar51 = dpi->len;
    if (dpi->alc < sVar51 + 0x11) {
      d_print_append_buffer(dpi,"virtual thunk to ",0x11);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar46 = "virtual thunk to ";
    uVar41 = s_non_virtual_thunk_to_089f2084._4_4_;
    goto LAB_089cf914;
  case DEMANGLE_COMPONENT_COVARIANT_THUNK:
    if (dpi->alc < dpi->len + 0x1a) {
      d_print_append_buffer(dpi,"covariant return thunk to ",0x1a);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_covariant_return_thunk_to_089f209c._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar19;
    *(undefined4 *)(pcVar54 + 8) = uVar20;
    *(undefined4 *)(pcVar54 + 0xc) = uVar21;
    *(undefined4 *)(pcVar54 + 0x10) = uVar22;
    *(undefined4 *)(pcVar54 + 0x14) = uVar23;
    pcVar54[0x18] = s_covariant_return_thunk_to_089f209c[0x18];
    pcVar54[0x19] = s_covariant_return_thunk_to_089f209c[0x19];
    dpi->len = dpi->len + 0x1a;
    break;
  case DEMANGLE_COMPONENT_JAVA_CLASS:
    if (dpi->alc < dpi->len + 0xf) {
      d_print_append_buffer(dpi,"java Class for ",0xf);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_java_Class_for_089f20b8._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar24;
    *(undefined4 *)(pcVar54 + 8) = uVar25;
    pcVar54[0xc] = s_java_Class_for_089f20b8[0xc];
    pcVar54[0xd] = s_java_Class_for_089f20b8[0xd];
    pcVar54[0xe] = s_java_Class_for_089f20b8[0xe];
    dpi->len = dpi->len + 0xf;
    break;
  case DEMANGLE_COMPONENT_GUARD:
    if (dpi->alc < dpi->len + 0x13) {
      d_print_append_buffer(dpi,"guard variable for ",0x13);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_guard_variable_for_089f20c8._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar26;
    *(undefined4 *)(pcVar54 + 8) = uVar27;
    *(undefined4 *)(pcVar54 + 0xc) = uVar28;
    pcVar54[0x10] = s_guard_variable_for_089f20c8[0x10];
    pcVar54[0x11] = s_guard_variable_for_089f20c8[0x11];
    pcVar54[0x12] = s_guard_variable_for_089f20c8[0x12];
    dpi->len = dpi->len + 0x13;
    break;
  case DEMANGLE_COMPONENT_REFTEMP:
    if (dpi->alc < dpi->len + 0x18) {
      d_print_append_buffer(dpi,"reference temporary for ",0x18);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_reference_temporary_for_089f20dc._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar29;
    *(undefined4 *)(pcVar54 + 8) = uVar30;
    *(undefined4 *)(pcVar54 + 0xc) = uVar31;
    *(undefined4 *)(pcVar54 + 0x10) = uVar32;
    *(undefined4 *)(pcVar54 + 0x14) = uVar33;
    dpi->len = dpi->len + 0x18;
    break;
  case DEMANGLE_COMPONENT_HIDDEN_ALIAS:
    sVar51 = dpi->len;
    if (dpi->alc < sVar51 + 0x11) {
      d_print_append_buffer(dpi,"hidden alias for ",0x11);
      pdVar42 = (dc->u).s_binary.left;
      goto LAB_089cf960;
    }
    pcVar46 = "hidden alias for ";
    uVar41 = s_hidden_alias_for_089f20f8._0_4_;
LAB_089cf914:
    uVar44 = *(undefined4 *)(pcVar46 + 4);
    pcVar54 = pcVar54 + sVar51;
    uVar49 = *(undefined4 *)(pcVar46 + 8);
    uVar52 = *(undefined4 *)(pcVar46 + 0xc);
    *(undefined4 *)pcVar54 = uVar41;
    *(undefined4 *)(pcVar54 + 4) = uVar44;
    *(undefined4 *)(pcVar54 + 8) = uVar49;
    *(undefined4 *)(pcVar54 + 0xc) = uVar52;
    pcVar54[0x10] = pcVar46[0x10];
    dpi->len = dpi->len + 0x11;
    break;
  case DEMANGLE_COMPONENT_SUB_STD:
    sVar51 = dpi->len;
LAB_089cfae8:
    l = (dc->u).s_name.len;
    pcVar46 = (dc->u).s_name.s;
    if (dpi->alc < sVar51 + l) {
      d_print_append_buffer(dpi,pcVar46,l);
      return;
    }
    memcpy(pcVar54 + sVar51,pcVar46,l);
    dpi->len = (int)&((dc->u).s_extended_operator.name)->type + dpi->len;
    return;
  case DEMANGLE_COMPONENT_RESTRICT:
  case DEMANGLE_COMPONENT_VOLATILE:
  case DEMANGLE_COMPONENT_CONST:
    local_68.next = dpi->modifiers;
    if (local_68.next != (d_print_mod *)0x0) {
      iVar36 = (local_68.next)->printed;
      pdVar53 = local_68.next;
      do {
        if (iVar36 == 0) {
          dVar37 = pdVar53->mod->type;
          if (2 < dVar37 - DEMANGLE_COMPONENT_RESTRICT) break;
          if (dVar48 == dVar37) {
            pdVar42 = (dc->u).s_binary.left;
            goto LAB_089cf960;
          }
          pdVar53 = pdVar53->next;
        }
        else {
          pdVar53 = pdVar53->next;
        }
        if (pdVar53 == (d_print_mod *)0x0) break;
        iVar36 = pdVar53->printed;
      } while( true );
    }
    goto LAB_089d0a40;
  case DEMANGLE_COMPONENT_RESTRICT_THIS:
  case DEMANGLE_COMPONENT_VOLATILE_THIS:
  case DEMANGLE_COMPONENT_CONST_THIS:
  case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
  case DEMANGLE_COMPONENT_POINTER:
  case DEMANGLE_COMPONENT_REFERENCE:
  case DEMANGLE_COMPONENT_COMPLEX:
  case DEMANGLE_COMPONENT_IMAGINARY:
    local_68.next = dpi->modifiers;
LAB_089d0a40:
    dpi->modifiers = &local_68;
    local_68.templates = dpi->templates;
    local_68.printed = 0;
    local_68.mod = dc;
    d_print_comp(dpi,(dc->u).s_binary.left);
    if (local_68.printed != 0) {
      dpi->modifiers = local_68.next;
      return;
    }
    d_print_mod(dpi,dc);
    dpi->modifiers = local_68.next;
    return;
  case DEMANGLE_COMPONENT_BUILTIN_TYPE:
    if ((dpi->options & 4U) == 0) {
      pdVar42 = (dc->u).s_binary.left;
      l_00 = (pdVar42->u).s_ctor.kind;
      pcVar46 = (char *)pdVar42->type;
      if (dpi->alc < dpi->len + l_00) {
        d_print_append_buffer(dpi,pcVar46,l_00);
        return;
      }
      memcpy(pcVar54 + dpi->len,pcVar46,l_00);
      dpi->len = (size_t)((((dc->u).s_binary.left)->u).s_name.s + dpi->len);
      return;
    }
    pdVar42 = (dc->u).s_binary.left;
    dVar48 = pdVar42[1].type;
    pdVar42 = (pdVar42->u).s_extended_operator.name;
    if (dpi->alc < dpi->len + dVar48) {
      d_print_append_buffer(dpi,(char *)pdVar42,dVar48);
      return;
    }
    memcpy(pcVar54 + dpi->len,pdVar42,dVar48);
    dpi->len = dpi->len + *(int *)((dc->u).s_extended_operator.args + 0xc);
    return;
  case DEMANGLE_COMPONENT_VENDOR_TYPE:
    break;
  case DEMANGLE_COMPONENT_FUNCTION_TYPE:
    if ((dc->u).s_name.s != (char *)0x0) {
                    /* Unresolved local var: d_print_mod dpm@[???] */
      local_68.next = dpi->modifiers;
      dpi->modifiers = &local_68;
      local_68.templates = dpi->templates;
      local_68.printed = 0;
      local_68.mod = dc;
      d_print_comp(dpi,(dc->u).s_binary.left);
      dpi->modifiers = local_68.next;
      if (local_68.printed != 0) {
        return;
      }
      if ((dpi->buf == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
        d_print_append_char(dpi,0x20);
        pdVar53 = dpi->modifiers;
        goto LAB_089d03ac;
      }
      dpi->buf[uVar56] = ' ';
      dpi->len = uVar56 + 1;
    }
    pdVar53 = dpi->modifiers;
LAB_089d03ac:
    d_print_function_type(dpi,dc,pdVar53);
    return;
  case DEMANGLE_COMPONENT_ARRAY_TYPE:
    pdVar53 = dpi->modifiers;
    local_58.templates = dpi->templates;
    dpi->modifiers = &local_58;
    local_58.printed = 0;
    local_58.next = pdVar53;
    local_58.mod = dc;
    if ((pdVar53 == (d_print_mod *)0x0) || (2 < pdVar53->mod->type - DEMANGLE_COMPONENT_RESTRICT)) {
      uVar56 = 1;
LAB_089d0474:
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    else {
      uVar56 = 1;
      pdVar50 = pdVar53;
      pdVar38 = &local_58;
      do {
        if (pdVar50->printed == 0) {
          if (3 < uVar56) goto switchD_089cf8dc_caseD_2d;
          pdVar42 = pdVar50->mod;
          pdVar45 = pdVar50->templates;
          (&local_58)[uVar56].next = pdVar38;
          pdVar38 = &local_58 + uVar56;
          local_48[uVar56 - 1].mod = pdVar42;
          local_48[uVar56 - 1].templates = pdVar45;
          local_48[uVar56 - 1].printed = 0;
          uVar56 = uVar56 + 1;
          dpi->modifiers = pdVar38;
          pdVar50->printed = 1;
          pdVar50 = pdVar50->next;
        }
        else {
          pdVar50 = pdVar50->next;
        }
        if (pdVar50 == (d_print_mod *)0x0) goto LAB_089d0474;
      } while (pdVar50->mod->type - DEMANGLE_COMPONENT_RESTRICT < 3);
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,pdVar42);
    dpi->modifiers = pdVar53;
    if (local_58.printed != 0) {
      return;
    }
    if (1 < uVar56) {
      ppdVar55 = &(&local_68)[uVar56].mod;
      do {
        uVar56 = uVar56 - 1;
        d_print_mod(dpi,*ppdVar55);
        ppdVar55 = ppdVar55 + -4;
      } while (uVar56 != 1);
    }
    d_print_array_type(dpi,dc,dpi->modifiers);
    return;
  case DEMANGLE_COMPONENT_PTRMEM_TYPE:
                    /* Unresolved local var: d_print_mod dpm@[???] */
    local_68.next = dpi->modifiers;
    dpi->modifiers = &local_68;
    local_68.templates = dpi->templates;
    local_68.printed = 0;
    local_68.mod = dc;
    d_print_comp(dpi,(dc->u).s_extended_operator.name);
    if (local_68.printed == 0) {
      if ((dpi->buf == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
        d_print_append_char(dpi,0x20);
        pdVar42 = (dc->u).s_binary.left;
      }
      else {
        dpi->buf[uVar56] = ' ';
        dpi->len = uVar56 + 1;
        pdVar42 = (dc->u).s_binary.left;
      }
      d_print_comp(dpi,pdVar42);
      if ((dpi->buf != (char *)0x0) && (dpi->len + 3 <= dpi->alc)) {
        pcVar54 = dpi->buf + dpi->len;
        *pcVar54 = DAT_089f210c;
        pcVar54[1] = DAT_089f210d;
        pcVar54[2] = DAT_089f210e;
        dpi->len = dpi->len + 3;
        dpi->modifiers = local_68.next;
        return;
      }
      d_print_append_buffer(dpi,"::*",3);
    }
    dpi->modifiers = local_68.next;
    return;
  case DEMANGLE_COMPONENT_ARGLIST:
  case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
    d_print_comp(dpi,(dc->u).s_binary.left);
    if ((dc->u).s_name.len == 0) {
      return;
    }
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
      d_print_append_buffer(dpi,", ",2);
      pdVar42 = (dc->u).s_extended_operator.name;
      goto LAB_089cfa5c;
    }
    pcVar54 = dpi->buf + dpi->len;
    *pcVar54 = DAT_089f2110;
    pcVar54[1] = DAT_089f2111;
    dpi->len = dpi->len + 2;
    goto switchD_089cf8dc_caseD_6;
  case DEMANGLE_COMPONENT_OPERATOR:
                    /* Unresolved local var: char c@[???] */
    sVar51 = dpi->len;
    if (dpi->alc < sVar51 + 8) {
      d_print_append_buffer(dpi,"operator",8);
      pdVar42 = (dc->u).s_binary.left;
    }
    else {
      *(undefined4 *)(pcVar54 + sVar51) = s_operator_089f2114._0_4_;
      *(undefined4 *)(pcVar54 + sVar51 + 4) = uVar34;
      dpi->len = dpi->len + 8;
      pdVar42 = (dc->u).s_binary.left;
    }
    if (0x19 < (byte)(*(pdVar42->u).s_name.s + 0x9fU)) {
      pcVar54 = dpi->buf;
      goto LAB_089d02fc;
    }
    if (dpi->buf == (char *)0x0) {
LAB_089d128c:
      d_print_append_char(dpi,0x20);
      pdVar42 = (dc->u).s_binary.left;
    }
    else {
      uVar56 = dpi->len;
      if (dpi->alc <= uVar56) goto LAB_089d128c;
      dpi->buf[uVar56] = ' ';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_binary.left;
    }
    pcVar54 = dpi->buf;
LAB_089d02fc:
    sVar51 = (pdVar42->u).s_name.len;
    if ((pcVar54 != (char *)0x0) && (dpi->len + sVar51 <= dpi->alc)) {
      memcpy(pcVar54 + dpi->len,(pdVar42->u).s_name.s,sVar51);
      dpi->len = (int)&((((dc->u).s_binary.left)->u).s_extended_operator.name)->type + dpi->len;
      return;
    }
    d_print_append_buffer(dpi,(pdVar42->u).s_name.s,sVar51);
    return;
  case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
    if (dpi->alc < dpi->len + 9) {
      d_print_append_buffer(dpi,"operator ",9);
      pdVar42 = (dc->u).s_extended_operator.name;
      goto LAB_089cfa5c;
    }
    pcVar54 = pcVar54 + dpi->len;
    *(undefined4 *)pcVar54 = s_operator_089f2120._0_4_;
    *(undefined4 *)(pcVar54 + 4) = uVar35;
    pcVar54[8] = s_operator_089f2120[8];
    dpi->len = dpi->len + 9;
switchD_089cf8dc_caseD_6:
                    /* Unresolved local var: d_builtin_type_print tp@[???] */
    pdVar42 = (dc->u).s_extended_operator.name;
LAB_089cfa5c:
    d_print_comp(dpi,pdVar42);
    return;
  case DEMANGLE_COMPONENT_CAST:
    if (dpi->alc < dpi->len + 9) {
      d_print_append_buffer(dpi,"operator ",9);
    }
    else {
      pcVar54 = pcVar54 + dpi->len;
      *(undefined4 *)pcVar54 = s_operator_089f2120._0_4_;
      *(undefined4 *)(pcVar54 + 4) = uVar35;
      pcVar54[8] = s_operator_089f2120[8];
      dpi->len = dpi->len + 9;
    }
    d_print_cast(dpi,dc);
    return;
  case DEMANGLE_COMPONENT_UNARY:
    pdVar42 = (dc->u).s_binary.left;
    if (pdVar42->type == DEMANGLE_COMPONENT_CAST) {
      uVar56 = dpi->len;
      if (uVar56 < dpi->alc) {
        pcVar54[uVar56] = '(';
        dpi->len = uVar56 + 1;
        pdVar42 = (dc->u).s_binary.left;
      }
      else {
        d_print_append_char(dpi,0x28);
        pdVar42 = (dc->u).s_binary.left;
      }
      d_print_cast(dpi,pdVar42);
      if ((dpi->buf != (char *)0x0) && (uVar56 = dpi->len, uVar56 < dpi->alc)) {
        dpi->buf[uVar56] = ')';
        dpi->len = uVar56 + 1;
        goto LAB_089d0a94;
      }
      d_print_append_char(dpi,0x29);
      pcVar54 = dpi->buf;
    }
    else {
      d_print_expr_op(dpi,pdVar42);
LAB_089d0a94:
      pcVar54 = dpi->buf;
    }
    if ((pcVar54 == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
      d_print_append_char(dpi,0x28);
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    else {
      pcVar54[uVar56] = '(';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,pdVar42);
    pcVar54 = dpi->buf;
    if (pcVar54 == (char *)0x0) goto LAB_089d0ae4;
    uVar56 = dpi->len;
    goto LAB_089d008c;
  case DEMANGLE_COMPONENT_BINARY:
    if (((dc->u).s_extended_operator.name)->type != DEMANGLE_COMPONENT_BINARY_ARGS)
    goto switchD_089cf8dc_caseD_2d;
    pdVar42 = (dc->u).s_binary.left;
    if (pdVar42->type == DEMANGLE_COMPONENT_OPERATOR) {
      pdVar42 = (pdVar42->u).s_binary.left;
      if ((pdVar42->u).s_name.len != 1) {
        uVar56 = dpi->len;
        goto LAB_089cff4c;
      }
      if (*(pdVar42->u).s_name.s != '>') {
        uVar56 = dpi->len;
        goto LAB_089cff4c;
      }
      uVar56 = dpi->len;
      if (uVar56 < dpi->alc) {
        pcVar54[uVar56] = '(';
        dpi->len = uVar56 + 1;
        pcVar54 = dpi->buf;
      }
      else {
        d_print_append_char(dpi,0x28);
        pcVar54 = dpi->buf;
      }
      if (pcVar54 != (char *)0x0) {
        uVar56 = dpi->len;
        goto LAB_089cff4c;
      }
LAB_089d1350:
      d_print_append_char(dpi,0x28);
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    else {
      uVar56 = dpi->len;
LAB_089cff4c:
      if (dpi->alc <= uVar56) goto LAB_089d1350;
      pcVar54[uVar56] = '(';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,(pdVar42->u).s_binary.left);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
      d_print_append_buffer(dpi,") ",2);
    }
    else {
      pcVar54 = dpi->buf + dpi->len;
      *pcVar54 = DAT_089f212c;
      pcVar54[1] = DAT_089f212d;
      dpi->len = dpi->len + 2;
    }
    d_print_expr_op(dpi,(dc->u).s_binary.left);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
      d_print_append_buffer(dpi," (",2);
    }
    else {
      pcVar54 = dpi->buf + dpi->len;
      *pcVar54 = DAT_089f2130;
      pcVar54[1] = DAT_089f2131;
      dpi->len = dpi->len + 2;
    }
    d_print_comp(dpi,(((dc->u).s_extended_operator.name)->u).s_extended_operator.name);
    if ((dpi->buf == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
      d_print_append_char(dpi,0x29);
      pdVar42 = (dc->u).s_binary.left;
    }
    else {
      dpi->buf[uVar56] = ')';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_binary.left;
    }
    if (pdVar42->type != DEMANGLE_COMPONENT_OPERATOR) {
      return;
    }
    pdVar42 = (pdVar42->u).s_binary.left;
    if ((pdVar42->u).s_name.len != 1) {
      return;
    }
    if (*(pdVar42->u).s_name.s != '>') {
      return;
    }
    pcVar54 = dpi->buf;
    goto LAB_089d0080;
  case DEMANGLE_COMPONENT_TRINARY:
    pdVar42 = (dc->u).s_extended_operator.name;
    if ((pdVar42->type != DEMANGLE_COMPONENT_TRINARY_ARG1) ||
       (((pdVar42->u).s_extended_operator.name)->type != DEMANGLE_COMPONENT_TRINARY_ARG2))
    goto switchD_089cf8dc_caseD_2d;
    uVar56 = dpi->len;
    if (uVar56 < dpi->alc) {
      pcVar54[uVar56] = '(';
      dpi->len = uVar56 + 1;
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    else {
      d_print_append_char(dpi,0x28);
      pdVar42 = (dc->u).s_extended_operator.name;
    }
    d_print_comp(dpi,(pdVar42->u).s_binary.left);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
      d_print_append_buffer(dpi,") ",2);
    }
    else {
      pcVar54 = dpi->buf + dpi->len;
      *pcVar54 = DAT_089f212c;
      pcVar54[1] = DAT_089f212d;
      dpi->len = dpi->len + 2;
    }
    d_print_expr_op(dpi,(dc->u).s_binary.left);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
      d_print_append_buffer(dpi," (",2);
    }
    else {
      pcVar54 = dpi->buf + dpi->len;
      *pcVar54 = DAT_089f2130;
      pcVar54[1] = DAT_089f2131;
      dpi->len = dpi->len + 2;
    }
    d_print_comp(dpi,(((((dc->u).s_extended_operator.name)->u).s_extended_operator.name)->u).
                     s_binary.left);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 5)) {
      d_print_append_buffer(dpi,") : (",5);
    }
    else {
      pcVar54 = dpi->buf + dpi->len;
      *(undefined4 *)pcVar54 = DAT_089f2134;
      pcVar54[4] = DAT_089f2138;
      dpi->len = dpi->len + 5;
    }
    d_print_comp(dpi,(((((dc->u).s_extended_operator.name)->u).s_extended_operator.name)->u).
                     s_extended_operator.name);
    pcVar54 = dpi->buf;
LAB_089d0080:
    if (pcVar54 != (char *)0x0) {
      uVar56 = dpi->len;
LAB_089d008c:
      if (uVar56 < dpi->alc) {
        pcVar54[uVar56] = ')';
        dpi->len = uVar56 + 1;
        return;
      }
    }
LAB_089d0ae4:
    d_print_append_char(dpi,0x29);
    return;
  case DEMANGLE_COMPONENT_LITERAL:
  case DEMANGLE_COMPONENT_LITERAL_NEG:
    pdVar42 = (dc->u).s_binary.left;
    uVar56 = 0;
    if (pdVar42->type == DEMANGLE_COMPONENT_BUILTIN_TYPE) {
      uVar56 = *(uint *)((pdVar42->u).s_extended_operator.args + 0x10);
      if (uVar56 == 0) {
        uVar43 = dpi->len;
      }
      else if (uVar56 < 7) {
        pdVar42 = (dc->u).s_extended_operator.name;
        if (pdVar42->type == DEMANGLE_COMPONENT_NAME) {
          if (dVar48 == DEMANGLE_COMPONENT_LITERAL_NEG) {
            uVar43 = dpi->len;
            if (uVar43 < dpi->alc) {
              pcVar54[uVar43] = '-';
              dpi->len = uVar43 + 1;
              pdVar42 = (dc->u).s_extended_operator.name;
            }
            else {
              d_print_append_char(dpi,0x2d);
              pdVar42 = (dc->u).s_extended_operator.name;
            }
          }
          d_print_comp(dpi,pdVar42);
                    /* WARNING: Could not recover jumptable at 0x089d1520. Too many branches */
                    /* WARNING: Treating indirect jump as call */
          (**(code **)(&DAT_089f1940 + uVar56 * 4))();
          return;
        }
        uVar43 = dpi->len;
      }
      else if (uVar56 == 7) {
        pdVar42 = (dc->u).s_extended_operator.name;
        if (pdVar42->type == DEMANGLE_COMPONENT_NAME) {
          if ((pdVar42->u).s_name.len == 1) {
            if (dVar48 == DEMANGLE_COMPONENT_LITERAL) {
              cVar3 = *(pdVar42->u).s_name.s;
              if (cVar3 == '0') {
                sVar51 = dpi->len;
                if (sVar51 + 5 <= dpi->alc) {
                  *(undefined4 *)(pcVar54 + sVar51) = s_false_089f0594._0_4_;
                  (pcVar54 + sVar51)[4] = s_false_089f0594[4];
                  dpi->len = dpi->len + 5;
                  return;
                }
                d_print_append_buffer(dpi,"false",5);
                return;
              }
              if (cVar3 == '1') {
                if (dpi->len + 4 <= dpi->alc) {
                  *(undefined4 *)(pcVar54 + dpi->len) = DAT_089f058c;
                  dpi->len = dpi->len + 4;
                  return;
                }
                d_print_append_buffer(dpi,"true",4);
                return;
              }
              uVar43 = dpi->len;
            }
            else {
              uVar43 = dpi->len;
            }
          }
          else {
            uVar43 = dpi->len;
          }
        }
        else {
          uVar43 = dpi->len;
        }
      }
      else {
        uVar43 = dpi->len;
      }
    }
    else {
      uVar43 = dpi->len;
    }
    if (uVar43 < dpi->alc) {
      pcVar54[uVar43] = '(';
      dpi->len = uVar43 + 1;
      pdVar42 = (dc->u).s_binary.left;
    }
    else {
      d_print_append_char(dpi,0x28);
      pdVar42 = (dc->u).s_binary.left;
    }
    d_print_comp(dpi,pdVar42);
    if ((dpi->buf == (char *)0x0) || (uVar43 = dpi->len, dpi->alc <= uVar43)) {
      d_print_append_char(dpi,0x29);
      dVar48 = dc->type;
    }
    else {
      dpi->buf[uVar43] = ')';
      dpi->len = uVar43 + 1;
      dVar48 = dc->type;
    }
    if (dVar48 == DEMANGLE_COMPONENT_LITERAL_NEG) {
      if ((dpi->buf == (char *)0x0) || (uVar43 = dpi->len, dpi->alc <= uVar43)) {
        d_print_append_char(dpi,0x2d);
      }
      else {
        dpi->buf[uVar43] = '-';
        dpi->len = uVar43 + 1;
      }
    }
    if (uVar56 == 8) {
      if ((dpi->buf == (char *)0x0) || (uVar56 = dpi->len, dpi->alc <= uVar56)) {
        d_print_append_char(dpi,0x5b);
        pdVar42 = (dc->u).s_extended_operator.name;
      }
      else {
        dpi->buf[uVar56] = '[';
        dpi->len = uVar56 + 1;
        pdVar42 = (dc->u).s_extended_operator.name;
      }
      d_print_comp(dpi,pdVar42);
      if ((dpi->buf != (char *)0x0) && (uVar56 = dpi->len, uVar56 < dpi->alc)) {
        dpi->buf[uVar56] = ']';
        dpi->len = uVar56 + 1;
        return;
      }
      d_print_append_char(dpi,0x5d);
      return;
    }
    pdVar42 = (dc->u).s_extended_operator.name;
    goto LAB_089cfa5c;
  default:
    goto switchD_089cf8dc_default;
  }
                    /* Unresolved local var: d_print_mod * pdpm@[???] */
  pdVar42 = (dc->u).s_binary.left;
LAB_089cf960:
  d_print_comp(dpi,pdVar42);
  return;
}



----------------------------------------

// Function: d_print_cast @ 089d18d8

void d_print_cast(d_print_info *dpi,demangle_component *dc)

{
  uint uVar1;
  uint uVar2;
  char *pcVar3;
  d_print_mod *pdVar4;
  d_print_template local_18;
  
  local_18.template_decl = (dc->u).s_binary.left;
  if ((local_18.template_decl)->type != DEMANGLE_COMPONENT_TEMPLATE) {
    d_print_comp(dpi,local_18.template_decl);
    return;
  }
                    /* Unresolved local var: d_print_mod * hold_dpm@[???]
                       Unresolved local var: d_print_template dpt@[???] */
  local_18.next = dpi->templates;
  pdVar4 = dpi->modifiers;
  dpi->templates = &local_18;
  dpi->modifiers = (d_print_mod *)0x0;
  d_print_comp(dpi,(((dc->u).s_binary.left)->u).s_binary.left);
  pcVar3 = dpi->buf;
  dpi->templates = local_18.next;
  if (pcVar3 == (char *)0x0) {
LAB_089d1978:
    d_print_append_char(dpi,0x3c);
  }
  else {
    uVar2 = dpi->len;
    if (uVar2 == 0) {
LAB_089d1964:
      uVar1 = dpi->alc;
    }
    else {
      uVar1 = dpi->alc;
      if ((pcVar3 + uVar2)[-1] == '<') {
        if (uVar2 < uVar1) {
          pcVar3[uVar2] = ' ';
          dpi->len = uVar2 + 1;
          pcVar3 = dpi->buf;
        }
        else {
          d_print_append_char(dpi,0x20);
          pcVar3 = dpi->buf;
        }
        if (pcVar3 == (char *)0x0) goto LAB_089d1978;
        uVar2 = dpi->len;
        goto LAB_089d1964;
      }
    }
    if (uVar1 <= uVar2) goto LAB_089d1978;
    pcVar3[uVar2] = '<';
    dpi->len = uVar2 + 1;
  }
  d_print_comp(dpi,(((dc->u).s_binary.left)->u).s_extended_operator.name);
  pcVar3 = dpi->buf;
  if (pcVar3 != (char *)0x0) {
    uVar2 = dpi->len;
    if (uVar2 == 0) {
      uVar1 = dpi->alc;
    }
    else {
      if ((pcVar3 + uVar2)[-1] == '>') {
        if (uVar2 < dpi->alc) {
          pcVar3[uVar2] = ' ';
          dpi->len = uVar2 + 1;
          pcVar3 = dpi->buf;
        }
        else {
          d_print_append_char(dpi,0x20);
          pcVar3 = dpi->buf;
        }
        if (pcVar3 == (char *)0x0) goto LAB_089d1a4c;
        uVar2 = dpi->len;
      }
      uVar1 = dpi->alc;
    }
    if (uVar2 < uVar1) {
      pcVar3[uVar2] = '>';
      dpi->len = uVar2 + 1;
      dpi->modifiers = pdVar4;
      return;
    }
  }
LAB_089d1a4c:
  d_print_append_char(dpi,0x3e);
  dpi->modifiers = pdVar4;
  return;
}



----------------------------------------

// Function: d_print_expr_op @ 089d1ab0

void d_print_expr_op(d_print_info *dpi,demangle_component *dc)

{
  size_t len0;
  demangle_component *pdVar1;
  
  if (dc->type != DEMANGLE_COMPONENT_OPERATOR) {
    d_print_comp(dpi,dc);
    return;
  }
  pdVar1 = (dc->u).s_binary.left;
  if (dpi->buf != (char *)0x0) {
    len0 = (pdVar1->u).s_name.len;
    if (dpi->len + len0 <= dpi->alc) {
      memcpy(dpi->buf + dpi->len,(pdVar1->u).s_name.s,len0);
      dpi->len = (int)&((((dc->u).s_binary.left)->u).s_extended_operator.name)->type + dpi->len;
      return;
    }
  }
  d_print_append_buffer(dpi,(pdVar1->u).s_name.s,(pdVar1->u).s_name.len);
  return;
}



----------------------------------------

// Function: d_print_mod @ 089d1b60

void d_print_mod(d_print_info *dpi,demangle_component *mod)

{
  uint uVar1;
  undefined4 uVar2;
  uint uVar3;
  int c;
  demangle_component *dc;
  undefined4 uVar4;
  char *pcVar5;
  size_t l;
  char *pcVar6;
  
  uVar4 = s_imaginary_089f2174._4_4_;
  uVar2 = s_complex_089f2168._4_4_;
  switch(mod->type) {
  case DEMANGLE_COMPONENT_TYPED_NAME:
    mod = (mod->u).s_binary.left;
    goto LAB_089d1bac;
  default:
    goto LAB_089d1bac;
  case DEMANGLE_COMPONENT_RESTRICT:
  case DEMANGLE_COMPONENT_RESTRICT_THIS:
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 9)) {
      pcVar5 = " restrict";
      l = 9;
      goto LAB_089d1cac;
    }
    pcVar6 = " restrict";
    pcVar5 = dpi->buf + dpi->len;
    uVar2 = s_restrict_089f2148._0_4_;
    goto LAB_089d1f84;
  case DEMANGLE_COMPONENT_VOLATILE:
  case DEMANGLE_COMPONENT_VOLATILE_THIS:
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 9)) {
      pcVar5 = " volatile";
      l = 9;
      goto LAB_089d1cac;
    }
    pcVar6 = " volatile";
    pcVar5 = dpi->buf + dpi->len;
    uVar2 = s_volatile_089f2154._0_4_;
LAB_089d1f84:
    uVar4 = *(undefined4 *)(pcVar6 + 4);
    *(undefined4 *)pcVar5 = uVar2;
    *(undefined4 *)(pcVar5 + 4) = uVar4;
    pcVar5[8] = pcVar6[8];
    dpi->len = dpi->len + 9;
    break;
  case DEMANGLE_COMPONENT_CONST:
  case DEMANGLE_COMPONENT_CONST_THIS:
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 6)) {
      pcVar5 = " const";
      l = 6;
      goto LAB_089d1cac;
    }
    pcVar5 = dpi->buf + dpi->len;
    *(undefined4 *)pcVar5 = s_const_089f2160._0_4_;
    pcVar5[4] = s_const_089f2160[4];
    pcVar5[5] = s_const_089f2160[5];
    dpi->len = dpi->len + 6;
    break;
  case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
    if ((dpi->buf == (char *)0x0) || (uVar3 = dpi->len, dpi->alc <= uVar3)) {
      d_print_append_char(dpi,0x20);
      mod = (mod->u).s_extended_operator.name;
    }
    else {
      dpi->buf[uVar3] = ' ';
      dpi->len = uVar3 + 1;
      mod = (mod->u).s_extended_operator.name;
    }
LAB_089d1bac:
    d_print_comp(dpi,mod);
    return;
  case DEMANGLE_COMPONENT_POINTER:
    if ((dpi->options & 4U) == 0) {
      if ((dpi->buf == (char *)0x0) || (uVar3 = dpi->len, dpi->alc <= uVar3)) {
        c = 0x2a;
        goto LAB_089d1e5c;
      }
      dpi->buf[uVar3] = '*';
      dpi->len = uVar3 + 1;
    }
    break;
  case DEMANGLE_COMPONENT_REFERENCE:
    if ((dpi->buf == (char *)0x0) || (uVar3 = dpi->len, dpi->alc <= uVar3)) {
      c = 0x26;
LAB_089d1e5c:
      d_print_append_char(dpi,c);
      return;
    }
    dpi->buf[uVar3] = '&';
    dpi->len = uVar3 + 1;
    break;
  case DEMANGLE_COMPONENT_COMPLEX:
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 8)) {
      pcVar5 = "complex ";
      l = 8;
      goto LAB_089d1cac;
    }
    pcVar5 = dpi->buf + dpi->len;
    *(undefined4 *)pcVar5 = s_complex_089f2168._0_4_;
    *(undefined4 *)(pcVar5 + 4) = uVar2;
    dpi->len = dpi->len + 8;
    break;
  case DEMANGLE_COMPONENT_IMAGINARY:
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 10)) {
      pcVar5 = "imaginary ";
      l = 10;
      goto LAB_089d1cac;
    }
    pcVar5 = dpi->buf + dpi->len;
    *(undefined4 *)pcVar5 = s_imaginary_089f2174._0_4_;
    *(undefined4 *)(pcVar5 + 4) = uVar4;
    pcVar5[8] = s_imaginary_089f2174[8];
    pcVar5[9] = s_imaginary_089f2174[9];
    dpi->len = dpi->len + 10;
    break;
  case DEMANGLE_COMPONENT_PTRMEM_TYPE:
    pcVar5 = dpi->buf;
    if (pcVar5 == (char *)0x0) {
LAB_089d1e70:
      d_print_append_char(dpi,0x20);
      dc = (mod->u).s_binary.left;
    }
    else {
      uVar3 = dpi->len;
      if (uVar3 == 0) {
        uVar1 = dpi->alc;
LAB_089d1d24:
        if (uVar1 <= uVar3) goto LAB_089d1e70;
        pcVar5[uVar3] = ' ';
        dpi->len = uVar3 + 1;
        dc = (mod->u).s_binary.left;
      }
      else {
        if (pcVar5[uVar3 - 1] != '(') {
          uVar1 = dpi->alc;
          goto LAB_089d1d24;
        }
        dc = (mod->u).s_binary.left;
      }
    }
    d_print_comp(dpi,dc);
    if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 3)) {
      pcVar5 = "::*";
      l = 3;
LAB_089d1cac:
      d_print_append_buffer(dpi,pcVar5,l);
      return;
    }
    pcVar5 = dpi->buf + dpi->len;
    *pcVar5 = DAT_089f210c;
    pcVar5[1] = DAT_089f210d;
    pcVar5[2] = DAT_089f210e;
    dpi->len = dpi->len + 3;
  }
  return;
}



----------------------------------------

// Function: d_print_mod_list @ 089d1fc8

void d_print_mod_list(d_print_info *dpi,d_print_mod *mods,int suffix)

{
  int iVar1;
  demangle_component_type dVar2;
  uint uVar3;
  char *pcVar4;
  demangle_component *pdVar5;
  d_print_mod *pdVar6;
  d_print_template *pdVar7;
  
                    /* Unresolved local var: d_print_template * hold_dpt@[???] */
  if ((mods == (d_print_mod *)0x0) || (dpi->buf == (char *)0x0)) {
    return;
  }
  iVar1 = mods->printed;
  do {
    if (iVar1 == 0) {
      pdVar5 = mods->mod;
      if (suffix == 0) {
        if (pdVar5->type - DEMANGLE_COMPONENT_RESTRICT_THIS < 3) {
          mods = mods->next;
          goto LAB_089d2074;
        }
        dVar2 = pdVar5->type;
        mods->printed = 1;
        pdVar7 = dpi->templates;
        dpi->templates = mods->templates;
      }
      else {
        dVar2 = pdVar5->type;
        mods->printed = 1;
        pdVar7 = dpi->templates;
        dpi->templates = mods->templates;
      }
      if (dVar2 == DEMANGLE_COMPONENT_FUNCTION_TYPE) {
        d_print_function_type(dpi,pdVar5,mods->next);
        dpi->templates = pdVar7;
        return;
      }
      if (dVar2 == DEMANGLE_COMPONENT_ARRAY_TYPE) {
        d_print_array_type(dpi,pdVar5,mods->next);
        dpi->templates = pdVar7;
        return;
      }
      if (dVar2 == DEMANGLE_COMPONENT_LOCAL_NAME) {
        pdVar6 = dpi->modifiers;
                    /* Unresolved local var: d_print_mod * hold_modifiers@[???]
                       Unresolved local var: demangle_component * dc@[???] */
        dpi->modifiers = (d_print_mod *)0x0;
        d_print_comp(dpi,(pdVar5->u).s_binary.left);
        dpi->modifiers = pdVar6;
        if ((dpi->options & 4U) == 0) {
          if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
            d_print_append_buffer(dpi,"::",2);
          }
          else {
            pcVar4 = dpi->buf + dpi->len;
            *pcVar4 = DAT_089f200c;
            pcVar4[1] = DAT_089f200d;
            dpi->len = dpi->len + 2;
          }
LAB_089d2184:
          pdVar5 = mods->mod;
        }
        else {
          if (dpi->buf != (char *)0x0) {
            uVar3 = dpi->len;
            if (uVar3 < dpi->alc) {
              dpi->buf[uVar3] = '.';
              dpi->len = uVar3 + 1;
              goto LAB_089d2184;
            }
          }
          d_print_append_char(dpi,0x2e);
          pdVar5 = mods->mod;
        }
        pdVar5 = (pdVar5->u).s_extended_operator.name;
        if (pdVar5->type - DEMANGLE_COMPONENT_RESTRICT_THIS < 3) {
          for (pdVar5 = (pdVar5->u).s_binary.left;
              pdVar5->type - DEMANGLE_COMPONENT_RESTRICT_THIS < 3;
              pdVar5 = (pdVar5->u).s_binary.left) {
          }
        }
        d_print_comp(dpi,pdVar5);
        dpi->templates = pdVar7;
        return;
      }
      d_print_mod(dpi,pdVar5);
      mods = mods->next;
      dpi->templates = pdVar7;
    }
    else {
      mods = mods->next;
    }
LAB_089d2074:
    if (mods == (d_print_mod *)0x0) {
      return;
    }
    if (dpi->buf == (char *)0x0) {
      return;
    }
    iVar1 = mods->printed;
  } while( true );
}



----------------------------------------

// Function: d_print_array_type @ 089d2250

void d_print_array_type(d_print_info *dpi,demangle_component *dc,d_print_mod *mods)

{
  int iVar1;
  d_print_mod *pdVar2;
  char *pcVar3;
  uint uVar4;
  demangle_component *dc_00;
  
                    /* Unresolved local var: int need_space@[???] */
  if (mods == (d_print_mod *)0x0) {
LAB_089d22a0:
    pcVar3 = dpi->buf;
LAB_089d22a4:
    if (pcVar3 == (char *)0x0) {
LAB_089d22c4:
      d_print_append_char(dpi,0x20);
    }
    else {
      uVar4 = dpi->len;
      if (dpi->alc <= uVar4) goto LAB_089d22c4;
      pcVar3[uVar4] = ' ';
      dpi->len = uVar4 + 1;
    }
    pcVar3 = dpi->buf;
  }
  else {
                    /* Unresolved local var: int need_paren@[???]
                       Unresolved local var: d_print_mod * p@[???] */
    iVar1 = mods->printed;
    pdVar2 = mods;
    while (iVar1 != 0) {
      pdVar2 = pdVar2->next;
      if (pdVar2 == (d_print_mod *)0x0) {
        d_print_mod_list(dpi,mods,0);
        goto LAB_089d22a0;
      }
      iVar1 = pdVar2->printed;
    }
    if (pdVar2->mod->type != DEMANGLE_COMPONENT_ARRAY_TYPE) {
      if ((dpi->buf == (char *)0x0) || (dpi->alc < dpi->len + 2)) {
        d_print_append_buffer(dpi," (",2);
      }
      else {
        pcVar3 = dpi->buf + dpi->len;
        *pcVar3 = DAT_089f2130;
        pcVar3[1] = DAT_089f2131;
        dpi->len = dpi->len + 2;
      }
      d_print_mod_list(dpi,mods,0);
      if ((dpi->buf != (char *)0x0) && (uVar4 = dpi->len, uVar4 < dpi->alc)) {
        dpi->buf[uVar4] = ')';
        dpi->len = uVar4 + 1;
        goto LAB_089d22a0;
      }
      d_print_append_char(dpi,0x29);
      pcVar3 = dpi->buf;
      goto LAB_089d22a4;
    }
    d_print_mod_list(dpi,mods,0);
    pcVar3 = dpi->buf;
  }
  if (pcVar3 != (char *)0x0) {
    uVar4 = dpi->len;
    if (uVar4 < dpi->alc) {
      pcVar3[uVar4] = '[';
      dpi->len = uVar4 + 1;
      goto LAB_089d22f8;
    }
  }
  d_print_append_char(dpi,0x5b);
LAB_089d22f8:
  dc_00 = (dc->u).s_binary.left;
  if (dc_00 == (demangle_component *)0x0) {
    pcVar3 = dpi->buf;
  }
  else {
    d_print_comp(dpi,dc_00);
    pcVar3 = dpi->buf;
  }
  if (pcVar3 != (char *)0x0) {
    uVar4 = dpi->len;
    if (uVar4 < dpi->alc) {
      pcVar3[uVar4] = ']';
      dpi->len = uVar4 + 1;
      return;
    }
  }
  d_print_append_char(dpi,0x5d);
  return;
}



----------------------------------------

// Function: d_print_function_type @ 089d2474

void d_print_function_type(d_print_info *dpi,demangle_component *dc,d_print_mod *mods)

{
  bool bVar1;
  bool bVar2;
  bool bVar3;
  demangle_component *pdVar4;
  uint uVar5;
  uint uVar6;
  size_t sVar7;
  char *pcVar8;
  d_print_mod *pdVar9;
  
                    /* Unresolved local var: int need_paren@[???]
                       Unresolved local var: int saw_mod@[???]
                       Unresolved local var: int need_space@[???]
                       Unresolved local var: d_print_mod * p@[???]
                       Unresolved local var: d_print_mod * hold_modifiers@[???] */
  if ((mods != (d_print_mod *)0x0) && (mods->printed == 0)) {
    pdVar4 = mods->mod;
    pdVar9 = mods;
    do {
      uVar6 = pdVar4->type - DEMANGLE_COMPONENT_RESTRICT;
      uVar5 = 1 << (uVar6 & 0x1f);
      if (uVar6 < 0x10) {
        if ((uVar5 & 0x8647) == 0) {
          bVar2 = false;
          if ((uVar5 & 0x180) == 0) goto LAB_089d24e0;
        }
        else {
          bVar2 = true;
        }
        bVar3 = true;
        bVar1 = true;
        goto LAB_089d2510;
      }
LAB_089d24e0:
      pdVar9 = pdVar9->next;
      if ((pdVar9 == (d_print_mod *)0x0) || (pdVar9->printed != 0)) goto LAB_089d24fc;
      pdVar4 = pdVar9->mod;
    } while( true );
  }
  bVar3 = false;
  bVar1 = false;
  bVar2 = false;
LAB_089d2510:
  if ((((dc->u).s_name.s == (char *)0x0) || (bVar1)) && (!bVar3)) {
    pdVar9 = dpi->modifiers;
    dpi->modifiers = (d_print_mod *)0x0;
    d_print_mod_list(dpi,mods,0);
    pcVar8 = dpi->buf;
    goto LAB_089d25fc;
  }
  pcVar8 = dpi->buf;
  if (bVar2) {
    if (pcVar8 != (char *)0x0) {
      uVar5 = dpi->len;
      sVar7 = uVar5;
      if (uVar5 == 0) {
LAB_089d2554:
        if (dpi->alc <= sVar7) goto LAB_089d276c;
        pcVar8[sVar7] = ' ';
        dpi->len = sVar7 + 1;
        pcVar8 = dpi->buf;
        goto LAB_089d257c;
      }
LAB_089d2544:
      sVar7 = uVar5;
      if (pcVar8[uVar5 - 1] != ' ') goto LAB_089d2554;
      uVar6 = dpi->alc;
      goto LAB_089d258c;
    }
LAB_089d276c:
    d_print_append_char(dpi,0x20);
    pcVar8 = dpi->buf;
LAB_089d257c:
    if (pcVar8 != (char *)0x0) {
      uVar5 = dpi->len;
      goto LAB_089d2588;
    }
LAB_089d274c:
    d_print_append_char(dpi,0x28);
    pdVar9 = dpi->modifiers;
  }
  else {
    if (pcVar8 == (char *)0x0) goto LAB_089d276c;
    uVar5 = dpi->len;
    sVar7 = 0;
    if (uVar5 == 0) goto LAB_089d2554;
    if ((pcVar8[uVar5 - 1] != '(') && (pcVar8[uVar5 - 1] != '*')) goto LAB_089d2544;
LAB_089d2588:
    uVar6 = dpi->alc;
LAB_089d258c:
    if (uVar6 <= uVar5) goto LAB_089d274c;
    pcVar8[uVar5] = '(';
    dpi->len = uVar5 + 1;
    pdVar9 = dpi->modifiers;
  }
  dpi->modifiers = (d_print_mod *)0x0;
  d_print_mod_list(dpi,mods,0);
  if ((dpi->buf == (char *)0x0) || (uVar5 = dpi->len, dpi->alc <= uVar5)) {
    d_print_append_char(dpi,0x29);
    pcVar8 = dpi->buf;
  }
  else {
    dpi->buf[uVar5] = ')';
    dpi->len = uVar5 + 1;
    pcVar8 = dpi->buf;
  }
LAB_089d25fc:
  if ((pcVar8 == (char *)0x0) || (uVar5 = dpi->len, dpi->alc <= uVar5)) {
    d_print_append_char(dpi,0x28);
    pdVar4 = (dc->u).s_extended_operator.name;
  }
  else {
    pcVar8[uVar5] = '(';
    dpi->len = uVar5 + 1;
    pdVar4 = (dc->u).s_extended_operator.name;
  }
  if (pdVar4 == (demangle_component *)0x0) {
    pcVar8 = dpi->buf;
  }
  else {
    d_print_comp(dpi,pdVar4);
    pcVar8 = dpi->buf;
  }
  if ((pcVar8 != (char *)0x0) && (uVar5 = dpi->len, uVar5 < dpi->alc)) {
    pcVar8[uVar5] = ')';
    dpi->len = uVar5 + 1;
    d_print_mod_list(dpi,mods,1);
    dpi->modifiers = pdVar9;
    return;
  }
  d_print_append_char(dpi,0x29);
  d_print_mod_list(dpi,mods,1);
  dpi->modifiers = pdVar9;
  return;
LAB_089d24fc:
  bVar3 = false;
  bVar1 = true;
  bVar2 = false;
  goto LAB_089d2510;
}



----------------------------------------

// Function: d_demangle @ 089d278c

/* WARNING: Removing unreachable block (ram,0x089d28ec) */

char * d_demangle(char *mangled,int options,size_t *palc)

{
  int iVar1;
  bool bVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  undefined4 uVar9;
  undefined4 uVar10;
  undefined4 uVar11;
  undefined4 uVar12;
  undefined4 uVar13;
  undefined4 uVar14;
  size_t sVar15;
  demangle_component *dc;
  int iVar16;
  char *s1;
  char cVar17;
  d_print_info local_80;
  d_info local_64;
  
                    /* Unresolved local var: size_t len@[???]
                       Unresolved local var: int type@[???]
                       Unresolved local var: d_info di@[???]
                       Unresolved local var: demangle_component * dc@[???]
                       Unresolved local var: int estimate@[???]
                       Unresolved local var: char * ret@[???] */
  *palc = 0;
  sVar15 = strlen(mangled);
  if ((*mangled == '_') && (mangled[1] == 'Z')) {
    bVar2 = false;
    goto LAB_089d2820;
  }
  iVar16 = strncmp(mangled,"_GLOBAL_",8);
  if (iVar16 == 0) {
    cVar17 = mangled[8];
    if ((cVar17 == '.') || (cVar17 == '_')) {
      cVar17 = mangled[9];
    }
    else {
      if (cVar17 != '$') goto LAB_089d2818;
      cVar17 = mangled[9];
    }
    if (((cVar17 == 'D') || (cVar17 == 'I')) && (mangled[10] == '_')) {
                    /* Unresolved local var: char * r@[???] */
      s1 = malloc(sVar15 + 0x1d);
      uVar14 = s_global_destructors_keyed_to_089f21a0._24_4_;
      uVar13 = s_global_destructors_keyed_to_089f21a0._20_4_;
      uVar12 = s_global_destructors_keyed_to_089f21a0._16_4_;
      uVar11 = s_global_destructors_keyed_to_089f21a0._12_4_;
      uVar10 = s_global_destructors_keyed_to_089f21a0._8_4_;
      uVar9 = s_global_destructors_keyed_to_089f21a0._4_4_;
      uVar8 = s_global_constructors_keyed_to_089f2180._24_4_;
      uVar7 = s_global_constructors_keyed_to_089f2180._20_4_;
      uVar6 = s_global_constructors_keyed_to_089f2180._16_4_;
      uVar5 = s_global_constructors_keyed_to_089f2180._12_4_;
      uVar4 = s_global_constructors_keyed_to_089f2180._8_4_;
      uVar3 = s_global_constructors_keyed_to_089f2180._4_4_;
      if (s1 == (char *)0x0) {
        *palc = 1;
        return (char *)0x0;
      }
      if (mangled[9] == 'I') {
        *(undefined4 *)s1 = s_global_constructors_keyed_to_089f2180._0_4_;
        *(undefined4 *)(s1 + 4) = uVar3;
        *(undefined4 *)(s1 + 8) = uVar4;
        *(undefined4 *)(s1 + 0xc) = uVar5;
        *(undefined4 *)(s1 + 0x10) = uVar6;
        *(undefined4 *)(s1 + 0x14) = uVar7;
        *(undefined4 *)(s1 + 0x18) = uVar8;
        s1[0x1c] = s_global_constructors_keyed_to_089f2180[0x1c];
        s1[0x1d] = s_global_constructors_keyed_to_089f2180[0x1d];
      }
      else {
        *(undefined4 *)s1 = s_global_destructors_keyed_to_089f21a0._0_4_;
        *(undefined4 *)(s1 + 4) = uVar9;
        *(undefined4 *)(s1 + 8) = uVar10;
        *(undefined4 *)(s1 + 0xc) = uVar11;
        *(undefined4 *)(s1 + 0x10) = uVar12;
        *(undefined4 *)(s1 + 0x14) = uVar13;
        *(undefined4 *)(s1 + 0x18) = uVar14;
        s1[0x1c] = s_global_destructors_keyed_to_089f21a0[0x1c];
      }
      strcat(s1,mangled + 0xb);
      return s1;
    }
  }
LAB_089d2818:
  bVar2 = true;
  if ((options & 0x10U) == 0) {
    return (char *)0x0;
  }
LAB_089d2820:
  local_64.num_comps = sVar15 * 2;
                    /* Unresolved local var: demangle_component[0] comps@[???]
                       Unresolved local var: demangle_component *[0] subs@[???] */
  local_64.send = mangled + sVar15;
  local_64.next_comp = 0;
  local_64.next_sub = 0;
  local_64.did_subs = 0;
  local_64.last_name = (demangle_component *)0x0;
  iVar16 = -(sVar15 * 0x18 + 8);
  local_64.comps = (demangle_component *)((int)&local_80 + iVar16);
  iVar1 = -(sVar15 * 4 + 0xe & 0xfffffff8);
  local_64.subs = (demangle_component **)((int)&local_80 + iVar1 + iVar16);
  local_64.expansion = 0;
  local_64.s = mangled;
  local_64.options = options;
  local_64.n = mangled;
  local_64.num_subs = sVar15;
  if (bVar2) {
    dc = d_type(&local_64);
  }
  else {
    local_64.comps = (demangle_component *)((int)&local_80 + iVar16);
    local_64.subs = (demangle_component **)((int)&local_80 + iVar1 + iVar16);
    dc = d_mangled_name(&local_64,1);
  }
  if (((options & 1U) == 0) || (local_80.buf = (char *)0x0, *local_64.n == '\0')) {
    if (dc == (demangle_component *)0x0) {
      local_80.buf = (char *)0x0;
    }
    else {
                    /* Unresolved local var: d_print_info dpi@[???] */
      iVar16 = sVar15 + local_64.expansion + local_64.did_subs * 10;
      local_80.alc = iVar16 / 8 + iVar16 + 1;
      local_80.options = options;
      local_80.buf = malloc(local_80.alc);
      if (local_80.buf == (char *)0x0) {
        local_80.buf = (char *)0x0;
        *palc = 1;
      }
      else {
        local_80.len = 0;
        local_80.templates = (d_print_template *)0x0;
        local_80.modifiers = (d_print_mod *)0x0;
        local_80.allocation_failure = 0;
        d_print_comp(&local_80,dc);
        if ((local_80.buf == (char *)0x0) || (local_80.alc <= local_80.len)) {
          d_print_append_char(&local_80,0);
          if (local_80.buf == (char *)0x0) {
            *palc = local_80.allocation_failure;
            return (char *)0x0;
          }
        }
        else {
          local_80.buf[local_80.len] = '\0';
        }
        *palc = local_80.alc;
      }
    }
  }
  return local_80.buf;
}



----------------------------------------

// Function: __cxa_demangle @ 089d2b9c

char * __cxa_demangle(char *mangled_name,char *output_buffer,size_t *length,int *status)

{
  char *__s;
  size_t sVar1;
  size_t local_20 [2];
  
                    /* Unresolved local var: char * demangled@[???]
                       Unresolved local var: size_t alc@[???] */
  if ((mangled_name == (char *)0x0) || ((output_buffer != (char *)0x0 && (length == (size_t *)0x0)))
     ) {
    if (status == (int *)0x0) {
      __s = (char *)0x0;
    }
    else {
      __s = (char *)0x0;
      *status = -3;
    }
  }
  else {
    __s = d_demangle(mangled_name,0x11,local_20);
    if (__s == (char *)0x0) {
      if (status != (int *)0x0) {
        if (local_20[0] == 1) {
          *status = -1;
        }
        else {
          *status = -2;
        }
      }
    }
    else {
      if (output_buffer == (char *)0x0) {
        if (length != (size_t *)0x0) {
          *length = local_20[0];
        }
      }
      else {
        sVar1 = strlen(__s);
        if (sVar1 < *length) {
          strcpy(output_buffer,__s);
          free(__s);
          __s = output_buffer;
        }
        else {
          free(output_buffer);
          *length = local_20[0];
        }
      }
      if (status != (int *)0x0) {
        *status = 0;
      }
    }
  }
  return __s;
}



----------------------------------------

// Function: __cxa_current_exception_type @ 089d2ca8

type_info * __cxxabiv1::__cxa_current_exception_type(void)

{
  __cxa_eh_globals *p_Var1;
  type_info *ptVar2;
  
                    /* Unresolved local var: __cxa_eh_globals * globals@[???]
                       Unresolved local var: __cxa_exception * header@[???] */
  p_Var1 = __cxa_get_globals();
  ptVar2 = (type_info *)0x0;
  if (p_Var1->caughtExceptions != (__cxa_exception *)0x0) {
    ptVar2 = p_Var1->caughtExceptions->exceptionType;
  }
  return ptVar2;
}



----------------------------------------

// Function: _fdopen_r @ 089d2cd8

FILE * _fdopen_r(_reent *ptr,int fd,char *mode)

{
  int iVar1;
  uint uVar2;
  FILE *pFVar3;
  uint local_20 [2];
  
                    /* Unresolved local var: FILE * fp@[???]
                       Unresolved local var: int flags@[???]
                       Unresolved local var: int oflags@[???]
                       Unresolved local var: int fdflags@[???]
                       Unresolved local var: int fdmode@[???] */
  iVar1 = __sflags(ptr,mode,(int *)local_20);
  if ((iVar1 == 0) || (uVar2 = _fcntl_r(ptr,fd,3,0), (int)uVar2 < 0)) {
    pFVar3 = (FILE *)0x0;
  }
  else if (((uVar2 & 3) == 2) || ((uVar2 & 3) == (local_20[0] & 3))) {
    pFVar3 = __sfp(ptr);
    if (pFVar3 != (FILE *)0x0) {
      pFVar3->_flags = (ushort)iVar1;
      if (((local_20[0] & 8) != 0) && ((uVar2 & 8) == 0)) {
        pFVar3->_flags = (ushort)iVar1 | 0x100;
      }
      pFVar3->_read = __sread;
      pFVar3->_write = __swrite;
      pFVar3->_file = (short)fd;
      pFVar3->_seek = __sseek;
      pFVar3->_close = __sclose;
      pFVar3->_cookie = pFVar3;
    }
  }
  else {
    pFVar3 = (FILE *)0x0;
    ptr->_errno = 9;
  }
  return pFVar3;
}



----------------------------------------

// Function: fdopen @ 089d2de4

FILE * fdopen(int fd,char *mode)

{
  FILE *pFVar1;
  
  pFVar1 = _fdopen_r(_impure_ptr,fd,mode);
  return pFVar1;
}



----------------------------------------

// Function: fileno @ 089d2dfc

int fileno(FILE *f)

{
                    /* Unresolved local var: int result@[???] */
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
    return (int)f->_file;
  }
  return (int)f->_file;
}



----------------------------------------

// Function: _fputs_r @ 089d2e54

int _fputs_r(_reent *ptr,char *s,FILE *fp)

{
  int iVar1;
  __siov local_28;
  __suio local_20;
  
                    /* Unresolved local var: int result@[???]
                       Unresolved local var: __suio uio@[???]
                       Unresolved local var: __siov iov@[???] */
  local_28.iov_base = s;
  local_28.iov_len = strlen(s);
  local_20.uio_iovcnt = 1;
  local_20.uio_resid = local_28.iov_len;
  if ((ptr != (_reent *)0x0) && (ptr->__sdidinit == 0)) {
    local_20.uio_iov = &local_28;
    __sinit(ptr);
    iVar1 = __sfvwrite_r(ptr,fp,&local_20);
    return iVar1;
  }
  local_20.uio_iov = &local_28;
  iVar1 = __sfvwrite_r(ptr,fp,&local_20);
  return iVar1;
}



----------------------------------------

// Function: fputs @ 089d2eec

int fputs(char *s,FILE *fp)

{
  int iVar1;
  
  iVar1 = _fputs_r(_impure_ptr,s,fp);
  return iVar1;
}



----------------------------------------

// Function: getc @ 089d2f04

int getc(FILE *fp)

{
  byte bVar1;
  int iVar2;
  
                    /* Unresolved local var: int result@[???] */
  if ((_impure_ptr == (_reent *)0x0) || (_impure_ptr->__sdidinit != 0)) {
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  else {
    __sinit(_impure_ptr);
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  if (-1 < iVar2) {
    bVar1 = *fp->_p;
    fp->_p = fp->_p + 1;
    return (uint)bVar1;
  }
  iVar2 = __srget_r(_impure_ptr,fp);
  return iVar2;
}



----------------------------------------

// Function: _getc_r @ 089d2f94

int _getc_r(_reent *ptr,FILE *fp)

{
  byte bVar1;
  int iVar2;
  
                    /* Unresolved local var: int result@[???] */
  if ((ptr == (_reent *)0x0) || (ptr->__sdidinit != 0)) {
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  else {
    __sinit(ptr);
    iVar2 = fp->_r + -1;
    fp->_r = iVar2;
  }
  if (-1 < iVar2) {
    bVar1 = *fp->_p;
    fp->_p = fp->_p + 1;
    return (uint)bVar1;
  }
  iVar2 = __srget_r(ptr,fp);
  return iVar2;
}



----------------------------------------

// Function: setvbuf @ 089d302c

int setvbuf(FILE *fp,char *buf,int mode,size_t size)

{
  ushort uVar1;
  _reent *p_Var2;
  size_t sVar3;
  int iVar4;
  
                    /* Unresolved local var: int ret@[???] */
  if ((_impure_ptr != (_reent *)0x0) && (_impure_ptr->__sdidinit == 0)) {
    __sinit(_impure_ptr);
  }
  if (2 < (uint)mode) {
    return -1;
  }
  if ((int)size < 0) {
    return -1;
  }
  fflush(fp);
  fp->_r = 0;
  fp->_lbfsize = 0;
  if ((fp->_flags & 0x80U) == 0) {
    uVar1 = fp->_flags;
  }
  else {
    _free_r(_impure_ptr,(fp->_bf)._base);
    uVar1 = fp->_flags;
  }
  fp->_flags = uVar1 & 0xff7c;
  if (mode == 2) {
    iVar4 = 0;
LAB_089d3194:
    uVar1 = fp->_flags;
    (fp->_bf)._size = 1;
    fp->_flags = uVar1 | 2;
    (fp->_bf)._base = fp->_nbuf;
    fp->_w = 0;
    fp->_p = fp->_nbuf;
    return iVar4;
  }
  if (buf == (char *)0x0) {
    if (size == 0) {
      size = 0x400;
    }
    buf = malloc(size);
    if ((uchar *)buf == (uchar *)0x0) {
      buf = malloc(0x400);
      if ((uchar *)buf == (uchar *)0x0) {
        iVar4 = -1;
        goto LAB_089d3194;
      }
      size = 0x400;
    }
    fp->_flags = fp->_flags | 0x80;
  }
  if (mode != 0) {
    if (mode != 1) goto LAB_089d30f8;
    fp->_flags = fp->_flags | 1;
    if ((uchar *)buf == (uchar *)0x0) {
      fp->_lbfsize = 0;
    }
    else {
      fp->_lbfsize = -size;
    }
  }
  p_Var2 = _impure_ptr;
  (fp->_bf)._base = (uchar *)buf;
  p_Var2->__cleanup = _cleanup_r;
  fp->_p = (uchar *)buf;
  (fp->_bf)._size = size;
LAB_089d30f8:
  if ((fp->_flags & 8U) != 0) {
    sVar3 = 0;
    if ((fp->_flags & 3U) == 0) {
      sVar3 = size;
    }
    fp->_w = sVar3;
  }
  return 0;
}



----------------------------------------

// Function: strcoll @ 089d31f0

int strcoll(char *a,char *b)

{
  byte *pbVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  
  uVar2 = (uint)(byte)*a;
  if ((((uint)a | (uint)b) & 1) == 0) {
    while( true ) {
      uVar3 = (uint)(byte)*b;
      if ((uVar2 == 0) || (uVar4 = (uint)(byte)a[1], uVar2 != uVar3)) break;
      pbVar1 = (byte *)(b + 1);
      b = b + 2;
      if ((uVar4 == 0) || (uVar2 = (uint)(byte)a[2], a = a + 2, uVar4 != *pbVar1)) {
        return uVar4 - *pbVar1;
      }
    }
  }
  else {
    while( true ) {
      uVar3 = (uint)(byte)*b;
      a = a + 1;
      b = b + 1;
      if ((uVar2 == 0) || (uVar2 != uVar3)) break;
      uVar2 = (uint)(byte)*a;
    }
  }
  return uVar2 - uVar3;
}



----------------------------------------

// Function: iso_year_adjust @ 089d31f8

/* WARNING: Removing unreachable block (ram,0x089d322c) */
/* WARNING: Removing unreachable block (ram,0x089d325c) */

int iso_year_adjust(tm *tim_p)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  
                    /* Unresolved local var: int leap@[???] */
  iVar3 = tim_p->tm_year;
  iVar1 = -100;
  if (iVar3 < 0) {
    iVar1 = 0x76c;
  }
  if (((iVar1 + iVar3 & 3U) != 0) || (uVar2 = 1, (iVar1 + iVar3) % 100 == 0)) {
    iVar1 = -100;
    if (iVar3 < 0) {
      iVar1 = 0x76c;
    }
    uVar2 = (uint)((iVar1 + iVar3) % 400 == 0);
  }
  uVar2 = uVar2 + tim_p->tm_yday * 0x10 + tim_p->tm_wday * 2;
  if ((int)uVar2 < 0x22) {
    if ((int)uVar2 < 0x20) {
      if ((int)uVar2 < 0xe) {
        if (9 < (int)uVar2) {
          return -1;
        }
      }
      else {
        if ((int)uVar2 < 0x10) {
          return 0;
        }
        if ((int)uVar2 < 0x12) {
          return -1;
        }
        uVar2 = uVar2 - 0x1c;
      }
      if (1 < uVar2) {
        return 0;
      }
    }
    return -1;
  }
  if ((int)uVar2 < 0x16c7) {
    if (0x16c1 < (int)uVar2) {
      return 1;
    }
    if (uVar2 == 0x16a2) {
      return 1;
    }
    if ((0x16a1 < (int)uVar2) && (uVar2 - 0x16b2 < 3)) {
      return 1;
    }
  }
  else if (((uVar2 == 0x16d5) || (uVar2 == 0x16d7)) || (uVar2 == 0x16d3)) {
    return 1;
  }
  return 0;
}



----------------------------------------

// Function: strftime @ 089d3360

/* WARNING: Removing unreachable block (ram,0x089d4164) */
/* WARNING: Removing unreachable block (ram,0x089d4100) */
/* WARNING: Removing unreachable block (ram,0x089d4144) */
/* WARNING: Removing unreachable block (ram,0x089d4120) */
/* WARNING: Removing unreachable block (ram,0x089d3e7c) */
/* WARNING: Removing unreachable block (ram,0x089d4094) */
/* WARNING: Removing unreachable block (ram,0x089d3724) */
/* WARNING: Removing unreachable block (ram,0x089d3fa0) */
/* WARNING: Removing unreachable block (ram,0x089d41a4) */
/* WARNING: Removing unreachable block (ram,0x089d3b78) */
/* WARNING: Removing unreachable block (ram,0x089d3484) */
/* WARNING: Removing unreachable block (ram,0x089d4184) */
/* WARNING: Removing unreachable block (ram,0x089d40d4) */
/* WARNING: Removing unreachable block (ram,0x089d41cc) */
/* WARNING: Removing unreachable block (ram,0x089d389c) */
/* WARNING: Removing unreachable block (ram,0x089d34e0) */
/* WARNING: Removing unreachable block (ram,0x089d34f8) */
/* WARNING: Removing unreachable block (ram,0x089d3af4) */
/* WARNING: Removing unreachable block (ram,0x089d3ee0) */
/* WARNING: Removing unreachable block (ram,0x089d3b90) */
/* WARNING: Removing unreachable block (ram,0x089d3758) */
/* WARNING: Removing unreachable block (ram,0x089d3bb4) */
/* WARNING: Removing unreachable block (ram,0x089d377c) */
/* WARNING: Type propagation algorithm not settling */

size_t strftime(char *s,size_t maxsize,char *format,tm *tim_p)

{
  bool bVar1;
  __tzinfo_type *p_Var2;
  int iVar3;
  long lVar4;
  size_t sVar5;
  size_t sVar6;
  char *pcVar7;
  char *pcVar8;
  size_t sVar9;
  int iVar10;
  char cVar11;
  uint uVar12;
  int iVar13;
  uint uVar14;
  char *pcVar15;
  
                    /* Unresolved local var: size_t count@[???]
                       Unresolved local var: int i@[???] */
  uVar14 = 0;
LAB_089d339c:
  cVar11 = *format;
  while( true ) {
    if (cVar11 == '\0') goto LAB_089d33d4;
    if (cVar11 == '%') break;
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    s[uVar14] = cVar11;
    format = format + 1;
    cVar11 = *format;
    uVar14 = uVar14 + 1;
  }
  pcVar15 = format + 1;
  if (format[1] == 'E') {
    pcVar15 = format + 2;
  }
  else if (format[1] == 'O') {
    pcVar15 = format + 2;
  }
  uVar12 = (uint)*pcVar15;
  switch(uVar12 - 0x25 & 0xff) {
  case 0:
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    s[uVar14] = '%';
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 1;
    break;
  default:
    goto switchD_089d3458_caseD_1;
  case 0x1c:
    iVar3 = tim_p->tm_wday;
    if (0 < dname_len[iVar3]) {
      pcVar8 = s + uVar14;
      if (maxsize - 1 <= uVar14) {
        return 0;
      }
      iVar13 = 0;
      while( true ) {
        pcVar7 = dname[iVar3] + iVar13;
        iVar13 = iVar13 + 1;
        *pcVar8 = *pcVar7;
        iVar3 = tim_p->tm_wday;
        uVar14 = uVar14 + 1;
        if (dname_len[iVar3] <= iVar13) break;
        pcVar8 = pcVar8 + 1;
        if (maxsize - 1 <= uVar14) {
          return 0;
        }
      }
      cVar11 = *pcVar15;
      goto LAB_089d3660;
    }
    goto LAB_089d34ac;
  case 0x1d:
    iVar3 = tim_p->tm_mon;
    if (mname_len[iVar3] < 1) goto LAB_089d34ac;
    pcVar8 = s + uVar14;
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    iVar13 = 0;
    while( true ) {
      pcVar7 = mname[iVar3] + iVar13;
      iVar13 = iVar13 + 1;
      *pcVar8 = *pcVar7;
      iVar3 = tim_p->tm_mon;
      uVar14 = uVar14 + 1;
      if (mname_len[iVar3] <= iVar13) break;
      pcVar8 = pcVar8 + 1;
      if (maxsize - 1 <= uVar14) {
        return 0;
      }
    }
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x1e:
                    /* Unresolved local var: int neg@[???]
                       Unresolved local var: int century@[???] */
    iVar3 = tim_p->tm_year;
    if (iVar3 < 0) {
      abs(iVar3 + 0x76c);
    }
    pcVar8 = "";
    if (iVar3 < -0x76c) {
      pcVar8 = "-";
    }
    iVar3 = snprintf(s + uVar14,maxsize - uVar14,"%s%.*d",pcVar8);
    uVar14 = uVar14 + iVar3;
    if (maxsize <= uVar14) {
      return 0;
    }
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x1f:
  case 0x53:
    if (maxsize - 8 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_mon;
    iVar13 = tim_p->tm_mday;
    if (tim_p->tm_year < 0) {
      abs(tim_p->tm_year + 0x76c);
    }
    sprintf(s + uVar14,"%.2d/%.2d/%.2d",iVar3 + 1,iVar13);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 8;
    break;
  case 0x21:
                    /* Unresolved local var: size_t adjust@[???] */
    sVar6 = strftime(s + uVar14,maxsize - uVar14,"%C%y-%m-%d",tim_p);
    uVar14 = uVar14 + sVar6;
    if (sVar6 == 0) {
      return 0;
    }
    cVar11 = *pcVar15;
    goto LAB_089d3c8c;
  case 0x22:
                    /* Unresolved local var: int neg@[???]
                       Unresolved local var: int adjust@[???]
                       Unresolved local var: int century@[???]
                       Unresolved local var: int year@[???] */
    iVar13 = tim_p->tm_year;
    iVar3 = iso_year_adjust(tim_p);
    bVar1 = iVar13 < -0x76c;
    if (iVar13 < 0) {
      abs(iVar13 + 0x76c);
      if (tim_p->tm_year < 0) {
        abs(tim_p->tm_year + 0x76c);
      }
    }
    if ((iVar3 < 0) && (tim_p->tm_year < -0x76b)) {
      bVar1 = true;
    }
    pcVar8 = "";
    if (bVar1) {
      pcVar8 = "-";
    }
    iVar3 = snprintf(s + uVar14,maxsize - uVar14,"%s%.*d%.2d",pcVar8);
    uVar14 = uVar14 + iVar3;
    if (maxsize <= uVar14) {
      return 0;
    }
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x23:
  case 0x46:
    uVar12 = uVar12 ^ 0x6b;
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_hour;
    pcVar7 = "%.2d";
    pcVar8 = "%2d";
    goto LAB_089d384c;
  case 0x24:
  case 0x47:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_hour;
    if ((iVar3 != 0) && (iVar3 != 0xc)) {
      pcVar7 = s + uVar14;
      pcVar8 = "%.2d";
      if (uVar12 != 0x49) {
        pcVar8 = "%2d";
      }
      uVar14 = uVar14 + 2;
      sprintf(pcVar7,pcVar8,iVar3 % 0xc);
      if (*pcVar15 == '\0') goto LAB_089d33d4;
      format = pcVar15 + 1;
      goto LAB_089d339c;
    }
    s[uVar14] = '1';
    (s + uVar14)[1] = '2';
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 2;
    break;
  case 0x28:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_min;
    goto LAB_089d348c;
  case 0x2d:
    if (maxsize - 5 <= uVar14) {
      return 0;
    }
    sprintf(s + uVar14,"%.2d:%.2d",tim_p->tm_hour,tim_p->tm_min);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 5;
    break;
  case 0x2e:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_sec;
    goto LAB_089d348c;
  case 0x2f:
  case 0x33:
    if (maxsize - 8 <= uVar14) {
      return 0;
    }
    sprintf(s + uVar14,"%.2d:%.2d:%.2d",tim_p->tm_hour,tim_p->tm_min);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 8;
    break;
  case 0x30:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_yday;
    iVar13 = tim_p->tm_wday;
    goto LAB_089d3e68;
  case 0x31:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
                    /* Unresolved local var: int adjust@[???]
                       Unresolved local var: int wday@[???]
                       Unresolved local var: int week@[???] */
    iVar3 = iso_year_adjust(tim_p);
    iVar13 = tim_p->tm_wday + -1;
    if (tim_p->tm_wday == 0) {
      iVar13 = 6;
    }
    if (iVar3 < 1) {
      if (iVar3 == 0) {
        iVar3 = ((tim_p->tm_yday - iVar13) + 10) / 7;
      }
      else {
        iVar10 = tim_p->tm_year;
        iVar3 = -0x65;
        if (iVar10 < 0) {
          iVar3 = 0x76b;
        }
        if (((iVar3 + iVar10 & 3U) == 0) && ((iVar3 + iVar10) % 100 != 0)) {
          uVar12 = 1;
        }
        else {
          iVar3 = -0x65;
          if (iVar10 < 0) {
            iVar3 = 0x76b;
          }
          uVar12 = (uint)((iVar3 + iVar10) % 400 == 0);
        }
        iVar3 = 0x35;
        if (4 < (int)((iVar13 - tim_p->tm_yday) - uVar12)) {
          iVar3 = 0x34;
        }
      }
    }
    else {
      iVar3 = 1;
    }
    goto LAB_089d348c;
  case 0x32:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
                    /* Unresolved local var: int wday@[???] */
    iVar3 = tim_p->tm_yday;
    if (tim_p->tm_wday == 0) {
      iVar13 = 6;
    }
    else {
      iVar13 = tim_p->tm_wday + -1;
    }
LAB_089d3e68:
    pcVar8 = s + uVar14;
    uVar14 = uVar14 + 2;
    sprintf(pcVar8,"%.2d",((iVar3 - iVar13) + 7) / 7);
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x34:
                    /* Unresolved local var: size_t adjust@[???] */
    sVar6 = strftime(s + uVar14,maxsize - uVar14,"%C%y",tim_p);
    uVar14 = uVar14 + sVar6;
    if (sVar6 == 0) {
      return 0;
    }
    cVar11 = *pcVar15;
    goto LAB_089d3c8c;
  case 0x35:
    format = pcVar15 + 1;
    if (-1 < tim_p->tm_isdst) {
                    /* Unresolved local var: int size@[???] */
      __tz_lock();
      iVar3 = 4;
      if (tim_p->tm_isdst < 1) {
        iVar3 = 0;
      }
      sVar5 = strlen(*(char **)((int)_tzname + iVar3));
      if (0 < (int)sVar5) {
        pcVar8 = s + uVar14;
        if (maxsize - 1 <= uVar14) {
LAB_089d3fec:
          __tz_unlock();
          return 0;
        }
        sVar9 = 0;
        while( true ) {
          iVar3 = 4;
          uVar14 = uVar14 + 1;
          if (tim_p->tm_isdst < 1) {
            iVar3 = 0;
          }
          pcVar7 = (char *)(*(int *)((int)_tzname + iVar3) + sVar9);
          sVar9 = sVar9 + 1;
          *pcVar8 = *pcVar7;
          if (sVar5 == sVar9) break;
          pcVar8 = pcVar8 + 1;
          if (maxsize - 1 <= uVar14) goto LAB_089d3fec;
        }
      }
      __tz_unlock();
      cVar11 = *pcVar15;
      goto LAB_089d3660;
    }
    goto LAB_089d339c;
  case 0x3c:
    pcVar8 = s + uVar14;
    iVar3 = 0;
    do {
      bVar1 = maxsize - 1 <= uVar14;
      uVar14 = uVar14 + 1;
      if (bVar1) {
        return 0;
      }
      pcVar7 = dname[tim_p->tm_wday] + iVar3;
      iVar3 = iVar3 + 1;
      *pcVar8 = *pcVar7;
      pcVar8 = pcVar8 + 1;
    } while (iVar3 != 3);
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x3d:
  case 0x43:
    pcVar8 = s + uVar14;
    iVar3 = 0;
    do {
      bVar1 = maxsize - 1 <= uVar14;
      uVar14 = uVar14 + 1;
      if (bVar1) {
        return 0;
      }
      pcVar7 = mname[tim_p->tm_mon] + iVar3;
      iVar3 = iVar3 + 1;
      *pcVar8 = *pcVar7;
      pcVar8 = pcVar8 + 1;
    } while (iVar3 != 3);
    cVar11 = *pcVar15;
    goto LAB_089d3660;
  case 0x3e:
                    /* Unresolved local var: size_t adjust@[???] */
    sVar6 = strftime(s + uVar14,maxsize - uVar14,"%a %b %e %H:%M:%S %C%y",tim_p);
    uVar14 = uVar14 + sVar6;
    if (sVar6 == 0) {
      return 0;
    }
    cVar11 = *pcVar15;
LAB_089d3c8c:
    if (cVar11 == '\0') goto LAB_089d33d4;
    format = pcVar15 + 1;
    goto LAB_089d339c;
  case 0x3f:
  case 0x40:
    uVar12 = uVar12 ^ 100;
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    pcVar7 = "%2d";
    pcVar8 = "%.2d";
    iVar3 = tim_p->tm_mday;
LAB_089d384c:
    if (uVar12 != 0) {
      pcVar8 = pcVar7;
    }
    sprintf(s + uVar14,pcVar8,iVar3);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 2;
    break;
  case 0x42:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
                    /* Unresolved local var: int adjust@[???]
                       Unresolved local var: int year@[???] */
    iVar13 = iso_year_adjust(tim_p);
    iVar3 = tim_p->tm_year;
    if (iVar3 < 0) {
      iVar3 = abs(iVar3 + 0x76c);
    }
    if (iVar13 < 0) {
      if (tim_p->tm_year < -0x76b) {
        iVar13 = 1;
      }
    }
    else if ((0 < iVar13) && (tim_p->tm_year < -0x76c)) {
      iVar13 = -1;
    }
    pcVar8 = s + uVar14;
    uVar14 = uVar14 + 2;
    sprintf(pcVar8,"%.2d",((iVar3 % 100 + iVar13) % 100 + 100) % 100);
    if (*pcVar15 != '\0') goto code_r0x089d378c;
    goto LAB_089d33d4;
  case 0x45:
    if (maxsize - 3 <= uVar14) {
      return 0;
    }
    sprintf(s + uVar14,"%.3d",tim_p->tm_yday + 1);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 3;
    break;
  case 0x48:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    sprintf(s + uVar14,"%.2d",tim_p->tm_mon + 1);
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 2;
    break;
  case 0x49:
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    s[uVar14] = '\n';
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 1;
    break;
  case 0x4b:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
    pcVar8 = s + uVar14;
    if (tim_p->tm_hour < 0xc) {
      uVar14 = uVar14 + 1;
      *pcVar8 = 'A';
    }
    else {
      uVar14 = uVar14 + 1;
      *pcVar8 = 'P';
    }
    goto LAB_089d3a10;
  case 0x4d:
    if (maxsize - 0xb <= uVar14) {
      return 0;
    }
    iVar3 = tim_p->tm_hour;
    if ((iVar3 == 0) || (iVar3 == 0xc)) {
      s[uVar14] = '1';
      (s + uVar14)[1] = '2';
    }
    else {
      sprintf(s + uVar14,"%.2d",iVar3 % 0xc);
    }
    s[uVar14 + 2] = ':';
    sprintf(s + uVar14 + 3,"%.2d",tim_p->tm_min);
    s[uVar14 + 5] = ':';
    sprintf(s + uVar14 + 6,"%.2d",tim_p->tm_sec);
    s[uVar14 + 8] = ' ';
    iVar3 = uVar14 + 9;
    if (tim_p->tm_hour < 0xc) {
      uVar14 = uVar14 + 10;
      s[iVar3] = 'A';
    }
    else {
      uVar14 = uVar14 + 10;
      s[iVar3] = 'P';
    }
LAB_089d3a10:
    s[uVar14] = 'M';
    cVar11 = *pcVar15;
joined_r0x089d3a4c:
    uVar14 = uVar14 + 1;
    break;
  case 0x4f:
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    s[uVar14] = '\t';
    cVar11 = *pcVar15;
    goto joined_r0x089d3a4c;
  case 0x50:
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    if (tim_p->tm_wday == 0) {
      s[uVar14] = '7';
      cVar11 = *pcVar15;
      uVar14 = uVar14 + 1;
    }
    else {
      s[uVar14] = (char)tim_p->tm_wday + '0';
      cVar11 = *pcVar15;
      uVar14 = uVar14 + 1;
    }
    break;
  case 0x52:
    if (maxsize - 1 <= uVar14) {
      return 0;
    }
    s[uVar14] = (char)tim_p->tm_wday + '0';
    cVar11 = *pcVar15;
    uVar14 = uVar14 + 1;
    break;
  case 0x54:
    if (maxsize - 2 <= uVar14) {
      return 0;
    }
                    /* Unresolved local var: int year@[DW_OP_reg6(a2)] */
    iVar3 = tim_p->tm_year;
    if (iVar3 < 0) {
      iVar3 = abs(iVar3 + 0x76c);
      iVar3 = iVar3 % 100;
    }
    else {
      iVar3 = iVar3 % 100;
    }
LAB_089d348c:
    sprintf(s + uVar14,"%.2d",iVar3);
    uVar12 = (uint)*pcVar15;
    uVar14 = uVar14 + 2;
switchD_089d3458_caseD_1:
    if (uVar12 != 0) goto LAB_089d34ac;
    goto LAB_089d33d4;
  case 0x55:
    if (tim_p->tm_isdst < 0) goto LAB_089d34ac;
    if (maxsize - 5 <= uVar14) {
      return 0;
    }
                    /* Unresolved local var: long offset@[???]
                       Unresolved local var: __tzinfo_type * tz@[???] */
    p_Var2 = __gettzinfo();
    __tz_lock();
    iVar3 = 0x20;
    if (0 < tim_p->tm_isdst) {
      iVar3 = 0x3c;
    }
    iVar3 = *(int *)((int)p_Var2->__tzrule + iVar3 + -8);
    __tz_unlock();
    iVar3 = -iVar3;
    lVar4 = labs(iVar3 / 0x3c);
    pcVar8 = s + uVar14;
    uVar14 = uVar14 + 5;
    sprintf(pcVar8,"%+03ld%.2ld",iVar3 / 0xe10,lVar4 % 0x3c);
    cVar11 = *pcVar15;
LAB_089d3660:
    if (cVar11 == '\0') goto LAB_089d33d4;
    format = pcVar15 + 1;
    goto LAB_089d339c;
  }
  if (cVar11 == '\0') {
LAB_089d33d4:
    if (maxsize != 0) {
      s[uVar14] = '\0';
      return uVar14;
    }
    return uVar14;
  }
LAB_089d34ac:
  format = pcVar15 + 1;
  goto LAB_089d339c;
code_r0x089d378c:
  format = pcVar15 + 1;
  goto LAB_089d339c;
}



----------------------------------------

// Function: strxfrm @ 089d41dc

size_t strxfrm(char *s1,char *s2,size_t n)

{
  char cVar1;
  size_t sVar2;
  
                    /* Unresolved local var: size_t res@[???] */
  sVar2 = 0;
  if (n == 0) {
LAB_089d4214:
    cVar1 = *s2;
    while (cVar1 != '\0') {
      s2 = s2 + 1;
      sVar2 = sVar2 + 1;
      cVar1 = *s2;
    }
  }
  else {
    cVar1 = *s2;
    *s1 = cVar1;
    while (cVar1 != '\0') {
      s2 = s2 + 1;
      sVar2 = sVar2 + 1;
      if (n == sVar2) goto LAB_089d4214;
      cVar1 = *s2;
      s1[sVar2] = cVar1;
    }
  }
  return sVar2;
}



----------------------------------------

// Function: fstat @ 089d4238

int fstat(int fd,stat *pstat)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  int iVar4;
  __psp_descriptormap_type *p_Var5;
  __psp_descriptormap_type **pp_Var6;
  undefined8 uVar7;
  
  if ((uint)fd < 0x400) {
    pp_Var6 = __psp_descriptormap + fd;
    p_Var5 = *pp_Var6;
    if (p_Var5 != (__psp_descriptormap_type *)0x0) {
      if (p_Var5->type == '\0') {
        if (p_Var5->filename != (char *)0x0) {
          iVar2 = stat(p_Var5->filename,(stat *)pstat);
          uVar7 = sceIoLseek((*pp_Var6)->sce_descriptor);
          iVar4 = (int)((ulonglong)uVar7 >> 0x20);
          if ((int)uVar7 == -1) {
            if (iVar4 == -1) {
              return iVar2;
            }
            p_Var5 = *pp_Var6;
          }
          else {
            p_Var5 = *pp_Var6;
          }
          uVar3 = sceIoLseek(p_Var5->sce_descriptor);
          p_Var5 = *pp_Var6;
          *(undefined4 *)(pstat + 0x10) = uVar3;
          sceIoLseek(p_Var5->sce_descriptor,p_Var5,(int)uVar7,iVar4);
          return iVar2;
        }
      }
      else if (p_Var5->type == '\x03') {
        memset(pstat,0,0x3c);
        *(undefined4 *)(pstat + 4) = 0x2000;
        return 0;
      }
      piVar1 = __errno();
      *piVar1 = 9;
      return -1;
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: lseek @ 089d4240

off_t lseek(int fd,off_t pos,int whence)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  
  if ((((uint)fd < 0x400) &&
      (p_Var3 = __psp_descriptormap[fd], p_Var3 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var3->type == '\0')) {
    iVar2 = sceIoLseek(p_Var3->sce_descriptor,pos,pos,pos >> 0x1f);
    iVar2 = __psp_set_errno(iVar2);
    return iVar2;
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: read @ 089d4248

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x00000000) */

int read(int fd,void *buf,size_t cnt)

{
  u8 uVar1;
  int *piVar2;
  int iVar3;
  __psp_descriptormap_type *p_Var4;
  
  if (((uint)fd < 0x400) &&
     (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) {
    uVar1 = p_Var4->type;
    if (uVar1 == '\x01') {
      if ((p_Var4->flags & 0x4000) == 0) {
        iVar3 = __psp_pipe_read(fd,buf,cnt);
        return iVar3;
      }
      iVar3 = __psp_pipe_nonblocking_read(fd,buf,cnt);
      return iVar3;
    }
    if ((uVar1 == '\0') || ((uVar1 != '\x02' && (uVar1 == '\x03')))) {
      iVar3 = sceIoRead(p_Var4->sce_descriptor);
      iVar3 = __psp_set_errno(iVar3);
      return iVar3;
    }
  }
  piVar2 = __errno();
  *piVar2 = 9;
  return -1;
}



----------------------------------------

// Function: write @ 089d4250

/* WARNING: Control flow encountered bad instruction data */
/* WARNING: Removing unreachable block (ram,0x00000000) */

int write(int fd,void *buf,size_t cnt)

{
  u8 uVar1;
  int *piVar2;
  int iVar3;
  __psp_descriptormap_type *p_Var4;
  
  if (((uint)fd < 0x400) &&
     (p_Var4 = __psp_descriptormap[fd], p_Var4 != (__psp_descriptormap_type *)0x0)) {
    uVar1 = p_Var4->type;
    if (uVar1 == '\x01') {
      if ((p_Var4->flags & 0x4000) == 0) {
        iVar3 = __psp_pipe_write(fd,buf,cnt);
        return iVar3;
      }
      iVar3 = __psp_pipe_nonblocking_write(fd,buf,cnt);
      return iVar3;
    }
    if ((uVar1 == '\0') || ((uVar1 != '\x02' && (uVar1 == '\x03')))) {
      iVar3 = sceIoWrite(p_Var4->sce_descriptor);
      iVar3 = __psp_set_errno(iVar3);
      return iVar3;
    }
  }
  piVar2 = __errno();
  *piVar2 = 9;
  return -1;
}



----------------------------------------

// Function: snprintf @ 089d4258

int snprintf(char *str,size_t sz,char *format,...)

{
  int iVar1;
  undefined4 in_a3;
  char *local_2c;
  char *local_28;
  undefined4 local_14 [5];
  
                    /* Unresolved local var: va_list args@[???]
                       Unresolved local var: s_strargument arg@[???]
                       Unresolved local var: int ret@[???] */
  local_28 = str + (sz - 1);
  local_2c = str;
  local_14[0] = in_a3;
  iVar1 = vxprintf(__sout,&local_2c,format,local_14);
  return iVar1;
}



----------------------------------------

// Function: __sout @ 089d42b0

void __sout(char *txt,int amt,void *arg)

{
  char cVar1;
  char *pcVar2;
  int iVar3;
  char *pcVar4;
  int iVar5;
  
                    /* Unresolved local var: char * head@[???]
                       Unresolved local var: char * t@[???]
                       Unresolved local var: int a@[???]
                       Unresolved local var: char * tail@[???] */
  pcVar4 = *(char **)((int)arg + 4);
  pcVar2 = *(char **)arg;
  if (pcVar4 == (char *)0x0) {
    if (0 < amt) {
      pcVar4 = txt + amt;
      do {
        cVar1 = *txt;
        txt = txt + 1;
        *pcVar2 = cVar1;
        pcVar2 = pcVar2 + 1;
      } while (pcVar4 != txt);
      *pcVar2 = '\0';
      *(char **)arg = pcVar2;
      return;
    }
    *pcVar2 = '\0';
  }
  else {
    if ((0 < amt) && (pcVar2 < pcVar4)) {
      iVar5 = (int)pcVar4 - (int)pcVar2;
      iVar3 = 0;
      do {
        *pcVar2 = txt[iVar3];
        pcVar2 = pcVar2 + 1;
        if (amt + -1 == iVar3) break;
        iVar3 = iVar3 + 1;
      } while (iVar5 != iVar3);
    }
    *pcVar2 = '\0';
  }
  *(char **)arg = pcVar2;
  return;
}



----------------------------------------

// Function: abs @ 089d433c

int abs(int i)

{
  return 0;
}



----------------------------------------

// Function: _fcntl_r @ 089d4348

int _fcntl_r(_reent *ptr,int fd,int cmd,int arg)

{
  int iVar1;
  
                    /* Unresolved local var: int ret@[DW_OP_reg3(v1)] */
  errno = 0;
  iVar1 = _fcntl(fd,cmd,arg);
  if ((iVar1 == -1) && (errno != 0)) {
    ptr->_errno = errno;
    return -1;
  }
  return iVar1;
}



----------------------------------------

// Function: labs @ 089d43b8

long labs(long x)

{
  return 0;
}



----------------------------------------

// Function: _fcntl @ 089d43c4

int _fcntl(int fd,int cmd,...)

{
  int *piVar1;
  int iVar2;
  uint in_a2;
  __psp_descriptormap_type *p_Var3;
  undefined4 local_24;
  
  if (((uint)fd < 0x400) &&
     (p_Var3 = __psp_descriptormap[fd], p_Var3 != (__psp_descriptormap_type *)0x0)) {
    if (cmd == 3) {
      return p_Var3->flags;
    }
    if (cmd == 4) {
                    /* Unresolved local var: int newfl@[???]
                       Unresolved local var: va_list args@[???] */
      p_Var3->flags = in_a2;
      if (p_Var3->type != '\x02') {
        return 0;
      }
      if ((in_a2 & 0x4000) == 0) {
                    /* Unresolved local var: int zero@[???] */
        local_24 = 0;
        iVar2 = setsockopt(fd,0xffff,0x1009,&local_24,in_a2);
      }
      else {
                    /* Unresolved local var: int one@[???] */
        local_24 = 1;
        iVar2 = setsockopt(fd,0xffff,0x1009,&local_24,in_a2);
      }
    }
    else {
      if (cmd != 0) {
        piVar1 = __errno();
        *piVar1 = 9;
        return -1;
      }
      iVar2 = __psp_fdman_get_dup_descriptor(fd);
    }
    return iVar2;
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: setsockopt @ 089d4508

int setsockopt(int s,int level,int optname,void *optval,socklen_t optlen)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  __psp_descriptormap_type **pp_Var4;
  
                    /* Unresolved local var: int ret@[???] */
  if ((uint)s < 0x400) {
    pp_Var4 = __psp_descriptormap + s;
    p_Var3 = *pp_Var4;
    if ((p_Var3 != (__psp_descriptormap_type *)0x0) && (p_Var3->type == '\x02')) {
      iVar2 = sceNetInetSetsockopt(p_Var3->sce_descriptor);
      if (iVar2 < 0) {
        piVar1 = __errno();
        iVar2 = sceNetInetGetErrno();
        *piVar1 = iVar2;
        return -1;
      }
      if (level != 0xffff) {
        return 0;
      }
      if (optname != 0x1009) {
        return 0;
      }
      if (*(int *)optval != 1) {
        (*pp_Var4)->flags = (*pp_Var4)->flags & 0xffffbfff;
        return 0;
      }
      (*pp_Var4)->flags = (*pp_Var4)->flags | 0x4000;
      return 0;
    }
  }
  piVar1 = __errno();
  *piVar1 = 9;
  return -1;
}



----------------------------------------

// Function: getsockopt @ 089d4614

int getsockopt(int s,int level,int optname,void *optval,socklen_t *optlen)

{
  int *piVar1;
  int iVar2;
  __psp_descriptormap_type *p_Var3;
  int iVar4;
  
                    /* Unresolved local var: int ret@[???] */
  if ((((uint)s < 0x400) &&
      (p_Var3 = __psp_descriptormap[s], p_Var3 != (__psp_descriptormap_type *)0x0)) &&
     (p_Var3->type == '\x02')) {
    iVar2 = sceNetInetGetsockopt(p_Var3->sce_descriptor);
    iVar4 = 0;
    if (iVar2 < 0) {
      piVar1 = __errno();
      iVar2 = sceNetInetGetErrno();
      iVar4 = -1;
      *piVar1 = iVar2;
    }
  }
  else {
    piVar1 = __errno();
    iVar4 = -1;
    *piVar1 = 9;
  }
  return iVar4;
}



----------------------------------------

// Function: __fixunsdfsi @ 089d46a4

USItype __fixunsdfsi(DFtype a)

{
  SItype SVar1;
  USItype UVar2;
  FLO_type_conflict in_f14_15;
  
  SVar1 = __gedf2(a,in_f14_15);
  if (-1 < SVar1) {
    __subdf3(a,in_f14_15);
    SVar1 = __fixdfsi(a);
    return SVar1 + 0x80000000;
  }
  UVar2 = __fixdfsi(a);
  return UVar2;
}



----------------------------------------

// Function: __fixdfdi @ 089d474c

DItype __fixdfdi(DFtype a)

{
  SItype SVar1;
  FLO_type_conflict in_f14_15;
  DItype DVar2;
  
  SVar1 = __ltdf2(a,in_f14_15);
  if (-1 < SVar1) {
    DVar2 = __fixunsdfdi(a);
    return DVar2;
  }
  DVar2 = __fixunsdfdi(a);
  return CONCAT44(-(uint)(-(int)DVar2 != 0) - (int)((ulonglong)DVar2 >> 0x20),-(int)DVar2);
}



----------------------------------------

// Function: __divdi3 @ 089d47cc

DItype __divdi3(DItype u,DItype v)

{
  longlong lVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  uint uVar15;
  
                    /* Unresolved local var: word_type c@[???]
                       Unresolved local var: DWunion uu@[???]
                       Unresolved local var: DWunion vv@[???]
                       Unresolved local var: DItype w@[???] */
  if (u < 0) {
    u = CONCAT44(-(uint)(-(int)u != 0) - (int)((ulonglong)u >> 0x20),-(int)u);
    uVar13 = 0xffffffff;
  }
  else {
    uVar13 = 0;
  }
  uVar7 = (uint)((ulonglong)u >> 0x20);
  uVar11 = (uint)u;
  if (v < 0) {
    uVar13 = ~uVar13;
    v = CONCAT44(-(uint)(-(int)v != 0) - (int)((ulonglong)v >> 0x20),-(int)v);
  }
  uVar6 = (uint)((ulonglong)v >> 0x20);
                    /* Unresolved local var: DWunion nn@[???]
                       Unresolved local var: DWunion dd@[???]
                       Unresolved local var: DWunion rr@[???]
                       Unresolved local var: USItype d0@[???]
                       Unresolved local var: USItype d1@[???]
                       Unresolved local var: USItype n0@[???]
                       Unresolved local var: USItype n1@[???]
                       Unresolved local var: USItype n2@[???]
                       Unresolved local var: USItype q0@[???]
                       Unresolved local var: USItype q1@[???]
                       Unresolved local var: USItype b@[???]
                       Unresolved local var: USItype bm@[???]
                       Unresolved local var: DWunion ww@[???] */
  uVar12 = (uint)v;
  if (uVar6 != 0) {
    if (uVar6 <= uVar7) {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
      if ((ulonglong)v < 0x1000000000000) {
        iVar5 = 8;
        if ((ulonglong)v < 0x10000000000) {
          iVar5 = 0;
          iVar2 = 0;
        }
        else {
          iVar2 = 8;
        }
      }
      else if ((ulonglong)v < 0x100000000000000) {
        iVar5 = 0x10;
        iVar2 = 0x10;
      }
      else {
        iVar5 = 0x18;
        iVar2 = 0x18;
      }
      uVar9 = 0x20 - (iVar5 + (uint)""[uVar6 >> iVar2]);
      if (uVar9 != 0) {
        uVar8 = 0x20 - uVar9;
        uVar15 = uVar6 << (uVar9 & 0x1f) | uVar12 >> (uVar8 & 0x1f);
        uVar6 = uVar7 >> (uVar8 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
        uVar10 = uVar15 >> 0x10;
        uVar4 = uVar6 / uVar10;
        if (uVar10 == 0) {
          trap(7);
        }
        uVar8 = uVar7 << (uVar9 & 0x1f) | uVar11 >> (uVar8 & 0x1f);
        uVar6 = uVar6 % uVar10 << 0x10 | uVar8 >> 0x10;
        uVar7 = (uVar15 & 0xffff) * uVar4;
        if (uVar10 == 0) {
          trap(7);
        }
        uVar3 = uVar6 - uVar7;
        uVar14 = uVar4;
        if (uVar6 < uVar7) {
          uVar6 = uVar6 + uVar15;
          uVar14 = uVar4 - 1;
          if (uVar15 <= uVar6) {
            uVar3 = uVar6 - uVar7;
            if (uVar7 <= uVar6) goto LAB_089d4c60;
            uVar14 = uVar4 - 2;
            uVar6 = uVar6 + uVar15;
          }
          uVar3 = uVar6 - uVar7;
        }
LAB_089d4c60:
        uVar6 = uVar3 / uVar10;
        if (uVar10 == 0) {
          trap(7);
        }
        uVar4 = uVar3 % uVar10 << 0x10 | uVar8 & 0xffff;
        uVar8 = (uVar15 & 0xffff) * uVar6;
        if (uVar10 == 0) {
          trap(7);
        }
        uVar7 = uVar6;
        if (uVar4 < uVar8) {
          uVar4 = uVar4 + uVar15;
          uVar7 = uVar6 - 1;
          if ((uVar15 <= uVar4) && (uVar4 < uVar8)) {
            uVar4 = uVar4 + uVar15;
            uVar7 = uVar6 - 2;
          }
        }
        uVar7 = uVar7 | uVar14 << 0x10;
        lVar1 = (ulonglong)uVar7 * (ulonglong)(uVar12 << (uVar9 & 0x1f));
        uVar12 = (uint)((ulonglong)lVar1 >> 0x20);
        if ((uVar4 - uVar8 < uVar12) ||
           ((uVar4 - uVar8 == uVar12 && (uVar11 << (uVar9 & 0x1f) < (uint)lVar1)))) {
          uVar7 = uVar7 - 1;
          uVar6 = 0;
        }
        else {
          uVar6 = 0;
        }
        goto LAB_089d4954;
      }
      if ((uVar6 < uVar7) || (uVar12 <= uVar11)) {
        uVar7 = 1;
        uVar6 = 0;
        goto LAB_089d4954;
      }
    }
    uVar7 = 0;
    uVar6 = 0;
    goto LAB_089d4954;
  }
  if (uVar7 < uVar12) {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
    if (uVar12 < 0x10000) {
      iVar5 = 8;
      if (uVar12 < 0x100) {
        iVar5 = 0;
        iVar2 = 0;
      }
      else {
        iVar2 = 8;
      }
    }
    else if (uVar12 < 0x1000000) {
      iVar5 = 0x10;
      iVar2 = 0x10;
    }
    else {
      iVar5 = 0x18;
      iVar2 = 0x18;
    }
    uVar6 = 0x20 - (iVar5 + (uint)""[uVar12 >> iVar2]);
    if (uVar6 != 0) {
      u = CONCAT44(uVar7 << (uVar6 & 0x1f) | uVar11 >> (0x20 - uVar6 & 0x1f),
                   uVar11 << (uVar6 & 0x1f));
      uVar12 = uVar12 << (uVar6 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
    }
    uVar11 = (uint)((ulonglong)u >> 0x20);
    uVar7 = uVar12 >> 0x10;
    uVar6 = uVar11 / uVar7;
    if (uVar7 == 0) {
      trap(7);
    }
    uVar9 = uVar11 % uVar7 << 0x10 | (uint)u >> 0x10;
    uVar11 = (uVar12 & 0xffff) * uVar6;
    if (uVar7 == 0) {
      trap(7);
    }
    if (uVar9 < uVar11) {
      uVar9 = uVar9 + uVar12;
      uVar8 = uVar6 - 1;
      if ((uVar12 <= uVar9) && (uVar9 < uVar11)) {
        uVar8 = uVar6 - 2;
        uVar9 = uVar9 + uVar12;
      }
      uVar9 = uVar9 - uVar11;
    }
    else {
      uVar9 = uVar9 - uVar11;
      uVar8 = uVar6;
    }
    uVar11 = uVar9 / uVar7;
    if (uVar7 == 0) {
      trap(7);
    }
    uVar9 = uVar9 % uVar7 << 0x10 | (uint)u & 0xffff;
    uVar6 = (uVar12 & 0xffff) * uVar11;
    if (uVar7 == 0) {
      trap(7);
    }
    uVar7 = uVar11;
    if (uVar9 < uVar6) {
      uVar9 = uVar12 + uVar9;
      uVar7 = uVar11 - 1;
      if ((uVar12 <= uVar9) && (uVar9 < uVar6)) {
        uVar7 = uVar11 - 2;
      }
    }
    uVar7 = uVar7 | uVar8 << 0x10;
    uVar6 = 0;
    goto LAB_089d4954;
  }
  if (uVar12 == 0) {
    uVar12 = 1 / 0;
    trap(7);
    if (0xffff < uVar12) goto LAB_089d4b6c;
LAB_089d482c:
    iVar5 = 8;
    if (uVar12 < 0x100) {
      iVar5 = 0;
      iVar2 = 0;
    }
    else {
      iVar2 = 8;
    }
  }
  else {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
    if (uVar12 < 0x10000) goto LAB_089d482c;
LAB_089d4b6c:
    if (uVar12 < 0x1000000) {
      iVar5 = 0x10;
      iVar2 = 0x10;
    }
    else {
      iVar5 = 0x18;
      iVar2 = 0x18;
    }
  }
  uVar9 = 0x20 - (iVar5 + (uint)""[uVar12 >> iVar2]);
  if (uVar9 == 0) {
    uVar7 = uVar7 - uVar12;
    uVar8 = uVar12 >> 0x10;
    uVar10 = uVar12 & 0xffff;
    uVar6 = 1;
  }
  else {
    uVar12 = uVar12 << (uVar9 & 0x1f);
    uVar6 = uVar7 >> (0x20 - uVar9 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
    uVar8 = uVar12 >> 0x10;
    uVar15 = uVar6 / uVar8;
    if (uVar8 == 0) {
      trap(7);
    }
    uVar10 = uVar12 & 0xffff;
    uVar4 = uVar7 << (uVar9 & 0x1f) | uVar11 >> (0x20 - uVar9 & 0x1f);
    uVar6 = uVar6 % uVar8 << 0x10 | uVar4 >> 0x10;
    uVar7 = uVar10 * uVar15;
    if (uVar8 == 0) {
      trap(7);
    }
    if (uVar6 < uVar7) {
      uVar6 = uVar6 + uVar12;
      uVar14 = uVar15 - 1;
      if (uVar12 <= uVar6) {
        if (uVar7 <= uVar6) {
          uVar6 = uVar6 - uVar7;
          goto LAB_089d4d58;
        }
        uVar14 = uVar15 - 2;
        uVar6 = uVar6 + uVar12;
      }
      uVar6 = uVar6 - uVar7;
    }
    else {
      uVar6 = uVar6 - uVar7;
      uVar14 = uVar15;
    }
LAB_089d4d58:
    uVar15 = uVar6 / uVar8;
    if (uVar8 == 0) {
      trap(7);
    }
    uVar7 = uVar6 % uVar8 << 0x10 | uVar4 & 0xffff;
    uVar4 = uVar10 * uVar15;
    if (uVar8 == 0) {
      trap(7);
    }
    uVar6 = uVar15;
    if (uVar7 < uVar4) {
      uVar7 = uVar7 + uVar12;
      uVar6 = uVar15 - 1;
      if ((uVar12 <= uVar7) && (uVar7 < uVar4)) {
        uVar6 = uVar15 - 2;
        uVar7 = uVar7 + uVar12;
      }
    }
    uVar11 = uVar11 << (uVar9 & 0x1f);
    uVar7 = uVar7 - uVar4;
    uVar6 = uVar6 | uVar14 << 0x10;
  }
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
  uVar9 = uVar7 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar15 = uVar7 % uVar8 << 0x10 | uVar11 >> 0x10;
  uVar7 = uVar10 * uVar9;
  if (uVar8 == 0) {
    trap(7);
  }
  if (uVar15 < uVar7) {
    uVar15 = uVar15 + uVar12;
    uVar4 = uVar9 - 1;
    if ((uVar12 <= uVar15) && (uVar15 < uVar7)) {
      uVar4 = uVar9 - 2;
      uVar15 = uVar15 + uVar12;
    }
    uVar15 = uVar15 - uVar7;
  }
  else {
    uVar15 = uVar15 - uVar7;
    uVar4 = uVar9;
  }
  uVar9 = uVar15 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar11 = uVar15 % uVar8 << 0x10 | uVar11 & 0xffff;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar7 = uVar9;
  if (uVar11 < uVar10 * uVar9) {
    uVar11 = uVar12 + uVar11;
    uVar7 = uVar9 - 1;
    if ((uVar12 <= uVar11) && (uVar11 < uVar10 * uVar9)) {
      uVar7 = uVar9 - 2;
    }
  }
  uVar7 = uVar7 | uVar4 << 0x10;
LAB_089d4954:
  if (uVar13 != 0) {
    uVar7 = -uVar7;
    uVar6 = -(uint)(uVar7 != 0) - uVar6;
  }
  return CONCAT44(uVar6,uVar7);
}



----------------------------------------

// Function: __udivdi3 @ 089d4e74

UDItype __udivdi3(UDItype n,UDItype d)

{
  longlong lVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  
  uVar7 = (uint)(n >> 0x20);
  uVar11 = (uint)n;
                    /* Unresolved local var: DWunion nn@[???]
                       Unresolved local var: DWunion dd@[???]
                       Unresolved local var: DWunion rr@[???]
                       Unresolved local var: USItype d0@[???]
                       Unresolved local var: USItype d1@[???]
                       Unresolved local var: USItype n0@[DW_OP_reg14(t6)]
                       Unresolved local var: USItype n1@[???]
                       Unresolved local var: USItype n2@[???]
                       Unresolved local var: USItype q0@[???]
                       Unresolved local var: USItype q1@[???]
                       Unresolved local var: USItype b@[???]
                       Unresolved local var: USItype bm@[???]
                       Unresolved local var: DWunion ww@[DW_OP_reg12(t4); DW_OP_piece: 4;
                       DW_OP_reg13(t5); DW_OP_piece: 4] */
  uVar10 = (uint)(d >> 0x20);
  uVar9 = (uint)d;
  if (uVar10 != 0) {
    if (uVar10 <= uVar7) {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
      if (d < 0x1000000000000) {
        iVar5 = 8;
        if (d < 0x10000000000) {
          iVar5 = 0;
          iVar2 = 0;
        }
        else {
          iVar2 = 8;
        }
      }
      else if (d < 0x100000000000000) {
        iVar5 = 0x10;
        iVar2 = 0x10;
      }
      else {
        iVar5 = 0x18;
        iVar2 = 0x18;
      }
      uVar6 = 0x20 - (iVar5 + (uint)""[uVar10 >> iVar2]);
      if (uVar6 != 0) {
        uVar8 = 0x20 - uVar6;
        uVar12 = uVar10 << (uVar6 & 0x1f) | uVar9 >> (uVar8 & 0x1f);
        uVar10 = uVar7 >> (uVar8 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
        uVar14 = uVar12 >> 0x10;
        uVar4 = uVar10 / uVar14;
        if (uVar14 == 0) {
          trap(7);
        }
        uVar8 = uVar7 << (uVar6 & 0x1f) | uVar11 >> (uVar8 & 0x1f);
        uVar10 = uVar10 % uVar14 << 0x10 | uVar8 >> 0x10;
        uVar7 = (uVar12 & 0xffff) * uVar4;
        if (uVar14 == 0) {
          trap(7);
        }
        uVar3 = uVar10 - uVar7;
        uVar13 = uVar4;
        if (uVar10 < uVar7) {
          uVar10 = uVar10 + uVar12;
          uVar13 = uVar4 - 1;
          if (uVar12 <= uVar10) {
            uVar3 = uVar10 - uVar7;
            if (uVar7 <= uVar10) goto LAB_089d5280;
            uVar13 = uVar4 - 2;
            uVar10 = uVar10 + uVar12;
          }
          uVar3 = uVar10 - uVar7;
        }
LAB_089d5280:
        uVar7 = uVar3 / uVar14;
        if (uVar14 == 0) {
          trap(7);
        }
        uVar8 = uVar3 % uVar14 << 0x10 | uVar8 & 0xffff;
        uVar10 = (uVar12 & 0xffff) * uVar7;
        if (uVar14 == 0) {
          trap(7);
        }
        uVar14 = uVar7;
        if (uVar8 < uVar10) {
          uVar8 = uVar8 + uVar12;
          uVar14 = uVar7 - 1;
          if ((uVar12 <= uVar8) && (uVar8 < uVar10)) {
            uVar8 = uVar8 + uVar12;
            uVar14 = uVar7 - 2;
          }
        }
        uVar14 = uVar14 | uVar13 << 0x10;
        lVar1 = (ulonglong)uVar14 * (ulonglong)(uVar9 << (uVar6 & 0x1f));
        uVar7 = (uint)((ulonglong)lVar1 >> 0x20);
        if ((uVar8 - uVar10 < uVar7) ||
           ((uVar8 - uVar10 == uVar7 && (uVar11 << (uVar6 & 0x1f) < (uint)lVar1)))) {
          return (UDItype)(uVar14 - 1);
        }
        goto LAB_089d51a0;
      }
      if ((uVar10 < uVar7) || (uVar9 <= uVar11)) {
        return 1;
      }
    }
    uVar14 = 0;
LAB_089d51a0:
    return (UDItype)uVar14;
  }
  if (uVar7 < uVar9) {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
    if (uVar9 < 0x10000) {
      iVar5 = 8;
      if (uVar9 < 0x100) {
        iVar5 = 0;
        iVar2 = 0;
      }
      else {
        iVar2 = 8;
      }
    }
    else if (uVar9 < 0x1000000) {
      iVar5 = 0x10;
      iVar2 = 0x10;
    }
    else {
      iVar5 = 0x18;
      iVar2 = 0x18;
    }
    uVar10 = 0x20 - (iVar5 + (uint)""[uVar9 >> iVar2]);
    if (uVar10 != 0) {
      n = CONCAT44(uVar7 << (uVar10 & 0x1f) | uVar11 >> (0x20 - uVar10 & 0x1f),
                   uVar11 << (uVar10 & 0x1f));
      uVar9 = uVar9 << (uVar10 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
    }
    uVar7 = (uint)(n >> 0x20);
    uVar11 = uVar9 >> 0x10;
    uVar10 = uVar7 / uVar11;
    if (uVar11 == 0) {
      trap(7);
    }
    uVar6 = uVar7 % uVar11 << 0x10 | (uint)n >> 0x10;
    uVar7 = (uVar9 & 0xffff) * uVar10;
    if (uVar11 == 0) {
      trap(7);
    }
    if (uVar6 < uVar7) {
      uVar6 = uVar6 + uVar9;
      uVar8 = uVar10 - 1;
      if ((uVar9 <= uVar6) && (uVar6 < uVar7)) {
        uVar8 = uVar10 - 2;
        uVar6 = uVar6 + uVar9;
      }
      uVar6 = uVar6 - uVar7;
    }
    else {
      uVar6 = uVar6 - uVar7;
      uVar8 = uVar10;
    }
    uVar7 = uVar6 / uVar11;
    if (uVar11 == 0) {
      trap(7);
    }
    uVar6 = uVar6 % uVar11 << 0x10 | (uint)n & 0xffff;
    uVar10 = (uVar9 & 0xffff) * uVar7;
    if (uVar11 == 0) {
      trap(7);
    }
    uVar11 = uVar7;
    if (uVar6 < uVar10) {
      uVar6 = uVar9 + uVar6;
      uVar11 = uVar7 - 1;
      if ((uVar9 <= uVar6) && (uVar6 < uVar10)) {
        uVar11 = uVar7 - 2;
      }
    }
    return (UDItype)(uVar11 | uVar8 << 0x10);
  }
  if (uVar9 == 0) {
    uVar9 = 1 / 0;
    trap(7);
    if (0xffff < uVar9) goto LAB_089d51a8;
LAB_089d4eac:
    iVar5 = 8;
    if (uVar9 < 0x100) {
      iVar5 = 0;
      iVar2 = 0;
    }
    else {
      iVar2 = 8;
    }
  }
  else {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
    if (uVar9 < 0x10000) goto LAB_089d4eac;
LAB_089d51a8:
    if (uVar9 < 0x1000000) {
      iVar5 = 0x10;
      iVar2 = 0x10;
    }
    else {
      iVar5 = 0x18;
      iVar2 = 0x18;
    }
  }
  uVar10 = 0x20 - (iVar5 + (uint)""[uVar9 >> iVar2]);
  if (uVar10 == 0) {
    uVar7 = uVar7 - uVar9;
    uVar8 = uVar9 >> 0x10;
    uVar12 = uVar9 & 0xffff;
    uVar6 = 1;
    goto LAB_089d4ef4;
  }
  uVar9 = uVar9 << (uVar10 & 0x1f);
  uVar6 = uVar7 >> (0x20 - uVar10 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
  uVar8 = uVar9 >> 0x10;
  uVar14 = uVar6 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar12 = uVar9 & 0xffff;
  uVar4 = uVar7 << (uVar10 & 0x1f) | uVar11 >> (0x20 - uVar10 & 0x1f);
  uVar6 = uVar6 % uVar8 << 0x10 | uVar4 >> 0x10;
  uVar7 = uVar12 * uVar14;
  if (uVar8 == 0) {
    trap(7);
  }
  if (uVar6 < uVar7) {
    uVar6 = uVar6 + uVar9;
    uVar13 = uVar14 - 1;
    if (uVar9 <= uVar6) {
      if (uVar7 <= uVar6) {
        uVar6 = uVar6 - uVar7;
        goto LAB_089d5378;
      }
      uVar13 = uVar14 - 2;
      uVar6 = uVar6 + uVar9;
    }
    uVar6 = uVar6 - uVar7;
  }
  else {
    uVar6 = uVar6 - uVar7;
    uVar13 = uVar14;
  }
LAB_089d5378:
  uVar14 = uVar6 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar7 = uVar6 % uVar8 << 0x10 | uVar4 & 0xffff;
  uVar4 = uVar12 * uVar14;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar6 = uVar14;
  if (uVar7 < uVar4) {
    uVar7 = uVar7 + uVar9;
    uVar6 = uVar14 - 1;
    if ((uVar9 <= uVar7) && (uVar7 < uVar4)) {
      uVar6 = uVar14 - 2;
      uVar7 = uVar7 + uVar9;
    }
  }
  uVar11 = uVar11 << (uVar10 & 0x1f);
  uVar7 = uVar7 - uVar4;
  uVar6 = uVar6 | uVar13 << 0x10;
LAB_089d4ef4:
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
  uVar10 = uVar7 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar14 = uVar7 % uVar8 << 0x10 | uVar11 >> 0x10;
  uVar7 = uVar12 * uVar10;
  if (uVar8 == 0) {
    trap(7);
  }
  if (uVar14 < uVar7) {
    uVar14 = uVar14 + uVar9;
    uVar4 = uVar10 - 1;
    if ((uVar9 <= uVar14) && (uVar14 < uVar7)) {
      uVar4 = uVar10 - 2;
      uVar14 = uVar14 + uVar9;
    }
    uVar14 = uVar14 - uVar7;
  }
  else {
    uVar14 = uVar14 - uVar7;
    uVar4 = uVar10;
  }
  uVar7 = uVar14 / uVar8;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar11 = uVar14 % uVar8 << 0x10 | uVar11 & 0xffff;
  if (uVar8 == 0) {
    trap(7);
  }
  uVar10 = uVar7;
  if (uVar11 < uVar12 * uVar7) {
    uVar11 = uVar9 + uVar11;
    uVar10 = uVar7 - 1;
    if ((uVar9 <= uVar11) && (uVar11 < uVar12 * uVar7)) {
      uVar10 = uVar7 - 2;
    }
  }
  return CONCAT44(uVar6,uVar10 | uVar4 << 0x10);
}



----------------------------------------

// Function: __umoddi3 @ 089d5498

UDItype __umoddi3(UDItype u,UDItype v)

{
  longlong lVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  uint uVar11;
  uint uVar12;
  uint uVar13;
  uint uVar14;
  
  uVar6 = (uint)(u >> 0x20);
  uVar10 = (uint)u;
                    /* Unresolved local var: UDItype w@[???] */
  uVar11 = (uint)(v >> 0x20);
  uVar8 = (uint)v;
                    /* Unresolved local var: DWunion nn@[???]
                       Unresolved local var: DWunion dd@[???]
                       Unresolved local var: DWunion rr@[???]
                       Unresolved local var: USItype d0@[???]
                       Unresolved local var: USItype d1@[???]
                       Unresolved local var: USItype n0@[???]
                       Unresolved local var: USItype n1@[???]
                       Unresolved local var: USItype n2@[???]
                       Unresolved local var: USItype q0@[???]
                       Unresolved local var: USItype q1@[???]
                       Unresolved local var: USItype b@[???]
                       Unresolved local var: USItype bm@[???]
                       Unresolved local var: DWunion ww@[???] */
  if (uVar11 == 0) {
    if (uVar6 < uVar8) {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
      if (uVar8 < 0x10000) {
        iVar4 = 8;
        if (uVar8 < 0x100) {
          iVar4 = 0;
          iVar2 = 0;
        }
        else {
          iVar2 = 8;
        }
      }
      else if (uVar8 < 0x1000000) {
        iVar4 = 0x10;
        iVar2 = 0x10;
      }
      else {
        iVar4 = 0x18;
        iVar2 = 0x18;
      }
      uVar11 = 0x20 - (iVar4 + (uint)""[uVar8 >> iVar2]);
      if (uVar11 == 0) {
        uVar11 = 0;
      }
      else {
        uVar8 = uVar8 << (uVar11 & 0x1f);
        u = CONCAT44(uVar6 << (uVar11 & 0x1f) | uVar10 >> (0x20 - uVar11 & 0x1f),
                     uVar10 << (uVar11 & 0x1f));
      }
      uVar6 = (uint)(u >> 0x20);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
      uVar10 = uVar8 >> 0x10;
      if (uVar10 == 0) {
        trap(7);
      }
      uVar12 = uVar6 % uVar10 << 0x10 | (uint)u >> 0x10;
      uVar6 = (uVar8 & 0xffff) * (uVar6 / uVar10);
      if (uVar10 == 0) {
        trap(7);
      }
      if (uVar12 < uVar6) {
        uVar7 = uVar12 + uVar8;
        uVar12 = uVar7 - uVar6;
        if (uVar8 <= uVar7) {
          if (uVar7 < uVar6) {
            uVar7 = uVar7 + uVar8;
          }
          uVar12 = uVar7 - uVar6;
        }
      }
      else {
        uVar12 = uVar12 - uVar6;
      }
      if (uVar10 == 0) {
        trap(7);
      }
      uVar6 = uVar12 % uVar10 << 0x10 | (uint)u & 0xffff;
      uVar12 = (uVar8 & 0xffff) * (uVar12 / uVar10);
      if (uVar10 == 0) {
        trap(7);
      }
      uVar10 = uVar6 - uVar12;
      if (uVar12 <= uVar6) goto LAB_089d5784;
      uVar6 = uVar6 + uVar8;
    }
    else {
      if (uVar8 == 0) {
        uVar8 = 1 / 0;
        trap(7);
        if (0xffff < uVar8) goto LAB_089d57a0;
LAB_089d54d8:
        iVar4 = 8;
        if (uVar8 < 0x100) {
          iVar4 = 0;
          iVar2 = 0;
        }
        else {
          iVar2 = 8;
        }
      }
      else {
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
        if (uVar8 < 0x10000) goto LAB_089d54d8;
LAB_089d57a0:
        if (uVar8 < 0x1000000) {
          iVar4 = 0x10;
          iVar2 = 0x10;
        }
        else {
          iVar4 = 0x18;
          iVar2 = 0x18;
        }
      }
      uVar11 = 0x20 - (iVar4 + (uint)""[uVar8 >> iVar2]);
      if (uVar11 == 0) {
        uVar6 = uVar6 - uVar8;
        uVar7 = uVar8 >> 0x10;
        uVar12 = uVar8 & 0xffff;
        uVar11 = 0;
      }
      else {
        uVar8 = uVar8 << (uVar11 & 0x1f);
        uVar5 = uVar6 >> (0x20 - uVar11 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
        uVar7 = uVar8 >> 0x10;
        if (uVar7 == 0) {
          trap(7);
        }
        uVar12 = uVar8 & 0xffff;
        uVar9 = uVar6 << (uVar11 & 0x1f) | uVar10 >> (0x20 - uVar11 & 0x1f);
        uVar3 = uVar5 % uVar7 << 0x10 | uVar9 >> 0x10;
        uVar6 = uVar12 * (uVar5 / uVar7);
        if (uVar7 == 0) {
          trap(7);
        }
        if (uVar3 < uVar6) {
          uVar3 = uVar3 + uVar8;
          if (uVar3 < uVar8) goto LAB_089d58a4;
          if (uVar3 < uVar6) {
            uVar3 = uVar3 + uVar8;
            goto LAB_089d58a4;
          }
          uVar3 = uVar3 - uVar6;
        }
        else {
LAB_089d58a4:
          uVar3 = uVar3 - uVar6;
        }
        if (uVar7 == 0) {
          trap(7);
        }
        uVar6 = uVar3 % uVar7 << 0x10 | uVar9 & 0xffff;
        uVar5 = uVar12 * (uVar3 / uVar7);
        if (uVar7 == 0) {
          trap(7);
        }
        if (uVar6 < uVar5) {
          uVar6 = uVar6 + uVar8;
          if (uVar6 < uVar8) {
            uVar10 = uVar10 << (uVar11 & 0x1f);
          }
          else {
            if (uVar6 < uVar5) {
              uVar6 = uVar6 + uVar8;
            }
            uVar10 = uVar10 << (uVar11 & 0x1f);
          }
        }
        else {
          uVar10 = uVar10 << (uVar11 & 0x1f);
        }
        uVar6 = uVar6 - uVar5;
      }
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
      if (uVar7 == 0) {
        trap(7);
      }
      uVar5 = uVar6 % uVar7 << 0x10 | uVar10 >> 0x10;
      uVar6 = uVar12 * (uVar6 / uVar7);
      if (uVar7 == 0) {
        trap(7);
      }
      if (uVar5 < uVar6) {
        uVar3 = uVar5 + uVar8;
        uVar5 = uVar3 - uVar6;
        if (uVar8 <= uVar3) {
          if (uVar3 < uVar6) {
            uVar3 = uVar3 + uVar8;
          }
          uVar5 = uVar3 - uVar6;
        }
      }
      else {
        uVar5 = uVar5 - uVar6;
      }
      if (uVar7 == 0) {
        trap(7);
      }
      uVar6 = uVar5 % uVar7 << 0x10 | uVar10 & 0xffff;
      uVar12 = uVar12 * (uVar5 / uVar7);
      if (uVar7 == 0) {
        trap(7);
      }
      uVar10 = uVar6 - uVar12;
      if (uVar12 <= uVar6) goto LAB_089d5784;
      uVar6 = uVar6 + uVar8;
    }
    uVar10 = uVar6 - uVar12;
    if (uVar8 <= uVar6) {
      if (uVar6 < uVar12) {
        uVar6 = uVar6 + uVar8;
      }
      uVar10 = uVar6 - uVar12;
    }
LAB_089d5784:
    return (UDItype)(uVar10 >> (uVar11 & 0x1f));
  }
  if (uVar6 < uVar11) {
    return u;
  }
                    /* Unresolved local var: USItype __xr@[???]
                       Unresolved local var: USItype __a@[???] */
  if (v < 0x1000000000000) {
    iVar4 = 8;
    if (v < 0x10000000000) {
      iVar4 = 0;
      iVar2 = 0;
    }
    else {
      iVar2 = 8;
    }
  }
  else if (v < 0x100000000000000) {
    iVar4 = 0x10;
    iVar2 = 0x10;
  }
  else {
    iVar4 = 0x18;
    iVar2 = 0x18;
  }
  uVar12 = 0x20 - (iVar4 + (uint)""[uVar11 >> iVar2]);
  uVar7 = 0x20 - uVar12;
  if (uVar12 == 0) {
    if ((uVar11 < uVar6) || (uVar8 <= uVar10)) {
      u = CONCAT44((uVar6 - uVar11) - (uint)(uVar10 < uVar10 - uVar8),uVar10 - uVar8);
    }
    return u;
  }
                    /* Unresolved local var: USItype m1@[???]
                       Unresolved local var: USItype m0@[???] */
  uVar5 = uVar11 << (uVar12 & 0x1f) | uVar8 >> (uVar7 & 0x1f);
  uVar11 = uVar6 >> (uVar7 & 0x1f);
                    /* Unresolved local var: USItype __d1@[???]
                       Unresolved local var: USItype __d0@[???]
                       Unresolved local var: USItype __q1@[???]
                       Unresolved local var: USItype __q0@[???]
                       Unresolved local var: USItype __r1@[???]
                       Unresolved local var: USItype __r0@[???]
                       Unresolved local var: USItype __m@[???] */
  uVar3 = uVar5 >> 0x10;
  uVar9 = uVar11 / uVar3;
  if (uVar3 == 0) {
    trap(7);
  }
  uVar14 = uVar6 << (uVar12 & 0x1f) | uVar10 >> (uVar7 & 0x1f);
  uVar8 = uVar8 << (uVar12 & 0x1f);
  uVar11 = uVar11 % uVar3 << 0x10 | uVar14 >> 0x10;
  uVar6 = (uVar5 & 0xffff) * uVar9;
  if (uVar3 == 0) {
    trap(7);
  }
  uVar10 = uVar10 << (uVar12 & 0x1f);
  uVar13 = uVar9;
  if (uVar11 < uVar6) {
    uVar11 = uVar11 + uVar5;
    uVar13 = uVar9 - 1;
    if (uVar11 < uVar5) goto LAB_089d5988;
    if (uVar11 < uVar6) {
      uVar13 = uVar9 - 2;
      uVar11 = uVar11 + uVar5;
      goto LAB_089d5988;
    }
    uVar11 = uVar11 - uVar6;
  }
  else {
LAB_089d5988:
    uVar11 = uVar11 - uVar6;
  }
  uVar6 = uVar11 / uVar3;
  if (uVar3 == 0) {
    trap(7);
  }
  uVar9 = uVar11 % uVar3 << 0x10 | uVar14 & 0xffff;
  uVar11 = (uVar5 & 0xffff) * uVar6;
  if (uVar3 == 0) {
    trap(7);
  }
  uVar3 = uVar6;
  if (uVar9 < uVar11) {
    uVar9 = uVar9 + uVar5;
    uVar3 = uVar6 - 1;
    if ((uVar5 <= uVar9) && (uVar9 < uVar11)) {
      uVar3 = uVar6 - 2;
      uVar9 = uVar9 + uVar5;
    }
  }
  uVar9 = uVar9 - uVar11;
  lVar1 = (ulonglong)(uVar3 | uVar13 << 0x10) * (ulonglong)uVar8;
  uVar11 = (uint)lVar1;
  uVar6 = (uint)((ulonglong)lVar1 >> 0x20);
  if (uVar6 <= uVar9) {
    uVar3 = uVar11;
    if (uVar9 != uVar6) {
      iVar2 = uVar9 - uVar6;
      goto LAB_089d5a40;
    }
    if (uVar11 <= uVar10) {
      iVar2 = 0;
      goto LAB_089d5a40;
    }
  }
  uVar3 = uVar11 - uVar8;
  iVar2 = uVar9 - ((uVar6 - uVar5) - (uint)(uVar11 < uVar3));
LAB_089d5a40:
                    /* Unresolved local var: USItype __x@[???] */
  uVar6 = iVar2 - (uint)(uVar10 < uVar10 - uVar3);
  return CONCAT44(uVar6 >> (uVar12 & 0x1f),
                  uVar6 << (uVar7 & 0x1f) | uVar10 - uVar3 >> (uVar12 & 0x1f));
}



----------------------------------------

// Function: __extendsfdf2 @ 089d5af0

/* WARNING: Unknown calling convention */

DFtype __extendsfdf2(SFtype arg_a)

{
  DFtype DVar1;
  FLO_union_type local_20;
  fp_class_type local_1c;
  uint local_18;
  int local_14;
  UDItype in_stack_fffffff0;
  
                    /* Unresolved local var: fp_number_type in@[???]
                       Unresolved local var: FLO_union_type au@[???] */
  local_20 = (FLO_union_type)arg_a;
  __unpack_f(&local_20,(fp_number_type *)&local_1c);
  DVar1 = __make_dp(local_1c,local_18,local_14,in_stack_fffffff0);
  return DVar1;
}



----------------------------------------

// Function: _fpadd_parts @ 089d5b38

/* WARNING: Removing unreachable block (ram,0x089d5c30) */
/* WARNING: Removing unreachable block (ram,0x089d5c3c) */
/* WARNING: Removing unreachable block (ram,0x089d5c34) */

fp_number_type_conflict *
_fpadd_parts(fp_number_type_conflict *a,fp_number_type_conflict *b,fp_number_type_conflict *tmp)

{
  uint uVar1;
  fp_class_type fVar2;
  int iVar3;
  undefined4 uVar4;
  halffractype_conflict hVar5;
  uint uVar6;
  halffractype_conflict hVar7;
  fp_class_type fVar8;
  uint uVar9;
  uint uVar10;
  uint uVar11;
  uint uVar12;
  int iVar13;
  int iVar14;
  
                    /* Unresolved local var: intfrac tfraction@[???]
                       Unresolved local var: int a_normal_exp@[???]
                       Unresolved local var: int b_normal_exp@[???]
                       Unresolved local var: fractype.conflict a_fraction@[???]
                       Unresolved local var: fractype.conflict b_fraction@[???] */
  fVar8 = a->class;
  if (fVar8 < CLASS_ZERO) {
    return a;
  }
  fVar2 = b->class;
  if (fVar2 < CLASS_ZERO) {
    return b;
  }
  if (fVar8 == CLASS_INFINITY) {
    if (fVar2 != CLASS_INFINITY) {
      return a;
    }
    if (a->sign == b->sign) {
      return a;
    }
    return &__thenan_df;
  }
  if (fVar2 == CLASS_INFINITY) {
    return b;
  }
  if (fVar2 == CLASS_ZERO) {
    if (fVar8 != CLASS_ZERO) {
      return a;
    }
    iVar3 = a->normal_exp;
    hVar5 = (a->fraction).l[0];
    hVar7 = (a->fraction).l[1];
    uVar4 = *(undefined4 *)&a->field_0xc;
    tmp->sign = a->sign;
    tmp->class = CLASS_ZERO;
    tmp->normal_exp = iVar3;
    *(undefined4 *)&tmp->field_0xc = uVar4;
    (tmp->fraction).l[0] = hVar5;
    (tmp->fraction).l[1] = hVar7;
    tmp->sign = a->sign & b->sign;
    return tmp;
  }
  if (fVar8 == CLASS_ZERO) {
    return b;
  }
                    /* Unresolved local var: int diff@[???] */
  iVar14 = a->normal_exp;
  iVar13 = b->normal_exp;
  uVar11 = (a->fraction).l[0];
  uVar12 = (a->fraction).l[1];
  uVar9 = (b->fraction).l[0];
  uVar10 = (b->fraction).l[1];
  iVar3 = 0;
  if (iVar13 < iVar14) {
    do {
      uVar1 = uVar10 << 0x1f;
      uVar10 = uVar10 >> 1;
      iVar3 = iVar3 + 1;
      uVar9 = uVar9 & 1 | uVar1 | uVar9 >> 1;
    } while (iVar3 != iVar14 - iVar13);
    iVar13 = iVar13 + iVar3;
  }
  iVar3 = 0;
  if (iVar14 < iVar13) {
    do {
      uVar1 = uVar12 << 0x1f;
      uVar12 = uVar12 >> 1;
      iVar3 = iVar3 + 1;
      uVar11 = uVar11 & 1 | uVar1 | uVar11 >> 1;
    } while (iVar13 - iVar14 != iVar3);
    iVar14 = iVar14 + iVar3;
  }
  uVar6 = a->sign;
  uVar1 = uVar9 + uVar11;
  if (uVar6 == b->sign) {
    hVar5 = (uint)(uVar1 < uVar9) + uVar10 + uVar12;
    tmp->sign = uVar6;
    tmp->normal_exp = iVar14;
    (tmp->fraction).l[0] = uVar1;
    (tmp->fraction).l[1] = hVar5;
  }
  else {
    uVar1 = uVar11 - uVar9;
    if (uVar6 == 0) {
      hVar5 = (uVar12 - uVar10) - (uint)(uVar11 < uVar1);
    }
    else {
      uVar1 = uVar9 - uVar11;
      hVar5 = (uVar10 - uVar12) - (uint)(uVar9 < uVar1);
    }
    if ((int)hVar5 < 0) {
      tmp->sign = 1;
      tmp->normal_exp = iVar14;
      (tmp->fraction).l[0] = -uVar1;
      (tmp->fraction).l[1] = -(uint)(-uVar1 != 0) - hVar5;
    }
    else {
      tmp->normal_exp = iVar14;
      (tmp->fraction).l[0] = uVar1;
      (tmp->fraction).l[1] = hVar5;
      tmp->sign = 0;
    }
    uVar1 = (tmp->fraction).l[0];
    hVar5 = (tmp->fraction).l[1];
    uVar10 = (uint)(uVar1 - 1 < uVar1) + (hVar5 - 1);
    if (uVar10 < 0x10000000) {
      if (uVar10 == 0xfffffff) {
        if (uVar1 - 1 == 0xffffffff) goto LAB_089d5db0;
        iVar3 = tmp->normal_exp;
      }
      else {
        iVar3 = tmp->normal_exp;
      }
      uVar10 = uVar1 >> 0x1f;
      while( true ) {
        (tmp->fraction).l[0] = uVar1 << 1;
        (tmp->fraction).l[1] = hVar5 << 1 | uVar10;
        uVar1 = (tmp->fraction).l[0];
        hVar5 = (tmp->fraction).l[1];
        uVar10 = (uint)(uVar1 - 1 < uVar1) + (hVar5 - 1);
        iVar3 = iVar3 + -1;
        tmp->normal_exp = iVar3;
        if (0xfffffff < uVar10) break;
        if (uVar10 == 0xfffffff) {
          if (uVar1 - 1 == 0xffffffff) break;
          uVar10 = uVar1 >> 0x1f;
        }
        else {
          uVar10 = uVar1 >> 0x1f;
        }
      }
    }
  }
LAB_089d5db0:
  tmp->class = CLASS_NUMBER;
  if (0x1fffffff < hVar5) {
    iVar3 = tmp->normal_exp;
    (tmp->fraction).l[0] = uVar1 & 1 | hVar5 << 0x1f | uVar1 >> 1;
    (tmp->fraction).l[1] = hVar5 >> 1;
    tmp->normal_exp = iVar3 + 1;
  }
  return tmp;
}



----------------------------------------

// Function: __subdf3 @ 089d5e74

FLO_type_conflict __subdf3(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  fp_number_type_conflict *src;
  FLO_type_conflict FVar1;
  FLO_union_type_conflict local_68;
  FLO_union_type_conflict local_60;
  fp_number_type_conflict fStack_58;
  fp_number_type_conflict fStack_40;
  fp_number_type_conflict fStack_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: fp_number_type.conflict tmp@[???]
                       Unresolved local var: fp_number_type.conflict * res@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_68,&fStack_58);
  __unpack_d(&local_60,&fStack_40);
  fStack_40.sign = fStack_40.sign ^ 1;
  src = _fpadd_parts(&fStack_58,&fStack_40,&fStack_28);
  FVar1 = __pack_d(src);
  return FVar1;
}



----------------------------------------

// Function: __adddf3 @ 089d5ef4

FLO_type_conflict __adddf3(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  fp_number_type_conflict *src;
  FLO_type_conflict FVar1;
  FLO_union_type_conflict local_68;
  FLO_union_type_conflict local_60;
  fp_number_type_conflict fStack_58;
  fp_number_type_conflict fStack_40;
  fp_number_type_conflict fStack_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: fp_number_type.conflict tmp@[???]
                       Unresolved local var: fp_number_type.conflict * res@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_68,&fStack_58);
  __unpack_d(&local_60,&fStack_40);
  src = _fpadd_parts(&fStack_58,&fStack_40,&fStack_28);
  FVar1 = __pack_d(src);
  return FVar1;
}



----------------------------------------

// Function: __muldf3 @ 089d5f68

/* WARNING: Control flow encountered bad instruction data */

FLO_type_conflict __muldf3(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  fp_number_type_conflict *dst;
  FLO_type_conflict FVar1;
  FLO_union_type_conflict local_78;
  FLO_union_type_conflict local_70;
  fp_number_type_conflict local_68;
  fp_number_type_conflict local_50 [2];
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: fp_number_type.conflict tmp@[???]
                       Unresolved local var: fp_number_type.conflict * res@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  dst = &local_68;
  __unpack_d(&local_78,dst);
  __unpack_d(&local_70,local_50);
                    /* Unresolved local var: fractype.conflict low@[???]
                       Unresolved local var: fractype.conflict high@[???] */
  if (local_68.class < CLASS_ZERO) goto LAB_089d6030;
  if (local_50[0].class < CLASS_ZERO) goto LAB_089d5ff0;
  if (local_68.class == CLASS_INFINITY) {
    if (local_50[0].class != CLASS_ZERO) {
LAB_089d6030:
      local_68.sign = (uint)(local_68.sign != local_50[0].sign);
      goto LAB_089d6044;
    }
  }
  else {
    if (local_50[0].class != CLASS_INFINITY) {
      if (local_68.class != CLASS_ZERO) {
        if (local_50[0].class != CLASS_ZERO) {
                    /* Unresolved local var: USItype nl@[???]
                       Unresolved local var: USItype nh@[???]
                       Unresolved local var: USItype ml@[???]
                       Unresolved local var: USItype mh@[???]
                       Unresolved local var: UDItype pp_ll@[???]
                       Unresolved local var: UDItype pp_hl@[???]
                       Unresolved local var: UDItype pp_lh@[???]
                       Unresolved local var: UDItype pp_hh@[???]
                       Unresolved local var: UDItype res2@[???]
                       Unresolved local var: UDItype res0@[???]
                       Unresolved local var: UDItype ps_hh__@[???] */
                    /* WARNING: Bad instruction - Truncating control flow here */
          halt_baddata();
        }
        goto LAB_089d5ff0;
      }
      goto LAB_089d6030;
    }
    if (local_68.class != CLASS_ZERO) {
LAB_089d5ff0:
      local_50[0].sign = (uint)(local_68.sign != local_50[0].sign);
      FVar1 = __pack_d(local_50);
      return FVar1;
    }
  }
  dst = &__thenan_df;
LAB_089d6044:
  FVar1 = __pack_d(dst);
  return FVar1;
}



----------------------------------------

// Function: __divdf3 @ 089d6314

/* WARNING: Removing unreachable block (ram,0x089d63c0) */

FLO_type_conflict __divdf3(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  bool bVar1;
  undefined4 uVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  int iVar9;
  uint uVar10;
  undefined4 uVar11;
  FLO_type_conflict FVar12;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: fp_number_type.conflict * res@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
                    /* Unresolved local var: fractype.conflict bit@[???]
                       Unresolved local var: fractype.conflict numerator@[???]
                       Unresolved local var: fractype.conflict denominator@[???]
                       Unresolved local var: fractype.conflict quotient@[???] */
  uVar2 = local_40.fraction.l[0];
  uVar11 = local_40.fraction.l[1];
  if (local_40.class < CLASS_ZERO) goto LAB_089d640c;
  if (local_28.class < CLASS_ZERO) {
    FVar12 = __pack_d(&local_28);
    return FVar12;
  }
  local_40.sign = local_40.sign ^ local_28.sign;
  if ((local_40.class == CLASS_INFINITY) || (local_40.class == CLASS_ZERO)) {
    if (local_28.class == local_40.class) {
      FVar12 = __pack_d(&__thenan_df);
      return FVar12;
    }
    goto LAB_089d640c;
  }
  if (local_28.class == CLASS_INFINITY) {
    local_40.fraction.l[0] = 0;
    local_40.fraction.l[1] = 0;
    local_40.normal_exp = 0;
    uVar2 = local_40.fraction.l[0];
    uVar11 = local_40.fraction.l[1];
    goto LAB_089d640c;
  }
  if (local_28.class == CLASS_ZERO) {
    local_40.class = CLASS_INFINITY;
    goto LAB_089d640c;
  }
  local_40.normal_exp = local_40.normal_exp - local_28.normal_exp;
  if (local_28.fraction.l[1] <= local_40.fraction.l[1]) {
    bVar1 = false;
    if ((local_40.fraction.l[1] != local_28.fraction.l[1]) ||
       (local_28.fraction.l[0] <= local_40.fraction.l[0])) goto LAB_089d64a8;
  }
  local_40.fraction.l[1] = local_40.fraction.l[0] >> 0x1f | local_40.fraction.l[1] << 1;
  local_40.fraction.l[0] = local_40.fraction.l[0] << 1;
  local_40.normal_exp = local_40.normal_exp + -1;
  bVar1 = local_40.fraction.l[1] < local_28.fraction.l[1];
LAB_089d64a8:
  uVar3 = 0;
  uVar8 = 0x10000000;
  uVar10 = 0;
  uVar11 = 0;
  iVar9 = 0;
  do {
    iVar9 = iVar9 + 1;
    uVar4 = local_40.fraction.l[0];
    uVar5 = local_40.fraction.l[1];
    uVar6 = uVar10;
    uVar7 = uVar11;
    if (bVar1) {
LAB_089d64cc:
      local_40.fraction.l[0] = uVar4;
      local_40.fraction.l[1] = uVar5;
      uVar10 = uVar6;
      uVar11 = uVar7;
    }
    else {
      uVar4 = local_40.fraction.l[0] - local_28.fraction._0_4_;
      uVar5 = (local_40.fraction.l[1] - local_28.fraction._4_4_) -
              (uint)(local_40.fraction.l[0] < uVar4);
      uVar6 = uVar10 | uVar3;
      uVar7 = uVar11 | uVar8;
      if ((local_40.fraction.l[1] != local_28.fraction.l[1]) ||
         (local_28.fraction.l[0] <= local_40.fraction.l[0])) goto LAB_089d64cc;
    }
    local_40.fraction.l[1] = local_40.fraction.l[0] >> 0x1f | local_40.fraction.l[1] << 1;
    uVar3 = uVar8 << 0x1f | uVar3 >> 1;
    uVar8 = uVar8 >> 1;
    local_40.fraction.l[0] = local_40.fraction.l[0] << 1;
    if (iVar9 == 0x3d) break;
    bVar1 = local_40.fraction.l[1] < local_28.fraction.l[1];
  } while( true );
  uVar2 = uVar10;
  if ((((uVar10 & 0xff) == 0x80) && ((uVar10 & 0x100) == 0)) &&
     (local_40.fraction.l[0] != 0 || local_40.fraction.l[1] != 0)) {
    uVar2 = uVar10 + 0x80 & 0xffffff00;
    uVar11 = (uint)(uVar10 + 0x80 < uVar10) + uVar11;
  }
LAB_089d640c:
  local_40.fraction.l[1] = uVar11;
  local_40.fraction.l[0] = uVar2;
  FVar12 = __pack_d(&local_40);
  return FVar12;
}



----------------------------------------

// Function: __eqdf2 @ 089d6578

SItype __eqdf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
    return iVar1;
  }
  return 1;
}



----------------------------------------

// Function: __nedf2 @ 089d6618

SItype __nedf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
    return iVar1;
  }
  return 1;
}



----------------------------------------

// Function: __gtdf2 @ 089d66b8

SItype __gtdf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  iVar1 = -1;
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
  }
  return iVar1;
}



----------------------------------------

// Function: __gedf2 @ 089d6744

SItype __gedf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  iVar1 = -1;
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
  }
  return iVar1;
}



----------------------------------------

// Function: __ltdf2 @ 089d67d0

SItype __ltdf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
    return iVar1;
  }
  return 1;
}



----------------------------------------

// Function: __ledf2 @ 089d6870

SItype __ledf2(FLO_type_conflict arg_a,FLO_type_conflict arg_b)

{
  int iVar1;
  FLO_union_type_conflict local_50;
  FLO_union_type_conflict local_48;
  fp_number_type_conflict local_40;
  fp_number_type_conflict local_28;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: fp_number_type.conflict b@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???]
                       Unresolved local var: FLO_union_type.conflict bu@[???] */
  __unpack_d(&local_50,&local_40);
  __unpack_d(&local_48,&local_28);
  if ((CLASS_QNAN < local_40.class) && (CLASS_QNAN < local_28.class)) {
    iVar1 = __fpcmp_parts_d(&local_40,&local_28);
    return iVar1;
  }
  return 1;
}



----------------------------------------

// Function: __floatsidf @ 089d6910

FLO_type_conflict __floatsidf(SItype arg_a)

{
  FLO_type_conflict in_f0_1;
  FLO_type_conflict FVar1;
  fp_number_type_conflict local_20;
  
                    /* Unresolved local var: fp_number_type.conflict in@[???] */
  local_20.sign = -(arg_a >> 0x1f);
  local_20.class = CLASS_NUMBER;
  if (arg_a == 0) {
    local_20.class = CLASS_ZERO;
  }
  else {
    local_20.normal_exp = 0x3c;
    local_20.fraction.l[0] = arg_a;
    local_20.fraction.l[1] = arg_a >> 0x1f;
    if (local_20.sign != 0) {
      if (arg_a == -0x80000000) {
        return in_f0_1;
      }
      local_20.fraction.l[0] = -arg_a;
      local_20.fraction.l[1] = (int)local_20.fraction.l[0] >> 0x1f;
    }
    if (local_20.fraction.l[1] < 0x10000000) {
      local_20.normal_exp = 0x3c;
      do {
        local_20.fraction.l[1] = local_20.fraction.l[1] << 1 | local_20.fraction.l[0] >> 0x1f;
        local_20.fraction.l[0] = local_20.fraction.l[0] << 1;
        local_20.normal_exp = local_20.normal_exp + -1;
      } while (local_20.fraction.l[1] < 0x10000000);
    }
  }
  FVar1 = __pack_d(&local_20);
  return FVar1;
}



----------------------------------------

// Function: __fixdfsi @ 089d69ec

SItype __fixdfsi(FLO_type_conflict arg_a)

{
  uint uVar1;
  SItype SVar2;
  uint uVar3;
  FLO_union_type_conflict local_28;
  fp_number_type_conflict local_20;
  
                    /* Unresolved local var: fp_number_type.conflict a@[???]
                       Unresolved local var: SItype tmp@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???] */
  __unpack_d(&local_28,&local_20);
  if ((local_20.class == CLASS_ZERO) || (local_20.class < CLASS_ZERO)) {
LAB_089d6a44:
    SVar2 = 0;
  }
  else {
    if (local_20.class != CLASS_INFINITY) {
      if (local_20.normal_exp < 0) goto LAB_089d6a44;
      if (local_20.normal_exp < 0x1f) {
        uVar3 = 0x3c - local_20.normal_exp;
        uVar1 = (local_20.fraction.l[1] << 1) << (~uVar3 & 0x1f) |
                local_20.fraction.l[0] >> (uVar3 & 0x1f);
        if ((uVar3 & 0x20) != 0) {
          uVar1 = local_20.fraction.l[1] >> (uVar3 & 0x1f);
        }
        if (local_20.sign == 0) {
          return uVar1;
        }
        return -uVar1;
      }
    }
    if (local_20.sign == 0) {
      return 0x7fffffff;
    }
    SVar2 = -0x80000000;
  }
  return SVar2;
}



----------------------------------------

// Function: __make_dp @ 089d6aac

DFtype __make_dp(fp_class_type class,uint sign,int exp,UDItype frac)

{
  FLO_type_conflict FVar1;
  fp_number_type_conflict local_20;
  
                    /* Unresolved local var: fp_number_type.conflict in@[???] */
  local_20.class = class;
  local_20.sign = sign;
  local_20.normal_exp = exp;
  FVar1 = __pack_d(&local_20);
  return FVar1;
}



----------------------------------------

// Function: __truncdfsf2 @ 089d6ae0

SFtype __truncdfsf2(DFtype arg_a)

{
  uint frac;
  SFtype SVar1;
  FLO_union_type_conflict local_28;
  fp_number_type_conflict local_20;
  
                    /* Unresolved local var: fp_number_type.conflict in@[???]
                       Unresolved local var: USItype sffrac@[???]
                       Unresolved local var: FLO_union_type.conflict au@[???] */
  __unpack_d(&local_28,&local_20);
  frac = local_20.fraction.l[1] << 2 | local_20.fraction.l[0] >> 0x1e;
  if ((local_20.fraction.l[0] & 0x3fffffff) != 0) {
    frac = frac | 1;
  }
  SVar1 = __make_fp(local_20.class,local_20.sign,local_20.normal_exp,frac);
  return SVar1;
}



----------------------------------------

// Function: read_uleb128 @ 089d6b50

uchar * read_uleb128(uchar *p,_Unwind_Word *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg6(a2)]
                       Unresolved local var: uchar byte@[DW_OP_reg3(v1)]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg7(a3)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: read_sleb128 @ 089d6b84

uchar * read_sleb128(uchar *p,_Unwind_Sword *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg7(a3)]
                       Unresolved local var: uchar byte@[???]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg8(t0)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  if ((uVar2 < 0x20) && ((bVar1 & 0x40) != 0)) {
    uVar3 = uVar3 | -1 << (uVar2 & 0x1f);
  }
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: _Unwind_GetCFA @ 089d6bdc

_Unwind_Word _Unwind_GetCFA(_Unwind_Context *context)

{
  return (_Unwind_Word)context->cfa;
}



----------------------------------------

// Function: _Unwind_GetIP @ 089d6be4

_Unwind_Ptr _Unwind_GetIP(_Unwind_Context *context)

{
  return (_Unwind_Ptr)context->ra;
}



----------------------------------------

// Function: _Unwind_SetIP @ 089d6bec

void _Unwind_SetIP(_Unwind_Context *context,_Unwind_Ptr val)

{
  context->ra = (void *)val;
  return;
}



----------------------------------------

// Function: _Unwind_GetLanguageSpecificData @ 089d6bf4

void * _Unwind_GetLanguageSpecificData(_Unwind_Context *context)

{
  return context->lsda;
}



----------------------------------------

// Function: _Unwind_GetRegionStart @ 089d6bfc

_Unwind_Ptr _Unwind_GetRegionStart(_Unwind_Context *context)

{
  return (_Unwind_Ptr)(context->bases).func;
}



----------------------------------------

// Function: _Unwind_GetDataRelBase @ 089d6c04

_Unwind_Ptr _Unwind_GetDataRelBase(_Unwind_Context *context)

{
  return (_Unwind_Ptr)(context->bases).dbase;
}



----------------------------------------

// Function: _Unwind_GetTextRelBase @ 089d6c0c

_Unwind_Ptr _Unwind_GetTextRelBase(_Unwind_Context *context)

{
  return (_Unwind_Ptr)(context->bases).tbase;
}



----------------------------------------

// Function: _Unwind_DeleteException @ 089d6c14

void _Unwind_DeleteException(_Unwind_Exception_conflict9 *exc)

{
  if (exc->exception_cleanup != (_Unwind_Exception_Cleanup_Fn_conflict9)0x0) {
                    /* WARNING: Could not recover jumptable at 0x089d6c24. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (*exc->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,exc);
    return;
  }
  return;
}



----------------------------------------

// Function: _Unwind_SetGR @ 089d6c34

void _Unwind_SetGR(_Unwind_Context *context,int index,_Unwind_Word val)

{
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
  if ((index < 0xbd) && (dwarf_reg_size_table[index] == '\x04')) {
    *(_Unwind_Word *)context->reg[index] = val;
    return;
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: _Unwind_GetGR @ 089d6c84

_Unwind_Word _Unwind_GetGR(_Unwind_Context *context,int index)

{
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
  if ((index < 0xbd) && (dwarf_reg_size_table[index] == '\x04')) {
    return *(_Unwind_Word *)context->reg[index];
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: read_encoded_value_with_base @ 089d6cd4

uchar * read_encoded_value_with_base(uchar encoding,_Unwind_Ptr base,uchar *p,_Unwind_Ptr *val)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  uint *puVar5;
  uint local_20 [2];
  
                    /* Unresolved local var: unaligned * u@[???]
                       Unresolved local var: _Unwind_Internal_Ptr result@[???] */
  uVar3 = (uint)encoding;
  if (uVar3 == 0x50) {
                    /* Unresolved local var: _Unwind_Internal_Ptr a@[???] */
    local_20[0] = *(uint *)((uint)(p + 3) & 0xfffffffc);
    puVar5 = (uint *)((uint)(p + 3) & 0xfffffffc) + 1;
  }
  else {
    uVar4 = uVar3 & 0xf;
    if (0xc < uVar4) {
switchD_089d6d2c_caseD_5:
                    /* WARNING: Subroutine does not return */
      abort();
    }
    switch(uVar4) {
    case 0:
    case 3:
    case 0xb:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 4);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089d6d2c::switchdataD_089f2800)[uVar4] &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    case 1:
                    /* Unresolved local var: _Unwind_Word tmp@[???] */
      puVar5 = (uint *)read_uleb128(p,local_20);
      break;
    case 2:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(ushort *)p;
      break;
    case 4:
    case 0xc:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 8);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089d6d2c::switchdataD_089f2800 + uVar4) &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    default:
      goto switchD_089d6d2c_caseD_5;
    case 9:
                    /* Unresolved local var: _Unwind_Sword tmp@[???] */
      puVar5 = (uint *)read_sleb128(p,(_Unwind_Sword *)local_20);
      break;
    case 10:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(short *)p;
    }
    if (local_20[0] != 0) {
      if ((uVar3 & 0x70) == 0x10) {
        base = (_Unwind_Ptr)p;
      }
      local_20[0] = base + local_20[0];
      if ((char)encoding < '\0') {
        local_20[0] = *(uint *)local_20[0];
      }
    }
  }
  *val = local_20[0];
  return (uchar *)puVar5;
}



----------------------------------------

// Function: base_of_encoded_value @ 089d6e14

_Unwind_Ptr base_of_encoded_value(uchar encoding,_Unwind_Context *context)

{
  _Unwind_Ptr _Var1;
  byte bVar2;
  
  if (encoding != 0xff) {
    bVar2 = encoding & 0x70;
    if (bVar2 == 0x20) {
      _Var1 = _Unwind_GetTextRelBase(context);
      return _Var1;
    }
    if (bVar2 < 0x21) {
      if (((encoding & 0x70) != 0) && (bVar2 != 0x10)) {
                    /* WARNING: Subroutine does not return */
        abort();
      }
    }
    else {
      if (bVar2 == 0x40) {
        _Var1 = _Unwind_GetRegionStart(context);
        return _Var1;
      }
      if (bVar2 != 0x50) {
        if (bVar2 == 0x30) {
          _Var1 = _Unwind_GetDataRelBase(context);
          return _Var1;
        }
                    /* WARNING: Subroutine does not return */
        abort();
      }
    }
  }
  return 0;
}



----------------------------------------

// Function: _Unwind_FindEnclosingFunction @ 089d6eb4

void * _Unwind_FindEnclosingFunction(void *pc)

{
  fde *pfVar1;
  void *pvVar2;
  dwarf_eh_bases dStack_18;
  
                    /* Unresolved local var: dwarf_eh_bases bases@[???]
                       Unresolved local var: dwarf_fde * fde@[???] */
  pfVar1 = _Unwind_Find_FDE((void *)((int)pc + -1),&dStack_18);
  pvVar2 = (void *)0x0;
  if (pfVar1 != (fde *)0x0) {
    pvVar2 = dStack_18.func;
  }
  return pvVar2;
}



----------------------------------------

// Function: execute_cfa_program @ 089d6ee4

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

void execute_cfa_program(uchar *insn_ptr,uchar *insn_end,_Unwind_Context *context,
                        _Unwind_FrameState *fs)

{
  byte bVar1;
  uchar encoding;
  ushort uVar2;
  uchar *puVar3;
  _Unwind_Ptr base;
  uint uVar4;
  anon_enum_32 aVar5;
  uint uVar6;
  int iVar7;
  anon_union_4_3_890eaea0_for_loc aVar8;
  anon_struct_8_2_43e422f5 *paVar9;
  void *pvVar10;
  anon_enum_32 aVar11;
  _Unwind_Word _Var12;
  _Unwind_FrameState *p_Var13;
  _Unwind_FrameState *p_Var14;
  frame_state_reg_info *pfVar15;
  frame_state_reg_info *pfVar16;
  frame_state_reg_info *pfVar17;
  ushort *p;
  frame_state_reg_info *pfVar18;
  uint *puVar19;
  uint local_40;
  _Unwind_Word local_3c;
  _Unwind_Word local_38;
  anon_union_4_3_890eaea0_for_loc local_34 [5];
  
                    /* Unresolved local var: frame_state_reg_info * unused_rs@[???] */
  puVar19 = &local_40;
  (fs->regs).prev = (frame_state_reg_info *)0x0;
  if (insn_ptr < insn_end) {
    pvVar10 = fs->pc;
    pfVar18 = (frame_state_reg_info *)0x0;
    if (pvVar10 < context->ra) {
                    /* Unresolved local var: uchar insn@[???]
                       Unresolved local var: _Unwind_Word reg@[DW_OP_breg30(s8): 0]
                       Unresolved local var: _Unwind_Word utmp@[DW_OP_breg30(s8): +4]
                       Unresolved local var: _Unwind_Sword offset@[???]
                       Unresolved local var: _Unwind_Sword stmp@[DW_OP_breg30(s8): +8] */
      bVar1 = *insn_ptr;
      do {
        uVar6 = (uint)bVar1;
        uVar4 = uVar6 & 0xc0;
        p = (ushort *)((int)insn_ptr + 1);
        if (uVar4 == 0x40) {
          fs->pc = (void *)((int)pvVar10 + (uVar6 & 0x3f) * fs->code_align);
          goto switchD_089d6f7c_caseD_0;
        }
        if (uVar4 == 0x80) {
          local_40 = uVar6 & 0x3f;
LAB_089d6f94:
          p = (ushort *)read_uleb128((uchar *)p,&local_3c);
          iVar7 = fs->data_align;
          _Var12 = local_3c;
LAB_089d6fa8:
          paVar9 = (fs->regs).reg + local_40;
          paVar9->how = CFA_REG_OFFSET;
          (paVar9->loc).reg = iVar7 * _Var12;
          goto switchD_089d6f7c_caseD_0;
        }
        if (uVar4 == 0xc0) {
          local_40 = uVar6 & 0x3f;
          (fs->regs).reg[local_40].how = CFA_UNSET;
          goto switchD_089d6f7c_caseD_0;
        }
        switch(uVar6) {
        case 0:
          break;
        case 1:
                    /* Unresolved local var: _Unwind_Ptr pc@[DW_OP_breg30(s8): +12] */
          encoding = fs->fde_encoding;
          base = base_of_encoded_value(encoding,context);
          p = (ushort *)read_encoded_value_with_base(encoding,base,(uchar *)p,&local_34[0].reg);
          fs->pc = (void *)local_34[0];
          break;
        case 2:
          bVar1 = *(byte *)p;
          p = (ushort *)((int)insn_ptr + 2);
          fs->pc = (void *)((int)pvVar10 + (uint)bVar1 * fs->code_align);
          break;
        case 3:
          uVar2 = *p;
          p = (ushort *)((int)insn_ptr + 3);
          fs->pc = (void *)((int)pvVar10 + (uint)uVar2 * fs->code_align);
          break;
        case 4:
          iVar7 = *(int *)p;
          p = (ushort *)((int)insn_ptr + 5);
          fs->pc = (void *)((int)pvVar10 + iVar7 * fs->code_align);
          break;
        case 5:
          p = (ushort *)read_uleb128((uchar *)p,&local_40);
          goto LAB_089d6f94;
        case 6:
        case 7:
        case 8:
          p = (ushort *)read_uleb128((uchar *)p,&local_40);
          (fs->regs).reg[local_40].how = CFA_UNSET;
          break;
        case 9:
                    /* Unresolved local var: _Unwind_Word reg2@[???] */
          puVar3 = read_uleb128((uchar *)p,&local_40);
          p = (ushort *)read_uleb128(puVar3,&local_34[0].reg);
          paVar9 = (fs->regs).reg + local_40;
          paVar9->loc = local_34[0];
          paVar9->how = CFA_EXP;
          break;
        case 10:
                    /* Unresolved local var: frame_state_reg_info * new_rs@[???] */
          if (pfVar18 == (frame_state_reg_info *)0x0) {
            pfVar17 = (frame_state_reg_info *)((int)puVar19 + -0x5f8);
            puVar19 = (uint *)((int)puVar19 + -0x5f8);
          }
          else {
            pfVar17 = pfVar18;
            pfVar18 = pfVar18->prev;
          }
          p_Var14 = fs;
          pfVar16 = pfVar17;
          do {
            pfVar15 = pfVar16;
            p_Var13 = p_Var14;
            aVar5 = (p_Var13->regs).reg[0].how;
            aVar8 = (p_Var13->regs).reg[1].loc;
            aVar11 = (p_Var13->regs).reg[1].how;
            p_Var14 = (_Unwind_FrameState *)((p_Var13->regs).reg + 2);
            pfVar15->reg[0].loc = (p_Var13->regs).reg[0].loc;
            pfVar15->reg[0].how = aVar5;
            pfVar15->reg[1].loc = aVar8;
            pfVar15->reg[1].how = aVar11;
            pfVar16 = (frame_state_reg_info *)(pfVar15->reg + 2);
          } while (p_Var14 != (_Unwind_FrameState *)((fs->regs).reg + 0xbc));
          aVar8 = *(anon_union_4_3_890eaea0_for_loc *)&p_Var14->regs;
          aVar5 = (p_Var13->regs).reg[2].how;
          pfVar15->reg[3].loc = (p_Var13->regs).reg[3].loc;
          ((frame_state_reg_info *)(pfVar15->reg + 2))->reg[0].loc = aVar8;
          pfVar15->reg[2].how = aVar5;
          (fs->regs).prev = pfVar17;
          break;
        case 0xb:
                    /* Unresolved local var: frame_state_reg_info * old_rs@[???] */
          pfVar16 = (fs->regs).prev;
          pfVar17 = pfVar16;
          p_Var14 = fs;
          do {
            p_Var13 = p_Var14;
            pfVar15 = pfVar17;
            aVar5 = pfVar15->reg[0].how;
            aVar8 = pfVar15->reg[1].loc;
            aVar11 = pfVar15->reg[1].how;
            pfVar17 = (frame_state_reg_info *)(pfVar15->reg + 2);
            (p_Var13->regs).reg[0].loc = pfVar15->reg[0].loc;
            (p_Var13->regs).reg[0].how = aVar5;
            (p_Var13->regs).reg[1].loc = aVar8;
            (p_Var13->regs).reg[1].how = aVar11;
            p_Var14 = (_Unwind_FrameState *)((p_Var13->regs).reg + 2);
          } while (pfVar17 != (frame_state_reg_info *)(pfVar16->reg + 0xbc));
          aVar8 = pfVar17->reg[0].loc;
          aVar5 = pfVar15->reg[2].how;
          (p_Var13->regs).reg[3].loc = pfVar15->reg[3].loc;
          *(anon_union_4_3_890eaea0_for_loc *)&p_Var14->regs = aVar8;
          (p_Var13->regs).reg[2].how = aVar5;
          pfVar16->prev = pfVar18;
          pfVar18 = pfVar16;
          break;
        case 0xc:
          puVar3 = read_uleb128((uchar *)p,&fs->cfa_reg);
          p = (ushort *)read_uleb128(puVar3,&local_3c);
          fs->cfa_how = CFA_REG_OFFSET;
          fs->cfa_offset = local_3c;
          break;
        case 0xd:
          p = (ushort *)read_uleb128((uchar *)p,&fs->cfa_reg);
          fs->cfa_how = CFA_REG_OFFSET;
          break;
        case 0xe:
          p = (ushort *)read_uleb128((uchar *)p,&local_3c);
          fs->cfa_offset = local_3c;
          break;
        case 0xf:
          fs->cfa_exp = (uchar *)p;
          fs->cfa_how = CFA_EXP;
          puVar3 = read_uleb128((uchar *)p,&local_3c);
          p = (ushort *)(puVar3 + local_3c);
          break;
        case 0x10:
          puVar3 = read_uleb128((uchar *)p,&local_40);
          paVar9 = (fs->regs).reg + local_40;
          paVar9->how = REG_SAVED_EXP;
          (paVar9->loc).exp = puVar3;
          puVar3 = read_uleb128(puVar3,&local_3c);
          p = (ushort *)(puVar3 + local_3c);
          break;
        case 0x11:
          puVar3 = read_uleb128((uchar *)p,&local_40);
          p = (ushort *)read_sleb128(puVar3,(_Unwind_Sword *)&local_38);
          iVar7 = fs->data_align;
          _Var12 = local_38;
          goto LAB_089d6fa8;
        case 0x12:
          puVar3 = read_uleb128((uchar *)p,&fs->cfa_reg);
          p = (ushort *)read_sleb128(puVar3,&fs->cfa_offset);
          fs->cfa_how = CFA_REG_OFFSET;
          fs->cfa_offset = fs->cfa_offset * fs->data_align;
          break;
        case 0x13:
          p = (ushort *)read_sleb128((uchar *)p,&fs->cfa_offset);
          fs->cfa_offset = fs->cfa_offset * fs->data_align;
          break;
        default:
                    /* WARNING: Subroutine does not return */
          abort();
        case 0x2d:
          paVar9 = (fs->regs).reg + 0x10;
          _Var12 = 0;
          uVar4 = 0x10;
          do {
            local_40 = uVar4 + 1;
            (paVar9->loc).reg = _Var12;
            (fs->regs).reg[uVar4].how = CFA_REG_OFFSET;
            _Var12 = _Var12 + 4;
            paVar9 = paVar9 + 1;
            uVar4 = local_40;
          } while (local_40 < 0x20);
          goto LAB_089d6fcc;
        case 0x2e:
          p = (ushort *)read_uleb128((uchar *)p,&context->args_size);
          break;
        case 0x2f:
          puVar3 = read_uleb128((uchar *)p,&local_40);
          p = (ushort *)read_uleb128(puVar3,&local_3c);
          iVar7 = fs->data_align;
          paVar9 = (fs->regs).reg + local_40;
          paVar9->how = CFA_REG_OFFSET;
          (paVar9->loc).reg = -(iVar7 * local_3c);
        }
switchD_089d6f7c_caseD_0:
LAB_089d6fcc:
        if (insn_end <= p) {
          return;
        }
        pvVar10 = fs->pc;
        if (context->ra <= pvVar10) {
          return;
        }
        bVar1 = (byte)*p;
        insn_ptr = (uchar *)p;
      } while( true );
    }
  }
  return;
}



----------------------------------------

// Function: uw_frame_state_for @ 089d743c

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

_Unwind_Reason_Code uw_frame_state_for(_Unwind_Context *context,_Unwind_FrameState *fs)

{
  uchar uVar1;
  fde *pfVar2;
  size_t sVar3;
  byte *pbVar4;
  _Unwind_Ptr _Var5;
  fde *p;
  void *pvVar6;
  char cVar7;
  byte bVar8;
  uchar *puVar9;
  int iVar10;
  byte *insn_ptr;
  char *__s;
  char *pcVar11;
  fde *pfVar12;
  int *piVar13;
  byte *insn_ptr_00;
  void *local_30;
  _Unwind_Personality_Fn local_2c;
  
                    /* Unresolved local var: dwarf_fde * fde@[???]
                       Unresolved local var: dwarf_cie * cie@[???]
                       Unresolved local var: uchar * aug@[???]
                       Unresolved local var: uchar * insn@[???]
                       Unresolved local var: uchar * end@[???] */
  memset(fs,0,0x618);
  context->args_size = 0;
  context->lsda = (void *)0x0;
  if ((context->ra == (void *)0x0) ||
     (pfVar2 = _Unwind_Find_FDE((void *)((int)context->ra + -1),&context->bases),
     pfVar2 == (fde *)0x0)) {
    return _URC_END_OF_STACK;
  }
  piVar13 = (int *)((int)pfVar2 + (4 - pfVar2->CIE_delta));
                    /* Unresolved local var: uchar * aug@[???]
                       Unresolved local var: uchar * p@[???]
                       Unresolved local var: uchar * ret@[???]
                       Unresolved local var: _Unwind_Word utmp@[???] */
  __s = (char *)((int)piVar13 + 9);
  fs->pc = (context->bases).func;
  sVar3 = strlen(__s);
  puVar9 = (uchar *)(__s + sVar3 + 1);
  pcVar11 = __s;
  if ((*(char *)((int)piVar13 + 9) == 'e') && (*(char *)((int)piVar13 + 10) == 'h')) {
    pcVar11 = (char *)((int)piVar13 + 0xb);
    pvVar6 = *(void **)puVar9;
    puVar9 = (uchar *)(__s + sVar3 + 5);
    fs->eh_ptr = pvVar6;
  }
  puVar9 = read_uleb128(puVar9,&fs->code_align);
  pbVar4 = read_sleb128(puVar9,&fs->data_align);
  if ((char)piVar13[2] == '\x01') {
    fs->retaddr_column = (uint)*pbVar4;
    fs->lsda_encoding = 0xff;
    cVar7 = *pcVar11;
    pbVar4 = pbVar4 + 1;
    if (cVar7 != 'z') goto LAB_089d7520;
LAB_089d7600:
    pbVar4 = read_uleb128(pbVar4,(_Unwind_Word *)&local_30);
    fs->saw_z = '\x01';
    pcVar11 = pcVar11 + 1;
    cVar7 = *pcVar11;
    insn_ptr_00 = pbVar4 + (int)local_30;
  }
  else {
    pbVar4 = read_uleb128(pbVar4,&fs->retaddr_column);
    fs->lsda_encoding = 0xff;
    cVar7 = *pcVar11;
    if (cVar7 == 'z') goto LAB_089d7600;
LAB_089d7520:
    insn_ptr_00 = (byte *)0x0;
  }
LAB_089d7524:
  if (cVar7 != '\0') {
    while (cVar7 != 'L') {
      if (cVar7 == 'R') {
        bVar8 = *pbVar4;
        pcVar11 = pcVar11 + 1;
        pbVar4 = pbVar4 + 1;
        fs->fde_encoding = bVar8;
        cVar7 = *pcVar11;
        goto LAB_089d7524;
      }
      insn_ptr = insn_ptr_00;
      if (cVar7 != 'P') goto LAB_089d765c;
                    /* Unresolved local var: _Unwind_Ptr personality@[???] */
      bVar8 = *pbVar4;
      pcVar11 = pcVar11 + 1;
      _Var5 = base_of_encoded_value(bVar8,context);
      pbVar4 = read_encoded_value_with_base(bVar8,_Var5,pbVar4 + 1,(_Unwind_Ptr *)&local_2c);
      fs->personality = local_2c;
      cVar7 = *pcVar11;
      if (cVar7 == '\0') goto LAB_089d7580;
    }
    bVar8 = *pbVar4;
    pcVar11 = pcVar11 + 1;
    pbVar4 = pbVar4 + 1;
    fs->lsda_encoding = bVar8;
    cVar7 = *pcVar11;
    goto LAB_089d7524;
  }
LAB_089d7580:
  insn_ptr = pbVar4;
  if (insn_ptr_00 == (byte *)0x0) {
LAB_089d765c:
    if (insn_ptr == (byte *)0x0) {
      return _URC_FATAL_PHASE1_ERROR;
    }
    execute_cfa_program(insn_ptr,(uchar *)((int)piVar13 + *piVar13 + 4),context,fs);
    bVar8 = fs->fde_encoding;
    if (bVar8 != 0xff) goto LAB_089d75b4;
    iVar10 = 0;
  }
  else {
    execute_cfa_program(insn_ptr_00,(uchar *)((int)piVar13 + *piVar13 + 4),context,fs);
    bVar8 = fs->fde_encoding;
    iVar10 = 0;
    if (bVar8 != 0xff) {
LAB_089d75b4:
      bVar8 = bVar8 & 7;
      if (bVar8 != 2) {
        if (bVar8 < 3) {
          if (bVar8 != 0) {
LAB_089d75d8:
                    /* WARNING: Subroutine does not return */
            abort();
          }
        }
        else if (bVar8 != 3) {
          iVar10 = 0x10;
          if (bVar8 != 4) goto LAB_089d75d8;
          goto LAB_089d7694;
        }
        uVar1 = fs->saw_z;
        p = pfVar2 + 2;
        goto joined_r0x089d77a0;
      }
      iVar10 = 4;
    }
  }
LAB_089d7694:
  uVar1 = fs->saw_z;
  p = (fde *)((int)&pfVar2[1].length + iVar10);
joined_r0x089d77a0:
  if (uVar1 == '\0') {
    pfVar12 = (fde *)0x0;
  }
  else {
                    /* Unresolved local var: _Unwind_Word i@[???] */
    p = (fde *)read_uleb128((uchar *)p,(_Unwind_Word *)&local_30);
    pfVar12 = (fde *)((int)&p->length + (int)local_30);
  }
  uVar1 = fs->lsda_encoding;
  if (uVar1 != 0xff) {
                    /* Unresolved local var: _Unwind_Ptr lsda@[???] */
    _Var5 = base_of_encoded_value(uVar1,context);
    p = (fde *)read_encoded_value_with_base(uVar1,_Var5,(uchar *)p,(_Unwind_Ptr *)&local_30);
    context->lsda = local_30;
  }
  if (pfVar12 != (fde *)0x0) {
    p = pfVar12;
  }
  execute_cfa_program((uchar *)p,(uchar *)((int)&pfVar2->CIE_delta + pfVar2->length),context,fs);
  return _URC_NO_REASON;
}



----------------------------------------

// Function: __frame_state_for @ 089d77d4

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

frame_state * __frame_state_for(void *pc_target,frame_state *state_in)

{
  char cVar1;
  _Unwind_Reason_Code _Var2;
  anon_union_4_3_890eaea0_for_loc aVar3;
  frame_state *pfVar4;
  frame_state *pfVar5;
  anon_union_4_3_890eaea0_for_loc *paVar6;
  _Unwind_Context _Stack_938;
  anon_union_4_3_890eaea0_for_loc local_628;
  anon_union_4_3_890eaea0_for_loc local_624 [378];
  anon_union_4_3_890eaea0_for_loc local_3c;
  ushort local_38;
  int local_30;
  ushort local_1c;
  void *local_14;
  
                    /* Unresolved local var: _Unwind_Context context@[???]
                       Unresolved local var: _Unwind_FrameState fs@[???]
                       Unresolved local var: int reg@[???] */
  memset(&_Stack_938,0,0x310);
  _Stack_938.ra = (void *)((int)pc_target + 1);
  _Var2 = uw_frame_state_for(&_Stack_938,(_Unwind_FrameState *)&local_628);
  if ((_Var2 == _URC_NO_REASON) && (local_30 != 2)) {
    paVar6 = local_624;
    pfVar4 = state_in;
    pfVar5 = state_in;
    do {
      cVar1 = *(char *)paVar6;
      pfVar5->saved[0] = cVar1;
      if (cVar1 == '\x01') {
        aVar3 = paVar6[-1];
LAB_089d7884:
        pfVar4->reg_or_offset[0] = (long)aVar3;
      }
      else {
        if (cVar1 == '\x02') {
          aVar3 = paVar6[-1];
          goto LAB_089d7884;
        }
        pfVar4->reg_or_offset[0] = 0;
      }
      paVar6 = paVar6 + 2;
      pfVar5 = (frame_state *)((int)&pfVar5->cfa + 1);
      pfVar4 = (frame_state *)&pfVar4->eh_ptr;
    } while (paVar6 != &local_3c);
    state_in->cfa_offset = (long)local_3c;
    state_in->cfa_reg = local_38;
    state_in->retaddr_column = local_1c;
    state_in->args_size = _Stack_938.args_size;
    state_in->eh_ptr = local_14;
  }
  else {
    state_in = (frame_state *)0x0;
  }
  return state_in;
}



----------------------------------------

// Function: execute_stack_op @ 089d78b8

_Unwind_Word
execute_stack_op(uchar *op_ptr,uchar *op_end,_Unwind_Context *context,_Unwind_Word initial)

{
  byte bVar1;
  ushort uVar2;
  uchar *p;
  int iVar3;
  _Unwind_Word _Var4;
  ushort *puVar5;
  uint uVar6;
  _Unwind_Word _Var7;
  ushort *p_00;
  uint uVar8;
  uint uVar9;
  uint uVar10;
  ushort *local_130;
  _Unwind_Word local_12c;
  _Unwind_Word local_128;
  uint local_124;
  ushort *local_120;
  _Unwind_Word local_11c [65];
  
                    /* Unresolved local var: _Unwind_Word[64] stack@[???]
                       Unresolved local var: int stack_elt@[???] */
  local_11c[0] = initial;
  if (op_end <= op_ptr) {
    iVar3 = 0;
LAB_089d7988:
    return local_11c[iVar3];
  }
  uVar9 = 1;
                    /* Unresolved local var: dwarf_location_atom op@[???]
                       Unresolved local var: _Unwind_Word result@[???]
                       Unresolved local var: _Unwind_Word reg@[???]
                       Unresolved local var: _Unwind_Word utmp@[???]
                       Unresolved local var: _Unwind_Sword offset@[???]
                       Unresolved local var: _Unwind_Sword stmp@[???] */
  bVar1 = *op_ptr;
  do {
    uVar8 = (uint)bVar1;
    p_00 = (ushort *)((int)op_ptr + 1);
    uVar10 = uVar9;
    switch(uVar8 - 3 & 0xff) {
    case 0:
    case 9:
    case 10:
      puVar5 = *(ushort **)p_00;
      p_00 = (ushort *)((int)op_ptr + 5);
      break;
    case 3:
    case 0x16:
    case 0x1c:
    case 0x1d:
    case 0x20:
    case 0x91:
      if (uVar9 == 0) goto switchD_089d7918_caseD_1;
      uVar10 = uVar9 - 1;
      local_130 = (ushort *)local_11c[uVar9 - 1];
      if (uVar8 == 0x1f) {
LAB_089d7be8:
        puVar5 = (ushort *)-(int)local_130;
      }
      else if (uVar8 < 0x20) {
        if (uVar8 == 6) {
LAB_089d7e04:
                    /* Unresolved local var: void * ptr@[???] */
          puVar5 = *(ushort **)local_130;
        }
        else {
          if (uVar8 != 0x19) goto switchD_089d7918_caseD_1;
          puVar5 = local_130;
          if ((int)local_130 < 0) goto LAB_089d7be8;
        }
      }
      else if (uVar8 == 0x23) {
        p_00 = (ushort *)read_uleb128((uchar *)p_00,&local_128);
        puVar5 = (ushort *)((int)local_130 + local_128);
      }
      else if (uVar8 == 0x94) {
        bVar1 = *(byte *)p_00;
        p_00 = (ushort *)((int)op_ptr + 2);
        if (bVar1 == 2) {
          puVar5 = (ushort *)(uint)*local_130;
        }
        else if (bVar1 < 3) {
          if (bVar1 != 1) goto switchD_089d7918_caseD_1;
          puVar5 = (ushort *)(uint)(byte)*local_130;
        }
        else {
          if (bVar1 == 4) goto LAB_089d7e04;
          if (bVar1 != 8) goto switchD_089d7918_caseD_1;
          puVar5 = *(ushort **)local_130;
        }
      }
      else {
        puVar5 = (ushort *)~(uint)local_130;
        if (uVar8 != 0x20) goto switchD_089d7918_caseD_1;
      }
      break;
    case 5:
      bVar1 = *(byte *)p_00;
      p_00 = (ushort *)((int)op_ptr + 2);
      puVar5 = (ushort *)(uint)bVar1;
      break;
    case 6:
      bVar1 = *(byte *)p_00;
      p_00 = (ushort *)((int)op_ptr + 2);
      puVar5 = (ushort *)(int)(char)bVar1;
      break;
    case 7:
      uVar2 = *p_00;
      p_00 = (ushort *)((int)op_ptr + 3);
      puVar5 = (ushort *)(uint)uVar2;
      break;
    case 8:
      uVar2 = *p_00;
      p_00 = (ushort *)((int)op_ptr + 3);
      puVar5 = (ushort *)(int)(short)uVar2;
      break;
    case 0xb:
    case 0xc:
      puVar5 = *(ushort **)p_00;
      p_00 = (ushort *)((int)op_ptr + 9);
      break;
    case 0xd:
      p_00 = (ushort *)read_uleb128((uchar *)p_00,(_Unwind_Word *)&local_130);
      puVar5 = local_130;
      break;
    case 0xe:
      p_00 = (ushort *)read_sleb128((uchar *)p_00,(_Unwind_Sword *)&local_120);
      local_130 = local_120;
      puVar5 = local_130;
      break;
    case 0xf:
      if (uVar9 == 0) goto switchD_089d7918_caseD_1;
      puVar5 = (&local_120)[uVar9];
      break;
    case 0x10:
      if (uVar9 != 0) {
        uVar9 = uVar9 - 1;
        goto switchD_089d7918_caseD_93;
      }
    default:
switchD_089d7918_caseD_1:
                    /* WARNING: Subroutine does not return */
      abort();
    case 0x11:
      if ((int)uVar9 < 2) goto switchD_089d7918_caseD_1;
      puVar5 = (ushort *)(&local_124)[uVar9];
      break;
    case 0x12:
      local_124 = (uint)*(byte *)p_00;
      if ((int)(uVar9 - 1) <= (int)local_124) goto switchD_089d7918_caseD_1;
      p_00 = (ushort *)((int)op_ptr + 2);
      puVar5 = (&local_120)[uVar9 - local_124];
      break;
    case 0x14:
                    /* Unresolved local var: _Unwind_Word t1@[???]
                       Unresolved local var: _Unwind_Word t2@[???]
                       Unresolved local var: _Unwind_Word t3@[???] */
      if (2 < (int)uVar9) {
        _Var7 = local_11c[uVar9 - 1];
        _Var4 = local_11c[uVar9 - 3];
        local_11c[uVar9 - 1] = local_11c[uVar9 - 2];
        local_11c[uVar9 - 2] = _Var4;
        local_11c[uVar9 - 3] = _Var7;
        goto switchD_089d7918_caseD_93;
      }
      goto switchD_089d7918_caseD_1;
    case 0x17:
    case 0x18:
    case 0x19:
    case 0x1a:
    case 0x1b:
    case 0x1e:
    case 0x1f:
    case 0x21:
    case 0x22:
    case 0x23:
    case 0x24:
    case 0x26:
    case 0x27:
    case 0x28:
    case 0x29:
    case 0x2a:
    case 0x2b:
                    /* Unresolved local var: _Unwind_Word first@[???]
                       Unresolved local var: _Unwind_Word second@[???] */
      if ((int)uVar9 < 2) goto switchD_089d7918_caseD_1;
      uVar10 = uVar9 - 2;
      uVar6 = local_11c[uVar9 - 1];
      uVar9 = local_11c[uVar9 - 2];
      switch(uVar8 - 0x1a & 0xff) {
      case 0:
        puVar5 = (ushort *)(uVar9 & uVar6);
        break;
      case 1:
        puVar5 = (ushort *)((int)uVar9 / (int)uVar6);
        if (uVar6 == 0) {
          trap(7);
        }
        break;
      case 2:
        puVar5 = (ushort *)(uVar9 - uVar6);
        break;
      case 3:
        puVar5 = (ushort *)((int)uVar9 % (int)uVar6);
        if (uVar6 == 0) {
          trap(7);
        }
        break;
      case 4:
        puVar5 = (ushort *)(uVar9 * uVar6);
        break;
      default:
        goto switchD_089d7918_caseD_1;
      case 7:
        puVar5 = (ushort *)(uVar9 | uVar6);
        break;
      case 8:
        puVar5 = (ushort *)(uVar9 + uVar6);
        break;
      case 10:
        puVar5 = (ushort *)(uVar9 << (uVar6 & 0x1f));
        break;
      case 0xb:
        puVar5 = (ushort *)(uVar9 >> (uVar6 & 0x1f));
        break;
      case 0xc:
        puVar5 = (ushort *)((int)uVar9 >> (uVar6 & 0x1f));
        break;
      case 0xd:
        puVar5 = (ushort *)(uVar9 ^ uVar6);
        break;
      case 0xf:
        puVar5 = (ushort *)(uint)(uVar9 == uVar6);
        break;
      case 0x10:
        puVar5 = (ushort *)((int)uVar6 < (int)uVar9 ^ 1);
        break;
      case 0x11:
        puVar5 = (ushort *)(uint)((int)uVar9 < (int)uVar6);
        break;
      case 0x12:
        puVar5 = (ushort *)((int)uVar9 < (int)uVar6 ^ 1);
        break;
      case 0x13:
        puVar5 = (ushort *)(uint)((int)uVar6 < (int)uVar9);
        break;
      case 0x14:
        puVar5 = (ushort *)(uint)(uVar9 != uVar6);
      }
      break;
    case 0x25:
      if (uVar9 != 0) {
                    /* Unresolved local var: unaligned * up@[???] */
        uVar10 = uVar9 - 1;
        uVar2 = *p_00;
        iVar3 = uVar9 - 1;
        local_124 = (int)(short)uVar2;
        p_00 = (ushort *)((int)op_ptr + 3);
        uVar9 = uVar10;
        if (local_11c[iVar3] != 0) {
          p_00 = (ushort *)((int)p_00 + (int)(short)uVar2);
        }
        goto switchD_089d7918_caseD_93;
      }
      goto switchD_089d7918_caseD_1;
    case 0x2c:
                    /* Unresolved local var: unaligned * up@[???] */
      uVar2 = *p_00;
      p_00 = (ushort *)((int)op_ptr + (int)(short)uVar2 + 3U);
      local_124 = (int)(short)uVar2;
      goto switchD_089d7918_caseD_93;
    case 0x2d:
    case 0x2e:
    case 0x2f:
    case 0x30:
    case 0x31:
    case 0x32:
    case 0x33:
    case 0x34:
    case 0x35:
    case 0x36:
    case 0x37:
    case 0x38:
    case 0x39:
    case 0x3a:
    case 0x3b:
    case 0x3c:
    case 0x3d:
    case 0x3e:
    case 0x3f:
    case 0x40:
    case 0x41:
    case 0x42:
    case 0x43:
    case 0x44:
    case 0x45:
    case 0x46:
    case 0x47:
    case 0x48:
    case 0x49:
    case 0x4a:
    case 0x4b:
    case 0x4c:
      puVar5 = (ushort *)(uVar8 - 0x30);
      break;
    case 0x4d:
    case 0x4e:
    case 0x4f:
    case 0x50:
    case 0x51:
    case 0x52:
    case 0x53:
    case 0x54:
    case 0x55:
    case 0x56:
    case 0x57:
    case 0x58:
    case 0x59:
    case 0x5a:
    case 0x5b:
    case 0x5c:
    case 0x5d:
    case 0x5e:
    case 0x5f:
    case 0x60:
    case 0x61:
    case 0x62:
    case 99:
    case 100:
    case 0x65:
    case 0x66:
    case 0x67:
    case 0x68:
    case 0x69:
    case 0x6a:
    case 0x6b:
    case 0x6c:
      _Var4 = uVar8 - 0x50;
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[DW_OP_reg3(v1)] */
      if (0xbc < (int)_Var4) {
                    /* WARNING: Subroutine does not return */
        abort();
      }
      goto LAB_089d7c50;
    case 0x6d:
    case 0x6e:
    case 0x6f:
    case 0x70:
    case 0x71:
    case 0x72:
    case 0x73:
    case 0x74:
    case 0x75:
    case 0x76:
    case 0x77:
    case 0x78:
    case 0x79:
    case 0x7a:
    case 0x7b:
    case 0x7c:
    case 0x7d:
    case 0x7e:
    case 0x7f:
    case 0x80:
    case 0x81:
    case 0x82:
    case 0x83:
    case 0x84:
    case 0x85:
    case 0x86:
    case 0x87:
    case 0x88:
    case 0x89:
    case 0x8a:
    case 0x8b:
    case 0x8c:
      p_00 = (ushort *)read_sleb128((uchar *)p_00,(_Unwind_Sword *)&local_124);
      _Var4 = uVar8 - 0x70;
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[DW_OP_reg3(v1)] */
      if ((int)_Var4 < 0xbd) goto LAB_089d7b68;
      goto switchD_089d7918_caseD_1;
    case 0x8d:
      p_00 = (ushort *)read_uleb128((uchar *)p_00,&local_12c);
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
      _Var4 = local_12c;
      if (0xbc < (int)local_12c) goto switchD_089d7918_caseD_1;
LAB_089d7c50:
      if (dwarf_reg_size_table[_Var4] != '\x04') goto switchD_089d7918_caseD_1;
      puVar5 = *(ushort **)context->reg[_Var4];
      break;
    case 0x8f:
      p = read_uleb128((uchar *)p_00,&local_12c);
      p_00 = (ushort *)read_sleb128(p,(_Unwind_Sword *)&local_124);
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
      _Var4 = local_12c;
      if (0xbc < (int)local_12c) goto switchD_089d7918_caseD_1;
LAB_089d7b68:
      if (dwarf_reg_size_table[_Var4] != '\x04') goto switchD_089d7918_caseD_1;
      puVar5 = (ushort *)(local_124 + *(int *)context->reg[_Var4]);
      break;
    case 0x93:
      goto switchD_089d7918_caseD_93;
    }
    local_130 = puVar5;
    if (0x3f < uVar10) goto switchD_089d7918_caseD_1;
    local_11c[uVar10] = (_Unwind_Word)local_130;
    uVar9 = uVar10 + 1;
switchD_089d7918_caseD_93:
    if (op_end <= p_00) {
      iVar3 = uVar9 - 1;
      if (uVar9 != 0) goto LAB_089d7988;
      goto switchD_089d7918_caseD_1;
    }
    bVar1 = (byte)*p_00;
    op_ptr = (uchar *)p_00;
  } while( true );
}



----------------------------------------

// Function: uw_update_context_1 @ 089d7ea8

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

void uw_update_context_1(_Unwind_Context *context,_Unwind_FrameState *fs)

{
  anon_struct_8_2_43e422f5 *paVar1;
  void **ppvVar2;
  uchar *puVar3;
  void *pvVar4;
  anon_enum_32 aVar5;
  _Unwind_Word _Var6;
  void *pvVar7;
  void *pvVar8;
  _Unwind_Context *p_Var9;
  _Unwind_Context *p_Var10;
  anon_enum_32 *paVar11;
  int iVar12;
  void *local_340;
  _Unwind_Word local_33c;
  _Unwind_Context local_338;
  
                    /* Unresolved local var: _Unwind_Context orig_context@[???]
                       Unresolved local var: void * cfa@[???]
                       Unresolved local var: long i@[???]
                       Unresolved local var: _Unwind_SpTmp tmp_sp@[???] */
  p_Var9 = context;
  p_Var10 = &local_338;
  do {
    ppvVar2 = p_Var9->reg;
    pvVar4 = p_Var9->reg[1];
    pvVar7 = p_Var9->reg[2];
    pvVar8 = p_Var9->reg[3];
    p_Var9 = (_Unwind_Context *)(p_Var9->reg + 4);
    p_Var10->reg[0] = *ppvVar2;
    p_Var10->reg[1] = pvVar4;
    p_Var10->reg[2] = pvVar7;
    p_Var10->reg[3] = pvVar8;
    p_Var10 = (_Unwind_Context *)(p_Var10->reg + 4);
  } while (p_Var9 != context + 1);
  if (local_338.reg[0x1d] == (undefined1 *)0x0) {
                    /* Unresolved local var: int size@[???] */
    if (dwarf_reg_size_table[0x1d] != '\x04') goto LAB_089d7f40;
    local_338.reg[0x1d] = &local_340;
    local_340 = context->cfa;
  }
  aVar5 = fs->cfa_how;
  context->reg[0x1d] = (void *)0x0;
  if (aVar5 == CFA_REG_OFFSET) {
    _Var6 = fs->cfa_reg;
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
    if ((0xbc < (int)_Var6) || (dwarf_reg_size_table[_Var6] != '\x04')) goto LAB_089d7f40;
    pvVar4 = (void *)(*(int *)local_338.reg[_Var6] + fs->cfa_offset);
  }
  else {
    if (aVar5 != CFA_EXP) {
LAB_089d7f40:
                    /* WARNING: Subroutine does not return */
      abort();
    }
                    /* Unresolved local var: uchar * exp@[???]
                       Unresolved local var: _Unwind_Word len@[???] */
    puVar3 = read_uleb128(fs->cfa_exp,&local_33c);
    pvVar4 = (void *)execute_stack_op(puVar3,puVar3 + local_33c,&local_338,0);
  }
  paVar11 = &(fs->regs).reg[0].how;
  iVar12 = 0;
  context->cfa = pvVar4;
  do {
    while (aVar5 = *paVar11, aVar5 == CFA_EXP) {
      paVar1 = (anon_struct_8_2_43e422f5 *)(paVar11 + -1);
      iVar12 = iVar12 + 1;
      paVar11 = paVar11 + 2;
      context->reg[0] = local_338.reg[(paVar1->loc).reg];
      context = (_Unwind_Context *)(context->reg + 1);
      if (iVar12 == 0xbd) {
        return;
      }
    }
    if (aVar5 == REG_SAVED_EXP) {
                    /* Unresolved local var: uchar * exp@[???]
                       Unresolved local var: _Unwind_Word len@[???]
                       Unresolved local var: _Unwind_Ptr val@[???] */
      puVar3 = read_uleb128((((anon_struct_8_2_43e422f5 *)(paVar11 + -1))->loc).exp,&local_33c);
      pvVar7 = (void *)execute_stack_op(puVar3,puVar3 + local_33c,&local_338,(_Unwind_Word)pvVar4);
      context->reg[0] = pvVar7;
    }
    else if (aVar5 == CFA_REG_OFFSET) {
      context->reg[0] =
           (uchar *)((int)pvVar4 + (int)(((anon_struct_8_2_43e422f5 *)(paVar11 + -1))->loc).exp);
    }
    iVar12 = iVar12 + 1;
    paVar11 = paVar11 + 2;
    context = (_Unwind_Context *)(context->reg + 1);
  } while (iVar12 != 0xbd);
  return;
}



----------------------------------------

// Function: uw_init_context_1 @ 089d809c

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

void uw_init_context_1(_Unwind_Context *context,void *outer_cfa,void *outer_ra)

{
  _Unwind_Reason_Code _Var1;
  uint unaff_retaddr;
  void *local_640;
  _Unwind_FrameState _Stack_63c;
  
                    /* Unresolved local var: void * ra@[???]
                       Unresolved local var: _Unwind_FrameState fs@[???]
                       Unresolved local var: _Unwind_SpTmp sp_slot@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  memset(context,0,0x310);
  context->ra = (void *)(unaff_retaddr & 0xfffffffe);
  _Var1 = uw_frame_state_for(context,&_Stack_63c);
  if (_Var1 == _URC_NO_REASON) {
    if (dwarf_reg_size_table[0] == '\0') {
      builtin_memcpy(dwarf_reg_size_table,
                     "\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04"
                     ,0xbc);
    }
                    /* Unresolved local var: int size@[???] */
    if (dwarf_reg_size_table[0x1d] == '\x04') {
      context->reg[0x1d] = &local_640;
      _Stack_63c.cfa_how = CFA_REG_OFFSET;
      _Stack_63c.cfa_reg = 0x1d;
      _Stack_63c.cfa_offset = 0;
      local_640 = outer_cfa;
      uw_update_context_1(context,&_Stack_63c);
      context->ra = (void *)((uint)outer_ra & 0xfffffffe);
      return;
    }
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: uw_install_context_1 @ 089d8750

long uw_install_context_1(_Unwind_Context *current,_Unwind_Context *target)

{
  void *pvVar1;
  void *src0;
  int iVar2;
  uchar *puVar3;
  void *local_28 [2];
  
                    /* Unresolved local var: long i@[???]
                       Unresolved local var: _Unwind_SpTmp sp_slot@[???] */
  if (target->reg[0x1d] == (void *)0x0) {
    pvVar1 = target->cfa;
    if (dwarf_reg_size_table[0x1d] != '\x04') goto LAB_089d8868;
    target->reg[0x1d] = local_28;
    local_28[0] = pvVar1;
  }
                    /* Unresolved local var: int size@[???] */
  iVar2 = 0;
  puVar3 = dwarf_reg_size_table;
  do {
                    /* Unresolved local var: void * c@[???]
                       Unresolved local var: void * t@[???] */
    src0 = *(void **)((int)target->reg + iVar2);
    pvVar1 = *(void **)((int)current->reg + iVar2);
    if (((src0 != (void *)0x0) && (pvVar1 != (void *)0x0)) && (pvVar1 != src0)) {
      memcpy(pvVar1,src0,(uint)*puVar3);
    }
    iVar2 = iVar2 + 4;
    puVar3 = puVar3 + 1;
  } while (iVar2 != 0x2f0);
  if (current->reg[0x1d] != (void *)0x0) {
                    /* Unresolved local var: void * target_cfa@[???]
                       Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
    return 0;
  }
  if (dwarf_reg_size_table[0x1d] == '\x04') {
    return (*(int *)target->reg[0x1d] - (int)current->cfa) + target->args_size;
  }
LAB_089d8868:
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: uw_update_context @ 089d8870

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

void uw_update_context(_Unwind_Context *context,_Unwind_FrameState *fs)

{
  void *pvVar1;
  _Unwind_Word _Var2;
  uint *puVar3;
  
  uw_update_context_1(context,fs);
  _Var2 = fs->retaddr_column;
                    /* Unresolved local var: int size@[???]
                       Unresolved local var: void * ptr@[???] */
  if (((int)_Var2 < 0xbd) && (puVar3 = context->reg[_Var2], dwarf_reg_size_table[_Var2] == '\x04'))
  {
    pvVar1 = (void *)(*puVar3 & 0xfffffffe);
    context->ra = pvVar1;
    *puVar3 = (uint)pvVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: _Unwind_Backtrace @ 089d88ec

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn trace,void *trace_argument)

{
  _Unwind_Reason_Code _Var1;
  void *unaff_retaddr;
  undefined1 auStackX_0 [16];
  _Unwind_Context _Stack_990;
  _Unwind_FrameState _Stack_680;
  _Unwind_Reason_Code local_68;
  _Unwind_Trace_Fn local_64;
  void *local_60;
  
                    /* Unresolved local var: _Unwind_Context context@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  local_64 = trace;
  local_60 = trace_argument;
  uw_init_context_1(&_Stack_990,auStackX_0,unaff_retaddr);
  while( true ) {
    local_68 = uw_frame_state_for(&_Stack_990,&_Stack_680);
    if ((local_68 != _URC_NO_REASON) && (local_68 != _URC_END_OF_STACK)) {
      return _URC_FATAL_PHASE1_ERROR;
    }
    _Var1 = (*local_64)(&_Stack_990,local_60);
    if (_Var1 != _URC_NO_REASON) {
      return _URC_FATAL_PHASE1_ERROR;
    }
                    /* Unresolved local var: _Unwind_FrameState fs@[???] */
    if (local_68 == _URC_END_OF_STACK) break;
    uw_update_context(&_Stack_990,&_Stack_680);
  }
  return _URC_END_OF_STACK;
}



----------------------------------------

// Function: _Unwind_RaiseException_Phase2 @ 089d8a2c

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

_Unwind_Reason_Code
_Unwind_RaiseException_Phase2(_Unwind_Exception_conflict9 *exc,_Unwind_Context *context)

{
  _Unwind_Reason_Code _Var1;
  uint uVar2;
  anon_union_4_3_890eaea0_for_loc in_stack_fffff9e0;
  _Unwind_Context *in_stack_fffff9e4;
  _Unwind_Personality_Fn local_30;
  
                    /* Unresolved local var: _Unwind_Reason_Code code@[???] */
                    /* Unresolved local var: _Unwind_FrameState fs@[???]
                       Unresolved local var: int match_handler@[???] */
  _Var1 = uw_frame_state_for(context,(_Unwind_FrameState *)&stack0xfffff9d0);
  uVar2 = 4;
  if (context->ra != (void *)exc->private_2) {
    uVar2 = 0;
  }
  do {
    if (_Var1 != _URC_NO_REASON) {
      return _URC_FATAL_PHASE2_ERROR;
    }
    if (local_30 != (_Unwind_Personality_Fn)0x0) {
      _Var1 = (*local_30)(1,uVar2 | 2,exc->exception_class,
                          (_Unwind_Exception_conflict9 *)in_stack_fffff9e0.exp,in_stack_fffff9e4);
      if (_Var1 == _URC_INSTALL_CONTEXT) {
        return _URC_INSTALL_CONTEXT;
      }
      if (_Var1 != _URC_CONTINUE_UNWIND) {
        return _URC_FATAL_PHASE2_ERROR;
      }
    }
    if (uVar2 != 0) {
                    /* WARNING: Subroutine does not return */
      abort();
    }
    uw_update_context(context,(_Unwind_FrameState *)&stack0xfffff9d0);
    _Var1 = uw_frame_state_for(context,(_Unwind_FrameState *)&stack0xfffff9d0);
    uVar2 = 4;
    if (context->ra != (void *)exc->private_2) {
      uVar2 = 0;
    }
  } while( true );
}



----------------------------------------

// Function: _Unwind_RaiseException @ 089d8b10

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception_conflict9 *exc)

{
  void **ppvVar1;
  _Unwind_Reason_Code _Var2;
  undefined1 *puVar3;
  void *pvVar4;
  void *pvVar5;
  void **ppvVar6;
  void *pvVar7;
  _Unwind_Context *p_Var8;
  _Unwind_Context *p_Var9;
  _Unwind_Context *p_Var10;
  void *unaff_retaddr;
  undefined1 auStackX_0 [16];
  void *local_ca8 [4];
  _Unwind_Exception_conflict9 *in_stack_fffff368;
  _Unwind_Context *in_stack_fffff36c;
  _Unwind_Context local_998;
  _Unwind_FrameState _Stack_688;
  _Unwind_Exception_conflict9 *local_70;
  _Unwind_Exception_conflict9 *local_68;
  
                    /* Unresolved local var: _Unwind_Context this_context@[???]
                       Unresolved local var: _Unwind_Context cur_context@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  p_Var8 = (_Unwind_Context *)local_ca8;
  p_Var9 = (_Unwind_Context *)local_ca8;
  ppvVar6 = local_ca8;
  local_70 = exc;
  local_68 = exc;
  uw_init_context_1((_Unwind_Context *)local_ca8,auStackX_0,unaff_retaddr);
  p_Var10 = &local_998;
  do {
    ppvVar1 = p_Var8->reg;
    pvVar4 = p_Var8->reg[1];
    pvVar5 = p_Var8->reg[2];
    pvVar7 = p_Var8->reg[3];
    p_Var8 = (_Unwind_Context *)(p_Var8->reg + 4);
    p_Var10->reg[0] = *ppvVar1;
    p_Var10->reg[1] = pvVar4;
    p_Var10->reg[2] = pvVar5;
    p_Var10->reg[3] = pvVar7;
    p_Var10 = (_Unwind_Context *)(p_Var10->reg + 4);
  } while (p_Var8 != &local_998);
                    /* Unresolved local var: _Unwind_FrameState fs@[???] */
  _Var2 = uw_frame_state_for(&local_998,&_Stack_688);
  do {
    if (_Var2 == _URC_END_OF_STACK) {
      return _URC_END_OF_STACK;
    }
    if (_Var2 != _URC_NO_REASON) {
      return _URC_FATAL_PHASE1_ERROR;
    }
    if (_Stack_688.personality != (_Unwind_Personality_Fn)0x0) {
      _Var2 = (*_Stack_688.personality)
                        (1,1,local_70->exception_class,in_stack_fffff368,in_stack_fffff36c);
      if (_Var2 == _URC_HANDLER_FOUND) {
        local_70->private_1 = 0;
        local_70->private_2 = (_Unwind_Word)local_998.ra;
        p_Var10 = &local_998;
        do {
          ppvVar1 = p_Var9->reg;
          pvVar4 = p_Var9->reg[1];
          pvVar5 = p_Var9->reg[2];
          pvVar7 = p_Var9->reg[3];
          p_Var9 = (_Unwind_Context *)(p_Var9->reg + 4);
          p_Var10->reg[0] = *ppvVar1;
          p_Var10->reg[1] = pvVar4;
          p_Var10->reg[2] = pvVar5;
          p_Var10->reg[3] = pvVar7;
          p_Var10 = (_Unwind_Context *)(p_Var10->reg + 4);
        } while (p_Var9 != &local_998);
        puVar3 = (undefined1 *)_Unwind_RaiseException_Phase2(local_70,&local_998);
        if (puVar3 == (undefined1 *)0x7) {
          uw_install_context_1((_Unwind_Context *)local_ca8,&local_998);
          puVar3 = (undefined1 *)ppvVar6;
        }
        return (_Unwind_Reason_Code)puVar3;
      }
      if (_Var2 != _URC_CONTINUE_UNWIND) {
        return _URC_FATAL_PHASE1_ERROR;
      }
    }
    uw_update_context(&local_998,&_Stack_688);
    _Var2 = uw_frame_state_for(&local_998,&_Stack_688);
  } while( true );
}



----------------------------------------

// Function: _Unwind_ForcedUnwind_Phase2 @ 089d8d5c

/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

_Unwind_Reason_Code
_Unwind_ForcedUnwind_Phase2(_Unwind_Exception_conflict9 *exc,_Unwind_Context *context)

{
  _Unwind_Reason_Code _Var1;
  int iVar2;
  undefined4 uVar3;
  code *pcVar4;
  anon_union_4_3_890eaea0_for_loc in_stack_fffff9d0;
  _Unwind_Context *in_stack_fffff9d4;
  _Unwind_Personality_Fn local_40;
  
                    /* Unresolved local var: _Unwind_Stop_Fn stop@[???]
                       Unresolved local var: void * stop_argument@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???]
                       Unresolved local var: _Unwind_Reason_Code stop_code@[???] */
  pcVar4 = (code *)exc->private_1;
  do {
    _Var1 = uw_frame_state_for(context,(_Unwind_FrameState *)&stack0xfffff9c0);
    uVar3 = 10;
    if (_Var1 != _URC_NO_REASON) {
      if (_Var1 != _URC_END_OF_STACK) {
        return _URC_FATAL_PHASE2_ERROR;
      }
      uVar3 = 0x1a;
    }
    iVar2 = (*pcVar4)(1,uVar3,(int)exc->exception_class,
                      *(undefined4 *)((int)&exc->exception_class + 4));
    if (iVar2 != 0) {
      return _URC_FATAL_PHASE2_ERROR;
    }
                    /* Unresolved local var: _Unwind_FrameState fs@[???]
                       Unresolved local var: int action@[???] */
    if (_Var1 == _URC_END_OF_STACK) {
      return _URC_END_OF_STACK;
    }
    if (local_40 != (_Unwind_Personality_Fn)0x0) {
      _Var1 = (*local_40)(1,10,exc->exception_class,
                          (_Unwind_Exception_conflict9 *)in_stack_fffff9d0.exp,in_stack_fffff9d4);
      if (_Var1 == _URC_INSTALL_CONTEXT) {
        return _URC_INSTALL_CONTEXT;
      }
      if (_Var1 != _URC_CONTINUE_UNWIND) {
        return _URC_FATAL_PHASE2_ERROR;
      }
    }
    uw_update_context(context,(_Unwind_FrameState *)&stack0xfffff9c0);
  } while( true );
}



----------------------------------------

// Function: _Unwind_Resume_or_Rethrow @ 089d8e64

_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception_conflict9 *exc)

{
  void **ppvVar1;
  _Unwind_Context *p_Var2;
  _Unwind_Reason_Code _Var3;
  void *pvVar4;
  void *pvVar5;
  void *pvVar6;
  _Unwind_Context *p_Var7;
  _Unwind_Context *p_Var8;
  void *unaff_retaddr;
  undefined1 auStackX_0 [16];
  _Unwind_Context local_690;
  _Unwind_Context local_380;
  _Unwind_Exception_conflict9 *local_70;
  _Unwind_Exception_conflict9 *local_68;
  
                    /* Unresolved local var: _Unwind_Context this_context@[???]
                       Unresolved local var: _Unwind_Context cur_context@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  p_Var7 = &local_690;
  p_Var2 = &local_690;
  local_70 = exc;
  local_68 = exc;
  if (exc->private_1 == 0) {
    p_Var2 = (_Unwind_Context *)_Unwind_RaiseException(exc);
  }
  else {
    uw_init_context_1(&local_690,auStackX_0,unaff_retaddr);
    p_Var8 = &local_380;
    do {
      ppvVar1 = p_Var7->reg;
      pvVar4 = p_Var7->reg[1];
      pvVar5 = p_Var7->reg[2];
      pvVar6 = p_Var7->reg[3];
      p_Var7 = (_Unwind_Context *)(p_Var7->reg + 4);
      p_Var8->reg[0] = *ppvVar1;
      p_Var8->reg[1] = pvVar4;
      p_Var8->reg[2] = pvVar5;
      p_Var8->reg[3] = pvVar6;
      p_Var8 = (_Unwind_Context *)(p_Var8->reg + 4);
    } while (p_Var7 != &local_380);
    _Var3 = _Unwind_ForcedUnwind_Phase2(local_70,&local_380);
    if (_Var3 != _URC_INSTALL_CONTEXT) {
                    /* WARNING: Subroutine does not return */
      abort();
    }
                    /* Unresolved local var: long offset@[???]
                       Unresolved local var: void * handler@[???] */
    uw_install_context_1(&local_690,&local_380);
  }
  return (_Unwind_Reason_Code)(undefined1 *)p_Var2;
}



----------------------------------------

// Function: _Unwind_Resume @ 089d8fe4

/* DWARF original prototype: void _Unwind_Resume(_Unwind_Exception.conflict9 * exc) */

void _Unwind_Resume(_Unwind_Exception_conflict9 *exc)

{
  void **ppvVar1;
  _Unwind_Reason_Code _Var2;
  void *pvVar3;
  void *pvVar4;
  void *pvVar5;
  _Unwind_Context *p_Var6;
  _Unwind_Context *p_Var7;
  void *unaff_retaddr;
  undefined1 auStackX_0 [16];
  _Unwind_Context local_690;
  _Unwind_Context local_380;
  _Unwind_Exception_conflict9 *local_70;
  _Unwind_Exception_conflict9 *local_68;
  
                    /* Unresolved local var: _Unwind_Context this_context@[???]
                       Unresolved local var: _Unwind_Context cur_context@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  p_Var6 = &local_690;
  local_70 = exc;
  local_68 = exc;
  uw_init_context_1(&local_690,auStackX_0,unaff_retaddr);
  p_Var7 = &local_380;
  do {
    ppvVar1 = p_Var6->reg;
    pvVar3 = p_Var6->reg[1];
    pvVar4 = p_Var6->reg[2];
    pvVar5 = p_Var6->reg[3];
    p_Var6 = (_Unwind_Context *)(p_Var6->reg + 4);
    p_Var7->reg[0] = *ppvVar1;
    p_Var7->reg[1] = pvVar3;
    p_Var7->reg[2] = pvVar4;
    p_Var7->reg[3] = pvVar5;
    p_Var7 = (_Unwind_Context *)(p_Var7->reg + 4);
  } while (p_Var6 != &local_380);
  if (local_70->private_1 == 0) {
    _Var2 = _Unwind_RaiseException_Phase2(local_70,&local_380);
  }
  else {
    _Var2 = _Unwind_ForcedUnwind_Phase2(local_70,&local_380);
  }
  if (_Var2 != _URC_INSTALL_CONTEXT) {
                    /* WARNING: Subroutine does not return */
    abort();
  }
                    /* Unresolved local var: long offset@[???]
                       Unresolved local var: void * handler@[DW_OP_reg2(v0)] */
  uw_install_context_1(&local_690,&local_380);
  return;
}



----------------------------------------

// Function: _Unwind_ForcedUnwind @ 089d9168

_Unwind_Reason_Code
_Unwind_ForcedUnwind(_Unwind_Exception_conflict9 *exc,_Unwind_Stop_Fn stop,void *stop_argument)

{
  void **ppvVar1;
  undefined1 *puVar2;
  void *pvVar3;
  void *pvVar4;
  _Unwind_Context *p_Var5;
  void *pvVar6;
  _Unwind_Context *p_Var7;
  _Unwind_Context *p_Var8;
  void *unaff_retaddr;
  undefined1 auStackX_0 [16];
  _Unwind_Context local_698;
  _Unwind_Context local_388;
  _Unwind_Exception_conflict9 *local_78;
  _Unwind_Stop_Fn local_74;
  void *local_70;
  _Unwind_Exception_conflict9 *local_68;
  _Unwind_Stop_Fn local_64;
  void *local_60;
  
                    /* Unresolved local var: _Unwind_Context this_context@[???]
                       Unresolved local var: _Unwind_Context cur_context@[???]
                       Unresolved local var: _Unwind_Reason_Code code@[???] */
  p_Var7 = &local_698;
  p_Var5 = &local_698;
  local_78 = exc;
  local_74 = stop;
  local_70 = stop_argument;
  local_68 = exc;
  local_64 = stop;
  local_60 = stop_argument;
  uw_init_context_1(&local_698,auStackX_0,unaff_retaddr);
  p_Var8 = &local_388;
  do {
    ppvVar1 = p_Var7->reg;
    pvVar3 = p_Var7->reg[1];
    pvVar4 = p_Var7->reg[2];
    pvVar6 = p_Var7->reg[3];
    p_Var7 = (_Unwind_Context *)(p_Var7->reg + 4);
    p_Var8->reg[0] = *ppvVar1;
    p_Var8->reg[1] = pvVar3;
    p_Var8->reg[2] = pvVar4;
    p_Var8->reg[3] = pvVar6;
    p_Var8 = (_Unwind_Context *)(p_Var8->reg + 4);
  } while (p_Var7 != &local_388);
  local_78->private_1 = (_Unwind_Word)local_74;
  local_78->private_2 = (_Unwind_Word)local_70;
  puVar2 = (undefined1 *)_Unwind_ForcedUnwind_Phase2(local_78,&local_388);
  if (puVar2 == (undefined1 *)0x7) {
                    /* Unresolved local var: long offset@[???]
                       Unresolved local var: void * handler@[???] */
    uw_install_context_1(&local_698,&local_388);
    puVar2 = (undefined1 *)p_Var5;
  }
  return (_Unwind_Reason_Code)puVar2;
}



----------------------------------------

// Function: read_uleb128 @ 089d92f0

uchar * read_uleb128(uchar *p,_Unwind_Word *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg6(a2)]
                       Unresolved local var: uchar byte@[DW_OP_reg3(v1)]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg7(a3)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: read_sleb128 @ 089d9324

uchar * read_sleb128(uchar *p,_Unwind_Sword *val)

{
  byte bVar1;
  uint uVar2;
  uint uVar3;
  
                    /* Unresolved local var: uint shift@[DW_OP_reg7(a3)]
                       Unresolved local var: uchar byte@[???]
                       Unresolved local var: _Unwind_Word result@[DW_OP_reg8(t0)] */
  uVar2 = 0;
  uVar3 = 0;
  do {
    bVar1 = *p;
    p = p + 1;
    uVar3 = uVar3 | (bVar1 & 0x7f) << (uVar2 & 0x1f);
    uVar2 = uVar2 + 7;
  } while ((char)bVar1 < '\0');
  if ((uVar2 < 0x20) && ((bVar1 & 0x40) != 0)) {
    uVar3 = uVar3 | -1 << (uVar2 & 0x1f);
  }
  *val = uVar3;
  return p;
}



----------------------------------------

// Function: __register_frame_info_table_bases @ 089d937c

void __register_frame_info_table_bases(void *begin,object *ob,void *tbase,void *dbase)

{
  (ob->s).i = 0x7fa;
  (ob->u).single = begin;
  ob->next = unseen_objects;
  ob->pc_begin = (void *)0xffffffff;
  unseen_objects = ob;
  ob->tbase = tbase;
  ob->dbase = dbase;
  return;
}



----------------------------------------

// Function: __register_frame_info_table @ 089d93ac

void __register_frame_info_table(void *begin,object *ob)

{
  __register_frame_info_table_bases(begin,ob,(void *)0x0,(void *)0x0);
  return;
}



----------------------------------------

// Function: fde_unencoded_compare @ 089d93b8

int fde_unencoded_compare(object *ob,fde *x,fde *y)

{
  int iVar1;
  
                    /* Unresolved local var: _Unwind_Ptr x_ptr@[???]
                       Unresolved local var: _Unwind_Ptr y_ptr@[DW_OP_reg3(v1)] */
  iVar1 = 1;
  if ((x[1].length <= y[1].length) && (iVar1 = -1, y[1].length <= x[1].length)) {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: frame_downheap @ 089d93e0

void frame_downheap(object *ob,fde_compare_t fde_compare,fde **a,int lo,int hi)

{
  int iVar1;
  int iVar2;
  fde *pfVar3;
  int in_t0;
  int iVar4;
  fde **ppfVar5;
  
  while( true ) {
    iVar1 = lo * 2 + 1;
    if (in_t0 <= iVar1) {
      return;
    }
    iVar4 = lo * 2 + 2;
    ppfVar5 = a + iVar1;
    if ((iVar4 < in_t0) && (iVar2 = (*fde_compare)(ob,*ppfVar5,ppfVar5[1]), iVar2 < 0)) {
      ppfVar5 = a + iVar4;
      iVar2 = (*fde_compare)(ob,a[lo],*ppfVar5);
    }
    else {
      iVar2 = (*fde_compare)(ob,a[lo],*ppfVar5);
      iVar4 = iVar1;
    }
    if (-1 < iVar2) break;
                    /* Unresolved local var: fde * tmp@[???] */
    pfVar3 = a[lo];
    a[lo] = *ppfVar5;
    *ppfVar5 = pfVar3;
    lo = iVar4;
  }
  return;
}



----------------------------------------

// Function: frame_heapsort @ 089d9504

void frame_heapsort(object *ob,fde_compare_t fde_compare,fde_vector *erratic)

{
  void *pvVar1;
  int iVar2;
  int lo;
  int iVar3;
  void **ppvVar4;
  uint uVar5;
  fde_vector *a;
  int unaff_s4;
  
                    /* Unresolved local var: fde * * a@[???]
                       Unresolved local var: size_t n@[???]
                       Unresolved local var: int m@[???] */
  uVar5 = erratic->count;
  iVar2 = (uVar5 >> 1) - 1;
  a = erratic + 1;
  if (-1 < iVar2) {
    lo = iVar2;
    do {
      iVar3 = lo + -1;
      frame_downheap(ob,fde_compare,&a->orig_data,lo,unaff_s4);
      lo = iVar3;
    } while (iVar3 != ((uVar5 >> 1) - iVar2) + -2);
  }
  if (0 < (int)(uVar5 - 1)) {
    ppvVar4 = &a->orig_data + uVar5;
    iVar2 = 0;
    do {
                    /* Unresolved local var: fde * tmp@[???] */
      pvVar1 = a->orig_data;
      a->orig_data = ppvVar4[-1];
      ppvVar4[-1] = pvVar1;
      iVar2 = iVar2 + 1;
      frame_downheap(ob,fde_compare,&a->orig_data,0,unaff_s4);
      ppvVar4 = ppvVar4 + -1;
    } while (uVar5 - 1 != iVar2);
  }
  return;
}



----------------------------------------

// Function: base_from_object @ 089d95ec

_Unwind_Ptr base_from_object(uchar encoding,object *ob)

{
  byte bVar1;
  
  if (encoding != 0xff) {
    bVar1 = encoding & 0x70;
    if (bVar1 == 0x20) {
      return (_Unwind_Ptr)ob->tbase;
    }
    if (0x20 < bVar1) {
      if (bVar1 == 0x30) {
        return (_Unwind_Ptr)ob->dbase;
      }
      if (bVar1 == 0x50) {
        return 0;
      }
                    /* WARNING: Subroutine does not return */
      abort();
    }
    if ((encoding & 0x70) != 0) {
      if (bVar1 == 0x10) {
        return 0;
      }
                    /* WARNING: Subroutine does not return */
      abort();
    }
  }
  return 0;
}



----------------------------------------

// Function: read_encoded_value_with_base @ 089d966c

uchar * read_encoded_value_with_base(uchar encoding,_Unwind_Ptr base,uchar *p,_Unwind_Ptr *val)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  uint *puVar5;
  uint local_20 [2];
  
                    /* Unresolved local var: unaligned * u@[???]
                       Unresolved local var: _Unwind_Internal_Ptr result@[???] */
  uVar3 = (uint)encoding;
  if (uVar3 == 0x50) {
                    /* Unresolved local var: _Unwind_Internal_Ptr a@[???] */
    local_20[0] = *(uint *)((uint)(p + 3) & 0xfffffffc);
    puVar5 = (uint *)((uint)(p + 3) & 0xfffffffc) + 1;
  }
  else {
    uVar4 = uVar3 & 0xf;
    if (0xc < uVar4) {
switchD_089d96c4_caseD_5:
                    /* WARNING: Subroutine does not return */
      abort();
    }
    switch(uVar4) {
    case 0:
    case 3:
    case 0xb:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 4);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089d96c4::switchdataD_089f2b98)[uVar4] &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    case 1:
                    /* Unresolved local var: _Unwind_Word tmp@[???] */
      puVar5 = (uint *)read_uleb128(p,local_20);
      break;
    case 2:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(ushort *)p;
      break;
    case 4:
    case 0xc:
      uVar1 = (uint)(p + 3) & 3;
      puVar5 = (uint *)(p + 8);
      uVar2 = (uint)p & 3;
      local_20[0] = (*(int *)(p + 3 + -uVar1) << (3 - uVar1) * 8 |
                    (uint)(&switchD_089d96c4::switchdataD_089f2b98 + uVar4) &
                    0xffffffffU >> (uVar1 + 1) * 8) & -1 << (4 - uVar2) * 8 |
                    *(uint *)(p + -uVar2) >> uVar2 * 8;
      break;
    default:
      goto switchD_089d96c4_caseD_5;
    case 9:
                    /* Unresolved local var: _Unwind_Sword tmp@[???] */
      puVar5 = (uint *)read_sleb128(p,(_Unwind_Sword *)local_20);
      break;
    case 10:
      puVar5 = (uint *)(p + 2);
      local_20[0] = (uint)*(short *)p;
    }
    if (local_20[0] != 0) {
      if ((uVar3 & 0x70) == 0x10) {
        base = (_Unwind_Ptr)p;
      }
      local_20[0] = base + local_20[0];
      if ((char)encoding < '\0') {
        local_20[0] = *(uint *)local_20[0];
      }
    }
  }
  *val = local_20[0];
  return (uchar *)puVar5;
}



----------------------------------------

// Function: fde_single_encoding_compare @ 089d97ac

int fde_single_encoding_compare(object *ob,fde *x,fde *y)

{
  _Unwind_Ptr base;
  int iVar1;
  uint local_20;
  uint local_1c;
  
                    /* Unresolved local var: _Unwind_Ptr base@[???]
                       Unresolved local var: _Unwind_Ptr x_ptr@[???]
                       Unresolved local var: _Unwind_Ptr y_ptr@[???] */
  base = base_from_object((uchar)(((ob->s).i << 0x15) >> 0x18),ob);
  read_encoded_value_with_base((uchar)(((ob->s).i << 0x15) >> 0x18),base,(uchar *)(x + 1),&local_20)
  ;
  read_encoded_value_with_base((uchar)(((ob->s).i << 0x15) >> 0x18),base,(uchar *)(y + 1),&local_1c)
  ;
  iVar1 = 1;
  if ((local_20 <= local_1c) && (iVar1 = -1, local_1c <= local_20)) {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: get_cie_encoding @ 089d9854

int get_cie_encoding(dwarf_cie *cie)

{
  byte bVar1;
  size_t sVar2;
  uchar *puVar3;
  uchar *p;
  byte *pbVar4;
  char cVar5;
  char *pcVar6;
  _Unwind_Ptr _Stack_20;
  _Unwind_Word _Stack_1c;
  _Unwind_Sword a_Stack_18 [2];
  
                    /* Unresolved local var: uchar * aug@[???]
                       Unresolved local var: uchar * p@[???]
                       Unresolved local var: _Unwind_Ptr dummy@[???]
                       Unresolved local var: _Unwind_Word utmp@[???]
                       Unresolved local var: _Unwind_Sword stmp@[???] */
  if (cie->field_0x9 != 'z') {
    return 0;
  }
  sVar2 = strlen(&cie->field_0x9);
  puVar3 = read_uleb128(&cie->field_0x9 + sVar2 + 1,&_Stack_1c);
  puVar3 = read_sleb128(puVar3,a_Stack_18);
  p = puVar3 + 1;
  if (cie->version != '\x01') {
    p = read_uleb128(puVar3,&_Stack_1c);
  }
  pbVar4 = read_uleb128(p,&_Stack_1c);
  cVar5 = cie->field_0xa;
  pcVar6 = &cie->field_0xa;
  if (cVar5 == 'R') {
    bVar1 = *pbVar4;
  }
  else {
    do {
      while (cVar5 == 'P') {
        pcVar6 = pcVar6 + 1;
        pbVar4 = read_encoded_value_with_base(*pbVar4 & 0x7f,0,pbVar4 + 1,&_Stack_20);
        cVar5 = *pcVar6;
        if (cVar5 == 'R') goto LAB_089d9958;
      }
      pcVar6 = pcVar6 + 1;
      if (cVar5 != 'L') {
        return 0;
      }
      cVar5 = *pcVar6;
      pbVar4 = pbVar4 + 1;
    } while (cVar5 != 'R');
LAB_089d9958:
    bVar1 = *pbVar4;
  }
  return (uint)bVar1;
}



----------------------------------------

// Function: size_of_encoded_value @ 089d9974

uint size_of_encoded_value(uchar encoding)

{
  uint uVar1;
  byte bVar2;
  
  if (encoding == 0xff) {
    uVar1 = 0;
  }
  else {
    bVar2 = encoding & 7;
    if (bVar2 == 2) {
      return 2;
    }
    if (bVar2 < 3) {
      if ((encoding & 7) != 0) goto LAB_089d99b0;
    }
    else if (bVar2 != 3) {
      if (bVar2 == 4) {
        return 8;
      }
LAB_089d99b0:
                    /* WARNING: Subroutine does not return */
      abort();
    }
    uVar1 = 4;
  }
  return uVar1;
}



----------------------------------------

// Function: __register_frame_table @ 089d99e8

void __register_frame_table(void *begin)

{
  object *ob;
  
                    /* Unresolved local var: object * ob@[???] */
  ob = malloc(0x18);
  __register_frame_info_table(begin,ob);
  return;
}



----------------------------------------

// Function: __register_frame_info_bases @ 089d9a18

void __register_frame_info_bases(void *begin,object *ob,void *tbase,void *dbase)

{
  if ((begin != (void *)0x0) && (*(int *)begin != 0)) {
    (ob->u).single = begin;
    (ob->s).i = 0x7f8;
    ob->next = unseen_objects;
    ob->pc_begin = (void *)0xffffffff;
    unseen_objects = ob;
    ob->tbase = tbase;
    ob->dbase = dbase;
  }
  return;
}



----------------------------------------

// Function: __register_frame_info @ 089d9a5c

void __register_frame_info(void *begin,object *ob)

{
  __register_frame_info_bases(begin,ob,(void *)0x0,(void *)0x0);
  return;
}



----------------------------------------

// Function: __register_frame @ 089d9a68

void __register_frame(void *begin)

{
  object *ob;
  
                    /* Unresolved local var: object * ob@[???] */
  if (*(int *)begin == 0) {
    return;
  }
  ob = malloc(0x18);
  __register_frame_info(begin,ob);
  return;
}



----------------------------------------

// Function: __deregister_frame_info_bases @ 089d9ab4

void * __deregister_frame_info_bases(void *begin)

{
  object *poVar1;
  uint uVar2;
  object **ppoVar3;
  object *poVar4;
  
                    /* Unresolved local var: object * * p@[???]
                       Unresolved local var: object * ob@[???] */
  if ((begin == (void *)0x0) || (*(int *)begin == 0)) {
    return (void *)0x0;
  }
  if (unseen_objects != (object *)0x0) {
    poVar4 = unseen_objects;
    if (begin == (unseen_objects->u).single) {
      ppoVar3 = &unseen_objects;
      poVar1 = unseen_objects->next;
    }
    else {
      do {
        ppoVar3 = &poVar4->next;
        poVar4 = poVar4->next;
        if (poVar4 == (object *)0x0) goto LAB_089d9b38;
      } while (begin != (poVar4->u).single);
      poVar1 = poVar4->next;
    }
    *ppoVar3 = poVar1;
    return poVar4;
  }
LAB_089d9b38:
  ppoVar3 = &seen_objects;
  if (seen_objects != (object *)0x0) {
    uVar2 = (seen_objects->s).i;
    poVar4 = seen_objects;
    while( true ) {
      if ((uVar2 & 1) == 0) {
        if (begin == (poVar4->u).single) {
          *ppoVar3 = poVar4->next;
          return poVar4;
        }
      }
      else if (begin == (void *)((poVar4->u).single)->length) {
        *ppoVar3 = poVar4->next;
        free((poVar4->u).single);
        return poVar4;
      }
      ppoVar3 = &poVar4->next;
      poVar4 = poVar4->next;
      if (poVar4 == (object *)0x0) break;
      uVar2 = (poVar4->s).i;
    }
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: __deregister_frame_info @ 089d9bac

void * __deregister_frame_info(void *begin)

{
  object *poVar1;
  uint uVar2;
  object **ppoVar3;
  object *poVar4;
  
  if ((begin == (void *)0x0) || (*(int *)begin == 0)) {
    return (void *)0x0;
  }
  if (unseen_objects != (object *)0x0) {
    poVar4 = unseen_objects;
    if (begin == (unseen_objects->u).single) {
      ppoVar3 = &unseen_objects;
      poVar1 = unseen_objects->next;
    }
    else {
      do {
        ppoVar3 = &poVar4->next;
        poVar4 = poVar4->next;
        if (poVar4 == (object *)0x0) goto LAB_089d9b38;
      } while (begin != (poVar4->u).single);
      poVar1 = poVar4->next;
    }
    *ppoVar3 = poVar1;
    return poVar4;
  }
LAB_089d9b38:
  ppoVar3 = &seen_objects;
  if (seen_objects != (object *)0x0) {
    uVar2 = (seen_objects->s).i;
    poVar4 = seen_objects;
    while( true ) {
      if ((uVar2 & 1) == 0) {
        if (begin == (poVar4->u).single) {
          *ppoVar3 = poVar4->next;
          return poVar4;
        }
      }
      else if (begin == (void *)((poVar4->u).single)->length) {
        *ppoVar3 = poVar4->next;
        free((poVar4->u).single);
        return poVar4;
      }
      ppoVar3 = &poVar4->next;
      poVar4 = poVar4->next;
      if (poVar4 == (object *)0x0) break;
      uVar2 = (poVar4->s).i;
    }
  }
                    /* WARNING: Subroutine does not return */
  abort();
}



----------------------------------------

// Function: __deregister_frame @ 089d9bb4

void __deregister_frame(void *begin)

{
  void *aptr;
  
  if (*(int *)begin == 0) {
    return;
  }
  aptr = __deregister_frame_info(begin);
  free(aptr);
  return;
}



----------------------------------------

// Function: classify_object_over_fdes @ 089d9be8

size_t classify_object_over_fdes(object *ob,fde *this_fde)

{
  sword *psVar1;
  uword uVar2;
  void *pvVar3;
  uint uVar4;
  dwarf_cie *pdVar5;
  uint uVar6;
  dwarf_cie *cie;
  uint uVar7;
  _Unwind_Ptr base;
  size_t sVar8;
  void *local_28 [2];
  
                    /* Unresolved local var: dwarf_cie * last_cie@[???]
                       Unresolved local var: size_t count@[???]
                       Unresolved local var: int encoding@[???]
                       Unresolved local var: _Unwind_Ptr base@[???] */
  if (this_fde->length == 0) {
    return 0;
  }
  sVar8 = 0;
  uVar7 = 0;
  base = 0;
  pdVar5 = (dwarf_cie *)0x0;
  do {
    while (this_fde->CIE_delta == 0) {
      uVar2 = this_fde->length;
      cie = pdVar5;
LAB_089d9c5c:
      psVar1 = &this_fde->CIE_delta;
      this_fde = (fde *)((int)&this_fde->CIE_delta + uVar2);
      pdVar5 = cie;
      if (*(int *)((int)psVar1 + uVar2) == 0) {
        return sVar8;
      }
    }
    cie = (dwarf_cie *)((int)this_fde + (4 - this_fde->CIE_delta));
    uVar6 = uVar7 & 0xff;
    if (cie != pdVar5) {
      uVar7 = get_cie_encoding(cie);
      uVar6 = uVar7 & 0xff;
      base = base_from_object((uchar)uVar7,ob);
      uVar4 = (ob->s).i;
      if ((uVar4 & 0x7f8) == 0x7f8) {
        (ob->s).i = uVar4 & 0xfffff807 | uVar6 << 3;
      }
      else if (uVar7 != (uVar4 & 0x7ff) >> 3) {
        (ob->s).i = uVar4 | 4;
      }
    }
    read_encoded_value_with_base((uchar)uVar6,base,(uchar *)(this_fde + 1),(_Unwind_Ptr *)local_28);
    uVar6 = size_of_encoded_value((uchar)uVar6);
    if (uVar6 < 4) {
      if (((1 << ((uVar6 & 3) << 3)) - 1U & (uint)local_28[0]) != 0) {
        pvVar3 = ob->pc_begin;
LAB_089d9c44:
        sVar8 = sVar8 + 1;
        if (local_28[0] < pvVar3) {
          ob->pc_begin = local_28[0];
          uVar2 = this_fde->length;
          goto LAB_089d9c5c;
        }
      }
      uVar2 = this_fde->length;
    }
    else {
                    /* Unresolved local var: dwarf_cie * this_cie@[???]
                       Unresolved local var: _Unwind_Ptr mask@[???]
                       Unresolved local var: _Unwind_Ptr pc_begin@[???] */
      if (local_28[0] != (void *)0x0) {
        pvVar3 = ob->pc_begin;
        goto LAB_089d9c44;
      }
      uVar2 = this_fde->length;
    }
    psVar1 = &this_fde->CIE_delta;
    this_fde = (fde *)((int)&this_fde->CIE_delta + uVar2);
    pdVar5 = cie;
    if (*(int *)((int)psVar1 + uVar2) == 0) {
      return sVar8;
    }
  } while( true );
}



----------------------------------------

// Function: linear_search_fdes @ 089d9d9c

fde * linear_search_fdes(object *ob,fde *this_fde,void *pc)

{
  _Unwind_Ptr base;
  uword uVar1;
  uword uVar2;
  uint uVar3;
  uchar *p;
  uint uVar4;
  byte encoding;
  dwarf_cie *cie;
  dwarf_cie *pdVar5;
  uword local_28;
  uint local_24;
  
                    /* Unresolved local var: dwarf_cie * last_cie@[???]
                       Unresolved local var: int encoding@[???]
                       Unresolved local var: _Unwind_Ptr base@[???] */
  uVar3 = ((ob->s).i & 0x7ff) >> 3;
  base = base_from_object((uchar)(((ob->s).i << 0x15) >> 0x18),ob);
  uVar1 = this_fde->length;
  pdVar5 = (dwarf_cie *)0x0;
  do {
    if (uVar1 == 0) {
      return (fde *)0x0;
    }
                    /* Unresolved local var: dwarf_cie * this_cie@[???]
                       Unresolved local var: _Unwind_Ptr pc_begin@[???]
                       Unresolved local var: _Unwind_Ptr pc_range@[???] */
    if (this_fde->CIE_delta == 0) {
      uVar2 = this_fde->length;
    }
    else {
      if ((((ob->s).i & 4) != 0) &&
         (cie = (dwarf_cie *)((int)this_fde + (4 - this_fde->CIE_delta)), pdVar5 != cie)) {
        uVar3 = get_cie_encoding(cie);
        base = base_from_object((uchar)uVar3,ob);
        pdVar5 = cie;
      }
      if (uVar3 == 0) {
        local_28 = this_fde[1].length;
        local_24 = this_fde[1].CIE_delta;
        if (local_28 != 0) {
LAB_089d9e58:
          if ((int)pc - local_28 < local_24) {
            return this_fde;
          }
        }
        uVar2 = this_fde->length;
      }
      else {
                    /* Unresolved local var: _Unwind_Ptr mask@[???]
                       Unresolved local var: uchar * p@[???] */
        encoding = (byte)uVar3;
        p = read_encoded_value_with_base(encoding,base,(uchar *)(this_fde + 1),&local_28);
        read_encoded_value_with_base(encoding & 0xf,0,p,&local_24);
        uVar4 = size_of_encoded_value(encoding);
        if (uVar4 < 4) {
          uVar4 = (1 << ((uVar4 & 3) << 3)) - 1;
        }
        else {
          uVar4 = 0xffffffff;
        }
        if ((uVar4 & local_28) != 0) goto LAB_089d9e58;
        uVar2 = this_fde->length;
      }
    }
    uVar1 = *(uword *)((int)&this_fde->CIE_delta + uVar2);
    this_fde = (fde *)((int)&this_fde->CIE_delta + uVar2);
  } while( true );
}



----------------------------------------

// Function: add_fdes @ 089d9f18

void add_fdes(object *ob,fde_accumulator *accu,fde *this_fde)

{
  _Unwind_Ptr base;
  uword uVar1;
  uword uVar2;
  uint uVar3;
  size_t sVar4;
  uint uVar5;
  fde_vector *pfVar6;
  dwarf_cie *cie;
  dwarf_cie *pdVar7;
  uint local_30 [2];
  
                    /* Unresolved local var: dwarf_cie * last_cie@[???]
                       Unresolved local var: int encoding@[???]
                       Unresolved local var: _Unwind_Ptr base@[???] */
  uVar3 = ((ob->s).i & 0x7ff) >> 3;
  base = base_from_object((uchar)(((ob->s).i << 0x15) >> 0x18),ob);
  uVar1 = this_fde->length;
  pdVar7 = (dwarf_cie *)0x0;
  do {
    if (uVar1 == 0) {
      return;
    }
                    /* Unresolved local var: dwarf_cie * this_cie@[???] */
    if (this_fde->CIE_delta == 0) {
      uVar2 = this_fde->length;
    }
    else {
      if ((((ob->s).i & 4) != 0) &&
         (cie = (dwarf_cie *)((int)this_fde + (4 - this_fde->CIE_delta)), pdVar7 != cie)) {
        uVar3 = get_cie_encoding(cie);
        base = base_from_object((uchar)uVar3,ob);
        pdVar7 = cie;
      }
      if (uVar3 == 0) {
        if (this_fde[1].length == 0) {
          uVar2 = this_fde->length;
        }
        else {
          pfVar6 = accu->linear;
LAB_089d9fd4:
          if (pfVar6 == (fde_vector *)0x0) {
            uVar2 = this_fde->length;
          }
          else {
            sVar4 = pfVar6->count;
            pfVar6->count = sVar4 + 1;
            (&pfVar6[1].orig_data)[sVar4] = this_fde;
            uVar2 = this_fde->length;
          }
        }
      }
      else {
                    /* Unresolved local var: _Unwind_Ptr pc_begin@[???]
                       Unresolved local var: _Unwind_Ptr mask@[???] */
        read_encoded_value_with_base((uchar)uVar3,base,(uchar *)(this_fde + 1),local_30);
        uVar5 = size_of_encoded_value((uchar)uVar3);
        if (uVar5 < 4) {
          uVar5 = (1 << ((uVar5 & 3) << 3)) - 1;
        }
        else {
          uVar5 = 0xffffffff;
        }
        if ((uVar5 & local_30[0]) != 0) {
          pfVar6 = accu->linear;
          goto LAB_089d9fd4;
        }
        uVar2 = this_fde->length;
      }
    }
    uVar1 = *(uword *)((int)&this_fde->CIE_delta + uVar2);
    this_fde = (fde *)((int)&this_fde->CIE_delta + uVar2);
  } while( true );
}



----------------------------------------

// Function: fde_mixed_encoding_compare @ 089da088

int fde_mixed_encoding_compare(object *ob,fde *x,fde *y)

{
  int iVar1;
  _Unwind_Ptr _Var2;
  uint local_20;
  uint local_1c;
  
                    /* Unresolved local var: int x_encoding@[???]
                       Unresolved local var: int y_encoding@[???]
                       Unresolved local var: _Unwind_Ptr x_ptr@[???]
                       Unresolved local var: _Unwind_Ptr y_ptr@[???] */
  iVar1 = get_cie_encoding((dwarf_cie *)((int)x + (4 - x->CIE_delta)));
  _Var2 = base_from_object((uchar)iVar1,ob);
  read_encoded_value_with_base((uchar)iVar1,_Var2,(uchar *)(x + 1),&local_20);
  iVar1 = get_cie_encoding((dwarf_cie *)((int)y + (4 - y->CIE_delta)));
  _Var2 = base_from_object((uchar)iVar1,ob);
  read_encoded_value_with_base((uchar)iVar1,_Var2,(uchar *)(y + 1),&local_1c);
  iVar1 = 1;
  if ((local_20 <= local_1c) && (iVar1 = -1, local_1c <= local_20)) {
    iVar1 = 0;
  }
  return iVar1;
}



----------------------------------------

// Function: search_object @ 089da154

/* WARNING: Type propagation algorithm not settling */

fde * search_object(object *ob,void *pc)

{
  bool bVar1;
  int iVar2;
  anon_union_4_3_e157c12f_for_u aVar3;
  dwarf_fde *pdVar4;
  size_t sVar5;
  void *pvVar6;
  _Unwind_Ptr _Var7;
  uchar *puVar8;
  int iVar9;
  uint uVar10;
  byte bVar11;
  dwarf_fde *pdVar12;
  fde *pfVar13;
  anon_union_4_3_e157c12f_for_u *paVar14;
  anon_union_4_3_e157c12f_for_u *paVar15;
  anon_union_4_3_e157c12f_for_u *paVar16;
  dwarf_fde **ppdVar17;
  uint uVar18;
  uint uVar19;
  size_t sVar20;
  fde_vector *pfVar21;
  code *fde_compare;
  void *local_60;
  void *local_5c;
  fde_accumulator local_58;
  dwarf_fde *local_50;
  dwarf_fde *local_4c;
  fde_vector *local_48;
  dwarf_fde *local_44;
  anon_union_4_3_e157c12f_for_u *local_40;
  fde_vector *local_3c;
  void *local_38;
  anon_union_4_3_e157c12f_for_u *local_30;
  
  uVar10 = (ob->s).i;
  local_38 = pc;
  if ((uVar10 & 1) != 0) goto LAB_089da4c0;
                    /* Unresolved local var: fde_accumulator accu@[???]
                       Unresolved local var: size_t count@[???] */
  local_4c = (dwarf_fde *)(uVar10 >> 0xb);
  if (local_4c == (dwarf_fde *)0x0) {
    if ((uVar10 & 2) == 0) {
      local_4c = (dwarf_fde *)classify_object_over_fdes(ob,(ob->u).single);
      uVar10 = (ob->s).i;
      pdVar4 = (dwarf_fde *)((uint)local_4c & 0x1fffff);
    }
    else {
                    /* Unresolved local var: fde * * p@[???] */
      ppdVar17 = (ob->u).array;
      pfVar13 = *ppdVar17;
      pdVar4 = (dwarf_fde *)0x0;
      if (pfVar13 == (dwarf_fde *)0x0) {
        local_4c = (dwarf_fde *)0x0;
      }
      else {
        local_4c = (dwarf_fde *)0x0;
        do {
          sVar5 = classify_object_over_fdes(ob,pfVar13);
          ppdVar17 = ppdVar17 + 1;
          pfVar13 = *ppdVar17;
          local_4c = (dwarf_fde *)((int)&local_4c->length + sVar5);
        } while (pfVar13 != (dwarf_fde *)0x0);
        uVar10 = (ob->s).i;
        pdVar4 = (dwarf_fde *)((uint)local_4c & 0x1fffff);
      }
    }
    (ob->s).i = uVar10 & 0x7ff | (int)pdVar4 << 0xb;
    if (local_4c != pdVar4) {
      (ob->s).i = uVar10 & 0x7ff;
    }
    if (local_4c != (dwarf_fde *)0x0) goto LAB_089da1a8;
    pvVar6 = ob->pc_begin;
  }
  else {
LAB_089da1a8:
    sVar5 = (int)local_4c * 4 + 8;
    local_58.linear = malloc(sVar5);
    if ((anon_union_4_3_e157c12f_for_u *)local_58.linear != (anon_union_4_3_e157c12f_for_u *)0x0) {
      ((anon_union_4_3_e157c12f_for_u *)((int)local_58.linear + 4))->single = (dwarf_fde *)0x0;
      local_58.erratic = malloc(sVar5);
      if (local_58.erratic != (fde_vector *)0x0) {
        (local_58.erratic)->count = 0;
      }
      if (((ob->s).i & 2) == 0) {
        add_fdes(ob,&local_58,(ob->u).single);
      }
      else {
                    /* Unresolved local var: fde * * p@[???] */
        ppdVar17 = (ob->u).array;
        pfVar13 = *ppdVar17;
        if (pfVar13 != (dwarf_fde *)0x0) {
          do {
            ppdVar17 = ppdVar17 + 1;
            add_fdes(ob,&local_58,pfVar13);
            pfVar13 = *ppdVar17;
          } while (pfVar13 != (dwarf_fde *)0x0);
        }
      }
      pfVar21 = local_58.erratic;
      paVar14 = (anon_union_4_3_e157c12f_for_u *)local_58.linear;
      local_40 = (anon_union_4_3_e157c12f_for_u *)local_58.linear;
      if (((anon_union_4_3_e157c12f_for_u *)local_58.linear != (anon_union_4_3_e157c12f_for_u *)0x0)
         && (local_4c != ((anon_union_4_3_e157c12f_for_u *)((int)local_58.linear + 4))->single)) {
LAB_089da880:
                    /* WARNING: Subroutine does not return */
        abort();
      }
      if (((ob->s).i & 4) == 0) {
        if (((ob->s).i & 0x7f8) == 0) {
          fde_compare = fde_unencoded_compare;
        }
        else {
          fde_compare = fde_single_encoding_compare;
        }
      }
      else {
        fde_compare = fde_mixed_encoding_compare;
      }
      local_3c = local_58.erratic;
      if (local_58.erratic == (fde_vector *)0x0) {
        frame_heapsort(ob,fde_compare,local_58.linear);
      }
      else {
                    /* Unresolved local var: size_t count@[???]
                       Unresolved local var: fde * * chain_end@[???]
                       Unresolved local var: size_t i@[???]
                       Unresolved local var: size_t j@[???]
                       Unresolved local var: size_t k@[???] */
        local_44 = ((anon_union_4_3_e157c12f_for_u *)((int)local_58.linear + 4))->single;
        if (local_44 == (dwarf_fde *)0x0) {
          pdVar4 = (dwarf_fde *)0x0;
          sVar5 = 0;
        }
        else {
                    /* Unresolved local var: fde * * probe@[???] */
          local_50 = (dwarf_fde *)0x1;
          local_58.erratic[1].orig_data = &marker_3275;
          pdVar4 = (dwarf_fde *)0x0;
          iVar9 = 0;
          if (local_44 != (dwarf_fde *)0x1) {
            do {
              paVar16 = (anon_union_4_3_e157c12f_for_u *)
                        ((fde_vector *)paVar14 + (int)((int)&pdVar4->length + 2));
              if (paVar16 != (anon_union_4_3_e157c12f_for_u *)&marker_3275) {
                do {
                  iVar2 = (*fde_compare)(ob,*(fde **)((int)paVar14 + iVar9 + 0xc),paVar16->single);
                  if (-1 < iVar2) break;
                  iVar2 = (int)paVar16 - (int)((fde_vector *)paVar14 + 2) >> 2;
                  paVar16 = (&pfVar21[1].orig_data)[iVar2];
                  (&pfVar21[1].orig_data)[iVar2] = (void *)0x0;
                } while (paVar16 != (anon_union_4_3_e157c12f_for_u *)&marker_3275);
              }
              pdVar12 = (dwarf_fde *)((int)&local_50->length + 1);
              *(anon_union_4_3_e157c12f_for_u **)((int)&pfVar21[1].count + iVar9) = paVar16;
              pdVar4 = local_50;
              iVar9 = iVar9 + 4;
              local_50 = pdVar12;
            } while (local_44 != pdVar12);
          }
          pdVar12 = (dwarf_fde *)0x0;
          pdVar4 = (dwarf_fde *)0x0;
          sVar5 = 0;
          paVar15 = (anon_union_4_3_e157c12f_for_u *)(pfVar21 + 1);
          paVar16 = (anon_union_4_3_e157c12f_for_u *)((fde_vector *)paVar14 + 2);
          do {
            while (pfVar21[1].orig_data == (void *)0x0) {
              pdVar12 = (dwarf_fde *)((int)&pdVar12->length + 1);
              sVar5 = sVar5 + 1;
              *paVar15 = paVar14[2];
              paVar15 = paVar15 + 1;
              pfVar21 = (fde_vector *)&pfVar21->count;
              paVar14 = paVar14 + 1;
              if (local_44 == pdVar12) goto LAB_089da37c;
            }
            pdVar12 = (dwarf_fde *)((int)&pdVar12->length + 1);
            pdVar4 = (dwarf_fde *)((int)&pdVar4->length + 1);
            *paVar16 = paVar14[2];
            paVar16 = paVar16 + 1;
            pfVar21 = (fde_vector *)&pfVar21->count;
            paVar14 = paVar14 + 1;
          } while (local_44 != pdVar12);
        }
LAB_089da37c:
        local_40[1].single = pdVar4;
        local_3c->count = sVar5;
        if (local_4c !=
            (dwarf_fde *)
            ((int)&((anon_union_4_3_e157c12f_for_u *)((int)local_58.linear + 4))->single->length +
            (local_58.erratic)->count)) goto LAB_089da880;
        frame_heapsort(ob,fde_compare,local_58.erratic);
        pfVar21 = local_58.erratic;
                    /* Unresolved local var: size_t i1@[???]
                       Unresolved local var: size_t i2@[???]
                       Unresolved local var: fde * fde2@[???] */
        sVar5 = (local_58.erratic)->count;
        if (sVar5 != 0) {
          pdVar4 = ((anon_union_4_3_e157c12f_for_u *)((int)local_58.linear + 4))->single;
          local_48 = (fde_vector *)(&(local_58.erratic)->count + sVar5);
          paVar14 = (anon_union_4_3_e157c12f_for_u *)local_58.linear;
          do {
            sVar20 = sVar5 - 1;
            pfVar13 = local_48->orig_data;
            if (pdVar4 != (dwarf_fde *)0x0) {
              paVar16 = paVar14 + (int)((int)&pdVar4->length + 1);
              paVar15 = paVar14 + (int)&pdVar4->length + sVar5 + 1;
              local_30 = paVar14;
              do {
                iVar9 = (*fde_compare)(ob,paVar16->single,pfVar13);
                pdVar12 = (dwarf_fde *)((int)&pdVar4[-1].CIE_delta + 3);
                paVar14 = local_30;
                if (iVar9 < 1) goto LAB_089da43c;
                aVar3.single = *(dwarf_fde **)paVar16;
                paVar16 = paVar16 + -1;
                paVar15->single = (dwarf_fde *)aVar3;
                paVar15 = paVar15 + -1;
                pdVar4 = pdVar12;
              } while (pdVar12 != (dwarf_fde *)0x0);
              pdVar4 = (dwarf_fde *)0x0;
            }
LAB_089da43c:
            local_48 = (fde_vector *)((int)(local_48 + 0xffffffff) + 4);
            paVar14[(int)&pdVar4->length + sVar5 + 1].single = pfVar13;
            sVar5 = sVar20;
          } while (sVar20 != 0);
          paVar14[1].single = (dwarf_fde *)((int)&(paVar14[1].single)->length + pfVar21->count);
        }
        free(local_58.erratic);
      }
      *(anon_union_4_3_e157c12f_for_u *)local_58.linear = ob->u;
      (ob->u).single = (dwarf_fde *)local_58.linear;
      (ob->s).i = (ob->s).i | 1;
    }
    pvVar6 = ob->pc_begin;
  }
  if (local_38 < pvVar6) {
    return (fde *)0x0;
  }
  uVar10 = (ob->s).i;
  if ((uVar10 & 1) == 0) {
    if ((uVar10 & 2) == 0) {
      pfVar13 = linear_search_fdes(ob,(ob->u).single,local_38);
      return pfVar13;
    }
                    /* Unresolved local var: fde * * p@[???] */
    ppdVar17 = (ob->u).array;
    pfVar13 = *ppdVar17;
    while( true ) {
      if (pfVar13 == (fde *)0x0) {
        return (fde *)0x0;
      }
                    /* Unresolved local var: fde * f@[???] */
      pfVar13 = linear_search_fdes(ob,pfVar13,local_38);
      if (pfVar13 != (fde *)0x0) break;
      ppdVar17 = ppdVar17 + 1;
      pfVar13 = *ppdVar17;
    }
    return pfVar13;
  }
LAB_089da4c0:
  if ((uVar10 & 4) == 0) {
    if ((uVar10 & 0x7f8) == 0) {
                    /* Unresolved local var: fde_vector * vec@[???]
                       Unresolved local var: size_t lo@[???]
                       Unresolved local var: size_t hi@[???] */
      uVar10 = ((ob->u).sort)->count;
      if (uVar10 == 0) {
        return (fde *)0x0;
      }
      uVar19 = 0;
      do {
        while( true ) {
          uVar18 = uVar10 + uVar19 >> 1;
          pfVar13 = (&(ob->u).sort[1].orig_data)[uVar18];
          if ((void *)pfVar13[1].length <= local_38) break;
                    /* Unresolved local var: size_t i@[???]
                       Unresolved local var: fde * f@[???]
                       Unresolved local var: void * pc_begin@[???]
                       Unresolved local var: uaddr pc_range@[???] */
          uVar10 = uVar18;
          if (uVar18 <= uVar19) {
            return (fde *)0x0;
          }
        }
        if (local_38 < (void *)((int)pfVar13[1].length + pfVar13[1].CIE_delta)) {
          return pfVar13;
        }
        uVar19 = uVar18 + 1;
      } while (uVar19 < uVar10);
    }
    else {
      pfVar21 = (ob->u).sort;
                    /* Unresolved local var: fde_vector * vec@[???]
                       Unresolved local var: int encoding@[???]
                       Unresolved local var: _Unwind_Ptr base@[???]
                       Unresolved local var: size_t lo@[???]
                       Unresolved local var: size_t hi@[???] */
      bVar11 = (byte)((uVar10 << 0x15) >> 0x18);
      _Var7 = base_from_object(bVar11,ob);
      uVar10 = pfVar21->count;
      if (uVar10 != 0) {
        uVar19 = 0;
        do {
                    /* Unresolved local var: size_t i@[???]
                       Unresolved local var: fde * f@[???]
                       Unresolved local var: _Unwind_Ptr pc_begin@[???]
                       Unresolved local var: _Unwind_Ptr pc_range@[???]
                       Unresolved local var: uchar * p@[???] */
          uVar18 = uVar10 + uVar19 >> 1;
          pfVar13 = (&pfVar21[1].orig_data)[uVar18];
          puVar8 = read_encoded_value_with_base
                             (bVar11,_Var7,(uchar *)(pfVar13 + 1),(_Unwind_Ptr *)&local_60);
          read_encoded_value_with_base(bVar11 & 0xf,0,puVar8,(_Unwind_Ptr *)&local_5c);
          if (local_38 < local_60) {
            bVar1 = uVar19 < uVar18;
            uVar10 = uVar18;
          }
          else {
            uVar19 = uVar18 + 1;
            if (local_38 < (void *)((int)local_60 + (int)local_5c)) {
              return pfVar13;
            }
            bVar1 = uVar19 < uVar10;
          }
        } while (bVar1);
        return (fde *)0x0;
      }
    }
  }
  else {
                    /* Unresolved local var: fde_vector * vec@[???]
                       Unresolved local var: size_t lo@[???]
                       Unresolved local var: size_t hi@[???] */
    pfVar21 = (ob->u).sort;
    uVar10 = pfVar21->count;
    uVar19 = 0;
    if (uVar10 != 0) {
      do {
                    /* Unresolved local var: size_t i@[???]
                       Unresolved local var: fde * f@[???]
                       Unresolved local var: _Unwind_Ptr pc_begin@[???]
                       Unresolved local var: _Unwind_Ptr pc_range@[???]
                       Unresolved local var: uchar * p@[???]
                       Unresolved local var: int encoding@[???] */
        uVar18 = uVar19 + uVar10 >> 1;
        pfVar13 = (&pfVar21[1].orig_data)[uVar18];
        iVar9 = get_cie_encoding((dwarf_cie *)((int)pfVar13 + (4 - pfVar13->CIE_delta)));
        bVar11 = (byte)iVar9;
        _Var7 = base_from_object(bVar11,ob);
        puVar8 = read_encoded_value_with_base
                           (bVar11,_Var7,(uchar *)(pfVar13 + 1),(_Unwind_Ptr *)&local_5c);
        read_encoded_value_with_base(bVar11 & 0xf,0,puVar8,(_Unwind_Ptr *)&local_60);
        if (local_38 < local_5c) {
          bVar1 = uVar19 < uVar18;
          uVar10 = uVar18;
        }
        else {
          uVar19 = uVar18 + 1;
          if (local_38 < (void *)((int)local_5c + (int)local_60)) {
            return pfVar13;
          }
          bVar1 = uVar19 < uVar10;
        }
      } while (bVar1);
      return (fde *)0x0;
    }
  }
  return (fde *)0x0;
}



----------------------------------------

// Function: _Unwind_Find_FDE @ 089da888

fde * _Unwind_Find_FDE(void *pc,dwarf_eh_bases *bases)

{
  uchar encoding;
  _Unwind_Ptr base;
  fde *pfVar1;
  void *pvVar2;
  uint uVar3;
  object *poVar5;
  object **ppoVar6;
  object *poVar7;
  void *local_28 [2];
  int iVar4;
  
                    /* Unresolved local var: object * ob@[???]
                       Unresolved local var: fde * f@[???] */
  for (poVar7 = seen_objects; poVar7 != (object *)0x0; poVar7 = poVar7->next) {
    if (poVar7->pc_begin <= pc) {
      pfVar1 = search_object(poVar7,pc);
      if (pfVar1 != (fde *)0x0) {
                    /* Unresolved local var: int encoding@[DW_OP_reg2(v0)]
                       Unresolved local var: _Unwind_Ptr func@[???] */
        bases->tbase = poVar7->tbase;
        bases->dbase = poVar7->dbase;
        uVar3 = (poVar7->s).i;
        encoding = (uchar)((uVar3 & 0x7ff) >> 3);
        goto joined_r0x089da908;
      }
      break;
    }
  }
  pfVar1 = (fde *)0x0;
  do {
    while( true ) {
      poVar7 = unseen_objects;
      if (unseen_objects == (object *)0x0) {
        return pfVar1;
      }
      unseen_objects = unseen_objects->next;
      pfVar1 = search_object(poVar7,pc);
      if ((seen_objects != (object *)0x0) &&
         (poVar5 = seen_objects, poVar7->pc_begin <= seen_objects->pc_begin)) break;
      poVar7->next = seen_objects;
      seen_objects = poVar7;
      if (pfVar1 != (fde *)0x0) {
        pvVar2 = poVar7->tbase;
        goto LAB_089da9e4;
      }
    }
    do {
      ppoVar6 = &poVar5->next;
      poVar5 = poVar5->next;
      if (poVar5 == (object *)0x0) {
        poVar7->next = (object *)0x0;
        goto LAB_089da9d8;
      }
    } while (poVar7->pc_begin <= poVar5->pc_begin);
    poVar7->next = poVar5;
LAB_089da9d8:
    *ppoVar6 = poVar7;
  } while (pfVar1 == (fde *)0x0);
  pvVar2 = poVar7->tbase;
LAB_089da9e4:
  bases->tbase = pvVar2;
  bases->dbase = poVar7->dbase;
  uVar3 = (poVar7->s).i;
  encoding = (uchar)((uVar3 & 0x7ff) >> 3);
joined_r0x089da908:
  if ((uVar3 & 4) != 0) {
    iVar4 = get_cie_encoding((dwarf_cie *)((int)pfVar1 + (4 - pfVar1->CIE_delta)));
    encoding = (uchar)iVar4;
  }
  base = base_from_object(encoding,poVar7);
  read_encoded_value_with_base(encoding,base,(uchar *)(pfVar1 + 1),(_Unwind_Ptr *)local_28);
  bases->func = local_28[0];
  return pfVar1;
}



----------------------------------------

// Function: __fixunsdfdi @ 089daa30

DItype __fixunsdfdi(DFtype a)

{
  USItype arg_a;
  USItype UVar1;
  FLO_type_conflict in_f14_15;
  
                    /* Unresolved local var: USItype hi@[???]
                       Unresolved local var: USItype lo@[???] */
  __muldf3(a,in_f14_15);
  arg_a = __fixunsdfsi(a);
  __floatsidf(arg_a);
  if ((int)arg_a < 0) {
    __adddf3(a,in_f14_15);
  }
  __muldf3(a,in_f14_15);
  __adddf3(a,in_f14_15);
  UVar1 = __fixunsdfsi(a);
  return CONCAT44(arg_a,UVar1);
}



----------------------------------------

// Function: __unpack_f @ 089dab0c

void __unpack_f(FLO_union_type *src,fp_number_type *dst)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  int iVar4;
  fractype fVar5;
  
                    /* Unresolved local var: fractype fraction@[???]
                       Unresolved local var: int exp@[???]
                       Unresolved local var: int sign@[???] */
  uVar2 = src->value_raw;
  uVar1 = (uVar2 & 0x7fffffff) >> 0x17;
  dst->sign = uVar2 >> 0x1f;
  uVar3 = uVar2 & 0x7fffff;
  if (uVar1 == 0) {
    if (uVar3 == 0) {
      dst->class = CLASS_ZERO;
      return;
    }
    fVar5 = uVar3 << 7;
    iVar4 = -0x7e;
    dst->normal_exp = -0x7e;
    dst->class = CLASS_NUMBER;
    if (fVar5 < 0x40000000) {
      do {
        fVar5 = fVar5 << 1;
        iVar4 = iVar4 + -1;
      } while (fVar5 < 0x40000000);
      dst->normal_exp = iVar4;
    }
    (dst->fraction).ll = fVar5;
    return;
  }
  if (uVar1 == 0xff) {
    if (uVar3 != 0) {
      if ((uVar2 & 0x100000) == 0) {
        dst->class = CLASS_QNAN;
      }
      else {
        dst->class = CLASS_SNAN;
      }
      (dst->fraction).ll = uVar3;
      return;
    }
    dst->class = CLASS_INFINITY;
    return;
  }
  (dst->fraction).ll = uVar3 << 7 | 0x40000000;
  dst->normal_exp = uVar1 - 0x7f;
  dst->class = CLASS_NUMBER;
  return;
}



----------------------------------------

// Function: __make_fp @ 089dabdc

SFtype __make_fp(fp_class_type class,uint sign,int exp,USItype frac)

{
  FLO_type FVar1;
  fp_number_type local_18;
  
                    /* Unresolved local var: fp_number_type in@[???] */
  local_18.class = class;
  local_18.sign = sign;
  local_18.normal_exp = exp;
  local_18.fraction = (anon_union_4_2_7f9ecf93_for_fraction)frac;
  FVar1 = __pack_f(&local_18);
  return FVar1;
}



----------------------------------------

// Function: __pack_d @ 089dac08

FLO_type_conflict __pack_d(fp_number_type_conflict *src)

{
  fp_class_type fVar1;
  FLO_type_conflict in_f0_1;
  
                    /* Unresolved local var: FLO_union_type.conflict dst@[???]
                       Unresolved local var: fractype.conflict fraction@[???]
                       Unresolved local var: int sign@[???]
                       Unresolved local var: int exp@[???] */
  fVar1 = src->class;
  if (fVar1 < CLASS_ZERO) {
    return in_f0_1;
  }
  if (fVar1 != CLASS_INFINITY) {
    if ((fVar1 == CLASS_ZERO) || ((src->fraction).l[0] == 0 && (src->fraction).l[1] == 0)) {
      return in_f0_1;
    }
    if (src->normal_exp < -0x3fe) {
      return in_f0_1;
    }
    if (src->normal_exp < 0x400) {
      return in_f0_1;
    }
  }
  return in_f0_1;
}



----------------------------------------

// Function: __unpack_d @ 089dae98

void __unpack_d(FLO_union_type_conflict *src,fp_number_type_conflict *dst)

{
  int iVar1;
  uint uVar2;
  halffractype_conflict hVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  
                    /* Unresolved local var: fractype.conflict fraction@[???]
                       Unresolved local var: int exp@[???]
                       Unresolved local var: int sign@[???] */
  uVar2 = src->words[1];
  uVar4 = (uVar2 & 0x7fffffff) >> 0x14;
  uVar5 = src->words[0];
  uVar6 = uVar2 & 0xfffff;
  dst->sign = uVar2 >> 0x1f;
  if (uVar4 == 0) {
    if (uVar5 != 0 || uVar6 != 0) {
      uVar4 = uVar5 >> 0x18 | uVar6 << 8;
      hVar3 = uVar5 << 8;
      dst->normal_exp = -0x3fe;
      dst->class = CLASS_NUMBER;
      if (uVar4 < 0x10000000) {
        iVar1 = -0x3fe;
        do {
          uVar4 = hVar3 >> 0x1f | uVar4 << 1;
          hVar3 = hVar3 << 1;
          iVar1 = iVar1 + -1;
        } while (uVar4 < 0x10000000);
        dst->normal_exp = iVar1;
      }
      (dst->fraction).l[0] = hVar3;
      (dst->fraction).l[1] = uVar4;
      return;
    }
    dst->class = CLASS_ZERO;
    return;
  }
  if (uVar4 != 0x7ff) {
    (dst->fraction).l[1] = uVar5 >> 0x18 | uVar6 << 8 | 0x10000000;
    dst->normal_exp = uVar4 - 0x3ff;
    dst->class = CLASS_NUMBER;
    (dst->fraction).l[0] = uVar5 << 8;
    return;
  }
  if (uVar5 == 0 && uVar6 == 0) {
    dst->class = CLASS_INFINITY;
    return;
  }
  if ((uVar2 & 0x80000) == 0) {
    dst->class = CLASS_QNAN;
  }
  else {
    dst->class = CLASS_SNAN;
  }
  (dst->fraction).l[0] = uVar5;
  (dst->fraction).l[1] = uVar6;
  return;
}



----------------------------------------

// Function: __fpcmp_parts_d @ 089dafbc

int __fpcmp_parts_d(fp_number_type_conflict *a,fp_number_type_conflict *b)

{
  uint uVar1;
  fp_class_type fVar2;
  uint uVar3;
  fp_class_type fVar4;
  uint uVar5;
  
  fVar2 = a->class;
  if (fVar2 < CLASS_ZERO) {
    return 1;
  }
  fVar4 = b->class;
  if (fVar4 < CLASS_ZERO) {
    return 1;
  }
  if (fVar2 == CLASS_INFINITY) {
    if (fVar4 == CLASS_INFINITY) {
      return b->sign - a->sign;
    }
    uVar1 = a->sign;
    goto joined_r0x089db02c;
  }
  if (fVar4 == CLASS_INFINITY) {
    uVar1 = b->sign;
  }
  else {
    if (fVar2 != CLASS_ZERO) {
      if (fVar4 == CLASS_ZERO) {
        uVar1 = a->sign;
      }
      else {
        uVar1 = a->sign;
        if ((uVar1 == b->sign) && (a->normal_exp <= b->normal_exp)) {
          if (b->normal_exp <= a->normal_exp) {
            uVar3 = (a->fraction).l[1];
            uVar5 = (b->fraction).l[1];
            if (uVar5 < uVar3) goto joined_r0x089db02c;
            if ((uVar5 == uVar3) && ((b->fraction).l[0] < (a->fraction).l[0])) {
              if (uVar1 != 0) {
                return -1;
              }
              return 1;
            }
            if (uVar5 <= uVar3) {
              if (uVar3 != uVar5) {
                return 0;
              }
              if ((b->fraction).l[0] <= (a->fraction).l[0]) {
                return 0;
              }
            }
          }
          goto joined_r0x089db0b0;
        }
      }
joined_r0x089db02c:
      if (uVar1 == 0) {
        return 1;
      }
      return -1;
    }
    if (fVar4 == CLASS_ZERO) {
      return 0;
    }
    uVar1 = b->sign;
  }
joined_r0x089db0b0:
  if (uVar1 != 0) {
    return 1;
  }
  return -1;
}



----------------------------------------

// Function: __pack_f @ 089db0ec

FLO_type __pack_f(fp_number_type *src)

{
  uint uVar1;
  uint uVar2;
  fp_class_type fVar3;
  uint uVar4;
  int iVar5;
  uint uVar6;
  uint uVar7;
  
                    /* Unresolved local var: FLO_union_type dst@[DW_OP_reg6(a2)]
                       Unresolved local var: fractype fraction@[???]
                       Unresolved local var: int sign@[???]
                       Unresolved local var: int exp@[???] */
  fVar3 = src->class;
  uVar6 = (src->fraction).ll;
  uVar7 = src->sign;
  if (fVar3 < CLASS_ZERO) {
    uVar4 = uVar6 & 0x7fffff | 0xfffff;
    uVar1 = 0xff;
  }
  else {
    if (fVar3 == CLASS_INFINITY) {
LAB_089db1c8:
      return (FLO_type)(uVar7 << 0x1f | 0x7f800000);
    }
    if ((fVar3 == CLASS_ZERO) || (uVar6 == 0)) {
      return (FLO_type)(uVar7 << 0x1f);
    }
    iVar5 = src->normal_exp;
    if (iVar5 < -0x7e) {
                    /* Unresolved local var: int shift@[???] */
      uVar1 = -iVar5 - 0x7e;
      if ((int)uVar1 < 0x1a) {
                    /* Unresolved local var: int lowbit@[???] */
        uVar2 = (uint)((uVar6 & (1 << (uVar1 & 0x1f)) - 1U) != 0);
        uVar6 = uVar6 >> (uVar1 & 0x1f);
        uVar4 = uVar6 | uVar2;
        if ((uVar6 & 0x7f | uVar2) == 0x40) {
          if ((uVar6 & 0x80) != 0) {
            uVar4 = uVar4 + 0x40;
          }
          uVar1 = (uint)(0x3fffffff < uVar4);
          uVar4 = uVar4 >> 7;
        }
        else {
          uVar1 = (uint)(0x3fffffff < uVar4 + 0x3f);
          uVar4 = uVar4 + 0x3f >> 7;
        }
      }
      else {
        uVar1 = 0;
        uVar4 = 0;
      }
      uVar4 = uVar4 & 0x7fffff;
    }
    else {
      if (0x7f < iVar5) goto LAB_089db1c8;
      uVar1 = iVar5 + 0x7f;
      if ((uVar6 & 0x7f) == 0x40) {
        if ((uVar6 & 0x80) != 0) {
          uVar6 = uVar6 + 0x40;
        }
      }
      else {
        uVar6 = uVar6 + 0x3f;
      }
      if ((int)uVar6 < 0) {
        uVar6 = uVar6 >> 1;
        uVar1 = iVar5 + 0x80;
      }
      uVar4 = uVar6 >> 7 & 0x7fffff;
      uVar1 = uVar1 & 0xff;
    }
  }
  return (FLO_type)(uVar4 | uVar1 << 0x17 | uVar7 << 0x1f);
}



----------------------------------------

// Function: __do_global_ctors_aux @ 089db280

void __do_global_ctors_aux(void)

{
  code *pcVar1;
  undefined **ppuVar2;
  
  ppuVar2 = &PTR__GLOBAL__I_____________libstdc___v3_src_iostream_inst_cc_8D2A3925_20339BE4_089fb94c
  ;
  pcVar1 = (code *)
           PTR__GLOBAL__I_____________libstdc___v3_src_iostream_inst_cc_8D2A3925_20339BE4_089fb94c;
  while (pcVar1 != (code *)0xffffffff) {
    ppuVar2 = ppuVar2 + -1;
    (*pcVar1)();
    pcVar1 = (code *)*ppuVar2;
  }
  return;
}



----------------------------------------

// Function: call___do_global_ctors_aux @ 089db2d4

void call___do_global_ctors_aux(void)

{
  return;
}



----------------------------------------

// Function: _fini @ 089db2e8

void _fini(void)

{
  __do_global_dtors_aux();
  return;
}



----------------------------------------

// Function: sceCtrlSetSamplingCycle @ 089db308

void sceCtrlSetSamplingCycle(void)

{
  return;
}



----------------------------------------

// Function: sceCtrlSetSamplingMode @ 089db310

void sceCtrlSetSamplingMode(void)

{
  return;
}



----------------------------------------

// Function: sceCtrlPeekBufferPositive @ 089db318

void sceCtrlPeekBufferPositive(void)

{
  return;
}



----------------------------------------

// Function: sceCtrlReadBufferPositive @ 089db320

void sceCtrlReadBufferPositive(void)

{
  return;
}



----------------------------------------

// Function: sceGeEdramGetSize @ 089db328

void sceGeEdramGetSize(void)

{
  return;
}



----------------------------------------

// Function: sceGeEdramGetAddr @ 089db330

void sceGeEdramGetAddr(void)

{
  return;
}



----------------------------------------

// Function: sceGeGetCmd @ 089db338

void sceGeGetCmd(void)

{
  return;
}



----------------------------------------

// Function: sceGeGetMtx @ 089db340

void sceGeGetMtx(void)

{
  return;
}



----------------------------------------

// Function: sceGeListEnQueue @ 089db348

void sceGeListEnQueue(void)

{
  return;
}



----------------------------------------

// Function: sceGeListDeQueue @ 089db350

void sceGeListDeQueue(void)

{
  return;
}



----------------------------------------

// Function: sceGeListUpdateStallAddr @ 089db358

void sceGeListUpdateStallAddr(void)

{
  return;
}



----------------------------------------

// Function: sceGeListSync @ 089db360

void sceGeListSync(void)

{
  return;
}



----------------------------------------

// Function: sceGeDrawSync @ 089db368

void sceGeDrawSync(void)

{
  return;
}



----------------------------------------

// Function: sceGeSetCallback @ 089db370

void sceGeSetCallback(void)

{
  return;
}



----------------------------------------

// Function: sceGeUnsetCallback @ 089db378

void sceGeUnsetCallback(void)

{
  return;
}



----------------------------------------

// Function: sceDisplaySetMode @ 089db380

void sceDisplaySetMode(void)

{
  return;
}



----------------------------------------

// Function: sceDisplaySetFrameBuf @ 089db388

void sceDisplaySetFrameBuf(void)

{
  return;
}



----------------------------------------

// Function: sceDisplayGetVcount @ 089db390

void sceDisplayGetVcount(void)

{
  return;
}



----------------------------------------

// Function: sceDisplayWaitVblankStart @ 089db398

void sceDisplayWaitVblankStart(void)

{
  return;
}



----------------------------------------

// Function: sceHprmPeekCurrentKey @ 089db3a0

void sceHprmPeekCurrentKey(void)

{
  return;
}



----------------------------------------

// Function: sceRtcGetCurrentTick @ 089db3a8

void sceRtcGetCurrentTick(void)

{
  return;
}



----------------------------------------

// Function: sceAudioOutputBlocking @ 089db3b0

void sceAudioOutputBlocking(void)

{
  return;
}



----------------------------------------

// Function: sceAudioOutputPannedBlocking @ 089db3b8

void sceAudioOutputPannedBlocking(void)

{
  return;
}



----------------------------------------

// Function: sceAudioChReserve @ 089db3c0

void sceAudioChReserve(void)

{
  return;
}



----------------------------------------

// Function: sceAudioChRelease @ 089db3c8

void sceAudioChRelease(void)

{
  return;
}



----------------------------------------

// Function: sceIoClose @ 089db3d0

void sceIoClose(void)

{
  return;
}



----------------------------------------

// Function: sceIoOpen @ 089db3d8

void sceIoOpen(void)

{
  return;
}



----------------------------------------

// Function: sceIoRead @ 089db3e0

void sceIoRead(void)

{
  return;
}



----------------------------------------

// Function: sceIoWrite @ 089db3e8

void sceIoWrite(void)

{
  return;
}



----------------------------------------

// Function: sceIoLseek @ 089db3f0

void sceIoLseek(void)

{
  return;
}



----------------------------------------

// Function: sceIoDopen @ 089db3f8

void sceIoDopen(void)

{
  return;
}



----------------------------------------

// Function: sceIoDclose @ 089db400

void sceIoDclose(void)

{
  return;
}



----------------------------------------

// Function: sceIoChdir @ 089db408

void sceIoChdir(void)

{
  return;
}



----------------------------------------

// Function: sceIoGetstat @ 089db410

void sceIoGetstat(void)

{
  return;
}



----------------------------------------

// Function: sceKernelSelfStopUnloadModule @ 089db418

void sceKernelSelfStopUnloadModule(void)

{
  return;
}



----------------------------------------

// Function: sceKernelStdin @ 089db420

void sceKernelStdin(void)

{
  return;
}



----------------------------------------

// Function: sceKernelStdout @ 089db428

void sceKernelStdout(void)

{
  return;
}



----------------------------------------

// Function: sceKernelStderr @ 089db430

void sceKernelStderr(void)

{
  return;
}



----------------------------------------

// Function: sceKernelMaxFreeMemSize @ 089db438

void sceKernelMaxFreeMemSize(void)

{
  return;
}



----------------------------------------

// Function: sceKernelAllocPartitionMemory @ 089db440

void sceKernelAllocPartitionMemory(void)

{
  return;
}



----------------------------------------

// Function: sceKernelFreePartitionMemory @ 089db448

void sceKernelFreePartitionMemory(void)

{
  return;
}



----------------------------------------

// Function: sceKernelGetBlockHeadAddr @ 089db450

void sceKernelGetBlockHeadAddr(void)

{
  return;
}



----------------------------------------

// Function: sceKernelCreateCallback @ 089db458

void sceKernelCreateCallback(void)

{
  return;
}



----------------------------------------

// Function: sceKernelSleepThreadCB @ 089db460

void sceKernelSleepThreadCB(void)

{
  return;
}



----------------------------------------

// Function: sceKernelWaitThreadEnd @ 089db468

void sceKernelWaitThreadEnd(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDelayThread @ 089db470

void sceKernelDelayThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDelayThreadCB @ 089db478

void sceKernelDelayThreadCB(void)

{
  return;
}



----------------------------------------

// Function: sceKernelCreateSema @ 089db480

void sceKernelCreateSema(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDeleteSema @ 089db488

void sceKernelDeleteSema(void)

{
  return;
}



----------------------------------------

// Function: sceKernelSignalSema @ 089db490

void sceKernelSignalSema(void)

{
  return;
}



----------------------------------------

// Function: sceKernelWaitSema @ 089db498

void sceKernelWaitSema(void)

{
  return;
}



----------------------------------------

// Function: sceKernelPollSema @ 089db4a0

void sceKernelPollSema(void)

{
  return;
}



----------------------------------------

// Function: sceKernelReferSemaStatus @ 089db4a8

void sceKernelReferSemaStatus(void)

{
  return;
}



----------------------------------------

// Function: sceKernelCreateEventFlag @ 089db4b0

void sceKernelCreateEventFlag(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDeleteEventFlag @ 089db4b8

void sceKernelDeleteEventFlag(void)

{
  return;
}



----------------------------------------

// Function: sceKernelSetEventFlag @ 089db4c0

void sceKernelSetEventFlag(void)

{
  return;
}



----------------------------------------

// Function: sceKernelCreateMsgPipe @ 089db4c8

void sceKernelCreateMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDeleteMsgPipe @ 089db4d0

void sceKernelDeleteMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelSendMsgPipe @ 089db4d8

void sceKernelSendMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelTrySendMsgPipe @ 089db4e0

void sceKernelTrySendMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelReceiveMsgPipe @ 089db4e8

void sceKernelReceiveMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelTryReceiveMsgPipe @ 089db4f0

void sceKernelTryReceiveMsgPipe(void)

{
  return;
}



----------------------------------------

// Function: sceKernelReferMsgPipeStatus @ 089db4f8

void sceKernelReferMsgPipeStatus(void)

{
  return;
}



----------------------------------------

// Function: sceKernelCreateThread @ 089db500

void sceKernelCreateThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDeleteThread @ 089db508

void sceKernelDeleteThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelStartThread @ 089db510

void sceKernelStartThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelExitThread @ 089db518

void sceKernelExitThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelTerminateDeleteThread @ 089db520

void sceKernelTerminateDeleteThread(void)

{
  return;
}



----------------------------------------

// Function: sceKernelChangeCurrentThreadAttr @ 089db528

void sceKernelChangeCurrentThreadAttr(void)

{
  return;
}



----------------------------------------

// Function: sceKernelChangeThreadPriority @ 089db530

void sceKernelChangeThreadPriority(void)

{
  return;
}



----------------------------------------

// Function: sceKernelGetThreadId @ 089db538

void sceKernelGetThreadId(void)

{
  return;
}



----------------------------------------

// Function: sceKernelReferThreadStatus @ 089db540

void sceKernelReferThreadStatus(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDcacheInvalidateRange @ 089db548

void sceKernelDcacheInvalidateRange(void)

{
  return;
}



----------------------------------------

// Function: sceKernelLibcTime @ 089db550

void sceKernelLibcTime(void)

{
  return;
}



----------------------------------------

// Function: sceKernelLibcGettimeofday @ 089db558

void sceKernelLibcGettimeofday(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDcacheWritebackAll @ 089db560

void sceKernelDcacheWritebackAll(void)

{
  return;
}



----------------------------------------

// Function: sceKernelDcacheWritebackInvalidateRange @ 089db568

void sceKernelDcacheWritebackInvalidateRange(void)

{
  return;
}



----------------------------------------

// Function: sceKernelExitGame @ 089db570

void sceKernelExitGame(void)

{
  return;
}



----------------------------------------

// Function: sceKernelRegisterExitCallback @ 089db578

void sceKernelRegisterExitCallback(void)

{
  return;
}



----------------------------------------

// Function: scePowerTick @ 089db580

void scePowerTick(void)

{
  return;
}



----------------------------------------

// Function: sceNetInetGetsockopt @ 089db588

void sceNetInetGetsockopt(void)

{
  return;
}



----------------------------------------

// Function: sceNetInetSetsockopt @ 089db590

void sceNetInetSetsockopt(void)

{
  return;
}



----------------------------------------

// Function: sceNetInetGetErrno @ 089db598

void sceNetInetGetErrno(void)

{
  return;
}



----------------------------------------

